Java Reference
In-Depth Information
4.5.4 Generation
As usual, we invoke the transformation from mapping to generator model using
the context menu
Create Generator Model
on our
scenario.gmfmap
model. In
the generator model, we change the
Diagram File Extension
property to
scenario
, and we set the
Same File For Diagram And Model
property to
true
, as seen in Figure 4-34.
Figure 4-34
Scenario GMF generator model
We next generate our scenario diagram plug-in and move on to making some
of the necessary code changes—or you can run the diagram now to see how it
looks.
Border Item Adjustment
Our border item
Event
nodes are offset by default so that the edge of the node
meets the edge of the parent. For our
Event
nodes, we want them to straddle the
border, so we must modify the
addFixedChild()
method of the parent
TaskEditPart
class to set the offset to half the diameter of the
Event
circle fig-
ure. The modified method follows, showing the general
EventXEditPart
mod-
ification, where
X
is replaced by the number of each side-affixed event. A better
solution would be to use
childEditPart.getSize().width/2
to calculate
the offset. Changes appear in bold.
/**
*
Modified to add border offset for overlapping event nodes
*
* @generated
NOT
*/
protected boolean addFixedChild(EditPart childEditPart) {
if
(childEditPart instanceof TaskNameEditPart) {
Search WWH ::
Custom Search