From a1848a9061a28aa4420fda2e6acf041065f0c8c0 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sat, 1 Jun 2019 11:16:15 +0200 Subject: [PATCH] ConfigItem: fix items again --- src/be/nikiroo/utils/ui/ConfigItem.java | 29 +++++-------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/be/nikiroo/utils/ui/ConfigItem.java b/src/be/nikiroo/utils/ui/ConfigItem.java index 46775e1..1f69886 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); } -- 2.27.0