Search in sources :

Example 1 with DummyConnectionFigure

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

the class NodeFigure method addSourceConnection.

public void addSourceConnection(ConnectionFigure sourceConnection) {
    if (!sourceDummyMap.keySet().contains(sourceConnection)) {
        if (connection != null) {
            connection.disposeColors();
        }
        connection = new DummyConnectionFigure(sourceConnection.getConnection(), sourceConnection.getConnectionProperty(), node);
        connection.setTargetDecoration(null);
        add(connection);
        if (dummy) {
            connection.setAlpha(255);
            connection.setVisible(true);
        } else {
            connection.setVisible(false);
        }
        this.sourceDummyMap.put(sourceConnection, connection);
        newSourceConnections.add(sourceConnection);
    }
}
Also used : DummyConnectionFigure(org.talend.designer.core.ui.editor.connections.DummyConnectionFigure)

Example 2 with DummyConnectionFigure

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

the class NodeFigure method setDummy.

public void setDummy(boolean value) {
    dummy = value;
    if (sourceDummyMap != null) {
        if (dummy) {
            for (DummyConnectionFigure connection : sourceDummyMap.values()) {
                connection.setAlpha(255);
                connection.setVisible(true);
            }
        } else {
            for (DummyConnectionFigure connection : sourceDummyMap.values()) {
                connection.setVisible(false);
            }
        }
    }
    if (targetDummy != null) {
        if (dummy) {
            targetDummy.setAlpha(255);
            targetDummy.setVisible(true);
        } else {
            targetDummy.setVisible(false);
        }
    }
}
Also used : DummyConnectionFigure(org.talend.designer.core.ui.editor.connections.DummyConnectionFigure)

Example 3 with DummyConnectionFigure

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

the class NodeFigure method updateSource.

private ConnectionFigure updateSource(ConnectionFigure curConn) {
    DummyConnectionFigure connection = sourceDummyMap.get(curConn);
    if (curConn.getTargetAnchor() == null || curConn.getSourceAnchor() == null) {
        connection.setVisible(false);
        return curConn;
    }
    Point figCenter = new Rectangle(this.node.getLocation(), this.node.getSize()).getCenter();
    curConn.getConnectionRouter().route(curConn);
    Point endPoint = curConn.getStart();
    if (!figCenter.equals(connection.getStart())) {
        connection.setStart(figCenter);
    }
    if (!endPoint.equals(connection.getEnd())) {
        connection.setEnd(endPoint);
    }
    return null;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) DummyConnectionFigure(org.talend.designer.core.ui.editor.connections.DummyConnectionFigure) Point(org.eclipse.draw2d.geometry.Point)

Example 4 with DummyConnectionFigure

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

the class NodeFigure method setTargetConnection.

/**
     * Sets the endConnection.
     * 
     * @param endConnection the endConnection to set
     */
public void setTargetConnection(ConnectionFigure targetConnection) {
    if (!targetDummyMap.keySet().contains(targetConnection)) {
        if (targetConnection != null && targetConnection.getSourceAnchor() != null) {
            targetConnection.getSourceAnchor().removeAnchorListener(targetListener);
        }
        if (this.targetConnection == null) {
            this.targetConnection = targetConnection;
        } else if (targetConnection.getConnection().getLineStyle() == EConnectionType.FLOW_MAIN) {
            this.targetConnection = targetConnection;
        } else {
            return;
        }
        if (connection != null) {
            connection.disposeColors();
        }
        connection = new DummyConnectionFigure(targetConnection.getConnection(), targetConnection.getConnectionProperty(), node);
        connection.setTargetDecoration(null);
        add(connection);
        if (dummy) {
            connection.setAlpha(255);
            connection.setVisible(true);
        } else {
            connection.setVisible(false);
        }
        targetDummy = connection;
        if (targetConnection.getSourceAnchor() != null && targetConnection.getSourceAnchor().getOwner() != null) {
            targetConnection.getSourceAnchor().addAnchorListener(targetListener);
        }
        targetDummyMap.put(targetConnection, targetDummy);
    }
}
Also used : DummyConnectionFigure(org.talend.designer.core.ui.editor.connections.DummyConnectionFigure)

Aggregations

DummyConnectionFigure (org.talend.designer.core.ui.editor.connections.DummyConnectionFigure)4 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1