Package org.eclipse.graphiti.mm.pictograms

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


    return bandShape;
  }

  private static void addBandLabel(ContainerShape container, String name, int w, int h) {
    Diagram diagram = peService.getDiagramForShape(container);
    Shape labelShape = peService.createShape(container, false);
    Text label = gaService.createDefaultText(diagram, labelShape);
    label.setValue(name);
    gaService.setLocationAndSize(label, 0, 0, w, h);
    label.setStyle(StyleUtil.getStyleForText(peService.getDiagramForPictogramElement(container)));
    label.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
View Full Code Here


    ContainerShape envelope = peService.createContainerShape(diagram, true);
    Rectangle invisibleRectangle = gaService.createInvisibleRectangle(envelope);
    gaService.setLocation(invisibleRectangle, x, y);
    gaService.setSize(invisibleRectangle, ENV_W + 50, ENV_H);

    Shape envelopeShape = peService.createShape(envelope, false);
    Envelope envelopeGa = GraphicsUtil.createEnvelope(envelopeShape, 0, 0, ENV_W, ENV_H);
    IColorConstant color = filled ? IColorConstant.LIGHT_GRAY : IColorConstant.WHITE;
    envelopeGa.rect.setFilled(true);
    envelopeGa.rect.setBackground(gaService.manageColor(diagram, color));
    envelopeGa.rect.setForeground(gaService.manageColor(diagram, StyleUtil.CLASS_FOREGROUND));
    envelopeGa.line.setForeground(gaService.manageColor(diagram, StyleUtil.CLASS_FOREGROUND));
    AnchorUtil.addFixedPointAnchors(envelope, envelopeGa.rect);

    Shape textShape = peService.createShape(envelope, false);
    Text text = gaService.createDefaultText(diagram, textShape);
    IDimension size = GraphitiUi.getUiLayoutService().calculateTextSize(name, text.getFont());
    gaService.setLocationAndSize(text, ENV_W + 3, 3, size.getWidth(), size.getHeight());
    text.setValue(name);
View Full Code Here

    peService.setPropertyValue(envelope, MESSAGE_LINK, Boolean.toString(true));
  }

  public static void drawMultiplicityMarkers(ContainerShape container) {
    Diagram diagram = peService.getDiagramForPictogramElement(container);
    Shape multiplicityShape = peService.createShape(container, false);
    Rectangle rect = gaService.createInvisibleRectangle(multiplicityShape);

    IDimension size = gaService.calculateSize(container.getGraphicsAlgorithm());
    int w = 10;
    int h = 10;
View Full Code Here

  private static void setMessageLabel(String label, PictogramElement message) {
    ContainerShape containerShape = (ContainerShape) message;
    Iterator<Shape> iterator = peService.getAllContainedShapes(containerShape).iterator();
    while (iterator.hasNext()) {
      Shape shape = iterator.next();
      if (shape.getGraphicsAlgorithm() instanceof Text) {
        Text text = (Text) shape.getGraphicsAlgorithm();
        text.setValue(label);
        IDimension size = GraphitiUi.getUiLayoutService().calculateTextSize(label, text.getFont());
        gaService.setSize(containerShape.getGraphicsAlgorithm(), ENV_W + size.getWidth() + 3, ENV_H);
        gaService.setSize(text, size.getWidth(), size.getHeight());
        break;
View Full Code Here

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

    }
  }

  public static void drawChoreographyLoopType(ContainerShape markerShape, ChoreographyLoopType type) {
    Collection<Shape> shapes = peService.getAllContainedShapes(markerShape);
    Shape drawingShape = null;

    if (shapes.size() == 1) { // remove previous shape
      Iterator<Shape> iterator = shapes.iterator();
      while (iterator.hasNext()) {
        Shape shape = iterator.next();
        drawingShape = shape;
        break;
      }
    }
View Full Code Here

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

    ContainerShape containerShape = (ContainerShape) context.getPictogramElement();
    GraphicsAlgorithm parentGa = containerShape.getGraphicsAlgorithm();

    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

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

    EventWithDefinitions definitions = support.create(event);
    int size = definitions.getEventDefinitions().size();

    if (size > 1) {
      if (GraphicsUtil.clearEvent(container)) {
        Shape multipleShape = Graphiti.getPeService().createShape(container, false);
        drawForEvent(event, multipleShape);
        link(multipleShape, definitions.getEventDefinitions().toArray(new EventDefinition[size]));
      }
    } else {
      Shape addedShape = getDecorationAlgorithm(event).draw(container);
      link(addedShape, context.getNewObject());
    }

    return null;
  }
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.