Package net.sf.graphiti.ui.editparts

Examples of net.sf.graphiti.ui.editparts.VertexEditPart


public class DeleteComponentEditPolicy extends ComponentEditPolicy {

  @Override
  protected Command createDeleteCommand(GroupRequest deleteRequest) {
    if (getHost() instanceof VertexEditPart) {
      VertexEditPart part = (VertexEditPart) getHost();
      List<?> incoming = part.getSourceConnections();
      List<?> outgoing = part.getTargetConnections();
      if (!incoming.isEmpty() || !outgoing.isEmpty()) {
        CompoundCommand compound = new CompoundCommand();
        for (Object obj : incoming) {
          DeleteCommand command = new DeleteCommand(
              ((EdgeEditPart) obj).getModel());
View Full Code Here


    CellEditor editor = request.getCellEditor();
    editor.setValidator(new ICellEditorValidator() {

      @Override
      public String isValid(Object value) {
        VertexEditPart part = (VertexEditPart) getHost();
        Vertex vertex = (Vertex) part.getModel();
        Graph graph = vertex.getParent();

        String vertexId = (String) value;
        if (vertexId.isEmpty()) {
          return "";
View Full Code Here

  protected Command createChangeConstraintCommand(EditPart child,
      Object constraint) {
    VertexMoveCommand command = null;

    if (child instanceof VertexEditPart) {
      VertexEditPart editPart = (VertexEditPart) child;
      Vertex vertex = (Vertex) editPart.getModel();

      command = new VertexMoveCommand(vertex, (Rectangle) constraint);
    }

    return command;
View Full Code Here

  @Override
  protected Command getConnectionCompleteCommand(
      CreateConnectionRequest request) {
    EdgeCreateCommand command = (EdgeCreateCommand) request
        .getStartCommand();
    VertexEditPart vertexEditPart = (VertexEditPart) request
        .getTargetEditPart();
    command.setTarget((Vertex) (vertexEditPart.getModel()));
    return command;
  }
View Full Code Here

  @Override
  protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    EdgeCreateCommand command = new EdgeCreateCommand((Edge) request
        .getNewObject());
    VertexEditPart vertexEditPart = (VertexEditPart) request
        .getTargetEditPart();
    command.setSource((Vertex) (vertexEditPart.getModel()));
    request.setStartCommand(command);
    return command;
  }
View Full Code Here

  @Override
  protected Command getReconnectSourceCommand(ReconnectRequest request) {
    EdgeReconnectCommand command = new EdgeReconnectCommand();
    command.setOriginalEdge((Edge) request.getConnectionEditPart()
        .getModel());
    VertexEditPart vertexEditPart = (VertexEditPart) getHost();
    command.setSource((Vertex) vertexEditPart.getModel());
    return command;
  }
View Full Code Here

  @Override
  protected Command getReconnectTargetCommand(ReconnectRequest request) {
    EdgeReconnectCommand command = new EdgeReconnectCommand();
    command.setOriginalEdge((Edge) request.getConnectionEditPart()
        .getModel());
    VertexEditPart vertexEditPart = (VertexEditPart) getHost();
    command.setTarget((Vertex) vertexEditPart.getModel());
    return command;
  }
View Full Code Here

  public void execute() {
    // copy vertices
    List<Vertex> vertices = new ArrayList<Vertex>();
    for (Object obj : list) {
      if (obj instanceof VertexEditPart) {
        VertexEditPart vertexEditPart = (VertexEditPart) obj;
        Vertex vertex = (Vertex) vertexEditPart.getModel();

        // copy vertex and add to list
        vertex = new Vertex(vertex);
        vertices.add(vertex);
      }
View Full Code Here

  public void setSelection(ISelection selection) {
    vertex = null;
    if (selection instanceof IStructuredSelection) {
      Object obj = ((IStructuredSelection) selection).getFirstElement();
      if (obj instanceof VertexEditPart) {
        VertexEditPart part = (VertexEditPart) obj;
        vertex = (Vertex) part.getModel();
        policy = vertex.getConfiguration().getRefinementPolicy();
      }
    }
  }
View Full Code Here

    parents = new ArrayList<Graph>();
    List<Vertex> vertices = new ArrayList<Vertex>();

    for (Object obj : list) {
      if (obj instanceof VertexEditPart) {
        VertexEditPart part = (VertexEditPart) obj;
        Vertex vertex = (Vertex) part.getModel();

        // remove from parent
        Graph parent = vertex.getParent();
        parent.removeVertex(vertex);
View Full Code Here

TOP

Related Classes of net.sf.graphiti.ui.editparts.VertexEditPart

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.