Examples of IGaService


Examples of org.eclipse.graphiti.services.IGaService

    org.eclipse.swt.graphics.Rectangle shadowRect = new org.eclipse.swt.graphics.Rectangle(0 + BASE_RECT_SPACE_X + SHADOW_WIDTH, 0 + BASE_RECT_SPACE_Y + SHADOW_HEIGHT, content_width, image_height + label_height + IMAGE_LABEL_SPACE + TOP_BOTTOM_SPACE + TOP_BOTTOM_SPACE);
    org.eclipse.swt.graphics.Rectangle contentRect = new org.eclipse.swt.graphics.Rectangle(0 + BASE_RECT_SPACE_X, 0 + BASE_RECT_SPACE_Y, content_width, image_height + label_height + IMAGE_LABEL_SPACE + TOP_BOTTOM_SPACE + TOP_BOTTOM_SPACE);
    org.eclipse.swt.graphics.Rectangle imageRect = new org.eclipse.swt.graphics.Rectangle(0 + BASE_RECT_SPACE_X, 0 + BASE_RECT_SPACE_Y + TOP_BOTTOM_SPACE, content_width, image_height);
    org.eclipse.swt.graphics.Rectangle labelRect = new org.eclipse.swt.graphics.Rectangle(0 + BASE_RECT_SPACE_X, 0 + BASE_RECT_SPACE_Y + image_height + IMAGE_LABEL_SPACE, content_width, label_height + TOP_BOTTOM_SPACE);
   
    final IGaService gaService = Graphiti.getGaService();
    final RoundedRectangle baseRectangle = gaService.createRoundedRectangle(containerShape, ROUNDED_RECTANGLE_WIDTH, ROUNDED_RECTANGLE_HEIGHT);

    // create invisible outer rectangle expanded by
    // the width needed for the anchor
    gaService.setLocationAndSize(baseRectangle, baseRect.x, baseRect.y, baseRect.width, baseRect.height);
    baseRectangle.setFilled(false);
    baseRectangle.setLineVisible(false);
   
    // shadow
    RoundedRectangle shadowRectangle; // need to access it later
    {
      // create and set visible rectangle inside invisible rectangle
      shadowRectangle = gaService.createRoundedRectangle(baseRectangle, ROUNDED_RECTANGLE_WIDTH, ROUNDED_RECTANGLE_HEIGHT);
      shadowRectangle.setParentGraphicsAlgorithm(baseRectangle);
      shadowRectangle.setStyle(StyleUtil.getShadowStyleForCamelClass(getDiagram()));
      shadowRectangle.setLineVisible(false);
      shadowRectangle.setFilled(true);
      gaService.setLocationAndSize(shadowRectangle, shadowRect.x, shadowRect.y, shadowRect.width, shadowRect.height);
    }

    // the real figure
    RoundedRectangle roundedRectangle; // need to access it later
    {
      // create and set visible rectangle inside invisible rectangle
      roundedRectangle = gaService.createRoundedRectangle(baseRectangle, ROUNDED_RECTANGLE_WIDTH, ROUNDED_RECTANGLE_HEIGHT);
      roundedRectangle.setParentGraphicsAlgorithm(baseRectangle);
      roundedRectangle.setStyle(StyleUtil.getStyleForCamelClass(getDiagram()));
      gaService.setLocationAndSize(roundedRectangle, contentRect.x, contentRect.y, contentRect.width, contentRect.height);
    }
   
    // image
    {
      // create shape for image
      final Shape shape = peCreateService.createShape(containerShape, false);

      // create and set image
      final Image image = gaService.createImage(shape, ImageProvider.getKeyForLargeIcon(addedClass.getIconName()));
      gaService.setLocationAndSize(image, imageRect.x, imageRect.y, imageRect.width, imageRect.height);

      // if addedClass has no resource we add it to the resource of the diagram
      // in a real scenario the business model would have its own resource
//      if (addedClass.eResource() == null) {
//        getDiagram().eResource().getContents().add(addedClass);
//      }
    }

    // SHAPE WITH TEXT
    {
      // create shape for text
      final Shape shape = peCreateService.createShape(containerShape, false);

      // create and set text graphics algorithm
      final Text text = gaService.createDefaultText(getDiagram(), shape, label);

      Style style = StyleUtil.getStyleForCamelText(getDiagram());
      text.setStyle(style);
      text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
      text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
      text.setFont(style.getFont());

      gaService.setLocationAndSize(text, labelRect.x, labelRect.y, labelRect.width, labelRect.height);

      // create link and wire it
      //        link(shape, addedClass);

      // provide information to support direct-editing directly
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

        return true;
      }

      @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);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  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);
    text.getFont().setBold(true);
    link(textShape, activity);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public IAddFeature getAddFeature(IFeatureProvider fp) {
    return new AddExpandedSubProcessFeature(fp) {

      @Override
      protected void decorateActivityRectangle(RoundedRectangle rect) {
        IGaService gaService = Graphiti.getGaService();
        RoundedRectangle innerRect = gaService.createRoundedRectangle(rect, 5, 5);
        innerRect.setFilled(false);
        innerRect.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
        gaService.setLocationAndSize(innerRect, offset, offset, rect.getWidth() - (2 * offset),
            rect.getHeight() - (2 * offset));
      }

      @Override
      protected int getMarkerContainerOffset() {
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  @Override
  public ILayoutFeature getLayoutFeature(IFeatureProvider fp) {
    return new SubProcessLayoutFeature(fp) {
      @Override
      protected void layoutInRectangle(RoundedRectangle rect) {
        IGaService gaService = Graphiti.getGaService();
        RoundedRectangle innerRect = (RoundedRectangle) rect.getGraphicsAlgorithmChildren().get(0);
        gaService.setSize(innerRect, rect.getWidth() - 6, rect.getHeight() - 6);
      }

      @Override
      protected int getMarkerContainerOffset() {
        return offset;
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

        return true;
      }

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

        int width = context.getWidth() > 0 ? context.getWidth() : 30;
        int height = context.getHeight() > 0 ? context.getHeight() : 20;
        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);

        Envelope envelope = GraphicsUtil.createEnvelope(invisibleRect, 0, 0, width, height);
        envelope.rect.setFilled(true);
        StyleUtil.applyBGStyle(envelope.rect, this);
        envelope.line.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, msg.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, msg);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    Iterator<Shape> iterator = Graphiti.getPeService().getAllContainedShapes(containerShape).iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      IGaService gaService = Graphiti.getGaService();

      int newWidth = parentGa.getWidth();
      int newHeight = parentGa.getHeight();

      String markerProperty = Graphiti.getPeService().getPropertyValue(shape,
          GraphicsUtil.ACTIVITY_MARKER_CONTAINER);
      if (markerProperty != null && new Boolean(markerProperty)) {
        int x = (newWidth / 2) - (ga.getWidth() / 2);
        int y = newHeight - ga.getHeight() - 3 - getMarkerContainerOffset();
        gaService.setLocation(ga, x, y);
        continue;
      }

      Shape rectShape = FeatureSupport.getShape(containerShape, "activity", Boolean.toString(true));
      gaService.setSize(rectShape.getGraphicsAlgorithm(), newWidth, newHeight);
      layoutInRectangle((RoundedRectangle) rectShape.getGraphicsAlgorithm());

      Object[] objects = getAllBusinessObjectsForPictogramElement(shape);
      for (Object bo : objects) {
        layoutHook(shape, ga, bo, newWidth, newHeight);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  @Override
  public PictogramElement add(IAddContext context) {
    Activity activity = (Activity) context.getNewObject();

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

    int width = context.getWidth() > 0 ? context.getWidth() : getWidth();
    int height = context.getHeight() > 0 ? context.getHeight() : getHeight();

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

    Shape rectShape = peService.createShape(containerShape, false);
    RoundedRectangle rect = gaService.createRoundedRectangle(rectShape, 5, 5);
    StyleUtil.applyBGStyle(rect, this);
    gaService.setLocationAndSize(rect, 0, 0, width, height);
    link(rectShape, activity);
    decorateActivityRectangle(rect);
    peService.setPropertyValue(rectShape, "activity", Boolean.toString(true));

    ContainerShape markerContainer = peService.createContainerShape(containerShape, false);
    Rectangle markerInvisibleRect = gaService.createInvisibleRectangle(markerContainer);
    int h = 10;
    int y = height - h - 3 - getMarkerContainerOffset();
    gaService.setLocationAndSize(markerInvisibleRect, 0, y, invisibleRect.getWidth(), h);
    peService.setPropertyValue(markerContainer, GraphicsUtil.ACTIVITY_MARKER_CONTAINER, Boolean.toString(true));

    hook(activity, containerShape, context, width, height); // hook for subclasses to inject extra code

    peService.createChopboxAnchor(containerShape);
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  @Override
  public boolean layout(ILayoutContext context) {
    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();

    GraphicsAlgorithm containerGa = containerShape.getGraphicsAlgorithm();
    IGaService gaService = Graphiti.getGaService();

    int containerHeight = containerGa.getHeight();
    Iterator<Shape> iterator = containerShape.getChildren().iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      IDimension size = gaService.calculateSize(ga);
      if (containerHeight != size.getHeight()) {
        if (ga instanceof Polyline) {
          Polyline line = (Polyline) ga;
          Point firstPoint = line.getPoints().get(0);
          Point newPoint = gaService.createPoint(firstPoint.getX(), containerHeight);
          line.getPoints().set(1, newPoint);
        } else if (ga instanceof Text) {
          gaService.setHeight(ga, containerHeight);
        }
      }
    }

    Shape shape = FeatureSupport.getShape(containerShape, ParticipantMultiplicityUpdateFeature.MULTIPLICITY_MARKER,
        Boolean.toString(true));
    if (shape != null) {
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      int x = (containerGa.getWidth() / 2) - 10;
      int y = containerGa.getHeight() - 20;
      gaService.setLocation(ga, x, y);
    }

    DIUtils.updateDIShape(containerShape);
    return true;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    }

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

      ContainerShape container = (ContainerShape) context.getPictogramElement();
      CallActivity callActivity = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
          CallActivity.class);

      ContainerShape markerContainer = (ContainerShape) getShape(container,
          GraphicsUtil.ACTIVITY_MARKER_CONTAINER);
      Shape globalTaskShape = getShape(container, GLOBAL_TASK_SHAPE_PROPERTY);

      if (callActivity.getCalledElementRef() == null) {
        GraphicsUtil.clearActivityMarker(markerContainer, GraphicsUtil.ACTIVITY_MARKER_EXPAND);
        if (globalTaskShape != null) {
          peService.deletePictogramElement(globalTaskShape);
        }
      }

      else if (callActivity.getCalledElementRef() instanceof GlobalTask) {
        GraphicsUtil.clearActivityMarker(markerContainer, GraphicsUtil.ACTIVITY_MARKER_EXPAND);
        GlobalTask t = (GlobalTask) callActivity.getCalledElementRef();
        if (globalTaskShape == null) {
          globalTaskShape = peService.createShape(container, false);
          peService.setPropertyValue(globalTaskShape, GLOBAL_TASK_SHAPE_PROPERTY, Boolean.toString(true));
        }
        String imageId = getImageId(t);
        if (imageId != null) {
          Image image = gaService.createImage(globalTaskShape, imageId);
          gaService.setLocationAndSize(image, MARKER_OFFSET + 2, MARKER_OFFSET + 2, 16, 16);
        }
      }

      else if (callActivity.getCalledElementRef() instanceof Process) {
        if (globalTaskShape != null) {
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.