Package org.eclipse.sapphire.ui.swt.gef.model

Examples of org.eclipse.sapphire.ui.swt.gef.model.DiagramNodeModel


    }
    return false;
  }
 
  private GraphicalEditPart getNodeEditPart(EditPart part) {
    DiagramNodeModel nodeModel = ((ShapeModel)part.getModel()).getNodeModel();
    EditPart parentEditPart = part;
    while (parentEditPart != null) {
      if (nodeModel.equals(parentEditPart.getModel())) {
        return (GraphicalEditPart)parentEditPart;
      }
      parentEditPart = parentEditPart.getParent();
    }
    return (GraphicalEditPart) getCurrentViewer().getRootEditPart();
View Full Code Here


      DiagramNodePart nodePart = null;
      DiagramConnectionPart connPart = null;
      if (sapphirePart instanceof DiagramNodePart)
      {
        nodePart = (DiagramNodePart)sapphirePart;
        DiagramNodeModel nodeModel = this.getDiagramModel().getDiagramNodeModel(nodePart);
        editpartObj = viewer.getEditPartRegistry().get(nodeModel);
      }
      else if (sapphirePart instanceof ShapePart)
      {
        nodePart = sapphirePart.nearest(DiagramNodePart.class);
        DiagramNodeModel nodeModel = this.getDiagramModel().getDiagramNodeModel(nodePart);
        ShapeModel shapeModel = ShapeModelUtil.getChildShapeModel(nodeModel.getShapeModel(), (ShapePart)sapphirePart);
        editpartObj = viewer.getEditPartRegistry().get(shapeModel);
      }
      else if (sapphirePart instanceof DiagramConnectionPart)
      {
        connPart = (DiagramConnectionPart)sapphirePart;
View Full Code Here

  protected Command createChangeConstraintCommand(ChangeBoundsRequest request, EditPart child, Object constraint) {
    if (child instanceof DiagramNodeEditPart && constraint instanceof Rectangle) {     
      // Bug 382542 - Diagram: sometimes moving a node does not move context buttons
      // Hide the context buttons when moving a node
      this.presentation.getConfigurationManager().getDiagramEditor().getContextButtonManager().hideContextButtonsInstantly();
      DiagramNodeModel node = ((DiagramNodeEditPart)child).getCastedModel();
      return new MoveNodeCommand(node, (Rectangle)constraint);
    }
    return super.createChangeConstraintCommand(request, child, constraint);
  }
View Full Code Here

  @Override
  protected Command createDeleteCommand(GroupRequest deleteRequest) {
    Object child = getHost().getModel();
    if (child instanceof DiagramNodeModel) {
      DiagramNodeModel nodeModel = (DiagramNodeModel)child;
      return new DeleteNodeCommand(nodeModel.getNodePresentation());
    }
    return super.createDeleteCommand(deleteRequest);
  }
View Full Code Here

 
  @Override
  protected List<ShapeModel> getModelChildren()
  {
    List<ShapeModel> returnedModelChildren = new ArrayList<ShapeModel>();
    DiagramNodeModel nodeModel = (DiagramNodeModel)getModel();
    ShapeModel shapeModel = nodeModel.getShapeModel();
    if (shapeModel instanceof ContainerShapeModel)
    {
      ContainerShapeModel containerModel = (ContainerShapeModel)shapeModel;
      returnedModelChildren.addAll(ShapeModelUtil.collectActiveChildrenRecursively(containerModel));
    }
View Full Code Here

      nodeList.add(node);
    }
    List<DiagramConnectionModel> connections = diagramModel.getConnections();
    for (DiagramConnectionModel connection : connections)
    {
      DiagramNodeModel sourceNode = connection.getSourceNode();
      DiagramNodeModel targetNode = connection.getTargetNode();
      if (sourceNode != targetNode)
      {
        Edge edge = new Edge(connection, shapeToNode.get(sourceNode), shapeToNode.get(targetNode));
        edge.weight = 2;
        edge.data = connection;
View Full Code Here

    NodeList myNodes = new NodeList();
    myNodes.addAll(graph.nodes);
    for (Object object : myNodes)
    {
      Node node = (Node) object;
      DiagramNodeModel nodeModel = (DiagramNodeModel) node.data;
      DiagramNodePart nodePart = nodeModel.getModelPart();
      nodePart.setNodeBounds(node.x, node.y, autoLayout, false);
    }   
  }
View Full Code Here

    return cmd;
  }

  @Override
  protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    DiagramNodeModel source = (DiagramNodeModel) getHost().getModel();
    Object def = request.getNewObjectType();
    CreateConnectionCommand cmd = new CreateConnectionCommand(source, (IDiagramConnectionDef)def);
    request.setStartCommand(cmd);
    return cmd;
  }
View Full Code Here

    return cmd;
  }

  @Override
  protected Command getReconnectTargetCommand(ReconnectRequest request) {
    DiagramNodeModel newTarget = (DiagramNodeModel) getHost().getModel();
    DiagramConnectionEditPart editPart = (DiagramConnectionEditPart)request.getConnectionEditPart();
    ReconnectConnectionCommand cmd = new ReconnectConnectionCommand(editPart.getCastedModel());
    cmd.setNewTarget(newTarget);
    return cmd;
  }
View Full Code Here

    return cmd;
  }

  @Override
  protected Command getReconnectSourceCommand(ReconnectRequest request) {
    DiagramNodeModel newSource = (DiagramNodeModel) getHost().getModel();
    DiagramConnectionEditPart editPart = (DiagramConnectionEditPart)request.getConnectionEditPart();
    ReconnectConnectionCommand cmd = new ReconnectConnectionCommand(editPart.getCastedModel());
    cmd.setNewSource(newSource);
    return cmd;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.swt.gef.model.DiagramNodeModel

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.