Package org.eclipse.graphiti.mm.pictograms

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


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


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

    Object importProperty = context.getProperty(DIImport.IMPORT_PROPERTY);
    if (importProperty != null && (Boolean) importProperty) {
      addedFromImport(choreography, choreographyContainer, context);
    }

    Shape nameShape = peService.createShape(choreographyContainer, false);

    Text text = gaService.createDefaultText(getDiagram(), nameShape);
    text.setValue(choreography.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
View Full Code Here

    ContainerShape containerShape = peService.createContainerShape(context.getTargetContainer(), true);
    Rectangle invisibleRect = gaService.createInvisibleRectangle(containerShape);

    gaService.setLocationAndSize(invisibleRect, context.getX(), context.getY(), width, height + 18);

    Shape rectShape = peService.createShape(containerShape, false);
    RoundedRectangle rect = gaService.createRoundedRectangle(rectShape, 5, 5);
       
    StyleUtil.applyBGStyle(rect, this);   

    gaService.setLocationAndSize(rect, 0, 0, width, height);
    decorateRect(rect);
    link(rectShape, subprocess);

    Rectangle box = gaService.createRectangle(rect);
    gaService.setLocationAndSize(box, 40, 80, 20, 20);
    box.setFilled(false);
    box.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
    decorateBox(box);

    Shape textShape = peService.createShape(containerShape, false);
    MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, subprocess.getName());
    gaService.setLocationAndSize(text, 10, 10, 80, 80);
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
View Full Code Here

    Rectangle rect = gaService.createRectangle(containerShape);
    StyleUtil.applyBGStyle(rect, this);
    gaService.setLocationAndSize(rect, context.getX(), context.getY(), width, height);

    Shape lineShape = peCreateService.createShape(containerShape, false);
    Polyline line = gaService.createPolyline(lineShape, new int[] { 15, 0, 15, height });
    line.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));

    Shape textShape = peCreateService.createShape(containerShape, false);
    Text text = gaService.createText(textShape, p.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setAngle(-90);
View Full Code Here

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

    Shape textShape = getShape(container, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text textGa = (Text) textShape.getGraphicsAlgorithm();
    String text = textGa.getValue() == null ? "" : textGa.getValue();
    IDimension size = GraphitiUi.getUiLayoutService().calculateTextSize(text, textGa.getFont());

    GraphicsAlgorithm parentGa = container.getGraphicsAlgorithm();
View Full Code Here

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

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

    Shape rectShape = peService.createShape(container, false);
    Polygon rect = gaService.createPolygon(rectShape, new int[] { 0, 0, width - e, 0, width, e, width, height, 0,
        height });
    rect.setLineWidth(1);
    StyleUtil.applyBGStyle(rect, this);
    decorate(rect);

    int p = width - e - 1;
    Polyline edge = gaService.createPolyline(rect, new int[] { p, 0, p, e + 1, width, e + 1 });
    edge.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
    edge.setLineWidth(1);

    if (isSupportCollectionMarkers()) {
      int whalf = width / 2;
      createCollectionShape(container, new int[] { whalf - 2, height - 8, whalf - 2, height });
      createCollectionShape(container, new int[] { whalf, height - 8, whalf, height });
      createCollectionShape(container, new int[] { whalf + 2, height - 8, whalf + 2, height });

      Graphiti.getPeService().setPropertyValue(container, Properties.COLLECTION_PROPERTY, Boolean.toString(false));
    }
   
    Shape textShape = peService.createShape(container, false);
    peService.setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text text = gaService.createDefaultText(getDiagram(), textShape, getName(t));
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
View Full Code Here

  }

  private Shape createCollectionShape(ContainerShape container, int[] xy) {
    IPeService peService = Graphiti.getPeService();
    IGaService gaService = Graphiti.getGaService();
    Shape collectionShape = peService.createShape(container, false);
    Polyline line = gaService.createPolyline(collectionShape, xy);
    line.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
    line.setLineWidth(1);
    line.setLineVisible(false);
    peService.setPropertyValue(collectionShape, Properties.HIDEABLE_PROPERTY, Boolean.toString(true));
View Full Code Here

  public static Polygon createGateway(Shape container) {
    return gaService.createPolygon(container, GATEWAY);
  }

  public static Polygon createGatewayPentagon(ContainerShape container) {
    Shape pentagonShape = peService.createShape(container, false);
    Polygon pentagon = gaService.createPolygon(pentagonShape, new int[] { GATEWAY_RADIUS, 18, GATEWAY_RADIUS + 8,
            GATEWAY_RADIUS - 2, GATEWAY_RADIUS + 5, GATEWAY_RADIUS + 7, GATEWAY_RADIUS - 5, GATEWAY_RADIUS + 7,
            GATEWAY_RADIUS - 8, GATEWAY_RADIUS - 2 });
    peService.setPropertyValue(pentagonShape, DELETABLE_PROPERTY, "true");
    return pentagon;
View Full Code Here

TOP

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

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.