예제 #1
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);
  }
예제 #2
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;
  }