I'm trying to add figures to the screen in a specific location, but the setLocation method doesn't seem to be working the way I expect. I've set my root editPart as a freeFormLayer with a freeFormLayout as the manager. Then in each of the nodes, I create a label figure and set the location. The node figures don't end up displaying at all. What am I missing here?
public class RootEditPart extends AbstractGraphicalEditPart{
@Override
protected IFigure createFigure() {
Figure f = new FreeformLayer();
f.setLayoutManager(new FreeformLayout());
f.setBorder(new MarginBorder(1));
f.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
return f;
}
}
public class NodeEditPart extends AbstractGraphicalEditPart {
@Override
protected IFigure createFigure() {
System.out.println("Called NodeEditPart.createFigure()");
Label node = new Label();
return node;
}
@Override
protected void createEditPolicies() {
}
protected void refreshVisuals() {
System.out.println("Called NodeEditPart.refreshVisuals()");
Point loc = new Point(100, 100);
Label node = (Label) getFigure();
node.setIcon(image);
node.setText("test");
node.setLocation(loc);
System.out.println(" setting location to: " + loc);
}
}