Java Code Examples for org.eclipse.draw2d.PolylineConnection#setSourceAnchor()
The following examples show how to use
org.eclipse.draw2d.PolylineConnection#setSourceAnchor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoundDetailsPart.java From neoscada with Eclipse Public License 1.0 | 6 votes |
private void createRoundArrow ( final Figure figure ) { final PolylineConnection c = new PolylineConnection (); c.setSourceAnchor ( new ChopboxAnchor ( this.sourceRect ) ); c.setTargetAnchor ( new ChopboxAnchor ( this.targetRect ) ); final PolygonDecoration dec = new PolygonDecoration (); dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP ); c.setTargetDecoration ( dec ); final MidpointLocator typeLocator = new MidpointLocator ( c, 0 ); typeLocator.setRelativePosition ( PositionConstants.NORTH ); this.typeLabel = new Label ( "" ); //$NON-NLS-1$ c.add ( this.typeLabel, typeLocator ); figure.add ( c ); this.roundConnection = c; }
Example 2
Source File: BasicViewElementFactory.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public void createConnections ( final Layer layer, final SymbolController controller, final EList<Connection> connections ) { if ( connections == null ) { return; } for ( final Connection connection : connections ) { final Controller start = AdapterHelper.adapt ( controller.getElement ( connection.getStart () ), Controller.class ); final Controller end = AdapterHelper.adapt ( controller.getElement ( connection.getEnd () ), Controller.class ); if ( start != null && end != null ) { final PolylineConnection c = new PolylineConnection (); c.setSourceAnchor ( new ChopboxAnchor ( start.getFigure () ) ); c.setTargetAnchor ( new ChopboxAnchor ( end.getFigure () ) ); c.setAntialias ( SWT.ON ); layer.add ( c ); } } }
Example 3
Source File: ManualOverride.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private PolylineConnection createConnection ( final IFigure source, final IFigure target ) { final PolylineConnection c = new PolylineConnection (); final ChopboxAnchor sourceAnchor = new ChopboxAnchor ( source ); final ChopboxAnchor targetAnchor = new ChopboxAnchor ( target ); c.setSourceAnchor ( sourceAnchor ); c.setTargetAnchor ( targetAnchor ); return c; }
Example 4
Source File: InputScaleDetails.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void connect ( final IFigure figure, final IFigure source, final IFigure target ) { final PolylineConnection c = new PolylineConnection (); c.setSourceAnchor ( new ChopboxAnchor ( source ) ); c.setTargetAnchor ( new ChopboxAnchor ( target ) ); final PolygonDecoration dec = new PolygonDecoration (); dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP ); dec.setBackgroundColor ( ColorConstants.black ); c.setTargetDecoration ( dec ); figure.add ( c ); }
Example 5
Source File: BPMNShapeFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private PolylineConnection createConnectorFigure(Edge bonitaEdge) { Bounds sourceLocation = getBPMNShapeBounds(modelExporter.getEObjectID(bonitaEdge.getSource())); Bounds targetLocation = getBPMNShapeBounds(modelExporter.getEObjectID(bonitaEdge.getTarget())); PolylineConnection conn = new PolylineConnection(); AbstractRouter router = new CustomRectilinearRouter(); conn.setConnectionRouter(router); final List<RelativeBendpoint> pointList = ((RelativeBendpoints) bonitaEdge.getBendpoints()).getPoints(); List<org.eclipse.draw2d.RelativeBendpoint> figureConstraint = new ArrayList<>(); for (int i = 0; i < pointList.size(); i++) { RelativeBendpoint relativeBendpoint = (RelativeBendpoint) pointList.get(i); IFigure sourceFigure = new Figure(); sourceFigure.setBounds(toRectangle(sourceLocation)); IFigure targetFigure = new Figure(); targetFigure.setBounds(toRectangle(targetLocation)); conn.setSourceAnchor(new CustomAnchor(sourceFigure)); conn.setTargetAnchor(new CustomAnchor(targetFigure)); org.eclipse.draw2d.RelativeBendpoint rbp = new org.eclipse.draw2d.RelativeBendpoint(conn); rbp.setRelativeDimensions( new Dimension(relativeBendpoint.getSourceX(), relativeBendpoint.getSourceY()), new Dimension(relativeBendpoint.getTargetX(), relativeBendpoint.getTargetY())); if (pointList.size() == 1) { rbp.setWeight(0.5f); } else { rbp.setWeight(i / ((float) pointList.size() - 1)); } figureConstraint.add(rbp); } conn.setRoutingConstraint(figureConstraint); router.route(conn); return conn; }