@gmf.node(label="identifier,content", border.width="2",border.color="0,0,0",size="130,50",figure="rectangle", label.pattern="{0} : {1}") class Goal extends StandardNode { attr String identifier; attr String content; }
var GoalFigure = GmfGraph!Rectangle.all. selectOne(r|r.name = 'GoalFigure'); GoalFigure.label = new GmfGraph!Label;
package gsnModel.diagram.figures; import org.eclipse.draw2d.BorderLayout; import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.Graphics; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; public class StrategyFigure extends Figure { @Override public void paint(Graphics graphics) { Rectangle r = getBounds(); // Define the points of a trapez Point p1 = new Point(r.x + r.width/5, r.y); Point p2 = new Point(r.x + r.width, r.y); Point p3 = new Point (r.x -r.width/5 +r.width, r.y + r.height); Point p4 = new Point (r.x, r.y + r.height); PointList pointList = new PointList(); pointList.addPoint(p1); pointList.addPoint(p2); pointList.addPoint(p3); pointList.addPoint(p4); // Fill the shape graphics.fillPolygon(pointList); // Draw the outline graphics.drawLine(p1, p2); graphics.drawLine(p2, p3); graphics.drawLine(p3, p4); graphics.drawLine(p4, p1); // Move the label to the centre of the diamond WrappingLabel label = (WrappingLabel) this.getChildren().get(0); //System.out.println(this.getChildren().get(0).toString()); label.setAlignment(PositionConstants.BOTTOM | PositionConstants.RIGHT ); label.paint(graphics); } }
label.setAlignment(PositionConstants.TOP | PositionConstants.LEFT );