@Override protected IFigure createFigure() { Link lnk = (Link) getModel(); String dis = ""; if (lnk.getSource() instanceof TriggerInstanceTerminalNode || lnk.getTarget() instanceof TriggerInstanceTerminalNode) dis = "Period : " + lnk.getPeriod(); LabeledConnection conn = new LabeledConnection(dis); PolygonDecoration decoration = new PolygonDecoration(); PointList decorationPointList = new PointList(); decorationPointList.addPoint(0, 0); decorationPointList.addPoint(-2, 2); decorationPointList.addPoint(-2, -2); decoration.setTemplate(decorationPointList); conn.setTargetDecoration(decoration); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); PolygonDecoration polygonDecoreation = new PolygonDecoration(); polygonDecoreation.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); polygonDecoreation.setScale(10, 5); connection.setTargetDecoration(polygonDecoreation); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
/** * This method creates and returns the figure for {@link Relation}s from type cyclic, total, acyclic, reflexive and * irreflexive, which differs from relationshipConstraint to relationshipConstraint only in the * text of the {@link Label}. A cyclic, total, acyclic, reflexive or irreflexive figure is dashed line with a * {@link Label}. * * @return conn org.eclipse.draw2d.PolylineConnection * */ private static Figure createRelationshipConstraintFigure(Relation relation, EditPart editpart) { ORMRelationshipConstraintEditPart editP = (ORMRelationshipConstraintEditPart) editpart; editP.getLabel().setText(relation.getName()); editP.setTextInitial(relation.getName()); PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); conn.setLineDash(new float[] {5.0f, 5.0f}); conn.setLineStyle(SWT.LINE_CUSTOM); conn.setConnectionRouter(new BendpointConnectionRouter()); // add label to the connection ConnectionLocator loc = new ConnectionLocator(conn, ConnectionLocator.MIDDLE); loc.setRelativePosition(PositionConstants.SOUTH); loc.setGap(5); // this is needed, because when the label would be just added the label text could be seen in // the rootModel if (editP.getRoot().getContents() instanceof ORMCompartmentEditPart) { conn.add(editP.getLabel(), loc); } return conn; }
/** * {@link Relation}s from type roleequivalence have as figure a dashed line with a white arrow * tips at both connection ends. * * @return conn org.eclipse.draw2d.PolylineConnection */ private static Figure createRoleEquivalenceFigure() { // create white arrow tip 1 PolygonDecoration poly1 = new PolygonDecoration(); poly1.setAntialias(SWT.ON); poly1.setBackgroundColor(ColorConstants.white); poly1.setScale(5, 5); // create white arrow tip 2 PolygonDecoration poly2 = new PolygonDecoration(); poly2.setAntialias(SWT.ON); poly2.setBackgroundColor(ColorConstants.white); poly2.setScale(5, 5); PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); conn.setLineDash(new float[] {5.0f, 5.0f}); conn.setLineStyle(SWT.LINE_CUSTOM); // add white arrow tip 1 conn.setTargetDecoration(poly1); // add white arrow tip 2 conn.setSourceDecoration(poly2); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
/** * {@link Relations}s from type roleimplication and relationshipimplication have as figure a * dashed line with a white arrow tip at target end of this connection. * * @return conn org.eclipse.draw2d.PolylineConnection */ private static Figure createRoleRelationshipImplicationFigure() { // create white arrow tip PolygonDecoration poly = new PolygonDecoration(); poly.setAntialias(SWT.ON); poly.setBackgroundColor(ColorConstants.white); poly.setScale(5, 5); PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); conn.setLineDash(new float[] {5.0f, 5.0f}); conn.setLineStyle(SWT.LINE_CUSTOM); conn.setTargetDecoration(poly); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
/** * * {@link Relations}s from type roleprohibition and relationshipexclusion have as figure a * dashed line with a white arrow tip at target end of this connection. * * @return conn org.eclipse.draw2d.PolylineConnection * */ private static Figure createRoleRelationshipExclusionFigure() { // create white arrow tip PolylineDecoration poly1 = new PolylineDecoration(); poly1.setTemplate(INVERTED_TRIANGLE_TIP); poly1.setAntialias(SWT.ON); poly1.setBackgroundColor(ColorConstants.black); poly1.setScale(5, 5); PolylineDecoration poly2 = new PolylineDecoration(); poly2.setTemplate(INVERTED_TRIANGLE_TIP); poly2.setAntialias(SWT.ON); poly2.setBackgroundColor(ColorConstants.black); poly2.setScale(5, 5); PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); conn.setLineDash(new float[] {5.0f, 5.0f}); conn.setLineStyle(SWT.LINE_CUSTOM); conn.setTargetDecoration(poly1); conn.setSourceDecoration(poly2); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
/** * {@link Relation}s from type roleprohibition have as figure a dased line with two inverted and * open arrow tips at both ends of this connection. * * @return conn org.eclipse.draw2d.PolylineConnection */ private static Figure createRoleProhibitonFigure() { PolylineDecoration poly1 = new PolylineDecoration(); poly1.setTemplate(INVERTED_TRIANGLE_TIP); poly1.setAntialias(SWT.ON); poly1.setBackgroundColor(ColorConstants.black); poly1.setScale(5, 5); PolylineDecoration poly2 = new PolylineDecoration(); poly2.setTemplate(INVERTED_TRIANGLE_TIP); poly2.setAntialias(SWT.ON); poly2.setBackgroundColor(ColorConstants.black); poly2.setScale(5, 5); PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); conn.setLineDash(new float[] {5.0f, 5.0f}); conn.setLineStyle(SWT.LINE_CUSTOM); conn.setTargetDecoration(poly1); conn.setSourceDecoration(poly2); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
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 ); }
@Override protected IFigure createFigure() { LabeledConnection conn = new LabeledConnection("rank : " + ((Link) getModel()).getRank()); conn.setConnectionRouter(new BendpointConnectionRouter()); PolygonDecoration decoration = new PolygonDecoration(); PointList decorationPointList = new PointList(); decorationPointList.addPoint(0, 0); decorationPointList.addPoint(-2, 2); decorationPointList.addPoint(-2, -2); decoration.setTemplate(decorationPointList); conn.setTargetDecoration(decoration); return conn; }
@Override protected IFigure createFigure() { final PolylineConnection connection = new PolylineConnection(); connection.setConnectionRouter(new BendpointConnectionRouter()); PolygonDecoration decoration = new PolygonDecoration(); decoration.setTemplate(new PointList(new int[]{0, 0, -2, 2, -2, 0, -2, -2, 0, 0})); RGB rgb=Activator.getPreference().getTransitionColor(); decoration.setBackgroundColor(new Color(null,rgb)); connection.setTargetDecoration(decoration); connection.setAntialias(SWT.ON); connection.setForegroundColor(new Color(null,rgb)); return connection; }
public ConnectionFigure() { super(); setForegroundColor(ColorConstants.lightBlue); setConnectionRouter(new BendpointConnectionRouter()); EmptyTriangleDecoration decoration = new EmptyTriangleDecoration(); decoration.setLineWidth(1); setLineStyle(SWT.LINE_SOLID); setTargetDecoration(decoration); targetEndpointLocator.setVDistance(12); sourceEndpointLocator.setVDistance(12); }
protected ERDiagramConnection createERDiagramConnection() { final boolean bezier = getDiagram().getDiagramContents().getSettings().isUseBezierCurve(); final ERDiagramConnection connection = new ERDiagramConnection(bezier); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
protected ERDiagramConnection createERDiagramConnection() { boolean bezier = this.getDiagram().getDiagramContents().getSettings() .isUseBezierCurve(); ERDiagramConnection connection = new ERDiagramConnection(bezier); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { Relation relation = (Relation) getModel(); PolylineConnection connection = (PolylineConnection) super.createFigure(); connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); if (RelationType.SYNCHRONOUS_MESSAGE.equals(relation.getRelationType())) { return connection; } else if (RelationType.ASYNCHRONOUS_MESSAGE.equals(relation.getRelationType())) { PolylineDecoration poly = new PolylineDecoration(); PointList p = new PointList(); p.addPoint(0, 0); p.addPoint(-1, -1); p.addPoint(-1, 1); poly.setPoints(p); poly.setScale(10, 5); connection.setTargetDecoration(poly); connection.setLineStyle(Graphics.LINE_SOLID); return connection; } else if (RelationType.REPLY_MESSAGE.equals(relation.getRelationType())) { connection.setLineStyle(Graphics.LINE_DOT); return connection; } else if (RelationType.CREATE_MESSAGE.equals(relation.getRelationType())) { return connection; } else if (RelationType.DESTROY_MESSAGE.equals(relation.getRelationType())) { return connection; } else { return connection; } }
/** * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#createFigure() */ protected IFigure createFigure() { PolylineConnection conn = new PolylineConnection(); conn.setConnectionRouter(new BendpointConnectionRouter()); conn.setVisible(false); return conn; }
@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; }
@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; }
/** * {@link Relation}s from type relationship have as figure a drawn through line with two * {@link Label}s at both ends and Label in the middle for it's name. The {@link Label} are added * through child model elements( {@link NamedElements}). * * @return conn org.eclipse.draw2d.PolylineConnection */ private static Figure createRelationshipFigure(ORMRelationshipEditPart editPart) { //PolylineConnection connection = new PolylineConnection(); ORMConnectionMultiplePolyline connection = new ORMConnectionMultiplePolyline(); connection.setHasConstraint(true); connection.setConnectionRouter(new BendpointConnectionRouter()); // add label to the connection ConnectionLocator locNameLabel = new ConnectionLocator(connection, ConnectionLocator.MIDDLE); locNameLabel.setRelativePosition(PositionConstants.NORTH); locNameLabel.setGap(5); ConnectionLocator locConstraintLabel = new ConnectionLocator(connection, ConnectionLocator.MIDDLE); locConstraintLabel.setRelativePosition(PositionConstants.SOUTH); locConstraintLabel.setGap(5); // this is needed, because when the label would be just added the label text could be seen in // the rootModel if (editPart.getRoot().getContents() instanceof ORMCompartmentEditPart) { editPart.getNameLabel().setText(editPart.getRelationship().getName()); connection.add(editPart.getNameLabel(), locNameLabel); editPart.getConstraintLabel().setText(editPart.getRelationship().getName()); connection.add(editPart.getConstraintLabel(), locConstraintLabel); } return connection; }
/** * {@link Relation}s from type inheritance have as figure a drawn through line with a white arrow * tip at target end of this connection. * * @return conn org.eclipse.draw2d.PolylineConnection */ private static Figure createInheritanceFigure() { PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); // create white arrow tip PolygonDecoration poly = new PolygonDecoration(); poly.setAntialias(SWT.ON); poly.setBackgroundColor(ColorConstants.white); poly.setScale(5, 5); // add white arrow tip conn.setTargetDecoration(poly); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
protected IFigure createFigure() { PolylineConnection conn = new PolylineConnection(); conn.setTargetDecoration(new PolygonDecoration()); conn.setConnectionRouter(new BendpointConnectionRouter()); final Label label = new Label("Conn"); label.setOpaque(true); conn.add(label, new MidpointLocator(conn, 0)); return conn; }
/** * (non-Javadoc) * * @see org.eclipse.gef.editparts.AbstractEditPart#registerVisuals() */ protected void registerVisuals() { ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER); cLayer.setConnectionRouter(new BendpointConnectionRouter()); super.registerVisuals(); }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } }); // PolygonDecoration polygonDecoreation = new PolygonDecoration(); // polygonDecoreation.setScale(10,5); // connection.setTargetDecoration(polygonDecoreation); // connection.setLineStyle(SWT.LINE_DOT); // connection.addRoutingListener(RoutingAnimator.getDefault()); // connection.setConnectionRouter(new BendpointConnectionRouter()); connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); PolygonDecoration polygonDecoreation = new PolygonDecoration(); polygonDecoreation.setBackgroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); polygonDecoreation.setScale(10, 5); connection.setLineStyle(SWT.LINE_DOT); connection.setTargetDecoration(polygonDecoreation); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.setLineStyle(Graphics.LINE_DOT); ArrowDecoration arrow = new ArrowDecoration(); connection.setTargetDecoration(arrow); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } }); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); PolygonDecoration polygonDecoreation = new PolygonDecoration(); connection.setTargetDecoration(polygonDecoreation); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } }); return connection; }
/** * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractDiagramConnectionEditPart#createFigure() */ @Override protected IFigure createFigure() { PolylineConnection connection = new PolylineConnection() { @Override public void paintFigure(Graphics graphics) { graphics.setAntialias(SWT.ON); super.paintFigure(graphics); } }; connection.addFigureListener(new FigureListener() { /** * @see org.eclipse.draw2d.FigureListener#figureMoved(org.eclipse.draw2d.IFigure) */ @SuppressWarnings("unchecked") public void figureMoved(IFigure source) { Point sourcePoint = ((PolylineConnection) source).getStart(); Point targetPoint = ((PolylineConnection) source).getEnd(); RootEditPart rootEditPart = (RootEditPart) getParent(); List<EditPart> diagramEditparts = new ArrayList<EditPart>(); diagramEditparts = rootEditPart.getChildren(); List<EditPart> editParts = new ArrayList<EditPart>(); for (EditPart diagramEditPart : diagramEditparts) { editParts = diagramEditPart.getChildren(); for (EditPart editpart : editParts) { if (editpart.getModel() instanceof LabelNode) { if (((LabelNode) editpart.getModel()).getOwner() == getModel()) { if (editpart instanceof LabelNodeEditPart) { ((LabelNodeEditPart) editpart).setConnectionAnchorPoints(sourcePoint, targetPoint); } } } } } } }); connection.setTargetDecoration(new ArrowDecoration()); connection.setLineStyle(Graphics.LINE_DOT); connection.addRoutingListener(RoutingAnimator.getDefault()); connection.setConnectionRouter(new BendpointConnectionRouter()); return connection; }
/** * @see org.eclipse.gef.editparts.AbstractConnectionEditPart#createFigure() */ protected IFigure createFigure() { PolylineConnection conn = (PolylineConnection) super.createFigure(); conn.setConnectionRouter(new BendpointConnectionRouter()); return conn; }
/** * {@link Relation}s from type fulfillment have as figure a drawn through line with a * {@link Label} at the connection end that contains the names of the {@link Shape}s from type * roletype and rolegroup that are fulfilled from the source of this fulfillment and a black arrow * tip at the target end of the connection. * * @return conn org.eclipse.draw2d.PolylineConnection */ private static Figure createFulfillmentFigure(Relation relation, EditPart editPart) { PartFigure tooltipTarget = new PartFigure(); PolylineConnection conn = new PolylineConnection(); conn.setAntialias(SWT.ON); // create the black arrow tip PolygonDecoration poly = new PolygonDecoration(); poly.setAntialias(SWT.ON); poly.setBackgroundColor(ColorConstants.black); poly.setScale(5, 5); // add the the black arrow tip conn.setTargetDecoration(poly); conn.setConnectionRouter(new BendpointConnectionRouter()); // add target Label ConnectionEndpointLocator targetEndL = new ConnectionEndpointLocator(conn, true); targetEndL.setVDistance(-1); targetEndL.setUDistance(1); // add to the targetLabel the initial roletype and the rolegroup names in the fulfilledrole list Label label = new Label("<...>"); int roleCount = 0; for (Shape role : relation.getReferencedRoles()) { if (label.getText().equals("<...>")) { label.setText(role.getName()); } else { if (roleCount > 2) { tooltipTarget.add(new Label(role.getName())); } else { label.setText(label.getText() + ", " + role.getName()); } } roleCount++; } label.setToolTip(tooltipTarget); conn.add(label, targetEndL); if (editPart instanceof ORMFulfillmentEditPart) { ((ORMFulfillmentEditPart) editPart).setTargetLabel(label); ((ORMFulfillmentEditPart) editPart).setTargetToolTip(tooltipTarget); } return conn; }