private List<E> 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<E> list) {
this.list = new ArrayList<E>();
-
+
if (list != null) {
this.list.addAll(list);
}
-
+
for (E child : this) {
_enter(child, true);
}
*/
void setDirty() {
dirty = true;
+ if (parent != null) {
+ parent.setDirty();
+ }
}
/**
*/
private void _enter(E child, boolean initialLoad) {
child.setParent(this);
- if (!initialLoad)
+ if (!initialLoad) {
+ setDirty();
child.setDirty();
+ }
}
@Override