Exemplo n.º 1
0
  @Override
  public boolean add(E e) {
    Property property = new Property(this, String.valueOf(size()));

    boolean ret = internal.add(e);

    if (ret) {
      if (e instanceof IObject) {
        ((IObject) e).getParentsLinksToThis().add(property);
      }

      if (propagate) propagateChange(property);
    }

    return ret;
  }
Exemplo n.º 2
0
  @Override
  public void add(int index, E element) {
    Property property = new Property(this, String.valueOf(index));

    internal.add(index, element);

    if (element instanceof IObject) {
      ((IObject) element).getParentsLinksToThis().add(property);
    }

    for (index = index + 1; index < size(); index++) {
      E content = get(index);
      if (content instanceof IObject) {
        Property oldProperty = new Property(this, String.valueOf(index - 1));
        Property newProperty = new Property(this, String.valueOf(index));
        int linkIndex = ((IObject) content).getParentsLinksToThis().indexOf(oldProperty);
        ((IObject) content).getParentsLinksToThis().set(linkIndex, newProperty);
      }
    }

    if (propagate) propagateChange(new Property(this, ""));
  }