Search in sources :

Example 1 with CurvedPolylineConnection

use of org.knime.workbench.editor2.figures.CurvedPolylineConnection in project knime-core by knime.

the class ConnectionContainerEditPart method refreshVisuals.

/**
 * {@inheritDoc}
 */
@Override
protected void refreshVisuals() {
    super.refreshVisuals();
    LOGGER.debug("refreshing visuals for: " + getModel());
    ConnectionUIInformation ei = null;
    ei = getModel().getUIInfo();
    LOGGER.debug("modelling info: " + ei);
    // make flow variable port connections look red.
    CurvedPolylineConnection fig = (CurvedPolylineConnection) getFigure();
    if (getModel().isFlowVariablePortConnection()) {
        fig.setForegroundColor(AbstractPortFigure.getFlowVarPortColor());
    }
    // update 'curved' settings and line width
    EditorUIInformation uiInfo = getCurrentEditorSettings();
    fig.setCurved(uiInfo.getHasCurvedConnections());
    fig.setLineWidth(uiInfo.getConnectionLineWidth());
    // recreate list of bendpoints
    ArrayList<AbsoluteBendpoint> constraint = new ArrayList<AbsoluteBendpoint>();
    if (ei != null) {
        int[][] p = ei.getAllBendpoints();
        for (int i = 0; i < p.length; i++) {
            AbsoluteBendpoint bp = new AbsoluteBendpoint(p[i][0], p[i][1]);
            constraint.add(bp);
        }
    }
    fig.setRoutingConstraint(constraint);
}
Also used : AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) EditorUIInformation(org.knime.core.node.workflow.EditorUIInformation) ArrayList(java.util.ArrayList) ConnectionUIInformation(org.knime.core.node.workflow.ConnectionUIInformation) CurvedPolylineConnection(org.knime.workbench.editor2.figures.CurvedPolylineConnection) AbsoluteBendpoint(org.eclipse.draw2d.AbsoluteBendpoint) Point(org.eclipse.draw2d.geometry.Point)

Example 2 with CurvedPolylineConnection

use of org.knime.workbench.editor2.figures.CurvedPolylineConnection in project knime-core by knime.

the class ConnectionContainerEditPart method createFigure.

/**
 * {@inheritDoc}
 */
@Override
protected IFigure createFigure() {
    ProgressPolylineConnection conn = new CurvedPolylineConnection(false);
    // Bendpoints
    SnapOffBendPointConnectionRouter router = new SnapOffBendPointConnectionRouter();
    conn.setConnectionRouter(router);
    conn.setRoutingConstraint(new ArrayList());
    conn.setLineWidth(getCurrentEditorSettings().getConnectionLineWidth());
    // make flow variable port connections look red.
    if (getModel().isFlowVariablePortConnection()) {
        conn.setForegroundColor(AbstractPortFigure.getFlowVarPortColor());
    }
    return conn;
}
Also used : SnapOffBendPointConnectionRouter(org.knime.workbench.editor2.editparts.snap.SnapOffBendPointConnectionRouter) ArrayList(java.util.ArrayList) ProgressPolylineConnection(org.knime.workbench.editor2.figures.ProgressPolylineConnection) CurvedPolylineConnection(org.knime.workbench.editor2.figures.CurvedPolylineConnection)

Aggregations

ArrayList (java.util.ArrayList)2 CurvedPolylineConnection (org.knime.workbench.editor2.figures.CurvedPolylineConnection)2 AbsoluteBendpoint (org.eclipse.draw2d.AbsoluteBendpoint)1 Point (org.eclipse.draw2d.geometry.Point)1 ConnectionUIInformation (org.knime.core.node.workflow.ConnectionUIInformation)1 EditorUIInformation (org.knime.core.node.workflow.EditorUIInformation)1 SnapOffBendPointConnectionRouter (org.knime.workbench.editor2.editparts.snap.SnapOffBendPointConnectionRouter)1 ProgressPolylineConnection (org.knime.workbench.editor2.figures.ProgressPolylineConnection)1