Search in sources :

Example 31 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class LookupConnectionPart method createFigure.

@Override
protected IFigure createFigure() {
    PolylineConnection connection = new PolylineConnection();
    connection.setTargetDecoration(new PolygonDecoration());
    // connection.setBackgroundColor(ColorConstants.yellow);
    connection.setForegroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_UNSELECTED_LOOKUP_LINKS));
    connection.setLineWidth(2);
    cr = new LookupConnectionRouter();
    connection.setConnectionRouter(cr);
    return connection;
}
Also used : LookupConnectionRouter(org.talend.designer.gefabstractmap.figures.routers.LookupConnectionRouter) PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 32 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project tdi-studio-se by Talend.

the class TableEntityPart method refreshChildrenSourceConnections.

public void refreshChildrenSourceConnections(TableEntityPart rootPart, boolean expanded) {
    for (Object obj : getChildren()) {
        if (obj instanceof TableEntityPart) {
            TableEntityPart part = (TableEntityPart) obj;
            if (expanded) {
                // do collapse
                part.setRootAnchor(rootPart.getFigure());
            } else {
                part.setRootAnchor(null);
            }
            if (part.getSourceConnections() != null) {
                for (Object conn : part.getSourceConnections()) {
                    if (conn instanceof BaseConnectionEditPart) {
                        BaseConnectionEditPart connectionEditPart = (BaseConnectionEditPart) conn;
                        if (connectionEditPart.getFigure() instanceof PolylineConnection) {
                            PolylineConnection connFigure = (PolylineConnection) connectionEditPart.getFigure();
                            if (expanded) {
                                connectionEditPart.setNodeCollapsed(true);
                                connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                            } else {
                                connectionEditPart.setNodeCollapsed(false);
                                if (!connectionEditPart.isDOTStyle()) {
                                    connFigure.setLineStyle(SWT.LINE_SOLID);
                                } else {
                                    connFigure.setLineStyle(SWT.LINE_DASHDOTDOT);
                                }
                            }
                        }
                        connectionEditPart.refresh();
                    }
                }
            }
            part.refreshChildrenSourceConnections(rootPart, expanded);
        }
    }
}
Also used : PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 33 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project whole by wholeplatform.

the class GraphLayoutStrategy method applyLayout.

public void applyLayout(DirectedGraph graph) {
    NodeList nodes = graph.nodes;
    for (int i = 0; i < nodes.size(); i++) {
        Node node = (Node) nodes.get(i);
        GraphicalEditPart part = (GraphicalEditPart) node.data;
        part.getFigure().setBounds(new Rectangle(node.x, node.y, node.width, node.height));
    }
    EdgeList edges = graph.edges;
    for (int i = 0; i < edges.size(); i++) {
        Edge edge = (Edge) edges.get(i);
        ConnectionEditPart connectionPart = (ConnectionEditPart) edge.data;
        nodes = edge.vNodes;
        PolylineConnection conn = (PolylineConnection) connectionPart.getFigure();
        if (nodes != null) {
            List<AbsoluteBendpoint> bends = new ArrayList<AbsoluteBendpoint>();
            for (int j = 0; j < nodes.size(); j++) {
                Node vn = nodes.getNode(j);
                if (edge.isFeedback) {
                    bends.add(new AbsoluteBendpoint(vn.x, vn.y + vn.height));
                    bends.add(new AbsoluteBendpoint(vn.x, vn.y));
                } else {
                    bends.add(new AbsoluteBendpoint(vn.x, vn.y));
                    bends.add(new AbsoluteBendpoint(vn.x, vn.y + vn.height));
                }
            }
            conn.setRoutingConstraint(bends);
        } else
            conn.setRoutingConstraint(Collections.EMPTY_LIST);
    }
}
Also used : AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) NodeList(org.eclipse.draw2d.graph.NodeList) Node(org.eclipse.draw2d.graph.Node) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ArrayList(java.util.ArrayList) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EdgeList(org.eclipse.draw2d.graph.EdgeList) Edge(org.eclipse.draw2d.graph.Edge) AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 34 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project dbeaver by serge-rider.

the class DummyEdgePart method createFigure.

/**
 * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#createFigure()
 */
protected IFigure createFigure() {
    PolylineConnection conn = new PolylineConnection();
    conn.setConnectionRouter(new BendpointConnectionRouter());
    conn.setVisible(true);
    return conn;
}
Also used : BendpointConnectionRouter(org.eclipse.draw2d.BendpointConnectionRouter) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 35 with PolylineConnection

use of org.eclipse.draw2d.PolylineConnection in project dbeaver by serge-rider.

the class LockGraphEdgeEditPart method createFigure.

@Override
protected IFigure createFigure() {
    PolylineConnection connection = (PolylineConnection) super.createFigure();
    connection.setLineWidth(1);
    PolygonDecoration decoration = new PolygonDecoration();
    decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP);
    connection.setSourceDecoration(decoration);
    return connection;
}
Also used : PolygonDecoration(org.eclipse.draw2d.PolygonDecoration) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Aggregations

PolylineConnection (org.eclipse.draw2d.PolylineConnection)43 Point (org.eclipse.draw2d.geometry.Point)11 PolygonDecoration (org.eclipse.draw2d.PolygonDecoration)10 IFigure (org.eclipse.draw2d.IFigure)8 BendpointConnectionRouter (org.eclipse.draw2d.BendpointConnectionRouter)6 Label (org.eclipse.draw2d.Label)6 BaseConnectionEditPart (org.talend.designer.gefabstractmap.part.BaseConnectionEditPart)5 Edge (org.eclipse.draw2d.graph.Edge)3 ArrayList (java.util.ArrayList)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)2 ManhattanConnectionRouter (org.eclipse.draw2d.ManhattanConnectionRouter)2 Dimension (org.eclipse.draw2d.geometry.Dimension)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2 Node (org.eclipse.draw2d.graph.Node)2 NodeList (org.eclipse.draw2d.graph.NodeList)2 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)2 CurveConnectionRouter (org.talend.designer.gefabstractmap.figures.routers.CurveConnectionRouter)2 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 InputTablePart (org.talend.designer.gefabstractmap.part.InputTablePart)2 LookupConnectionPart (org.talend.designer.gefabstractmap.part.LookupConnectionPart)2