Package org.jgraph.graph

Examples of org.jgraph.graph.CellView


    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 = getLeafViewAt(x, y);
        if (cellView != null) {
          PortView defaultPort = getDefaultPortForCell(cellView
              .getCell());
          if (defaultPort != null)
            return defaultPort;
        }
      }
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

   * Converts the specified value to string. If the value is an instance of
   * CellView then the corresponding value or cell is used.
   */
  public String convertValueToString(Object value) {
    if (value instanceof CellView) {
      CellView view = (CellView) value;
      Object newValue = GraphConstants.getValue(view.getAllAttributes());
      if (newValue != null)
        value = newValue;
      else
        value = view.getCell();
    }
    return String.valueOf(value);
  }
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

    if (edgeView.getSource() instanceof PortView) {
      from = ((PortView) edgeView.getSource()).getLocation();

    }
    Point2D to = edgeView.getPoint(n - 1);
    CellView trg = edgeView.getTarget();
    if (trg instanceof PortView) {

      to = ((PortView) trg).getLocation();
    }
View Full Code Here

      Point2D point = mediator.fromScreen(new Point(e.getPoint()));
      if (!(ml.getFocus() != null && ml.getFocus().intersects(mediator.getGraph(), r))) {
        ml.setFocus(null);
      }
      // Avoid toggling of selection between inner components and blocking region
      CellView next = mediator.getNextViewAt(ml.getFocus(), point.getX(), point.getY());
      if (next != null && next.getCell() != null) {
        if (!(ml.getFocus() != null && next.getCell() instanceof BlockingRegion)) {
          ml.setCell(next);
        }
      }
      if (ml.getFocus() == null) {
        ml.setFocus(ml.getCell());
View Full Code Here

              Xmax[i] = new Integer((int) rett.getMaxX());
              Ymax[i] = new Integer((int) rett.getMaxY());
              moved = true;
            }
            if (cells[i] instanceof BlockingRegion) {
              CellView groupview = (graphtmp.getGraphLayoutCache()).getMapping(cells[i], false);
              Rectangle2D rett2 = groupview.getBounds();

              Object[] celgru = new Object[1];
              celgru[0] = cells[i];
              //celle presenti nel blocking region incluse port e regione
View Full Code Here

    public IconGraph(GraphModel model) {
      super(model);
      getGraphLayoutCache().setAutoSizeOnValueChange(true);
      getGraphLayoutCache().setFactory(new DefaultCellViewFactory() {
        public CellView createView(GraphModel model, Object c) {
          CellView view = null;
          if (c instanceof CustomCell) {
            return new JGraphIconView(c);
          } else if (c instanceof Port) {
            view = new InvisiblePortView(c);
          } else {
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.