Package org.eclipse.graphiti.mm.algorithms

Examples of org.eclipse.graphiti.mm.algorithms.Text


    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


  }

  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);
    label.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
  }
View Full Code Here

    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);

    gaService.setSize(invisibleRectangle, ENV_W + size.getWidth() + 3, ENV_H);

    AnchorLocation envelopeAnchorLoc = null;
    if (boundaryAnchor.locationType == AnchorLocation.TOP) {
View Full Code Here

    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

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

      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);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    text.getFont().setBold(false);
    setTextLocation(choreographyContainer, text, width, height);
    peService.setPropertyValue(nameShape, ChoreographyProperties.CHOREOGRAPHY_NAME, Boolean.toString(true));

    // use it when property editor supports enums
    // ContainerShape markerShape = peService.createContainerShape(choreographyContainer, false);
View Full Code Here

    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);
    gaService.setLocationAndSize(text, 0, 0, 15, height);
    peService.setPropertyValue(containerShape, MULTIPLICITY, Boolean.toString(false));

    createDIShape(containerShape, p);
    link(textShape, p);
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();

    if (size.getWidth() > getMinimumWidth()) {
      gaService.setSize(parentGa, size.getWidth() + 3, parentGa.getHeight());
    } else {
      gaService.setSize(parentGa, getMinimumWidth(), parentGa.getHeight());
    }

    gaService.setSize(textGa, size.getWidth() + 3, textGa.getHeight());

    return true;
  }
View Full Code Here

      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);
    gaService.setLocationAndSize(text, 0, height, width, textArea);
   
    peService.createChopboxAnchor(container);
    AnchorUtil.addFixedPointAnchors(container, invisibleRect);
    createDIShape(container, t);
View Full Code Here

    gaService.setLocationAndSize(gateway, 0, 0, d, d);
    decorateGateway(containerShape);

    Shape textShape = peService.createShape(containerShape, false);
    peService.setPropertyValue(textShape, UpdateBaseElementNameFeature.TEXT_ELEMENT, Boolean.toString(true));
    Text text = gaService.createDefaultText(getDiagram(), textShape, addedGateway.getName());
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
    gaService.setLocationAndSize(text, 0, d, d, p);

    createDIShape(containerShape, addedGateway);
    peService.createChopboxAnchor(containerShape);
    AnchorUtil.addFixedPointAnchors(containerShape, gateway);
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.algorithms.Text

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.