From: Niki Roo Date: Sat, 1 Jun 2019 09:16:15 +0000 (+0200) Subject: ConfigItem: fix items again X-Git-Tag: fanfix-swing-0.0.1~21^2~15 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=a1848a9061a28aa4420fda2e6acf041065f0c8c0;p=fanfix-swing.git ConfigItem: fix items again --- diff --git a/src/be/nikiroo/utils/ui/ConfigItem.java b/src/be/nikiroo/utils/ui/ConfigItem.java index 46775e11..1f698860 100644 --- a/src/be/nikiroo/utils/ui/ConfigItem.java +++ b/src/be/nikiroo/utils/ui/ConfigItem.java @@ -458,26 +458,6 @@ public abstract class ConfigItem> extends JPanel { addItem(item); } - // if (item >= 0) { - // Object value = getFromField(item); - // if (value == null) { - // value = ""; - // } - // - // boolean empty = value.equals(""); - // - // if (!empty && item >= info.getListSize(false)) { - // // item was deleted, remove it - // removeItem(item); - // return; - // } - // - // // in case of reload after remove - // if (!itemFields.containsKey(item)) { - // addItem(item); - // } - // } - Object value = getFromInfo(item); setToField(value, item); setOrig(value == null ? "" : value, item); @@ -491,16 +471,18 @@ public abstract class ConfigItem> extends JPanel { */ private void save() { if (info.isArray()) { - boolean dirty = fields.size() != info.getListSize(false); - for (int item = 0; item < fields.size(); item++) { + boolean dirty = itemFields.size() != info.getListSize(false); + for (int item = 0; item < itemFields.size(); item++) { if (getDirtyBit(item)) { dirty = true; } } if (dirty) { + info.setDirty(); info.setString(null, -1); - for (int item = 0; item < fields.size(); item++) { + + for (int item = 0; item < itemFields.size(); item++) { Object value = null; if (getField(item) != null) { value = getFromField(item); @@ -509,7 +491,6 @@ public abstract class ConfigItem> extends JPanel { } } - info.setDirty(); setToInfo(value, item); setOrig(value, item); }