Search in sources :

Example 6 with ConnectionFigure

use of org.talend.designer.core.ui.editor.connections.ConnectionFigure in project tdi-studio-se by Talend.

the class CreateComponentOnLinkHelper method selectConnection.

public static void selectConnection(ConnectionPart connPart) {
    ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
    if (fig.getLineWidth() != 2) {
        fig.setLineWidth(2);
        connPart.refresh();
    }
}
Also used : ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure)

Example 7 with ConnectionFigure

use of org.talend.designer.core.ui.editor.connections.ConnectionFigure in project tdi-studio-se by Talend.

the class CreateComponentOnLinkHelper method unselectConnection.

public static void unselectConnection(ConnectionPart connPart) {
    ConnectionFigure fig = (ConnectionFigure) connPart.getFigure();
    if (fig.getLineWidth() != 1) {
        fig.setLineWidth(1);
        connPart.refresh();
    }
}
Also used : ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure)

Example 8 with ConnectionFigure

use of org.talend.designer.core.ui.editor.connections.ConnectionFigure in project tdi-studio-se by Talend.

the class NodeFigure method setBounds.

@Override
public void setBounds(final Rectangle rect) {
    super.setBounds(rect);
    Point location = (new Point(rect.getCenter())).translate(new Point(-fig.getSize().width / 2, -(fig.getSize().height / 2)));
    Rectangle figBounds = new Rectangle(location, fig.getSize());
    this.fig.setBounds(figBounds);
    if (dummy) {
        if (sourceDummyMap != null) {
            if (targetConnection != null && sourceDummyMap.keySet().size() != 0) {
                for (final ConnectionFigure curConn : newSourceConnections) {
                    AnchorListener sourceListener = new AnchorListener() {

                        @Override
                        public void anchorMoved(ConnectionAnchor anchor) {
                            if (curConn != null) {
                                updateSource(curConn);
                            }
                        }
                    };
                    if (curConn.getTargetAnchor() != null && curConn.getTargetAnchor().getOwner() != null) {
                        sourceListeners.put(curConn, sourceListener);
                        curConn.getTargetAnchor().addAnchorListener(sourceListener);
                    }
                }
                newSourceConnections.clear();
                updateTarget();
                List<ConnectionFigure> toRemove = new ArrayList<ConnectionFigure>();
                for (ConnectionFigure curConn : sourceDummyMap.keySet()) {
                    ConnectionFigure connToRemove = updateSource(curConn);
                    if (connToRemove != null) {
                        toRemove.add(connToRemove);
                    }
                }
                sourceDummyMap.keySet().removeAll(toRemove);
            } else {
                INodeConnector mainNodeConnector = node.getConnectorFromType(EConnectionType.FLOW_MAIN);
                ConnectionFigure connection = new ConnectionFigure(mainNodeConnector.getConnectionProperty(EConnectionType.FLOW_MAIN), node);
                connection.setTargetDecoration(null);
                connection.setStart(new Point(figBounds.x, figBounds.y + figBounds.height / 2));
                connection.setEnd(new Point(figBounds.x + figBounds.width, figBounds.y + figBounds.height / 2));
            }
        }
    }
    if (!rect.getSize().equals(fig.getSize())) {
        lineBorder.setUseRectangle(true);
    } else {
        lineBorder.setUseRectangle(false);
    }
}
Also used : ConnectionAnchor(org.eclipse.draw2d.ConnectionAnchor) ConnectionFigure(org.talend.designer.core.ui.editor.connections.ConnectionFigure) DummyConnectionFigure(org.talend.designer.core.ui.editor.connections.DummyConnectionFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) AnchorListener(org.eclipse.draw2d.AnchorListener) ArrayList(java.util.ArrayList) Point(org.eclipse.draw2d.geometry.Point) INodeConnector(org.talend.core.model.process.INodeConnector)

Aggregations

ConnectionFigure (org.talend.designer.core.ui.editor.connections.ConnectionFigure)8 Point (org.eclipse.draw2d.geometry.Point)4 ArrayList (java.util.ArrayList)3 ConnectionPart (org.talend.designer.core.ui.editor.connections.ConnectionPart)3 List (java.util.List)2 ChopboxAnchor (org.eclipse.draw2d.ChopboxAnchor)2 IFigure (org.eclipse.draw2d.IFigure)2 PolylineConnection (org.eclipse.draw2d.PolylineConnection)2 PointList (org.eclipse.draw2d.geometry.PointList)2 CreateConnectionRequest (org.eclipse.gef.requests.CreateConnectionRequest)2 ReconnectRequest (org.eclipse.gef.requests.ReconnectRequest)2 IConnection (org.talend.core.model.process.IConnection)2 IExternalNode (org.talend.core.model.process.IExternalNode)2 INode (org.talend.core.model.process.INode)2 IGraphicalNode (org.talend.core.ui.process.IGraphicalNode)2 Connection (org.talend.designer.core.ui.editor.connections.Connection)2 TalendBorderItemRectilinearRouter (org.talend.designer.core.ui.editor.connections.TalendBorderItemRectilinearRouter)2 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)2 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)2 AnchorListener (org.eclipse.draw2d.AnchorListener)1