Package org.jgraph.graph

Examples of org.jgraph.graph.CellView


      if (r.getHeight() < 1.0) {
        r.setFrame(r.getX(), r.getY(), r.getWidth(), 1.0);
      }
      // Iterate through cells and switch to active
      // if current is traversed. Cache first cell.
      CellView first = null;
      boolean active = (c == null);
      for (int i = 0; i < cells.length; i++) {
        if (cells[i] != null && (!leafsOnly || cells[i].isLeaf())
            && cells[i].intersects(this, r)) {
          // TODO: This behaviour is specific to selection and
View Full Code Here


    if (ports != null) {
      for (int i = ports.length - 1; i >= 0; i--)
        if (ports[i] != null && ports[i].intersects(this, r))
          return ports[i];
      if (isJumpToDefaultPort()) {
        CellView cellView = getNextViewAt(null, x, y, true);

        // Finds a non-edge cell under the mousepointer
        if (cellView != null && graphModel.isEdge(cellView.getCell())) {
          CellView nextView = getNextViewAt(cellView, x, y, true);
          while (nextView != cellView
              && graphModel.isEdge(nextView.getCell())) {
            nextView = getNextViewAt(nextView, x, y, true);
          }
          cellView = nextView;
        }
        if (cellView != null) {
View Full Code Here

  public PortView getDefaultPortForCell(Object cell) {
    if (cell != null && !getModel().isEdge(cell)) {
      int childCount = getModel().getChildCount(cell);
      for (int i = 0; i < childCount; i++) {
        Object childCell = getModel().getChild(cell, i);
        CellView child = getGraphLayoutCache().getMapping(childCell,
            false);
        if (child instanceof PortView) {
          Point2D offset = GraphConstants.getOffset(child
              .getAllAttributes());
          if (offset == null || childCount == 1)
            return (PortView) child;
        }
      }
View Full Code Here

   * returns a view for the cell then this method returns allAttributes,
   * otherwise the method returns model.getAttributes(cell).
   */
  public AttributeMap getAttributes(Object cell) {
    AttributeMap attrs;
    CellView cellView = getGraphLayoutCache().getMapping(cell, false);
    if (cellView != null) {
      attrs = cellView.getAllAttributes();
    } else {
      attrs = getModel().getAttributes(cell);
    }
    return attrs;
  }
View Full Code Here

   * @see #isEditable
   *
   */
  public boolean isCellEditable(Object cell) {
    if (cell != null) {
      CellView view = graphLayoutCache.getMapping(cell, false);
      if (view != null) {
        return isEditable()
            && GraphConstants.isEditable(view.getAllAttributes());
      }
    }
    return false;
  }
View Full Code Here

   *         <code>event</code> is null
   */
  public String getToolTipText(MouseEvent e) {
    if (e != null) {
      Object cell = getFirstCellForLocation(e.getX(), e.getY());
      CellView view = getGraphLayoutCache().getMapping(cell, false);
      if (view != null) {
        Component c = view.getRendererComponent(this, false, false,
            false);
        if (c instanceof JComponent) {
          Rectangle2D rect = getCellBounds(cell);
          Point2D where = fromScreen(e.getPoint());
          // Pass the event to the renderer in graph coordinates;
View Full Code Here

  }

    public CellView createView(GraphModel model, Object cell)
    {
     
        CellView view = null;
        if (cell instanceof DefaultPort) view = createPortView(cell);
        else if (model.isEdge(cell)) view = new ArcView(cell);
        else view = createVertexView(cell);
        // cm.putMapping(cell, view);
        // view.refresh(true); // Create Dependent Views
        view.update(editor.getGraph().getGraphLayoutCache());
        return view;
    }
View Full Code Here

  }

  // Determines if a Cell is a Group
  public boolean isGroup(Object cell) {
    // Map the Cell to its View
    CellView view = graph.getGraphLayoutCache().getMapping(cell, false);
    if (view != null)
      return !view.isLeaf();
    return false;
  }
View Full Code Here

   * This assumes that cell is valid and visible.
   */
  protected boolean startEditing(Object cell, MouseEvent event) {
    completeEditing();
    if (graph.isCellEditable(cell)) {
      CellView tmp = graphLayoutCache.getMapping(cell, false);
      cellEditor = tmp.getEditor();
      editingComponent = cellEditor.getGraphCellEditorComponent(graph,
          cell, graph.isCellSelected(cell));
      if (cellEditor.isCellEditable(event)) {
        Rectangle2D cellBounds = graph.getCellBounds(cell);

View Full Code Here

   * class).
   */
  protected Point2D getEditorLocation(Object cell, Dimension2D editorSize,
      Point2D pt) {
    // Edges have different editor position and size
    CellView view = graphLayoutCache.getMapping(cell, false);
    if (view instanceof EdgeView) {
      EdgeView edgeView = (EdgeView) view;
      CellViewRenderer renderer = edgeView.getRenderer();
      if (renderer instanceof EdgeRenderer) {
        Point2D tmp = ((EdgeRenderer) renderer)
View Full Code Here

TOP

Related Classes of org.jgraph.graph.CellView

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.