Package org.jgraph.graph

Examples of org.jgraph.graph.CellView


      if (ignoresHiddenCells && graphLayoutCache != null) {

        // If only visible cells should be returned
        // we check if there is a cell view for the cell
        // and return if based on it's isLeaf property.
        CellView view = graphLayoutCache.getMapping(cell, false);
        if (view != null) {
          // Root cell views have no parent view
          if (ignoresCellsInGroups) {
            return (view.getParentView() == null);
          } else {
            return true;
          }
        }
        return false;
View Full Code Here


    }
    if (ignoresHiddenCells && graphLayoutCache != null) {
      if (!model.isEdge(cell)) {
        return false;
      }
      CellView view = graphLayoutCache.getMapping(cell, false);
      if (view != null) {
        if (ignoresCellsInGroups) {
          return view.isLeaf() && view.getParentView() == null;
        } else {
          return view.isLeaf();
        }
      }
      return false;
    } else {
      // Returns false if we find a child that is not a port
View Full Code Here

    if (map == null) {

      // First tries to get a view for the cell. If no view is available
      // tries to get the attributes from the model. Then stores a local
      // clone and associate it with the cell for future reference.
      CellView view = null;
      // Treat the bounds as a special case. If available, get the bounds
      // from the view, since this will return the correct bounds for
      // group cells
      Rectangle2D bounds = null;
      if (graphLayoutCache != null) {
        view = graphLayoutCache.getMapping(cell, false);
      }
      if (view != null) {
        map = view.getAllAttributes();
        bounds = (Rectangle2D)view.getBounds().clone();
      }
      if (map == null)
        map = model.getAttributes(cell);
      if (map != null) {
        map = (AttributeMap) map.clone();
View Full Code Here

    if (cells != null && cells.length > 0) {
      Rectangle2D ret = null;
      Rectangle2D r = null;
      for (int i = 0; i < cells.length; i++) {
        if (graphLayoutCache != null) {
          CellView view = graphLayoutCache.getMapping(cells[i], false);
          if (view != null) {
            r = view.getBounds();
          }
        } else if (model != null) {
          Map attributes = model.getAttributes(cells[i]);
          if (attributes != null) {
            r = GraphConstants.getBounds(attributes);
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

     * @param cell
     * @return boolean
     */
    public boolean isGroup(Object cell)
    {
        CellView view = getGraphLayoutCache().getMapping(cell, false);
        if (view != null) return !view.isLeaf();
        return false;
    }
View Full Code Here

      boolean leafsOnly) {
    Rectangle2D r = new Rectangle2D.Double(x, y, 1, 1);
    Object[] cells = getDescendants(getRoots());
    for (int i = (reverse) ? cells.length - 1 : 0; i >= 0
        && i < cells.length; i += (reverse) ? -1 : +1) {
      CellView view = getGraphLayoutCache().getMapping(cells[i], false);
      if (view != null
          && (!leafsOnly || view.isLeaf())
          && ((view.isLeaf() && view.intersects(this, r)) || (!view
              .isLeaf() && view.getBounds().contains(x, y))))
        return view;
    }
    return null;
  }
View Full Code Here

   * <code>current</code> cell. Returns the topmost cell if there are no
   * more cells behind <code>current</code>. Note: This does only return
   * visible cells.
   */
  public Object getNextCellForLocation(Object current, double x, double y) {
    CellView cur = graphLayoutCache.getMapping(current, false);
    CellView cell = getNextViewAt(cur, x, y);
    if (cell != null)
      return cell.getCell();
    return null;
  }
View Full Code Here

  /**
   * Returns the bounding rectangle of the specified cell.
   */
  public Rectangle2D getCellBounds(Object cell) {
    CellView view = graphLayoutCache.getMapping(cell, false);
    if (view != null)
      return view.getBounds();
    return null;
  }
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.