Andrea Said
> I'm trying to understand your code at
> the moment.
To help I've done a little renaming and have cut some things down to
the bone a bit more.
Here is a quick explanation
The key things in UMLActivityDiagram are these two methods - if you
want to add and node or edge there is nothing more to do in this
class. The pain is that you have often have to change the MetaTypes
interface and add the implementations to MDR and EUML
@Override
Object[] getNewEdgeTypes() {
return new Object[] {
Model.getMetaTypes().getControlFlow(),
Model.getMetaTypes().getObjectFlow()
};
}
@Override
Object[] getNewNodeTypes() {
return new Object[] {
Model.getMetaTypes().getCallBehaviorAction(),
Model.getMetaTypes().getCreateObjectAction(),
Model.getMetaTypes().getDestroyObjectAction(),
Model.getMetaTypes().getAcceptEventAction(),
Model.getMetaTypes().getSendSignalAction(),
Model.getMetaTypes().getDestroyObjectAction(),
Model.getMetaTypes().getActivityParameterNode(),
Model.getMetaTypes().getCentralBufferNode(),
Model.getMetaTypes().getDataStoreNode(),
};
}
The only Figs are FigActivityEdge and FigActivityNode
FigActivityNode can change its display according to the specific type
of model element it represents by this method. There are special
shapes for SendSignalAction and AcceptEventAction, all other
OctionNodes are rounded rectangles and ObjectNodes squared rectangles,
there are more shapes to complete for initial, final, merge etc
protected Fig createBigPortFig() {
if (Model.getFacade().isASendSignalAction(getOwner())) {
....
return polyFig;
} else if (Model.getFacade().isAAcceptEventAction(getOwner())) {
....
return polyFig;
} else if (Model.getFacade().isAAction(getOwner())) {
return new FigRRect(X0, Y0, WIDTH, HEIGHT, LINE_COLOR, FILL_COLOR);
} else if (Model.getFacade().isAObjectNode(getOwner())) {
return new FigRect(X0, Y0, WIDTH, HEIGHT, LINE_COLOR, FILL_COLOR);
} else {
// More to do here
return null;
}
}
The only other place to amend is in
UMLFactoryEUMLImpl.buildNode(Object) so that the model implementation
can create the required type when it is called by the diagram
framework.
Note there is never a need to call specific create methods from the
diagram. From the UI the creation process is data driven by the
getNewEdgeTypes and getNewNodeTypes return values in
UMLActivityDiagram
Cheers
Bob.
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2637773
To unsubscribe from this discussion, e-mail:
[[email protected]].
To be allowed to post to the list contact the mailing list moderator, email:
[[email protected]]