Package org.eclipse.sapphire.ui.diagram

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


    private boolean isDiagramLayoutChanged()
    {
      boolean changed = false;
      if (!context(SapphireDiagramEditorPagePart.class).disposed())
      {
        ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
      for (DiagramNodePart nodePart : context( SapphireDiagramEditorPagePart.class ).getNodes())
      {
        if (!nodePart.getLocalModelElement().disposed() && isNodeLayoutChanged(nodePart))
        {
          changed = true;
          break;
        }
      }
      for (DiagramConnectionPart connPart : connService.list())
      {
        if (!connPart.getLocalModelElement().disposed() && isConnectionLayoutChanged(connPart))
        {
          changed = true;
          break;
View Full Code Here


 
  private void refreshPersistedPartsCache()
  {
    this.nodeBounds.clear();
    this.connectionBendPoints.clear();
    ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);   
    for (DiagramConnectionPart connPart : connService.list())
    {
      addConnectionToPersistenceCache(connPart);
    }
    for (DiagramNodePart nodePart : context( SapphireDiagramEditorPagePart.class ).getNodes())
    {
View Full Code Here

    private void deleteNodeConnections(DiagramNodePart nodePart)
    {
      Element nodeElement = nodePart.getLocalModelElement();
      SapphireDiagramEditorPagePart diagramPart = nodePart.getDiagramNodeTemplate().getDiagramEditorPart();
      ConnectionService connService = diagramPart.service(ConnectionService.class);
      for (DiagramConnectionPart connPart : connService.list())
      {
       if (connPart.removable() &&
           ((connPart.getEndpoint1() != null && connPart.getEndpoint1() == nodeElement) ||
               connPart.getEndpoint2() != null && connPart.getEndpoint2() == nodeElement))
       {
View Full Code Here

        {
            context( SapphireDiagramEditorPagePart.class ).setShowGuides(showGuides);
        }
   
    ElementList<DiagramNodeLayout> nodes = this.layoutModel.getDiagramNodesLayout();
    ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    for (DiagramNodeLayout node : nodes)
    {
      String nodeId = node.getNodeId().content();
      DiagramNodePart nodePart = getNodePart(nodeId);
      int x = node.getX().content();
      int y = node.getY().content();
      int width = node.getWidth().content();
      int height = node.getHeight().content();
     
      if (nodePart != null)
      {
        nodePart.setNodeBounds(new DiagramNodeBounds(x, y, width, height, false, false));
      }
     
      ElementList<DiagramConnectionLayout> connList = node.getEmbeddedConnectionsLayout();
      for (DiagramConnectionLayout connLayout : connList)
      {
        String connId = connLayout.getConnectionId().content();
        ElementList<DiagramBendPointLayout> bps = connLayout.getConnectionBendpoints();
        DiagramConnectionPart connPart = getConnectionPart(connService, ConnectionHashKey.createKey(nodeId, connId));
        if (connPart != null)
        {         
          int index = 0;
          for (DiagramBendPointLayout pt : bps)
          {
            connPart.addBendpoint(index++, pt.getX().content(), pt.getY().content());
          }
         
          if (connLayout.getLabelX().content(false) != null && connLayout.getLabelY().content(false) != null)
          {
            Point labelPos = new Point(connLayout.getLabelX().content(), connLayout.getLabelY().content());
            connPart.setLabelPosition(labelPos);
          }
        }
      }
       
    }
   
    ElementList<DiagramConnectionLayout> connList = this.layoutModel.getDiagramConnectionsLayout();
    for (DiagramConnectionLayout connLayout : connList)
    {
      String connId = connLayout.getConnectionId().content();
      DiagramConnectionPart connPart = getConnectionPart(connService, ConnectionHashKey.createKey(null, connId));
      ElementList<DiagramBendPointLayout> bps = connLayout.getConnectionBendpoints();
      if (connPart != null)
      {
        int index = 0;
        for (DiagramBendPointLayout pt : bps)
        {
          connPart.addBendpoint(index++, pt.getX().content(), pt.getY().content());
        }
        List<Point> bendPoints = new ArrayList<Point>();
        bendPoints.addAll(connPart.getBendpoints());
       
        if (connLayout.getLabelX().content(false) != null &&
            connLayout.getLabelY().content(false) != null)
        {
          Point labelPos = new Point(connLayout.getLabelX().content(),
              connLayout.getLabelY().content());
          connPart.setLabelPosition(labelPos);
        }
      }
    }
   
    // Listen on existing connection parts
    for (DiagramConnectionPart connPart : connService.list())
    {
      connPart.attach(this.connectionPartListener);
    }
   
  }
View Full Code Here

  }
 
  private void addConnectionsToModel()
  {
    this.layoutModel.getDiagramConnectionsLayout().clear();
    ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    for (DiagramConnectionPart connPart : connService.list())
    {
      if (!connPart.removable() || (connPart instanceof StandardEmbeddedConnectionPart))
        continue;
      String id = connPart.getId();
      DiagramConnectionLayout conn = null;
View Full Code Here

 
  private void refreshPersistedPartsCache()
  {
    this.nodeBounds.clear();
    this.connectionBendPoints.clear();
    ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    for (DiagramConnectionPart connPart : connService.list())
    {
      if (connPart.removable())
      {
        addConnectionToPersistenceCache(connPart);
      }
View Full Code Here

        {
          changed = true;
          break;
        }
      }
      ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
      for (DiagramConnectionPart connPart : connService.list())
      {
        if (!connPart.getLocalModelElement().disposed() && connPart.removable() &&
            isConnectionLayoutChanged(connPart))
        {
          changed = true;
View Full Code Here

TOP

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

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.