X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2FBaseClass.java;h=cb07948aac144d6aee8406e0f87882c394e11738;hp=b96edea6ee60f33a2eda0acb8ac908ebd59a4d07;hb=b9f192ed5290f3263f60dc5a2dc9fd754eead958;hpb=49a08b5df6d29e0345ee34c714f265084625b31f diff --git a/src/be/nikiroo/jvcard/BaseClass.java b/src/be/nikiroo/jvcard/BaseClass.java index b96edea..cb07948 100644 --- a/src/be/nikiroo/jvcard/BaseClass.java +++ b/src/be/nikiroo/jvcard/BaseClass.java @@ -29,18 +29,22 @@ public abstract class BaseClass> implements List { private List list; /** - * Create a new {@link BaseClass} with the given list as its descendants. + * Create a new {@link BaseClass} with the items in the given list as its + * descendants. + * + * Note: the elements will be copied from the {@link List}, you cannot + * manage the {@link List} from outside * * @param list * the descendants of this object, or NULL if none */ protected BaseClass(List list) { this.list = new ArrayList(); - + if (list != null) { this.list.addAll(list); } - + for (E child : this) { _enter(child, true); } @@ -102,6 +106,9 @@ public abstract class BaseClass> implements List { */ void setDirty() { dirty = true; + if (parent != null) { + parent.setDirty(); + } } /** @@ -156,8 +163,10 @@ public abstract class BaseClass> implements List { */ private void _enter(E child, boolean initialLoad) { child.setParent(this); - if (!initialLoad) + if (!initialLoad) { + setDirty(); child.setDirty(); + } } @Override