コード例 #1
0
  private void removeIndexComponent(Component parent, Component compToIndex) {
    parent.allChildren.remove(compToIndex.id.toLowerCase());
    for (Component child : compToIndex.allChildren.values())
      parent.allChildren.remove(child.id.toLowerCase());

    if (parent.parent != null) removeIndexComponent(parent.parent, compToIndex);
  }
コード例 #2
0
 public void delete() {
   if (parent != null) {
     removeIndexComponent(this.parent, this);
     this.parent.directChildren.remove(this);
     this.parent = null;
   }
 }
コード例 #3
0
  public void addChild(Component component) {
    if (component.parent != null) {
      component.parent.directChildren.remove(component);
      removeIndexComponent(component.parent, component);
    }

    component.parent = this;
    this.directChildren.add(component);
    indexComponent(this, component);
  }
コード例 #4
0
  public void setId(String id) {
    id = id.isEmpty() == true ? generateCustomId() : id;

    if (this.parent != null) removeIndexComponent(this.parent, this);

    this.id = id;

    if (this.parent != null) indexComponent(this.parent, this);

    attributes.setId(this.id);
    initAttributesId();
  }