use of eu.esdihumboldt.hale.ui.util.graph.shapes.StretchedHexagon in project hale by halestudio.
the class GraphMLLabelProvider method getFigure.
@Override
public IFigure getFigure(Object element) {
ShapePainter shape = null;
if (element instanceof Vertex) {
Vertex vex = (Vertex) element;
if (vex.getProperty("type").equals("root")) {
shape = new TransformationNodeShape(10, SWT.NONE);
} else if (vex.getProperty("type").equals("target")) {
boolean assigns = false;
for (Vertex v : vex.getVertices(Direction.BOTH)) {
if (v.getProperty("type").equals("cell")) {
assigns = true;
}
}
if (assigns) {
shape = new FingerPost(10, SWT.LEFT);
} else
shape = new TransformationNodeShape(10, SWT.NONE);
} else if (vex.getProperty("type").equals("source")) {
if (vex.getVertices(Direction.IN).iterator().hasNext() && vex.getVertices(Direction.OUT).iterator().hasNext()) {
shape = new FingerPost(10, SWT.RIGHT);
} else
shape = new TransformationNodeShape(10, SWT.NONE);
} else if (vex.getProperty("type").equals("cell")) {
shape = new StretchedHexagon(10);
}
if (shape != null) {
CustomShapeLabel figure;
figure = new CustomShapeLabel(shape);
figure.setMaximumWidth(MAX_FIGURE_WIDTH);
return figure;
}
}
return null;
}
Aggregations