Package org.eclipse.graphiti.mm.algorithms

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


        PictogramElement pictogramElement = context.getPictogramElement();
        if (pictogramElement instanceof ContainerShape) {
            ContainerShape cs = (ContainerShape) pictogramElement;
            for (Shape shape : cs.getChildren()) {
                if (shape.getGraphicsAlgorithm() instanceof Text) {
                    Text text = (Text) shape.getGraphicsAlgorithm();
                    pictogramName = text.getValue();
                    //text is "variable_name\nclass_name"
                    //we only want variable_name
                    pictogramName = pictogramName.substring(
                        0, pictogramName.indexOf('\n'));
                }
View Full Code Here


        // Set name in pictogram model
        if (pictogramElement instanceof ContainerShape) {
            ContainerShape cs = (ContainerShape) pictogramElement;
            for (Shape shape : cs.getChildren()) {
                if (shape.getGraphicsAlgorithm() instanceof Text) {
                    Text text = (Text) shape.getGraphicsAlgorithm();
                    String textString = text.getValue();
                    String className = textString.substring(
                        textString.indexOf('\n'), textString.length());
                    text.setValue(businessName + className);
                    return true;
                }
            }
        }
View Full Code Here

    // create shape for text
    Shape shape = Graphiti.getPeCreateService().createShape(
        containerShape, false);

    // create and set text graphics algorithm
    Text text = Graphiti.getGaService().createDefaultText(
        getDiagram(), shape,
        lvs.getVariable().getName() + "\n" + peName);
    text.setStyle(StyleUtil.getStyleForText(getDiagram()));
    text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
    text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
    text.getFont().setBold(true);
    Graphiti.getGaService().setLocationAndSize(text, 0, 0, BOX_WIDTH, 40);

    // create link and wire it
    link(shape, lvs);
  }
View Full Code Here

     
      Shape shape = peCreateService.createShape(containerShape, true);
      Rectangle r = gaService.createRectangle(shape);
      r.setStyle(StyleUtil.getStyleForPEPort(getDiagram()));

      Text text = gaService.createDefaultText(getDiagram(), r,
          p.getName());
      text.setStyle(StyleUtil.getStyleForText(getDiagram()));
      text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
     
      //Put inputs on the left and outputs on the right
      if (p instanceof Output) {
        x = BOX_WIDTH/2 + 2;
        y = PORT_TOP_MARGIN + ((PORT_HEIGHT + 1) * outputs);
        outputs ++;
        text.setHorizontalAlignment(Orientation.ALIGNMENT_RIGHT);
      } else {
        y = PORT_TOP_MARGIN + ((PORT_HEIGHT + 1) * inputs);
        inputs ++;
        text.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
      }
     
      gaService.setLocationAndSize(r, x, y, (BOX_WIDTH/2) - 2 ,
          PORT_HEIGHT);
      link(shape, p);
View Full Code Here

    // create link and wire it
    link(connection, addedEReference);

    // add dynamic text decorator for the reference name
    ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.5, true);
    Text text = gaService.createDefaultText(getDiagram(), getDiagram().getGraphicsAlgorithm());
    textDecorator.setConnection(connection);
    text.setStyle(StyleUtil.getStyleForCamelText((getDiagram())));
    gaService.setLocation(text, 10, 0);
    // set reference name in the text decorator
    Flow flow = (Flow) context.getNewObject();
    text.setValue(flow.getName());
   
    // add static graphical decorators (composition and navigable)
    ConnectionDecorator cd;
    cd = peCreateService.createConnectionDecorator(connection, false, 1.0, true);
    createArrow(cd);
View Full Code Here

          cs.getGraphicsAlgorithm().setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.E_CLASS_FOREGROUND));
        }
       
        for (Shape shape : cs.getChildren()) {
          if (shape.getGraphicsAlgorithm() instanceof Text) {
            Text text = (Text) shape.getGraphicsAlgorithm();

            // now update node highlight
            if (highlight) {
              // set highlight
              text.setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.getColorConstant("255,0,0")));
            } else {
              // delete highlight
              text.setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.E_CLASS_TEXT_FOREGROUND));
            }
          }
        }
      }       
    } catch (Exception e) {
View Full Code Here

    PictogramElement pictogramElement = context.getPictogramElement();
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          pictogramName = text.getValue();
        }
      }
    }

    // retrieve name from business model
View Full Code Here

      boolean finished_icon = false;
      // now also adapt the text label of the figure
      for (Shape shape : cs.getChildren()) {
        // special handling for the text shape as its the figures label
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          // set the new figure label
          text.setValue(businessName);
         
          finished_label = true;
        } else if (shape.getGraphicsAlgorithm() instanceof Image) {
          // update the icon image
          AbstractNode addedClass = (AbstractNode)bo;
View Full Code Here

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

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