Search in sources :

Example 1 with StretchedHexagon

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;
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) FingerPost(eu.esdihumboldt.hale.ui.util.graph.shapes.FingerPost) StretchedHexagon(eu.esdihumboldt.hale.ui.util.graph.shapes.StretchedHexagon) ShapePainter(eu.esdihumboldt.hale.ui.util.graph.CustomShapeFigure.ShapePainter) CustomShapeLabel(eu.esdihumboldt.hale.ui.util.graph.CustomShapeLabel) TransformationNodeShape(eu.esdihumboldt.hale.ui.common.graph.figures.TransformationNodeShape)

Aggregations

Vertex (com.tinkerpop.blueprints.Vertex)1 TransformationNodeShape (eu.esdihumboldt.hale.ui.common.graph.figures.TransformationNodeShape)1 ShapePainter (eu.esdihumboldt.hale.ui.util.graph.CustomShapeFigure.ShapePainter)1 CustomShapeLabel (eu.esdihumboldt.hale.ui.util.graph.CustomShapeLabel)1 FingerPost (eu.esdihumboldt.hale.ui.util.graph.shapes.FingerPost)1 StretchedHexagon (eu.esdihumboldt.hale.ui.util.graph.shapes.StretchedHexagon)1