Package org.eclipse.graphiti.mm.pictograms

Examples of org.eclipse.graphiti.mm.pictograms.ConnectionDecorator


        connection.setEnd(addConContext.getTargetAnchor());

        IGaService gaService = Graphiti.getGaService();
        Polyline polyline = gaService.createPolyline(connection);
        polyline.setStyle(StyleUtil.getStyleForConn(getDiagram()));
        ConnectionDecorator cd = peCreateService.createConnectionDecorator(
            connection, false, 1.0, true);

        createArrow(cd);

        // create link and wire it
View Full Code Here


    // create link and wire it
    link(connection, addedEReference);

    // add dynamic text decorator for the reference name
    ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.5, true);
    Text text = gaService.createDefaultText(getDiagram(), getDiagram().getGraphicsAlgorithm());
    textDecorator.setConnection(connection);
    text.setStyle(StyleUtil.getStyleForCamelText((getDiagram())));
    gaService.setLocation(text, 10, 0);
    // set reference name in the text decorator
    Flow flow = (Flow) context.getNewObject();
    text.setValue(flow.getName());
   
    // add static graphical decorators (composition and navigable)
    ConnectionDecorator cd;
    cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);
    createArrow(cd);
   
    return connection;
  }
View Full Code Here

      connection.setStart(anchors.getFirst());
      connection.setEnd(anchors.getSecond());
    }
   
    if (ModelUtil.hasName(element)) {
      ConnectionDecorator labelDecorator = Graphiti.getPeService().createConnectionDecorator(connection, true, 0.5, true);
      Text text = gaService.createText(labelDecorator, ModelUtil.getName(element));
      peService.setPropertyValue(labelDecorator, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
      text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    }
   
View Full Code Here

      @Override
      protected void createConnectionDecorators(Connection connection) {
        int w = 3;
        int l = 8;
       
        ConnectionDecorator decorator = Graphiti.getPeService().createConnectionDecorator(connection, false,
            1.0, true);

        IGaService gaService = Graphiti.getGaService();
        Polyline arrow = gaService.createPolygon(decorator, new int[] { -l, w, 0, 0, -l, -w, -l, w });
View Full Code Here

    SequenceFlow flow = BusinessObjectUtil.getFirstElementOfType(connection, SequenceFlow.class);
    SequenceFlow defaultFlow = getDefaultFlow(flow.getSourceRef());
    boolean isDefault = defaultFlow == null ? false : defaultFlow.equals(flow);

    Tuple<ConnectionDecorator, ConnectionDecorator> decorators = getConnectionDecorators(connection);
    ConnectionDecorator def = decorators.getFirst();
    ConnectionDecorator cond = decorators.getSecond();

    if (isDefault) {
      if (cond != null) {
        peService.deletePictogramElement(cond);
      }
      def = createDefaultConnectionDecorator(connection);
      GraphicsAlgorithm ga = def.getGraphicsAlgorithm();
      ga.setForeground(manageColor(connection,StyleUtil.CLASS_FOREGROUND));
    } else {
      if (def != null) {
        peService.deletePictogramElement(def);
      }
      if (flow.getConditionExpression() != null && flow.getSourceRef() instanceof Activity) {
        cond = createConditionalConnectionDecorator(connection);
        GraphicsAlgorithm ga = cond.getGraphicsAlgorithm();
        ga.setFilled(true);
        ga.setForeground(manageColor(connection,StyleUtil.CLASS_FOREGROUND));
        ga.setBackground(manageColor(connection,IColorConstant.WHITE));
      }
    }
View Full Code Here

  private static void setConditionalSequenceFlow(Connection connection) {
    IPeService peService = Graphiti.getPeService();
    SequenceFlow flow = BusinessObjectUtil.getFirstElementOfType(connection, SequenceFlow.class);

    Tuple<ConnectionDecorator, ConnectionDecorator> decorators = getConnectionDecorators(connection);
    ConnectionDecorator def = decorators.getFirst();
    ConnectionDecorator cond = decorators.getSecond();

    if (flow.getConditionExpression() != null && flow.getSourceRef() instanceof Activity && def == null) {
      ConnectionDecorator decorator = createConditionalConnectionDecorator(connection);
      GraphicsAlgorithm ga = decorator.getGraphicsAlgorithm();
      ga.setFilled(true);
      ga.setForeground(manageColor(connection, StyleUtil.CLASS_FOREGROUND));
      ga.setBackground(manageColor(connection, IColorConstant.WHITE));
    } else if (cond != null) {
      peService.deletePictogramElement(cond);
View Full Code Here

  }

  private static Tuple<ConnectionDecorator, ConnectionDecorator> getConnectionDecorators(Connection connection) {
    IPeService peService = Graphiti.getPeService();

    ConnectionDecorator defaultDecorator = null;
    ConnectionDecorator conditionalDecorator = null;

    Iterator<ConnectionDecorator> iterator = connection.getConnectionDecorators().iterator();
    while (iterator.hasNext()) {
      ConnectionDecorator connectionDecorator = iterator.next();
      String defProp = peService.getPropertyValue(connectionDecorator, DEFAULT_MARKER_PROPERTY);
      if (defProp != null && new Boolean(defProp)) {
        defaultDecorator = connectionDecorator;
        continue;
      }
View Full Code Here

    return new Tuple<ConnectionDecorator, ConnectionDecorator>(defaultDecorator, conditionalDecorator);
  }

  private static ConnectionDecorator createDefaultConnectionDecorator(Connection connection) {
    ConnectionDecorator marker = Graphiti.getPeService().createConnectionDecorator(connection, false, 0.0, true);
    Graphiti.getGaService().createPolyline(marker, new int[] { -5, 5, -10, -5 });
    Graphiti.getPeService().setPropertyValue(marker, DEFAULT_MARKER_PROPERTY, Boolean.toString(true));
    return marker;
  }
View Full Code Here

    Graphiti.getPeService().setPropertyValue(marker, DEFAULT_MARKER_PROPERTY, Boolean.toString(true));
    return marker;
  }

  private static ConnectionDecorator createConditionalConnectionDecorator(Connection connection) {
    ConnectionDecorator marker = Graphiti.getPeService().createConnectionDecorator(connection, false, 0.0, true);
    Graphiti.getGaService().createPolygon(marker, new int[] { -15, 0, -7, 5, 0, 0, -7, -5 });
    Graphiti.getPeService().setPropertyValue(marker, CONDITIONAL_MARKER_PROPERTY, Boolean.toString(true));
    return marker;
  }
View Full Code Here

      @Override
      protected void createConnectionDecorators(Connection connection) {
        IPeService peService = Graphiti.getPeService();
        IGaService gaService = Graphiti.getGaService();

        ConnectionDecorator endDecorator = peService.createConnectionDecorator(connection, false, 1.0, true);

        int w = 5;
        int l = 10;

        Polyline polyline = gaService.createPolyline(endDecorator, new int[] { -l, w, 0, 0, -l, -w });
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.pictograms.ConnectionDecorator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.