|
|
|
@ -22,10 +22,14 @@ import java.io.File;
@@ -22,10 +22,14 @@ import java.io.File;
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.net.URI; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.Vector; |
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
import static de.srsoftware.belegscanner.Application.t; |
|
|
|
|
import static de.srsoftware.belegscanner.Constants.DEFAULT_HEIGHT; |
|
|
|
@ -64,6 +68,12 @@ public class Worker {
@@ -64,6 +68,12 @@ public class Worker {
|
|
|
|
|
|
|
|
|
|
public void dropProfile(String droppedProfile) { |
|
|
|
|
LOG.debug("Worker.dropProfile({})",droppedProfile); |
|
|
|
|
getProfiles().remove(droppedProfile); |
|
|
|
|
try { |
|
|
|
|
config.save(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
public JSONObject getProfiles() { |
|
|
|
|
return config.getOrCreate("profiles",new JSONObject()); |
|
|
|
@ -593,4 +603,25 @@ public class Worker {
@@ -593,4 +603,25 @@ public class Worker {
|
|
|
|
|
public void setTypeSelector(TypeSelector newVal) { |
|
|
|
|
typeSelector = newVal; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* gibt eine Pseudo-Liste wieder: diese Methode wird nur zum Erzeugen der |
|
|
|
|
* SelectComboBox benutzt. Diese wiederum greift nur auf die Methoden |
|
|
|
|
* isEmpty() und stream() zurück. Diese werden hier also so implementiert, |
|
|
|
|
* dass sie intern auf die Profil-Liste zugreifen. |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public List<String> getProfileNames() { |
|
|
|
|
return new Vector<>(){ |
|
|
|
|
@Override |
|
|
|
|
public synchronized boolean isEmpty() { |
|
|
|
|
return getProfiles().isEmpty(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Stream<String> stream() { |
|
|
|
|
return getProfiles().keySet().stream(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|