protected void removeFromDiagramImpl() { Object o = getOwner(); if (o != null) { removeElementListener(o); } ArgoEventPump.removeListener(this); Iterator it = getPathItemFigs().iterator(); while (it.hasNext()) { Fig fig = (Fig) it.next(); fig.removeFromDiagram(); } /* TODO: MVW: Why the next action? * Deleting a fig from 1 diagram should not influence others! * */ // GEF does not take into account the multiple diagrams we have // therefore we loop through our diagrams and delete each and every // occurence on our own it = ProjectManager.getManager().getCurrentProject().getDiagrams().iterator(); while (it.hasNext()) { ArgoDiagram diagram = (ArgoDiagram) it.next(); diagram.damage(); } /* TODO: MVW: Should we not call damage() * for diagrams AFTER the next step? */ super.removeFromDiagram(); }
/** @see org.tigris.gef.presentation.Fig#deleteFromModel() */ public void deleteFromModel() { Object own = getOwner(); if (own != null) { ProjectManager.getManager().getCurrentProject().moveToTrash(own); } Iterator it = getPathItemFigs().iterator(); while (it.hasNext()) { ((Fig) it.next()).deleteFromModel(); } super.deleteFromModel(); }
/** * This method should only be called once for any one Fig instance that represents a model element * (ie not for a FigEdgeNote). It is called either by the constructor that takes an model element * as an argument or it is called by PGMLStackParser after it has created the Fig by use of the * empty constructor. The assigned model element (owner) must not change during the lifetime of * the Fig. TODO: It is planned to refactor so that there is only one Fig constructor. When this * is achieved this method can refactored out. * * @param owner the model element that this Fig represents. * @throws IllegalArgumentException if the owner given is not a model element * @see org.tigris.gef.presentation.Fig#setOwner(java.lang.Object) */ public void setOwner(Object newOwner) { if (newOwner == null) { throw new IllegalArgumentException("An owner must be supplied"); } if (!Model.getFacade().isAModelElement(newOwner)) { throw new IllegalArgumentException( "The owner must be a model element - got a " + newOwner.getClass().getName()); } Object oldOwner = getOwner(); super.setOwner(newOwner); initNotationProviders(newOwner); renderingChanged(); updateListeners(oldOwner, newOwner); }
/** @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent pve) { Object src = pve.getSource(); String pName = pve.getPropertyName(); if (pve instanceof DeleteInstanceEvent && src == getOwner()) { removeFromDiagram(); return; } // We handle and consume editing events if (pName.equals("editing") && Boolean.FALSE.equals(pve.getNewValue())) { LOG.debug("finished editing"); // parse the text that was edited textEdited((FigText) src); calcBounds(); endTrans(); } else if (pName.equals("editing") && Boolean.TRUE.equals(pve.getNewValue())) { textEditStarted((FigText) src); } else { // Add/remove name change listeners for applied stereotypes if (src == getOwner() && "stereotype".equals(pName)) { if (pve instanceof RemoveAssociationEvent) { removeElementListener(pve.getOldValue()); } else if (pve instanceof AddAssociationEvent) { addElementListener(pve.getNewValue(), "name"); } } // Pass everything except editing events to superclass super.propertyChange(pve); } if (Model.getFacade().isAModelElement(src) && getOwner() != null && !Model.getUmlFactory().isRemoved(getOwner())) { /* If the source of the event is an UML object, * then the UML model has been changed.*/ modelChanged(pve); } damage(); // TODO: (MVW) Is this required? // After all these events? I doubt it... }
/** @see org.tigris.gef.presentation.Fig#damage() */ public void damage() { super.damage(); getFig().damage(); }
protected void superRemoveFromDiagram() { super.removeFromDiagram(); }
/** @see org.tigris.gef.presentation.Fig#setLayer(org.tigris.gef.base.Layer) */ public void setLayer(Layer lay) { super.setLayer(lay); getFig().setLayer(lay); }