Package net.sf.graphiti.ui.figure

Examples of net.sf.graphiti.ui.figure.VertexFigure


    width = 16;
    height = (int) (width / ratio);

    // Creates a new vertex figure
    Font font = Display.getDefault().getSystemFont();
    VertexFigure figure = new VertexFigure(font, new Dimension(width,
        height), color, shape);

    // Creates a new image of width x height on the current display
    Image image = new Image(Display.getCurrent(), width, height);

    // Paints the figure on it
    GC gc = new GC(image);
    Graphics graphics = new SWTGraphics(gc);
    figure.paint(graphics);

    // Get the image data back
    ImageData data = image.getImageData();
    ImageDescriptor id = ImageDescriptor.createFromImageData(data);
View Full Code Here


      VertexRenameCommand cmd = new VertexRenameCommand(vertex);
      cmd.setName((String) editor.getValue());
      return cmd;
    } else {
      String id = (String) vertex.getValue(ObjectType.PARAMETER_ID);
      VertexFigure figure = (VertexFigure) getHostFigure();
      figure.getLabelId().setText(id);
      figure.adjustSize();
      return null;
    }
  }
View Full Code Here

  }

  @Override
  protected void showCurrentEditValue(DirectEditRequest request) {
    String value = (String) request.getCellEditor().getValue();
    VertexFigure figure = (VertexFigure) getHostFigure();
    figure.getLabelId().setText(value);
    figure.adjustSize();
  }
View Full Code Here

    String name = (String) vertex.getAttribute(ObjectType.ATTRIBUTE_SHAPE);
    IShape shape = ShapeFactory.createShape(name);

    // Creates the figure with the specified properties, sets its id
    Font font = ((GraphicalEditPart) getParent()).getFigure().getFont();
    VertexFigure figure = new VertexFigure(font, dimension, color, shape);
    String id = (String) vertex.getValue(ObjectType.PARAMETER_ID);
    figure.setId(id);

    // update the figure position (if the graph has layout information)
    if ((Boolean) vertex.getParent().getValue(Graph.PROPERTY_HAS_LAYOUT)) {
      Rectangle bounds = (Rectangle) vertex
          .getValue(Vertex.PROPERTY_SIZE);
      if (bounds != null) {
        figure.setBounds(bounds);
      }
    }

    // update its size
    updatePorts(figure);
View Full Code Here

  }

  @Override
  public ConnectionAnchor getSourceConnectionAnchor(
      ConnectionEditPart connection) {
    VertexFigure figure = (VertexFigure) getFigure();
    Edge edge = (Edge) connection.getModel();
    Connection conn = (Connection) connection.getFigure();
    return figure.getSourceAnchor(edge, conn);
  }
View Full Code Here

    return figure.getSourceAnchor(edge, conn);
  }

  @Override
  public ConnectionAnchor getSourceConnectionAnchor(Request request) {
    VertexFigure figure = (VertexFigure) getFigure();
    return figure.getSourceAnchor();
  }
View Full Code Here

  }

  @Override
  public ConnectionAnchor getTargetConnectionAnchor(
      ConnectionEditPart connection) {
    VertexFigure figure = (VertexFigure) getFigure();
    Edge edge = (Edge) connection.getModel();
    Connection conn = (Connection) connection.getFigure();
    return figure.getTargetAnchor(edge, conn);
  }
View Full Code Here

    return figure.getTargetAnchor(edge, conn);
  }

  @Override
  public ConnectionAnchor getTargetConnectionAnchor(Request request) {
    VertexFigure figure = (VertexFigure) getFigure();
    return figure.getTargetAnchor();
  }
View Full Code Here

  @Override
  public void performRequest(Request request) {
    if (request.getType() == REQ_DIRECT_EDIT) {
      if (directEditManager == null) {
        VertexFigure figure = (VertexFigure) getFigure();
        directEditManager = new VertexDirectEditManager(this, figure);
      }
      directEditManager.show();
    } else if (request.getType() == REQ_OPEN) {
      Command command = getCommand(request);
View Full Code Here

  }

  public void propertyChange(PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName();
    if (propertyName.equals(Vertex.PROPERTY_SIZE)) {
      VertexFigure vertexFigure = (VertexFigure) getFigure();
      vertexFigure.setBounds((Rectangle) evt.getNewValue());
      refresh();
    } else if (propertyName.equals(Vertex.PROPERTY_SRC_VERTEX)) {
      updatePorts(getFigure());
      // refresh will cause target anchor to be rightly put
      refresh();
View Full Code Here

TOP

Related Classes of net.sf.graphiti.ui.figure.VertexFigure

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.