Package org.eclipse.sapphire.ui.diagram.editor

Examples of org.eclipse.sapphire.ui.diagram.editor.DiagramNodePart


   
  }
 
  private void handleNodeLayoutChange(Component component)
  {
    DiagramNodePart nodePart = context( SapphireDiagramEditorPagePart.class ).getDiagramNodePart(component);
    DiagramNodeBounds nodeBounds = new DiagramNodeBounds(component.getPosition().getX().content(),
        component.getPosition().getY().content());
    nodePart.setNodeBounds(nodeBounds);
  }
View Full Code Here


       
        context( SapphireDiagramEditorPagePart.class ).attach( this.diagramPartListener );
  }
   
    private void handleDiagramNodeEvent(DiagramNodeEvent event) {
      DiagramNodePart nodePart = (DiagramNodePart)event.part();
      if (event instanceof DiagramNodeAddEvent)
      {
        read(nodePart);
      }
      else if (event instanceof DiagramNodeDeleteEvent)
      {
        refreshDirtyState()
      }
      else if (event instanceof DiagramNodeMoveEvent)
      {
      DiagramNodeBounds nodeBounds = nodePart.getNodeBounds();
     
      if (nodeBounds.isAutoLayout())
      {
        // need to add the node bounds to the persistence cache so that "revert" could work
        addNodeToPersistenceCache(nodePart);
View Full Code Here

                if( ! map.hasLocation( locationName ) )
                {
                    final Location location = map.getLocations().insert();
                    location.setName( locationName );
                   
                    final DiagramNodePart locationNodePart = diagram.getDiagramNodePart(location);
                    locationNodePart.setNodeBounds( x, y );
                   
                    x += 50;
                    y += 50;
                }
            }
View Full Code Here

public final class LocationShowInWikipediaActionHandler extends SapphireActionHandler
{
    @Override
    protected Object run( final Presentation context )
    {
        final DiagramNodePart part = (DiagramNodePart) context.part();
        final Location location = (Location) part.getModelElement();
        final String locationName = location.getName().text();

        if( locationName != null )
        {
            try
View Full Code Here

            DiagramConnectionPart connPart = (DiagramConnectionPart)part;
            connPart.remove();  
        }
        else if (part instanceof DiagramNodePart)
        {
            DiagramNodePart nodePart = (DiagramNodePart)part;
            deleteNode(nodePart);
        }
        else if (part instanceof ShapePart)
        {
            ShapePart shapePart = (ShapePart)part;
            deleteShapePart(shapePart);
        }
        else if (part instanceof SapphireDiagramEditorPagePart)
        {
          SapphireDiagramEditorPagePart pagePart = (SapphireDiagramEditorPagePart)part;
          List<ISapphirePart> parts = new ArrayList<ISapphirePart>();
          parts.addAll(pagePart.getSelections());
          for (ISapphirePart selectedPart : parts)
          {
            if (selectedPart instanceof DiagramConnectionPart)
            {
                    DiagramConnectionPart connPart = (DiagramConnectionPart)selectedPart;
                    connPart.remove();               
            }
                else if (selectedPart instanceof DiagramNodePart)
                {
                    DiagramNodePart nodePart = (DiagramNodePart)selectedPart;
                    deleteNode(nodePart);
                }
                else if (selectedPart instanceof ShapePart)
                {
                    ShapePart shapePart = (ShapePart)selectedPart;
View Full Code Here

    String connId = connPart.getId();
    String nodeId = null;
    if (connPart instanceof StandardEmbeddedConnectionPart)
    {
      Element srcElement = connPart.getEndpoint1();
      DiagramNodePart nodePart = diagramPart.getDiagramNodePart(srcElement);
      nodeId = nodePart.getId();
    }
    ConnectionHashKey hashKey = new ConnectionHashKey(nodeId, connId);
    return hashKey;   
  }
View Full Code Here

  protected Object run(Presentation context)
  {
      SapphireDiagramEditorPagePart diagramPart =
          (SapphireDiagramEditorPagePart)this.nodeTemplate.parent();

    DiagramNodePart nodePart = this.nodeTemplate.createNewDiagramNode();
    Point pt = diagramPart.getMouseLocation();
    nodePart.setNodeBounds(pt.getX(), pt.getY());
   
    // Select the new node and put it in direct-edit mode
    diagramPart.selectAndDirectEdit(nodePart);
    return nodePart;
 
View Full Code Here

  @Override
  public List<SapphireActionHandler> create()
  {
        final ListFactory<SapphireActionHandler> handlers = ListFactory.start();
        ShapePart shapePart = null;
        DiagramNodePart nodePart = null;
        if (getPart() instanceof DiagramNodePart)
        {
          nodePart = (DiagramNodePart)getPart();
          shapePart = nodePart.getShapePart();
        }
        else if (getPart() instanceof ShapePart )
        {
          shapePart = (ShapePart)getPart();
          nodePart = shapePart.getNodePart();
View Full Code Here

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

        };
    context( SapphireDiagramEditorPagePart.class ).attach(diagramEditorPagePartListener);
  }
   
    private void handleDiagramNodeEvent(DiagramNodeEvent event) {
      DiagramNodePart nodePart = (DiagramNodePart)event.part();
      if (event instanceof DiagramNodeAddEvent) {
        read(nodePart);
      }
      else if (event instanceof DiagramNodeDeleteEvent) {
        refreshDirtyState();
      }
      else if (event instanceof DiagramNodeMoveEvent) {
      DiagramNodeBounds nodeBounds = nodePart.getNodeBounds();
      if (nodeBounds.isAutoLayout())
      {
        // need to add the node bounds to the persistence cache so that "revert" could work
        addNodeToPersistenceCache(nodePart);
        refreshDirtyState();
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.diagram.editor.DiagramNodePart

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.