Examples of CellView


Examples of org.jgraph.graph.CellView

  public Component getGraphCellEditorComponent(JGraph graph, Object cell,
      boolean isSelected) {
    Component component = super.getGraphCellEditorComponent(graph,
        cell, isSelected);
    // set the size of an editor to that of the view
    CellView view = graph.getGraphLayoutCache().getMapping(cell, false);
    Rectangle2D tmp = view.getBounds();
    editingComponent.setBounds((int) tmp.getX(), (int) tmp.getY(),
        (int) tmp.getWidth(), (int) tmp.getHeight());
    // I have to set a font here instead of in the
    // RealCellEditor.getGraphCellEditorComponent() because
    // I don't know what cell is being edited when in the
    // RealCellEditor.getGraphCellEditorComponent().
    Font font = GraphConstants.getFont(view.getAllAttributes());
    editingComponent.setFont((font != null) ? font : graph.getFont());
    return component;
  }
View Full Code Here

Examples of org.jgraph.graph.CellView

          if (document.getLength() > 0)
            document.remove(document.getLength() - 1, 1);

          // Workaround for the alignment not being serializable:
          // We use the label's alignment as the global alignment
          CellView view = graph.getGraphLayoutCache().getMapping(
              cell, false);
          if (view != null) {
            Map map = view.getAllAttributes();
            int align = GraphConstants
                .getHorizontalAlignment(map);
            SimpleAttributeSet sas = new SimpleAttributeSet();
            align = (align == JLabel.CENTER) ? StyleConstants.ALIGN_CENTER
                : (align == JLabel.RIGHT) ? StyleConstants.ALIGN_RIGHT
View Full Code Here

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

Examples of org.jgraph.graph.CellView

    }
    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

Examples of org.jgraph.graph.CellView

    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

Examples of org.jgraph.graph.CellView

    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

Examples of org.jgraph.graph.CellView

   * 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

Examples of org.jgraph.graph.CellView

   * 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

Examples of org.jgraph.graph.CellView

     * @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

Examples of org.jgraph.graph.CellView

      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
TOP
Copyright © 2018 www.massapi.com. 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.