Exemplo n.º 1
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);
  }
Exemplo n.º 2
0
  public Component(String id, ComponentType type, Component parent) {
    this.id = id;
    this.type = type;
    this.parent = null;
    directChildren = new ArrayList<>();
    attributes = new Attributes(this.id);
    allChildren = new HashMap<>();
    attributeId = new HashMap<>();

    initAttributesId();
    parent.addChild(this);
  }
Exemplo n.º 3
0
  public Component(Component parent) {
    this.id = generateCustomId();
    this.type = ComponentType.PANEL;
    this.parent = parent;
    directChildren = new ArrayList<>();
    attributes = new Attributes(this.id);
    allChildren = new HashMap<>();
    attributeId = new HashMap<>();

    initAttributesId();
    parent.addChild(this);
  }
Exemplo n.º 4
0
  private void clone(Component original, Component parent, String suffix) {
    Component clone = new Component(original.id + suffix, original.type, parent);

    clone.attributes = original.attributes.clone(clone.getId());
    clone.setAttributeId(ComponentState.NORMAL, clone.getId() + "NORMAL");
    clone.setAttributeId(ComponentState.HOVER, clone.getId() + "HOVER");
    clone.setAttributeId(ComponentState.CLICK, clone.getId() + "CLICK");

    for (Component copy : original.directChildren) clone(copy, clone, suffix);
  }
Exemplo n.º 5
0
  public Component clone(String suffix, boolean fakeParent) {
    Component clone;

    if (fakeParent && this.parent != null)
      clone =
          new Component(
              this.id + suffix, this.type, new Component(this.parent.getId(), ComponentType.PANEL));
    else if (this.parent != null) clone = new Component(this.id + suffix, this.type, this.parent);
    else clone = new Component(this.id + suffix, this.type);

    clone.attributes = attributes.clone(clone.getId());
    clone.setAttributeId(ComponentState.NORMAL, clone.getId() + "NORMAL");
    clone.setAttributeId(ComponentState.HOVER, clone.getId() + "HOVER");
    clone.setAttributeId(ComponentState.CLICK, clone.getId() + "CLICK");

    for (Component copy : directChildren) clone(copy, clone, suffix);

    return clone;
  }