Package org.eclipse.graphiti.services

Examples of org.eclipse.graphiti.services.IGaService


     */
    public static Style getStyleForPE(Diagram diagram) {
        final String styleId = "PE-Style";
        Style style = findStyle(diagram, styleId);

        IGaService gaService = Graphiti.getGaService();

         if (style == null) { // style not found - create new style
            style = gaService.createStyle(diagram, styleId);
            style.setForeground(gaService.manageColor(diagram,
                PE_FOREGROUND));

            style.setBackground(gaService.manageColor(diagram,
                PE_BACKGROUND));
            style.setLineWidth(2);
         }

        return style;
View Full Code Here


     */
    public static Style getStyleForPEPort(Diagram diagram) {
        final String styleId = "PEPort-Style";
        Style style = findStyle(diagram, styleId);

        IGaService gaService = Graphiti.getGaService();

         if (style == null) { // style not found - create new style
            style = gaService.createStyle(diagram, styleId);
            style.setForeground(gaService.manageColor(diagram,
                PE_PORT_FOREGROUND));

            style.setBackground(gaService.manageColor(diagram,
                PE_PORT_BACKGROUND));
            style.setLineWidth(2);
         }

        return style;
View Full Code Here

        // this is a child style of PE-Style
        Style parentStyle = getStyleForPE(diagram);
        Style style = findStyle(parentStyle, styleId);

        if (style == null) { // style not found - create new style
            IGaService gaService = Graphiti.getGaService();
            style = gaService.createStyle(getStyleForPE(diagram), styleId);

            // "overwrites" values from parent style
            style.setForeground(gaService.manageColor(diagram,
                TEXT_FOREGROUND));

            style.setFont(gaService.manageFont(diagram, DEFAULT_FONT, 8,
               false, true));
        }
        return style;
    }
View Full Code Here

     */
  public static Style getStyleForCI(Diagram diagram) {
     final String styleId = "CI-Style";
          Style style = findStyle(diagram, styleId);

          IGaService gaService = Graphiti.getGaService();

           if (style == null) { // style not found - create new style
              style = gaService.createStyle(diagram, styleId);
              style.setForeground(gaService.manageColor(diagram,
                  CI_FOREGROUND));

              style.setBackground(gaService.manageColor(diagram,
                  CI_BACKGROUND));
              style.setLineWidth(2);
           }

          return style;
View Full Code Here

   */
  public static Style getStyleForLiteral(Diagram diagram) {
    final String styleId = "Literal-Style";
        Style style = findStyle(diagram, styleId);

        IGaService gaService = Graphiti.getGaService();

         if (style == null) { // style not found - create new style
            style = gaService.createStyle(diagram, styleId);
            style.setForeground(gaService.manageColor(diagram,
                LITERAL_FOREGROUND));

            style.setBackground(gaService.manageColor(diagram,
                LITERAL_BACKGROUND));
            style.setLineWidth(2);
         }

        return style;
View Full Code Here

  public static Style getStyleForConn(Diagram diagram) {
    final String styleId = "Conn-Style";

    Style style = findStyle(diagram, styleId);

    IGaService gaService = Graphiti.getGaService();

    if (style == null) { // style not found - create new style
      style = gaService.createStyle(diagram, styleId);
      style.setLineWidth(4);
      style.setForeground(gaService.manageColor(diagram,
          CONN_FOREGROUND));
    }

    return style;
  }
View Full Code Here

   */
  private int createInputsAndOutputs(ContainerShape containerShape,
      ProcessingElementInstance pei) {
   
    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    IGaService gaService = Graphiti.getGaService();
    int inputs = 0;
    int outputs = 0;
    int x = 0;
    int y = 0;
   
    for (ProcessingElementParameter p :
      pei.getProcessingElementParameters()) {
     
      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);
     
      gaService.setLocationAndSize(text, 3, 0, ((BOX_WIDTH/2) -2) - 6,
          PORT_TEXT_HEIGHT);
     
      peCreateService.createChopboxAnchor(shape);
    }
 
View Full Code Here

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
    int width = context.getWidth() <= 0 ? 200 : context.getWidth();
    int height = context.getHeight() <= 0 ? 44 : context.getHeight();

    IGaService gaService = Graphiti.getGaService();

    {
      // create and set graphics algorithm
      RoundedRectangle roundedRectangle =
          gaService.createRoundedRectangle(containerShape, 5, 5);
      roundedRectangle.setStyle(StyleUtil.getStyleForCI(getDiagram()));
      gaService.setLocationAndSize(roundedRectangle,
          context.getX(), context.getY(), width, height);

      //Don't think this should happen, but want to be sure
      if (addedVar.eResource() == null) {
        Activator.logInfo("ConnectionInitialization has no resource");
View Full Code Here

        int containerWidth = containerGa.getWidth();

        for (Shape shape : containerShape.getChildren()){

            GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
            IGaService gaService = Graphiti.getGaService();

            IDimension size =
                 gaService.calculateSize(graphicsAlgorithm);

            if (containerWidth != size.getWidth()) {

                if (graphicsAlgorithm instanceof Polyline) {

                    Polyline polyline = (Polyline) graphicsAlgorithm;
                    Point secondPoint = polyline.getPoints().get(1);
                    Point newSecondPoint =
                        gaService.createPoint(containerWidth,
                            secondPoint.getY());
                    polyline.getPoints().set(1, newSecondPoint);
                    anythingChanged = true;

                } else if (graphicsAlgorithm instanceof Rectangle){
                 
                  Rectangle r = (Rectangle) graphicsAlgorithm;
                  r.setWidth((containerWidth/2) - 2);
                 
                  if (getBusinessObjectForPictogramElement(shape)
                      instanceof Output) {
                    r.setX(containerWidth/2 + 2);
                  }
               
                } else {
                    gaService.setWidth(graphicsAlgorithm,
                        containerWidth);
                    anythingChanged = true;
                }
            }
        }
View Full Code Here

        Connection connection = peCreateService
            .createFreeFormConnection(getDiagram());
        connection.setStart(addConContext.getSourceAnchor());
        connection.setEnd(addConContext.getTargetAnchor());

        IGaService gaService = Graphiti.getGaService();
        Polyline polyline = gaService.createPolyline(connection);
        polyline.setStyle(StyleUtil.getStyleForConn(getDiagram()));
        ConnectionDecorator cd = peCreateService.createConnectionDecorator(
            connection, false, 1.0, true);

        createArrow(cd);
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.services.IGaService

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.