Examples of IPeService


Examples of org.eclipse.graphiti.services.IPeService

      }
    }
    if (!(context.getPictogramElement() instanceof ContainerShape)) {
      return Reason.createFalseReason();
    }
    IPeService peService = Graphiti.getPeService();
    Participant participant = (Participant) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
        Participant.class);
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();

    boolean multiplicityProperty = new Boolean(peService.getPropertyValue(containerShape,
        AddParticipantFeature.MULTIPLICITY));
    boolean hasMultiplicity = participant.getParticipantMultiplicity() != null;

    return multiplicityProperty != hasMultiplicity ? Reason.createTrueReason() : Reason.createFalseReason();
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    return multiplicityProperty != hasMultiplicity ? Reason.createTrueReason() : Reason.createFalseReason();
  }

  @Override
  public boolean update(IUpdateContext context) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    Participant participant = (Participant) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
        Participant.class);
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();

    if (participant.getParticipantMultiplicity() != null) {
      Shape shape = peService.createShape(containerShape, false);
      peService.setPropertyValue(shape, MULTIPLICITY_MARKER, Boolean.toString(true));
      Rectangle invisibleRectangle = gaService.createInvisibleRectangle(shape);
      GraphicsAlgorithm parentGa = containerShape.getGraphicsAlgorithm();
      int x = (parentGa.getWidth() / 2) - 10;
      int y = parentGa.getHeight() - 20;
      gaService.setLocationAndSize(invisibleRectangle, x, y, 20, 20);

      Polyline line1 = gaService.createPolyline(invisibleRectangle, new int[] { 0, 0, 0, 20 });
      line1.setLineWidth(2);
      line1.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
      Polyline line2 = gaService.createPolyline(invisibleRectangle, new int[] { 9, 0, 9, 20 });
      line2.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
      line2.setLineWidth(2);
      Polyline line3 = gaService.createPolyline(invisibleRectangle, new int[] { 18, 0, 18, 20 });
      line3.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
      line3.setLineWidth(2);
    } else {
      Shape shape = FeatureSupport.getShape(containerShape, MULTIPLICITY_MARKER, Boolean.toString(true));
      if (shape != null) {
        peService.deletePictogramElement(shape);
      }
    }

    peService.setPropertyValue(containerShape, AddParticipantFeature.MULTIPLICITY,
        participant.getParticipantMultiplicity() != null ? Boolean.toString(true) : Boolean.toString(false));
    return true;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

      }

      @Override
      public PictogramElement add(IAddContext context) {
        PictogramElement element = super.add(context);
        IPeService service = Graphiti.getPeService();
        service.setPropertyValue(element, INSTANTIATE_PROPERTY, "false");
        service.setPropertyValue(element, EVENT_GATEWAY_TYPE_PROPERTY,
            EventBasedGatewayType.EXCLUSIVE.getName());
        return element;
      }
    };
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

      }

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

        int width = 50;
        int height = 50;
        int textArea = 15;

        ContainerShape container = peService.createContainerShape(context.getTargetContainer(), true);
        Rectangle invisibleRect = gaService.createInvisibleRectangle(container);
        gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), width, height + textArea);

        int whalf = width / 2;

        int[] xy = { 0, 10, whalf, 20, width, 10, width, height - 10, whalf, height, 0, height - 10 };
        int[] bend = { 0, 0, whalf, whalf, 0, 0, 0, 0, whalf, whalf, 0, 0 };
        Polygon polygon = gaService.createPolygon(invisibleRect, xy, bend);
        polygon.setFilled(true);
        // polygon.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

        StyleUtil.applyBGStyle(polygon, this);

        xy = new int[] { 0, 14, whalf, 24, width, 14 };
        bend = new int[] { 0, 0, whalf, whalf, 0, 0 };
        Polyline line1 = gaService.createPolyline(invisibleRect, xy, bend);
        line1.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

        xy = new int[] { 0, 18, whalf, 28, width, 18 };
        Polyline line2 = gaService.createPolyline(invisibleRect, xy, bend);
        line2.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

        xy = new int[] { 0, 11, whalf, 0, width, 11 };
        Polyline lineTop = gaService.createPolyline(invisibleRect, xy, bend);
        lineTop.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

        Shape textShape = peService.createShape(container, false);
        peService
            .setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
        Text text = gaService.createDefaultText(getDiagram(), textShape, store.getName());
        text.setStyle(StyleUtil.getStyleForText(getDiagram()));
        text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
        text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
        gaService.setLocationAndSize(text, 0, height, width, textArea);

        peService.createChopboxAnchor(container);
        AnchorUtil.addFixedPointAnchors(container, invisibleRect);
        createDIShape(container, store);
        layoutPictogramElement(container);
        return container;
      }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

  @Override
  protected void hook(Activity activity, ContainerShape container, IAddContext context, int width, int height) {
    super.hook(activity, container, context, width, height);
    Graphiti.getPeService().setPropertyValue(container, TRIGGERED_BY_EVENT, "false");

    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();

    Shape textShape = peService.createShape(container, false);
    Text text = gaService.createDefaultText(getDiagram(), textShape, activity.getName());
    gaService.setLocationAndSize(text, 5, 5, width - 10, 15);
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

      return o != null && o instanceof BaseElement && canApplyTo(o);
    }

    @Override
    public IReason updateNeeded(IUpdateContext context) {
      IPeService peService = Graphiti.getPeService();
      ContainerShape container = (ContainerShape) context.getPictogramElement();
      DataObject data = (DataObject) getBusinessObjectForPictogramElement(container);
      boolean isCollection = Boolean.parseBoolean(peService.getPropertyValue(container,
          Properties.COLLECTION_PROPERTY));
      return data.isIsCollection() != isCollection ? Reason.createTrueReason() : Reason.createFalseReason();
    }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

      return data.isIsCollection() != isCollection ? Reason.createTrueReason() : Reason.createFalseReason();
    }

    @Override
    public boolean update(IUpdateContext context) {
      IPeService peService = Graphiti.getPeService();
      ContainerShape container = (ContainerShape) context.getPictogramElement();
      DataObject data = (DataObject) getBusinessObjectForPictogramElement(container);

      boolean drawCollectionMarker = data.isIsCollection();

      Iterator<Shape> iterator = peService.getAllContainedShapes(container).iterator();
      while (iterator.hasNext()) {
        Shape shape = iterator.next();
        String prop = peService.getPropertyValue(shape, Properties.HIDEABLE_PROPERTY);
        if (prop != null && new Boolean(prop)) {
          Polyline line = (Polyline) shape.getGraphicsAlgorithm();
          line.setLineVisible(drawCollectionMarker);
        }
      }

      peService.setPropertyValue(container, Properties.COLLECTION_PROPERTY,
          Boolean.toString(data.isIsCollection()));
      return true;
    }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    return o != null && o instanceof EventBasedGateway;
  }

  @Override
  public IReason updateNeeded(IUpdateContext context) {
    IPeService service = Graphiti.getPeService();

    boolean instantiate = Boolean.parseBoolean(service.getPropertyValue(context.getPictogramElement(),
            EventBasedGatewayFeatureContainer.INSTANTIATE_PROPERTY));
    EventBasedGatewayType gatewayType = EventBasedGatewayType.getByName(service.getPropertyValue(
            context.getPictogramElement(), EventBasedGatewayFeatureContainer.EVENT_GATEWAY_TYPE_PROPERTY));

    EventBasedGateway gateway = (EventBasedGateway) getBusinessObjectForPictogramElement(context
            .getPictogramElement());
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

    return changed ? Reason.createTrueReason() : Reason.createFalseReason();
  }

  @Override
  public boolean update(IUpdateContext context) {
    IPeService service = Graphiti.getPeService();

    EventBasedGateway gateway = (EventBasedGateway) getBusinessObjectForPictogramElement(context
            .getPictogramElement());

    clearGateway(context.getPictogramElement());

    if (gateway.isInstantiate()) {
      if (gateway.getEventGatewayType() == EventBasedGatewayType.PARALLEL) {
        drawParallelMultipleEventBased((ContainerShape) context.getPictogramElement());
      } else {
        drawExclusiveEventBased((ContainerShape) context.getPictogramElement());
      }
    } else {
      drawEventBased((ContainerShape) context.getPictogramElement());
    }

    service.setPropertyValue(context.getPictogramElement(), EventBasedGatewayFeatureContainer.INSTANTIATE_PROPERTY,
            Boolean.toString(gateway.isInstantiate()));
    service.setPropertyValue(context.getPictogramElement(),
            EventBasedGatewayFeatureContainer.EVENT_GATEWAY_TYPE_PROPERTY, gateway.getEventGatewayType().getName());
    return true;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IPeService

  public IAddFeature getAddFeature(IFeatureProvider fp) {
    return new AddExpandedSubProcessFeature(fp) {
      @Override
      protected void hook(Activity activity, ContainerShape container, IAddContext context, int width, int height) {
        super.hook(activity, container, context, width, height);
        IPeService peService = Graphiti.getPeService();
        Iterator<Shape> iterator = peService.getAllContainedShapes(container).iterator();
        while (iterator.hasNext()) {
          Shape shape = iterator.next();
          String property = peService.getPropertyValue(shape, GraphicsUtil.ACTIVITY_MARKER_CONTAINER);
          if (property != null && new Boolean(property)) {
            Polyline tilde = GraphicsUtil.createActivityMarkerAdHoc((ContainerShape) shape);
            tilde.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
          }
        }
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.