Search in sources :

Example 6 with ViewDefinitionEdge

use of easik.overview.edge.ViewDefinitionEdge in project fql by CategoricalData.

the class OverviewGraphModel method getAttributes.

/**
 * Overridden method to get cell attributes; we make sure the appropriate
 * attributes are applied to the Easik objects before returning them.
 *
 * @see DefaultGraphModel.getAttributes(Object)
 *
 * @param o
 *
 * @return
 */
@Override
public AttributeMap getAttributes(Object o) {
    if (o instanceof GraphCell) {
        GraphCell cell = (GraphCell) o;
        AttributeMap attribs = cell.getAttributes();
        AttributeMap easikAttribs = null;
        if (cell instanceof SketchNode) {
            easikAttribs = sketchAttributes((SketchNode) cell);
        } else if (cell instanceof ViewNode) {
            easikAttribs = viewAttributes((ViewNode) cell);
        } else if (cell instanceof ViewDefinitionEdge) {
            easikAttribs = viewEdgeAttributes((ViewDefinitionEdge) cell);
        // easikAttribs =
        // easik.sketch.util.graph.SketchGraphModel.normalEdgeAttributes();
        }
        if (easikAttribs != null) {
            if (_overview.isCellSelected(cell)) {
                Color selColor = getColor("selection");
                float lineWidth = getWidth("selection", 3);
                int borderWidth = 1;
                Border currentBorder = GraphConstants.getBorder(easikAttribs);
                if (currentBorder instanceof LineBorder) {
                    borderWidth = ((LineBorder) currentBorder).getThickness();
                }
                GraphConstants.setBorder(easikAttribs, BorderFactory.createLineBorder(selColor, borderWidth));
                GraphConstants.setForeground(easikAttribs, selColor);
                GraphConstants.setLineColor(easikAttribs, selColor);
                GraphConstants.setLineWidth(easikAttribs, lineWidth);
            }
            if (attribs == null) {
                cell.setAttributes(easikAttribs);
                attribs = easikAttribs;
            } else {
                attribs.applyMap(easikAttribs);
            }
            return attribs;
        }
    }
    return super.getAttributes(o);
}
Also used : AttributeMap(org.jgraph.graph.AttributeMap) GraphCell(org.jgraph.graph.GraphCell) Color(java.awt.Color) LineBorder(javax.swing.border.LineBorder) ViewNode(easik.overview.vertex.ViewNode) SketchNode(easik.overview.vertex.SketchNode) ViewDefinitionEdge(easik.overview.edge.ViewDefinitionEdge) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border)

Aggregations

ViewDefinitionEdge (easik.overview.edge.ViewDefinitionEdge)6 ViewNode (easik.overview.vertex.ViewNode)5 SketchNode (easik.overview.vertex.SketchNode)4 DocumentInfo (easik.DocumentInfo)2 Cascade (easik.model.edge.ModelEdge.Cascade)2 ViewFrame (easik.ui.ViewFrame)2 Sketch (easik.sketch.Sketch)1 SketchEdge (easik.sketch.edge.SketchEdge)1 SketchFrame (easik.ui.SketchFrame)1 View (easik.view.View)1 InjectiveViewEdge (easik.view.edge.InjectiveViewEdge)1 NormalViewEdge (easik.view.edge.NormalViewEdge)1 PartialViewEdge (easik.view.edge.PartialViewEdge)1 View_Edge (easik.view.edge.View_Edge)1 QueryException (easik.view.util.QueryException)1 QueryNode (easik.view.vertex.QueryNode)1 Color (java.awt.Color)1 Point (java.awt.Point)1 Border (javax.swing.border.Border)1 LineBorder (javax.swing.border.LineBorder)1