Examples of IPeService


Examples of org.eclipse.graphiti.services.IPeService

    return handler.getParticipant(bo);
  }

  public static Shape getShape(ContainerShape container, String property, String expectedValue) {
    IPeService peService = Graphiti.getPeService();
    Iterator<Shape> iterator = peService.getAllContainedShapes(container).iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      String value = peService.getPropertyValue(shape, property);
      if (value != null && value.equals(expectedValue)) {
        return shape;
      }
    }
    return null;
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    return null;
  }

  @SuppressWarnings("unchecked")
  public static <T extends EObject> T getChildElementOfType(PictogramElement container, String property, String expectedValue, Class<T> clazz) {
    IPeService peService = Graphiti.getPeService();
    Iterator<PictogramElement> iterator = peService.getAllContainedPictogramElements(container).iterator();
    while (iterator.hasNext()) {
      PictogramElement pe = iterator.next();
      String value = peService.getPropertyValue(pe, property);
      if (value != null && value.equals(expectedValue) && clazz.isInstance(pe)) {
        return (T) pe;
      }
    }
    return null;
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    public ILocation location;
  }

  public static FixPointAnchor createAnchor(Shape s, AnchorLocation loc, int x, int y) {
    IGaService gaService = Graphiti.getGaService();
    IPeService peService = Graphiti.getPeService();

    FixPointAnchor anchor = peService.createFixPointAnchor(s);
    peService.setPropertyValue(anchor, BOUNDARY_FIXPOINT_ANCHOR, loc.getKey());
    anchor.setLocation(gaService.createPoint(x, y));
    gaService.createInvisibleRectangle(anchor);

    return anchor;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

        && getBoClass().isAssignableFrom(context.getNewObject().getClass());
  }

  @Override
  public PictogramElement add(IAddContext context) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    BaseElement element = (BaseElement) context.getNewObject();
    IAddConnectionContext addConContext = (IAddConnectionContext) context;

    Connection connection = peService.createFreeFormConnection(getDiagram());

    Object importProp = context.getProperty(DIImport.IMPORT_PROPERTY);
    if (importProp != null && (Boolean) importProp) {
      connection.setStart(addConContext.getSourceAnchor());
      connection.setEnd(addConContext.getTargetAnchor());
    } else {
      ContainerShape sourceContainer = (ContainerShape) addConContext.getSourceAnchor().eContainer();
      ContainerShape targetContainer = (ContainerShape) addConContext.getTargetAnchor().eContainer();
      Tuple<FixPointAnchor, FixPointAnchor> anchors = AnchorUtil.getSourceAndTargetBoundaryAnchors(
          sourceContainer, targetContainer, connection);

      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()));
    }
   
    Polyline connectionLine = gaService.createPolyline(connection);
    connectionLine.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    }
    return false;
  }

  public static boolean canMoveTo(IMoveShapeContext context, Diagram diagram) {
    IPeService peService = Graphiti.getPeService();

    int x = context.getX();
    int y = context.getY();

    if (!(context.getTargetContainer() instanceof Diagram)) {
      ILocation loc = peService.getLocationRelativeToDiagram(context.getTargetContainer());
      x += loc.getX();
      y += loc.getY();
    }

    BoundaryEvent event = BusinessObjectUtil.getFirstElementOfType(context.getShape(), BoundaryEvent.class);
    GraphicsAlgorithm eventGa = context.getShape().getGraphicsAlgorithm();
    ContainerShape activityContainer = (ContainerShape) BusinessObjectUtil.getFirstBaseElementFromDiagram(diagram,
            event.getAttachedToRef());
    GraphicsAlgorithm activityGa = activityContainer.getGraphicsAlgorithm();
    ILocation activityLoc = peService.getLocationRelativeToDiagram(activityContainer);

    if (!(activityContainer.equals(context.getTargetContainer()) || activityContainer.eContainer().equals(
            context.getTargetContainer()))) {
      return false;
    }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

            (int) eventBounds.getHeight(), (int) activityBounds.getX(), (int) activityBounds.getY(),
            (int) activityBounds.getWidth(), (int) activityBounds.getHeight());
  }

  public static PositionOnLine getPositionOnLineUsingAbsoluteCoordinates(Shape eventShape, Shape activityShape) {
    IPeService peService = Graphiti.getPeService();
    GraphicsAlgorithm eventGa = eventShape.getGraphicsAlgorithm();
    ILocation eventLoc = peService.getLocationRelativeToDiagram(eventShape);
    GraphicsAlgorithm activityGa = activityShape.getGraphicsAlgorithm();
    ILocation activityLoc = peService.getLocationRelativeToDiagram(activityShape);

    return getPositionOnLine(eventLoc.getX(), eventLoc.getY(), eventGa.getWidth(), eventGa.getHeight(),
            activityLoc.getX(), activityLoc.getY(), activityGa.getWidth(), activityGa.getHeight());
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    return pos;
  }

  public static void assignPositionOnLineProperty(PropertyContainer propertyContainer, PositionOnLine pos) {
    IPeService peService = Graphiti.getPeService();
    peService.setPropertyValue(propertyContainer, BOUNDARY_EVENT_RELATIVE_POS, pos.toString());
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    IPeService peService = Graphiti.getPeService();
    peService.setPropertyValue(propertyContainer, BOUNDARY_EVENT_RELATIVE_POS, pos.toString());
  }

  public static PositionOnLine getPositionOnLineProperty(PropertyContainer propertyContainer) {
    IPeService peService = Graphiti.getPeService();
    String value = peService.getPropertyValue(propertyContainer, BOUNDARY_EVENT_RELATIVE_POS);
    return PositionOnLine.fromString(value);
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

      return FlowNode.class;
    }
  }

  private static Color manageColor(PictogramElement element, IColorConstant colorConstant) {
    IPeService peService = Graphiti.getPeService();
    Diagram diagram = peService.getDiagramForPictogramElement(element);
    return Graphiti.getGaService().manageColor(diagram, colorConstant);
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    Diagram diagram = peService.getDiagramForPictogramElement(element);
    return Graphiti.getGaService().manageColor(diagram, colorConstant);
  }
 
  private static void setDefaultSequenceFlow(Connection connection) {
    IPeService peService = Graphiti.getPeService();
    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));
      }
    }

    peService.setPropertyValue(connection, IS_DEFAULT_FLOW_PROPERTY,
        Boolean.toString(isDefault));

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.