Package org.eclipse.sapphire.ui.diagram

Examples of org.eclipse.sapphire.ui.diagram.DiagramConnectionPart


   * @see org.eclipse.gef.commands.Command#execute()
   */
  public void execute()
  {
    ConnectionService connService = this.diagramPart.service(ConnectionService.class);
    DiagramConnectionPart connection = connService.connect(this.source.getModelPart(), this.target.getModelPart(),
        this.connDef.getId().content());
   
    // activate direct editing after object creation
    if (connection != null && connection.canEditLabel())
    {
      diagramPart.selectAndDirectEdit(connection);
    }
  }
View Full Code Here


    {
      GraphicalViewer viewer = this.getGraphicalViewer();
     
      Object editpartObj = null;
      DiagramNodePart nodePart = null;
      DiagramConnectionPart connPart = null;
      if (sapphirePart instanceof DiagramNodePart)
      {
        nodePart = (DiagramNodePart)sapphirePart;
        DiagramNodeModel nodeModel = this.getDiagramModel().getDiagramNodeModel(nodePart);
        editpartObj = viewer.getEditPartRegistry().get(nodeModel);
View Full Code Here

    return getCastedModel().getPresentation();
  }
 
  public void updateStyle(PolylineConnection connection) {
    DiagramResourceCache resourceCache = getCastedModel().getDiagramModel().getResourceCache();
    DiagramConnectionPart connectionPart = getCastedModel().getModelPart();
    IDiagramConnectionDef def = connectionPart.getConnectionDef();
    connection.setLineStyle(resourceCache.getLinkStyle(def));
    connection.setLineWidth(def.getLineWidth().content());
    connection.setForegroundColor(resourceCache.getLineColor(connectionPart));
  }
View Full Code Here

    connection.setLineWidth(def.getLineWidth().content());
    connection.setForegroundColor(resourceCache.getLineColor(connectionPart));
  }
 
  private void refreshBendpoints() {
    DiagramConnectionPart connectionPart = getCastedModel().getModelPart();

    List<AbsoluteBendpoint> figureConstraint = new ArrayList<AbsoluteBendpoint>();
    for (Point point : connectionPart.getBendpoints()) {
      AbsoluteBendpoint bendpoint = new AbsoluteBendpoint(point.getX(), point.getY());
      figureConstraint.add(bendpoint);
    }
    getConnectionFigure().setRoutingConstraint(figureConstraint);
  }
View Full Code Here

      {
        continue;
      }
      DiagramConnectionModel conn = (DiagramConnectionModel)edge.data;
      NodeList nodes = edge.vNodes;
      DiagramConnectionPart connPart = conn.getModelPart();
      ArrayList<org.eclipse.sapphire.ui.Point> connBendPoints = new ArrayList<org.eclipse.sapphire.ui.Point>();
      if (nodes != null)
      {
        //int bpIndex = 0;
        for (int i = 0; i < nodes.size(); i++)
        {
          Node vn = nodes.getNode(i);
          int x = vn.x;
          int y = vn.y;
          if (getGraphDirection() == PositionConstants.EAST)
          {
            if (edge.isFeedback())
            {
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x + vn.width, y));
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x, y));
            }
            else
            {
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x, y));
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x + vn.width, y));
            }
          }
          else
          {
            if (edge.isFeedback())
            {
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x, y + vn.height));
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x, y));
            }
            else
            {
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x, y));
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(x, y + vn.height));
            }
          }
        }
      }
      else
      {
            Point bendPoint = configManager.getConnectionRouter().route(conn);
            if (bendPoint != null)
            {
              connBendPoints.add(new org.eclipse.sapphire.ui.Point(bendPoint.x, bendPoint.y));
            }       
      }
      connPart.resetBendpoints(connBendPoints);
      connPart.setLabelPosition(null);
    }   
  }
View Full Code Here

      }
    }
  }
 
  private void moveAllBendpoints(DiagramConnectionModel conn, int deltaX, int deltaY) {
    DiagramConnectionPart part = conn.getModelPart();
    List<Point> pts = part.getBendpoints();
    for (int i = 0; i < pts.size(); i++) {
      Point current = pts.get(i);
      part.updateBendpoint(i, current.getX() + deltaX, current.getY() + deltaY);
    }
  }
View Full Code Here

    this.oldTarget = connection.getTargetNode();
  }

  @Override
  public boolean canExecute() {
    DiagramConnectionPart connectionPart = this.connection.getModelPart();
    if (!connectionPart.removable()) {
      return false;
    }
    if (newSource != null) {
      return checkSourceReconnection();
    } else if (newTarget != null) {
View Full Code Here

    }
    return false;
  }

  private boolean checkSourceReconnection() {
    DiagramConnectionPart connectionPart = this.connection.getModelPart();
    ConnectionService connService = connectionPart.nearest(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    if (!connService.valid(newSource.getModelPart(), oldTarget.getModelPart(), connectionPart.getConnectionTypeId()))
      return false;

    return true;
  }
View Full Code Here

    return true;
  }

  private boolean checkTargetReconnection() {
    DiagramConnectionPart connectionPart = this.connection.getModelPart();
    ConnectionService connService = connectionPart.nearest(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    if (!connService.valid(oldSource.getModelPart(), newTarget.getModelPart(), connectionPart.getConnectionTypeId()))
      return false;
       
    return true;
  }
View Full Code Here

  public void execute()
  {
    if ((newSource != null && newSource == oldSource) ||
        (newTarget != null && newTarget == oldTarget))
      return;
    DiagramConnectionPart connectionPart = connection.getModelPart();
    connectionPart.reconnect(newSource != null ? newSource.getModelPart() : oldSource.getModelPart(),
                  newTarget != null ? newTarget.getModelPart() : oldTarget.getModelPart());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.diagram.DiagramConnectionPart

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.