use of org.knime.workbench.editor2.editparts.snap.ConnectionBendpointCreationHandel in project knime-core by knime.
the class ConnectionBendpointEditPolicy method createHandlesForAutomaticBendpoints.
private List createHandlesForAutomaticBendpoints() {
List<ConnectionBendpointCreationHandel> list = new ArrayList<ConnectionBendpointCreationHandel>();
ConnectionEditPart connEP = (ConnectionEditPart) getHost();
PointList points = getConnection().getPoints();
for (int i = 0; i < points.size() - 1; i++) {
list.add(new ConnectionBendpointCreationHandel(connEP, 0, i));
}
return list;
}
use of org.knime.workbench.editor2.editparts.snap.ConnectionBendpointCreationHandel in project knime-core by knime.
the class ConnectionBendpointEditPolicy method createHandlesForUserBendpoints.
private List createHandlesForUserBendpoints() {
List<Object> list = new ArrayList<Object>();
ConnectionEditPart connEP = (ConnectionEditPart) getHost();
PointList points = getConnection().getPoints();
List bendPoints = (List) getConnection().getRoutingConstraint();
int bendPointIndex = 0;
Point currBendPoint = null;
if (bendPoints == null) {
bendPoints = NULL_CONSTRAINT;
} else if (!bendPoints.isEmpty()) {
currBendPoint = ((Bendpoint) bendPoints.get(0)).getLocation();
}
for (int i = 0; i < points.size() - 1; i++) {
// Put a create handle on the middle of every segment
list.add(new ConnectionBendpointCreationHandel(connEP, bendPointIndex, i));
// move handle
if (i < points.size() - 1 && bendPointIndex < bendPoints.size() && currBendPoint.equals(points.getPoint(i + 1))) {
list.add(new ConnectionBendpointMoveHandel(connEP, bendPointIndex, i + 1));
// Go to the next user bendpoint
bendPointIndex++;
if (bendPointIndex < bendPoints.size()) {
currBendPoint = ((Bendpoint) bendPoints.get(bendPointIndex)).getLocation();
}
}
}
return list;
}
Aggregations