new VertexDirectEditPolicy());
}
@Override
protected IFigure createFigure() {
Vertex vertex = (Vertex) getModel();
// Get default width and height
int width = (Integer) vertex.getAttribute(ObjectType.ATTRIBUTE_WIDTH);
int height = (Integer) vertex.getAttribute(ObjectType.ATTRIBUTE_HEIGHT);
// Get dimension, color, shape
Dimension dimension = new Dimension(width, height);
Color color = (Color) vertex.getAttribute(ObjectType.ATTRIBUTE_COLOR);
String name = (String) vertex.getAttribute(ObjectType.ATTRIBUTE_SHAPE);
IShape shape = ShapeFactory.createShape(name);
// Creates the figure with the specified properties, sets its id
Font font = ((GraphicalEditPart) getParent()).getFigure().getFont();
VertexFigure figure = new VertexFigure(font, dimension, color, shape);
String id = (String) vertex.getValue(ObjectType.PARAMETER_ID);
figure.setId(id);
// update the figure position (if the graph has layout information)
if ((Boolean) vertex.getParent().getValue(Graph.PROPERTY_HAS_LAYOUT)) {
Rectangle bounds = (Rectangle) vertex
.getValue(Vertex.PROPERTY_SIZE);
if (bounds != null) {
figure.setBounds(bounds);
}
}