mirror of
https://github.com/badvision/jace.git
synced 2024-11-28 10:52:33 +00:00
Removed duplication from config panel (hopefully without side-effects).
This commit is contained in:
parent
a6a1bf681b
commit
36173ab5f4
@ -164,7 +164,7 @@ public class Configuration implements Reconfigurable {
|
||||
|
||||
private ConfigNode findChild(String childName) {
|
||||
for (ConfigNode node : children) {
|
||||
if (childName.equalsIgnoreCase(String.valueOf(node.getValue()))) {
|
||||
if (childName.equalsIgnoreCase(node.toString())) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
@ -175,7 +175,8 @@ public class Configuration implements Reconfigurable {
|
||||
removeChild(childName);
|
||||
int index = 0;
|
||||
for (ConfigNode node : children) {
|
||||
if (String.valueOf(node.getValue()).compareToIgnoreCase(childName) > 0) {
|
||||
int compare = node.toString().compareToIgnoreCase(childName);
|
||||
if (compare >= 0) {
|
||||
break;
|
||||
} else {
|
||||
index++;
|
||||
@ -184,18 +185,18 @@ public class Configuration implements Reconfigurable {
|
||||
children.add(index, newChild);
|
||||
}
|
||||
}
|
||||
public final static ConfigNode BASE;
|
||||
public static ConfigNode BASE;
|
||||
public static EmulatorUILogic ui = Emulator.logic;
|
||||
public static Computer emulator = Emulator.computer;
|
||||
@ConfigurableField(name = "Autosave Changes", description = "If unchecked, changes are only saved when the Save button is pressed.")
|
||||
public static boolean saveAutomatically = false;
|
||||
|
||||
static {
|
||||
BASE = new ConfigNode(new Configuration());
|
||||
buildTree();
|
||||
}
|
||||
|
||||
public static void buildTree() {
|
||||
BASE = new ConfigNode(new Configuration());
|
||||
buildTree(BASE, new LinkedHashSet());
|
||||
}
|
||||
|
||||
@ -424,9 +425,9 @@ public class Configuration implements Reconfigurable {
|
||||
buildTree(oldRoot, new HashSet());
|
||||
}
|
||||
newRoot.getChildren().stream().forEach((child) -> {
|
||||
String childName = child.getValue().toString();
|
||||
String childName = child.toString();
|
||||
// System.out.println("Applying settings for " + childName);
|
||||
applyConfigTree(newRoot.findChild(childName), oldRoot.findChild(childName));
|
||||
applyConfigTree(child, oldRoot.findChild(childName));
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user