use of org.knime.workbench.editor2.figures.ProgressPolylineConnection in project knime-core by knime.
the class WorkflowEditorDropTargetListener method dragOver.
/**
* {@inheritDoc}
*
* Marks nodes or edges if a new node should replace an old node or should be inserted on an edge.
*/
@Override
public void dragOver(final DropTargetEvent event) {
WorkflowManagerUI wfm = ((WorkflowRootEditPart) getViewer().getRootEditPart().getContents()).getWorkflowManager();
m_node = null;
m_edge = null;
m_nodeCount = 0;
m_edgeCount = 0;
// edge-/nodedist
double edgedist = Integer.MAX_VALUE;
double nodedist = Integer.MAX_VALUE;
Point dropLocation = getDropLocation(event);
EditPart ep = getViewer().findObjectAt(dropLocation.getTranslated(0, 0));
if (ep instanceof NodeContainerEditPart) {
double temp = dropLocation.getDistance(dropLocation.getTranslated(0, 0));
// choose nearest node to mouse position
if (nodedist >= temp) {
m_node = (NodeContainerEditPart) ep;
nodedist = temp;
}
m_nodeCount++;
} else if (ep instanceof ConnectionContainerEditPart) {
double temp = dropLocation.getDistance(dropLocation.getTranslated(0, 0));
// choose nearest edge to mouse-position
if (edgedist >= temp) {
m_edge = (ConnectionContainerEditPart) ep;
edgedist = temp;
}
m_edgeCount++;
}
unmark(wfm);
if (m_node != null && m_nodeCount >= m_edgeCount) {
m_markedNode = m_node;
m_markedNode.mark();
// workaround for eclipse bug 393868 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=393868)
WindowsDNDHelper.hideDragImage();
} else if (m_edge != null) {
m_edgeColor = m_edge.getFigure().getForegroundColor();
m_edgeWidth = ((ProgressPolylineConnection) m_edge.getFigure()).getLineWidth();
m_markedEdge = m_edge;
((ProgressPolylineConnection) m_markedEdge.getFigure()).setLineWidth(m_edgeWidth + 3);
m_markedEdge.getFigure().setForegroundColor(RED);
// workaround for eclipse bug 393868 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=393868)
WindowsDNDHelper.hideDragImage();
}
}
use of org.knime.workbench.editor2.figures.ProgressPolylineConnection 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;
}
use of org.knime.workbench.editor2.figures.ProgressPolylineConnection in project knime-core by knime.
the class ConnectionContainerEditPart method progressChanged.
/**
* {@inheritDoc}
*/
@Override
public void progressChanged(final ConnectionProgressEvent pe) {
ProgressPolylineConnection conn = (ProgressPolylineConnection) getFigure();
conn.progressChanged(pe.getConnectionProgress());
}
Aggregations