Java Reference
In-Depth Information
along with Feature Value Spec and Value Expression that sets the value
of the type attributes upon link creation.
At this point, we only need to copy/paste the dependency link mapping and
alter the properties accordingly for INCLUDE and EXTEND links. When complete,
validation and update of the generator model from the mapping model, followed
by code regeneration, will enable us to run and test our updated diagram. This
will become a familiar sequence, which begs for the creation of a single action to
streamline the process. The Dashboard view comes in handy for this purpose.
Topic Figure Layout
Before we run the diagram, we need to make some tweaks to the generated code
if we want our Topic name labels to be centered in their rounded rectangle and
wrap. The code we use is from the GeoShapeFigure class in the runtime. In the
TopicEditPart class, adjust the constructor for the inner TopicFigure class
as follows:
/**
* Modified to adjust stack layout
*
* @generated NOT
*/
public TopicFigure() {
this.setLayoutManager(new StackLayout() {
public void layout(IFigure figure) {
Rectangle r = figure.getClientArea();
List children = figure.getChildren();
IFigure child;
Dimension d;
for (int i = 0; i < children.size(); i++) {
child = (IFigure) children.get(i);
d = child.getPreferredSize(r.width, r.height);
d.width = Math.min(d.width, r.width);
d.height = Math.min(d.height, r.height);
Rectangle childRect = new Rectangle(r.x + (r.width - d.width) /
2, r.y + (r.height - d.height) / 2, d.width, d.height);
child.setBounds(childRect);
}
}
} );
this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(15),
getMapMode().DPtoLP(15)));
this.setBorder(new MarginBorder(getMapMode().DPtoLP(0),
getMapMode().DPtoLP(5), getMapMode().DPtoLP(0),
getMapMode().DPtoLP(5)));
createContents();
}
Search WWH ::




Custom Search