org.eclipse.draw2d.PolylineConnection Java Examples
The following examples show how to use
org.eclipse.draw2d.PolylineConnection.
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: LinkPart.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override protected IFigure createFigure() { Link link = (Link) getModel(); link.editPart = this; SankeyDiagram editor = ((ProductSystemNode) link.sourceNode.parent).editor; PolylineConnection conn = new LinkFigure(link.getWidth(), editor); if (editor.isRouted()) { conn.setConnectionRouter(ROUTER); } else { conn.setConnectionRouter(ConnectionRouter.NULL); } link.figure = conn; conn.setTolerance(0); conn.setForegroundColor(link.getColor()); return conn; }
Example #3
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 #4
Source File: RelationEditPart.java From ermasterr with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ // @Override // public void refreshVisuals() { // super.refreshVisuals(); // // } @Override protected void decorateRelation() { final ERDiagram diagram = getDiagram(); if (diagram != null) { final Relation relation = (Relation) getModel(); final PolylineConnection connection = (PolylineConnection) getConnectionFigure(); final String notation = diagram.getDiagramContents().getSettings().getNotation(); final Decoration decoration = DecorationFactory.getDecoration(notation, relation.getParentCardinality(), relation.getChildCardinality()); connection.setSourceDecoration(decoration.getSourceDecoration()); connection.setTargetDecoration(decoration.getTargetDecoration()); targetLabel.setText(Format.null2blank(decoration.getTargetLabel())); } }
Example #5
Source File: CursorTimingsLayer.java From nebula with Eclipse Public License 2.0 | 6 votes |
public void moveTimingsTo(Point targetLocation) { final Dimension offset = targetLocation.getDifference(fConnectionsLocation); if (offset.height() != 0) { fConnectionsLocation = targetLocation; for (final Object connection : getChildren()) { if (connection instanceof PolylineConnection) { final CursorAnchor sourceAnchor = (CursorAnchor) ((PolylineConnection) connection).getSourceAnchor(); sourceAnchor.translatePixelsFromTop(offset.height()); final CursorAnchor targetAnchor = (CursorAnchor) ((PolylineConnection) connection).getTargetAnchor(); targetAnchor.translatePixelsFromTop(offset.height()); } } revalidate(); } }
Example #6
Source File: JConnection.java From JDeodorant with MIT License | 6 votes |
public PolylineConnection setRightRightAnchors(EntityFigure source, EntityFigure target){ RightAnchor sourceAnchor; RightAnchor targetAnchor; if (source.getRightAnchor() != null) sourceAnchor = source.getRightAnchor(); else{ sourceAnchor = new RightAnchor(source); source.setRightAnchor(sourceAnchor); } if(target.getRightAnchor() != null){ targetAnchor = target.getRightAnchor(); } else { targetAnchor = new RightAnchor(target); target.setRightAnchor(targetAnchor); } //RightAnchor sourceAnchor = new RightAnchor(source); //RightAnchor targetAnchor = new RightAnchor(target); this.setSourceAnchor(sourceAnchor); this.setTargetAnchor(targetAnchor); return this; }
Example #7
Source File: RelationEditPart.java From erflute with Apache License 2.0 | 6 votes |
@Override protected void refreshVisuals() { super.refreshVisuals(); final ERDiagram diagram = getDiagram(); if (diagram != null) { final Relationship relation = (Relationship) getModel(); final PolylineConnection connection = (PolylineConnection) getConnectionFigure(); final String notation = diagram.getDiagramContents().getSettings().getNotation(); final Decoration decoration = DecorationFactory.getDecoration(notation, relation.getParentCardinality(), relation.getChildCardinality()); connection.setSourceDecoration(decoration.getSourceDecoration()); connection.setTargetDecoration(decoration.getTargetDecoration()); targetLabel.setText(Format.null2blank(decoration.getTargetLabel())); } calculateAnchorLocation(); refreshBendpoints(); }
Example #8
Source File: JConnection.java From JDeodorant with MIT License | 6 votes |
public PolylineConnection setRightLeftAnchors(EntityFigure source, EntityFigure target){ RightAnchor sourceAnchor; LeftAnchor targetAnchor; if (source.getRightAnchor() != null) sourceAnchor = source.getRightAnchor(); else{ sourceAnchor = new RightAnchor(source); source.setRightAnchor(sourceAnchor); } if(target.getLeftAnchor() != null){ targetAnchor = target.getLeftAnchor(); } else { targetAnchor = new LeftAnchor(target); target.setLeftAnchor(targetAnchor); } this.setSourceAnchor(sourceAnchor); this.setTargetAnchor(targetAnchor); return this; }
Example #9
Source File: JConnection.java From JDeodorant with MIT License | 6 votes |
public PolylineConnection setLeftLeftAnchors(EntityFigure source, EntityFigure target){ LeftAnchor sourceAnchor; LeftAnchor targetAnchor; if (source.getLeftAnchor() != null) sourceAnchor = source.getLeftAnchor(); else{ sourceAnchor = new LeftAnchor(source); source.setLeftAnchor(sourceAnchor); } if(target.getLeftAnchor() != null){ targetAnchor = target.getLeftAnchor(); } else { targetAnchor = new LeftAnchor(target); target.setLeftAnchor(targetAnchor); } //LeftAnchor sourceAnchor = new LeftAnchor(source); //LeftAnchor targetAnchor = new LeftAnchor(target); this.setSourceAnchor(sourceAnchor); this.setTargetAnchor(targetAnchor); return this; }
Example #10
Source File: JConnection.java From JDeodorant with MIT License | 6 votes |
public PolylineConnection setLeftRightAnchors(EntityFigure source, EntityFigure target){ LeftAnchor sourceAnchor; RightAnchor targetAnchor; if (source.getLeftAnchor() != null) sourceAnchor = source.getLeftAnchor(); else{ sourceAnchor = new LeftAnchor(source); source.setLeftAnchor(sourceAnchor); } if(target.getRightAnchor() != null){ targetAnchor = target.getRightAnchor(); } else { targetAnchor = new RightAnchor(target); target.setRightAnchor(targetAnchor); } //LeftAnchor sourceAnchor = new LeftAnchor(source); //RightAnchor targetAnchor = new RightAnchor(target); this.setSourceAnchor(sourceAnchor); this.setTargetAnchor(targetAnchor); return this; }
Example #11
Source File: LinkPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public void setSelected(int value) { if (!getFigure().isVisible()) return; PolylineConnection figure = (PolylineConnection) getFigure(); if (value != EditPart.SELECTED_NONE) { figure.setLineWidth(2); figure.setForegroundColor(Link.HIGHLIGHT_COLOR); } else { figure.setLineWidth(1); figure.setForegroundColor(Link.COLOR); } super.setSelected(value); }
Example #12
Source File: JConnection.java From JDeodorant with MIT License | 5 votes |
public PolylineConnection setFullBendRouter(int bendHeightX){ float weight = 0.3f; int bendHeightY = 50; int secondBendHeight = -(bendHeightX+(bendHeightX/3)); /*int gap =10; if(classWidth<0) gap = -gap-25; */ BendpointConnectionRouter router = new BendpointConnectionRouter(); RelativeBendpoint bp2 = new RelativeBendpoint(this); bp2.setRelativeDimensions(new Dimension(secondBendHeight,0), new Dimension(0,0)); bp2.setWeight(weight); RelativeBendpoint bp3 = new RelativeBendpoint(this); bp3.setRelativeDimensions(new Dimension(-bendHeightX,bendHeightY), new Dimension(-bendHeightX,-bendHeightY)); //bp1.setWeight(weight); RelativeBendpoint bp4 = new RelativeBendpoint(this); bp4.setRelativeDimensions(new Dimension(0,0), new Dimension(secondBendHeight,0)); bp4.setWeight(1 - weight); /*RelativeBendpoint bp5 = new RelativeBendpoint(this); bp5.setRelativeDimensions(new Dimension(0,0), new Dimension(-((classWidth/2)+gap),0)); bp5.setWeight(1);*/ router.setConstraint(this, Arrays.asList(new Bendpoint[] {bp2, bp3, bp4})); this.setConnectionRouter(router); return this; }
Example #13
Source File: BPMNShapeFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") public BPMNEdge createBPMNEdge(final String bpmnFlowId, EObject bonitaElement) { Edge bonitaEdge = modelExporter.getElementNotationEdge(bonitaElement); if (bonitaEdge != null) { final BPMNEdge edge = DiFactory.eINSTANCE.createBPMNEdge(); edge.setBpmnElement(QName.valueOf(bpmnFlowId)); edge.setId(modelExporter.getEObjectID(bonitaEdge)); PolylineConnection conn = createConnectorFigure(bonitaEdge); PointList points = conn.getPoints(); for (int i = 0; i < points.size(); i++) { final org.omg.spec.dd.dc.Point sourcePoint = DcFactory.eINSTANCE.createPoint(); Point point = points.getPoint(i); sourcePoint.setX(point.x); sourcePoint.setY(point.y); edge.getWaypoint().add(sourcePoint); } if (bonitaElement instanceof SequenceFlow) { bonitaEdge.getPersistedChildren().stream() .filter(DecorationNode.class::isInstance) .findFirst() .ifPresent(decorationNode -> attachEdgeLabel((DecorationNode) decorationNode, edge, ((SequenceFlow) bonitaElement).getName(), bonitaEdge)); } return edge; } return null; }
Example #14
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; }
Example #15
Source File: LinkPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected IFigure createFigure() { PolylineConnection figure = new PolylineConnection(); figure.setForegroundColor(Link.COLOR); figure.setConnectionRouter(getConnectionRouter()); figure.setTargetDecoration(new PolygonDecoration()); figure.setVisible(isVisible()); getModel().figure = figure; return figure; }
Example #16
Source File: JConnection.java From JDeodorant with MIT License | 5 votes |
public PolylineConnection setMethodToMethodStyle(){ PolygonDecoration decoration = new PolygonDecoration(); decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP); decoration.setBackgroundColor(DecorationConstants.methodToMethodColor); this.setTargetDecoration(decoration); this.setForegroundColor(DecorationConstants.methodToMethodColor); return this; }
Example #17
Source File: ProcessLinkCreatePolicy.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected Connection createDummyConnection(Request req) { PolylineConnection con = (PolylineConnection) super.createDummyConnection(req); con.setForegroundColor(Link.COLOR); if (!(req instanceof CreateConnectionRequest)) { con.setTargetDecoration(new PolygonDecoration()); return con; } CreateLinkCommand cmd = (CreateLinkCommand) ((CreateConnectionRequest) req).getStartCommand(); if (cmd.output != null) con.setTargetDecoration(new PolygonDecoration()); else if (cmd.input != null) con.setSourceDecoration(new PolygonDecoration()); return con; }
Example #18
Source File: LinkPart.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public void setSelected(int value) { PolylineConnection figure = (PolylineConnection) getFigure(); Link link = ((Link) getModel()); if (value != EditPart.SELECTED_NONE) { figure.setForegroundColor(Link.HIGHLIGHT_COLOR); } else { figure.setForegroundColor(link.getColor()); } super.setSelected(value); }
Example #19
Source File: CommentConnectionEditPart.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected IFigure createFigure() { boolean bezier = this.getDiagram().getDiagramContents().getSettings() .isUseBezierCurve(); PolylineConnection connection = new ERDiagramConnection(bezier); connection.setConnectionRouter(new BendpointConnectionRouter()); connection.setLineStyle(SWT.LINE_DASH); return connection; }
Example #20
Source File: RelationEditPart.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected IFigure createFigure() { boolean bezier = this.getDiagram().getDiagramContents().getSettings() .isUseBezierCurve(); PolylineConnection connection = new ERDiagramConnection(bezier); connection.setConnectionRouter(new BendpointConnectionRouter()); ConnectionEndpointLocator targetLocator = new ConnectionEndpointLocator( connection, true); this.targetLabel = new Label(""); connection.add(targetLabel, targetLocator); return connection; }
Example #21
Source File: RelationEditPart.java From ermaster-b with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void refreshVisuals() { super.refreshVisuals(); ERDiagram diagram = this.getDiagram(); if (diagram != null) { Relation relation = (Relation) this.getModel(); PolylineConnection connection = (PolylineConnection) this .getConnectionFigure(); String notation = diagram.getDiagramContents().getSettings() .getNotation(); Decoration decoration = DecorationFactory.getDecoration(notation, relation.getParentCardinality(), relation .getChildCardinality()); connection.setSourceDecoration(decoration.getSourceDecoration()); connection.setTargetDecoration(decoration.getTargetDecoration()); targetLabel.setText(Format.null2blank(decoration.getTargetLabel())); } this.calculateAnchorLocation(); this.refreshBendpoints(); }
Example #22
Source File: JConnection.java From JDeodorant with MIT License | 5 votes |
public PolylineConnection setSlightBendRouter(){ BendpointConnectionRouter router = new BendpointConnectionRouter(); RelativeBendpoint bp1 = new RelativeBendpoint(this); bp1.setRelativeDimensions(new Dimension(20,20), new Dimension(20, 20)); bp1.setWeight(0.5f); router.setConstraint(this, Arrays.asList(new Bendpoint[] {bp1})); this.setConnectionRouter(router); return this; }
Example #23
Source File: JConnection.java From JDeodorant with MIT License | 5 votes |
public PolylineConnection setReadStyle(){ PolygonDecoration decoration = new PolygonDecoration(); decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP); decoration.setBackgroundColor(ColorConstants.black); this.setTargetDecoration(decoration); this.setForegroundColor(ColorConstants.darkBlue); return this; }
Example #24
Source File: JConnection.java From JDeodorant with MIT License | 5 votes |
public PolylineConnection setWriteStyle(){ isWrite = true; PolygonDecoration decoration = new PolygonDecoration(); decoration.setTemplate(PolygonDecoration.TRIANGLE_TIP); decoration.setBackgroundColor(ColorConstants.red); this.setTargetDecoration(decoration); this.setForegroundColor(ColorConstants.red); return this; }
Example #25
Source File: RelationEditPart.java From erflute with Apache License 2.0 | 5 votes |
@Override protected IFigure createFigure() { final boolean bezier = getDiagram().getDiagramContents().getSettings().isUseBezierCurve(); final PolylineConnection connection = new ERDiagramConnection(bezier); connection.setConnectionRouter(new BendpointConnectionRouter()); final ConnectionEndpointLocator targetLocator = new ConnectionEndpointLocator(connection, true); this.targetLabel = new Label(""); connection.add(targetLabel, targetLocator); return connection; }
Example #26
Source File: CommentConnectionEditPart.java From erflute with Apache License 2.0 | 5 votes |
@Override protected IFigure createFigure() { final boolean bezier = getDiagram().getDiagramContents().getSettings().isUseBezierCurve(); final PolylineConnection connection = new ERDiagramConnection(bezier); connection.setConnectionRouter(new BendpointConnectionRouter()); connection.setLineStyle(SWT.LINE_DASH); return connection; }
Example #27
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 #28
Source File: ManualOverride.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * Set graphics attribute according to the connection state * * @param connection * the connection to change * @param state * the state */ protected void setConnectionState ( final PolylineConnection connection, final boolean state ) { final PolygonDecoration dec = new PolygonDecoration (); dec.setTemplate ( PolygonDecoration.TRIANGLE_TIP ); connection.setLineStyle ( state ? Graphics.LINE_SOLID : Graphics.LINE_DOT ); connection.setLineWidth ( state ? 2 : 1 ); connection.setTargetDecoration ( state ? dec : null ); }
Example #29
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 #30
Source File: GenericLevelPresets.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void createConnection ( final Figure connLayer, final Label label, final Figure figure ) { final Connection c = new PolylineConnection (); c.setSourceAnchor ( new ChopboxAnchor ( label ) ); c.setTargetAnchor ( new ChopboxAnchor ( figure ) ); c.setConnectionRouter ( new BendpointConnectionRouter () ); connLayer.add ( c ); }