Пример #1
0
  private void indexComponent(Component parent, Component compToIndex) {
    parent.allChildren.put(compToIndex.id.toLowerCase(), compToIndex);
    for (Component child : compToIndex.allChildren.values())
      parent.allChildren.put(child.id.toLowerCase(), child);

    if (parent.parent != null) indexComponent(parent.parent, compToIndex);
  }
Пример #2
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);
  }
Пример #3
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();
  }