コード例 #1
0
  /** Sets the shared component. */
  protected void setSharedComponent(AXIComponent sharedComponent) {
    this.sharedComponent = sharedComponent;
    if (sharedComponent == null) {
      return;
    }
    AXIModelImpl thisModel = (AXIModelImpl) getModel();
    if (thisModel == sharedComponent.getModel()) {
      sharedComponent.addListener(this);
      return;
    }

    // keep listening to the other model
    thisModel.listenToReferencedModel(sharedComponent.getModel());
  }
コード例 #2
0
  /** Overwritten so that it can fire events to the proxies. */
  public void insertAtIndex(String property, AXIComponent child, int index) {
    if (getModel() != child.getModel()) return;

    super.insertAtIndex(property, child, index);
    if (pcs != null) pcs.firePropertyChange(PROP_CHILD_ADDED, null, child);

    if (this instanceof AXIDocumentImpl) ((AXIDocumentImpl) this).addToCache(child);
  }
コード例 #3
0
  /** Overwritten so that it can fire events to the proxies. */
  protected void appendChild(String property, AXIComponent child) {
    if (getModel() != child.getModel()) return;

    super.appendChild(property, child);
    if (pcs != null) pcs.firePropertyChange(PROP_CHILD_ADDED, null, child);

    if (this instanceof AXIDocumentImpl) ((AXIDocumentImpl) this).addToCache(child);
  }
コード例 #4
0
  /** Add a listener to the shared component. */
  public void addListener(AXIComponent proxy) {
    if (getModel() != proxy.getModel()) return;

    if (pcs == null) pcs = new PropertyChangeSupport(this);

    PropertyChangeListener l = getWeakListener(proxy, false);
    if (l != null) pcs.addPropertyChangeListener(l);
  }
コード例 #5
0
  /** Overwritten so that it can fire events to the proxies. */
  public void removeChild(String property, AXIComponent child) {
    if (getModel() != child.getModel()) return;

    super.removeChild(property, child);
    if (pcs != null) {
      // fire event so that proxy children get deleted from their parents
      pcs.firePropertyChange(PROP_CHILD_REMOVED, child, null);
      // finally, remove all listeners from the shared child
      child.removeAllListeners();
    }
    if (this instanceof AXIDocumentImpl) ((AXIDocumentImpl) this).removeFromCache(child);
  }
コード例 #6
0
 public AXIComponent copy(AXIComponent parent) {
   AXIComponentFactory f = parent.getModel().getComponentFactory();
   return f.copy(this);
 }