* Configuration.java: dropped debug outputs
* DocTable.java: altered shown profile path * Worker.java: implemented profile deletion
This commit is contained in:
@@ -9,7 +9,11 @@ Diese Anwendung soll helfen
|
|||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
* Pfad in Dok-Liste verbessern (Zeigt im Moment Seite mit an)
|
* Warnen beim Überschreiben
|
||||||
|
* Zusatzfelder zum aktuellen Profile mit speichern
|
||||||
* diese Anleitung vervollständigen
|
* diese Anleitung vervollständigen
|
||||||
* einfaches Löschen von Kategorien
|
* vordefinierte Platzhalter
|
||||||
|
* nutzerdefinierte Platzhalter
|
||||||
|
* Löschen von Profilen
|
||||||
|
* Beispiele für Profile
|
||||||
* einfacheres Starten mit der richtigen Sprache
|
* einfacheres Starten mit der richtigen Sprache
|
||||||
@@ -78,10 +78,8 @@ public class Configuration {
|
|||||||
JSONArray result = null;
|
JSONArray result = null;
|
||||||
for (int i=0; i<parts.length; i++) {
|
for (int i=0; i<parts.length; i++) {
|
||||||
String localKey = parts[i];
|
String localKey = parts[i];
|
||||||
LOG.debug("localKey = {}",localKey);
|
|
||||||
boolean lastPart = i == parts.length-1;
|
boolean lastPart = i == parts.length-1;
|
||||||
if (!localJson.has(localKey)) {
|
if (!localJson.has(localKey)) {
|
||||||
LOG.debug("{} not present in {}, creating…",localKey,localJson);
|
|
||||||
localJson.put(localKey, lastPart ? new JSONArray() : new JSONObject());
|
localJson.put(localKey, lastPart ? new JSONArray() : new JSONObject());
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
@@ -110,7 +108,6 @@ public class Configuration {
|
|||||||
JSONObject localJson = json;
|
JSONObject localJson = json;
|
||||||
for (int i=0; i<parts.length; i++) {
|
for (int i=0; i<parts.length; i++) {
|
||||||
String localKey = parts[i];
|
String localKey = parts[i];
|
||||||
LOG.debug("localKey = {}",localKey);
|
|
||||||
boolean lastPart = i == parts.length-1;
|
boolean lastPart = i == parts.length-1;
|
||||||
if (!localJson.has(localKey)) return null;
|
if (!localJson.has(localKey)) return null;
|
||||||
if (lastPart) return (T) localJson.get(localKey);
|
if (lastPart) return (T) localJson.get(localKey);
|
||||||
|
|||||||
@@ -22,10 +22,14 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static de.srsoftware.belegscanner.Application.t;
|
import static de.srsoftware.belegscanner.Application.t;
|
||||||
import static de.srsoftware.belegscanner.Constants.DEFAULT_HEIGHT;
|
import static de.srsoftware.belegscanner.Constants.DEFAULT_HEIGHT;
|
||||||
@@ -64,6 +68,12 @@ public class Worker {
|
|||||||
|
|
||||||
public void dropProfile(String droppedProfile) {
|
public void dropProfile(String droppedProfile) {
|
||||||
LOG.debug("Worker.dropProfile({})",droppedProfile);
|
LOG.debug("Worker.dropProfile({})",droppedProfile);
|
||||||
|
getProfiles().remove(droppedProfile);
|
||||||
|
try {
|
||||||
|
config.save();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public JSONObject getProfiles() {
|
public JSONObject getProfiles() {
|
||||||
return config.getOrCreate("profiles",new JSONObject());
|
return config.getOrCreate("profiles",new JSONObject());
|
||||||
@@ -593,4 +603,25 @@ public class Worker {
|
|||||||
public void setTypeSelector(TypeSelector newVal) {
|
public void setTypeSelector(TypeSelector newVal) {
|
||||||
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();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class DocTable extends JPanel{
|
|||||||
rows.put(project.pattern(), this);
|
rows.put(project.pattern(), this);
|
||||||
constraints.gridy = ++rowCounter;
|
constraints.gridy = ++rowCounter;
|
||||||
constraints.gridx = 0;
|
constraints.gridx = 0;
|
||||||
add(pathLabel = new JLabel(project.nextFile().toString()), constraints);
|
add(pathLabel = new JLabel(project.pattern()), constraints);
|
||||||
constraints.gridx = 1;
|
constraints.gridx = 1;
|
||||||
add(status = new JLabel("neu"),constraints);
|
add(status = new JLabel("neu"),constraints);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user