Permalink
Browse files

TreeItem old format

  • Loading branch information...
Torge Rothe
Torge Rothe committed Jan 25, 2014
1 parent e3487c1 commit 94b9236815a55b14a50c602eef738c4f8297373a
Showing with 15 additions and 3 deletions.
  1. +15 −3 nifty-controls/src/main/java/de/lessvoid/nifty/controls/TreeItem.java
@@ -59,13 +59,25 @@ public TreeItem(@Nullable final T itemValue) {
this();
value = itemValue;
}
-
+
public void addTreeItem(final TreeItem<T> item) {
- children.add(item);
+ children.add(item);
+ item.setParentItem(this);
}
public void addTreeItems(@Nonnull final Collection<TreeItem<T>> items) {
- children.addAll(items);
+ for (TreeItem<T> t : items)
+ addTreeItem(t);
+ }
+
+ public void removeTreeItem(final TreeItem<T> item) {
+ children.remove(item);
+ item.setParentItem(null);
+ }
+
+ public void removeTreeItems(@Nonnull final Collection<TreeItem<T>> items) {
+ for (TreeItem<T> t : items)
+ removeTreeItem(t);
}
/**

0 comments on commit 94b9236

Please sign in to comment.