protected void modelChanged() { super.modelChanged(); MComponentInstance coi = (MComponentInstance) getOwner(); if (coi == null) return; String nameStr = ""; if (coi.getName() != null) { nameStr = coi.getName().trim(); } // construct bases string (comma separated) String baseStr = ""; Collection col = coi.getClassifiers(); if (col != null && col.size() > 0) { Iterator it = col.iterator(); baseStr = ((MClassifier) it.next()).getName(); while (it.hasNext()) { baseStr += ", " + ((MClassifier) it.next()).getName(); } } if (_readyToEdit) { if (nameStr == "" && baseStr == "") _name.setText(""); else _name.setText(nameStr.trim() + " : " + baseStr); } Dimension nameMin = _name.getMinimumSize(); Rectangle r = getBounds(); setBounds(r.x, r.y, r.width, r.height); updateStereotypeText(); }
public Object makeNode() { Object newNode = super.makeNode(); MComponentInstance compspecType = (MComponentInstance) newNode; // neue ComponentInstance. System.err.println("makeNode() called"); compspecType.setName(orig.getName()); // Name ist gesetzt. MStereotype stereotype = new MStereotypeImpl(); // new Stereotype. stereotype.setName("comp spec"); // Sterotype Name auf "comp spec" gesetzt. compspecType.setStereotype(stereotype); // Stereotyp setzen. /*for (Iterator it = orig.getFeatures().iterator(); it.hasNext(); ) { Object f = it.next(); if (f instanceof MAttribute) { MAttribute origAttr = (MAttribute)f; MAttribute attr = compspecType.getFactory().createAttribute(); attr.setName(origAttr.getName()); attr.setType(origAttr.getType()); attr.setVisibility(origAttr.getVisibility()); compspecType.addFeature(attr); } } */ return newNode; }
public void setEnclosingFig(Fig encloser) { if (encloser != null && encloser.getOwner() instanceof MNodeInstance && getOwner() != null) { MNodeInstance node = (MNodeInstance) encloser.getOwner(); MComponentInstance comp = (MComponentInstance) getOwner(); if (comp.getNodeInstance() != node) { comp.setNodeInstance(node); } super.setEnclosingFig(encloser); Vector figures = getEnclosedFigs(); if (getLayer() != null) { // elementOrdering(figures); Vector contents = getLayer().getContents(); int contentsSize = contents.size(); for (int j = 0; j < contentsSize; j++) { Object o = contents.elementAt(j); if (o instanceof FigEdgeModelElement) { FigEdgeModelElement figedge = (FigEdgeModelElement) o; figedge.getLayer().bringToFront(figedge); } } } } else if (encloser == null && getEnclosingFig() != null) { if (getEnclosingFig() instanceof FigNodeModelElement) ((FigNodeModelElement) getEnclosingFig()).getEnclosedFigs().removeElement(this); _encloser = null; } /* super.setEnclosingFig(encloser); Vector figures = getEnclosedFigs(); if (getLayer() != null) { // elementOrdering(figures); Vector contents = getLayer().getContents(); int contentsSize = contents.size(); for (int j=0; j<contentsSize; j++) { Object o = contents.elementAt(j); if (o instanceof FigEdgeModelElement) { FigEdgeModelElement figedge = (FigEdgeModelElement) o; figedge.getLayer().bringToFront(figedge); } } } if (!(getOwner() instanceof MModelElement)) return; if (getOwner() instanceof MComponentInstance) { MComponentInstance me = (MComponentInstance) getOwner(); MNodeInstance mnode = null; if (encloser != null && (encloser.getOwner() instanceof MNodeInstance)) { mnode = (MNodeInstance) encloser.getOwner(); } if (encloser != null && (encloser.getOwner() instanceof MComponentInstance)) { MComponentInstance comp = (MComponentInstance) encloser.getOwner(); mnode = (MNodeInstance) comp.getNodeInstance(); } try { if(mnode != null) { me.setNodeInstance(mnode); } else { if (me.getNodeInstance() != null) { me.setNodeInstance(null); } } setNode(figures); } catch (Exception e) { cat.error("could not set package", e); } } */ }