Package org.jgraph.graph

Examples of org.jgraph.graph.CellView


    protected Point2D getInitialLocation(Object[] cells) {
      if (cells != null && cells.length > 0) {
        Rectangle2D ret = null;
        for (int i = 0; i < cells.length; i++) {
          if (graphModel.isEdge(cells[i])) {
            CellView cellView = graphLayoutCache.getMapping(
                cells[i], false);
            if (cellView instanceof EdgeView) {
              EdgeView edgeView = (EdgeView) cellView;
              if (edgeView.getSource() == null) {
                Point2D pt = edgeView.getPoint(0);
View Full Code Here


        }
        if (views != null) { // Start Move if over cell
          Point2D screenPoint = event.getPoint();
          Point2D pt = graph
              .fromScreen((Point2D) screenPoint.clone());
          CellView view = findViewForPoint(pt);
          if (view != null) {
            if (snapSelectedView) {
              Rectangle2D bounds = view.getBounds();
              start = graph.toScreen(new Point2D.Double(bounds
                  .getX(), bounds.getY()));
              snapStart = graph.snap((Point2D) start.clone());
              _mouseToViewDelta_x = screenPoint.getX()
                  - start.getX();
View Full Code Here

     * Used for move into group to find the target group.
     */
    protected CellView findUnselectedInnermostGroup(double x, double y) {
      Object[] cells = graph.getDescendants(graph.getRoots());
      for (int i = cells.length - 1; i >= 0; i--) {
        CellView view = graph.getGraphLayoutCache().getMapping(
            cells[i], false);
        if (view != null && !view.isLeaf()
            && !context.contains(view.getCell())
            && view.getBounds().contains(x, y))
          return view;
      }
      return null;
    }
View Full Code Here

              if (constrained && cachedBounds == null) {
                // Reset Initial Positions
                CellView[] all = graphLayoutCache
                    .getAllDescendants(views);
                for (int i = 0; i < all.length; i++) {
                  CellView orig = graphLayoutCache
                      .getMapping(all[i].getCell(), false);
                  AttributeMap attr = orig.getAllAttributes();
                  all[i].changeAttributes((AttributeMap) attr
                      .clone());
                  all[i].refresh(graph.getModel(), context,
                      false);
                }
View Full Code Here

              Map hiddenMapping = graphLayoutCache
                  .getHiddenMapping();
              for (int i = 0; i < cells.length; i++) {
                Object witness = attributes.get(cells[i]);
                if (witness == null) {
                  CellView view = (CellView) hiddenMapping
                      .get(cells[i]);
                  if (view != null
                      && !graphModel.isPort(view
                          .getCell())) {
                    // TODO: Clone required? Same in
                    // GraphConstants.
                    AttributeMap attrs = (AttributeMap) view
                        .getAllAttributes().clone();
                    // Maybe translate?
                    // attrs.translate(dx, dy);
                    attributes.put(cells[i], attrs.clone());
                  }
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

      Component component = super.getGraphCellEditorComponent(graph,
          cell, isSelected);

      // set the size of an editor to that of a 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

        return editorComponent.getText();
      }

      public boolean stopCellEditing() {
        // set the size of a vertex to that of an editor.
        CellView view = graph.getGraphLayoutCache().getMapping(
            graph.getEditingCell(), false);
        Map map = view.getAllAttributes();
        Rectangle2D cellBounds = GraphConstants.getBounds(map);
        Rectangle editingBounds = editorComponent.getBounds();
        GraphConstants.setBounds(map, new Rectangle((int) cellBounds
            .getX(), (int) cellBounds.getY(), editingBounds.width,
            editingBounds.height));
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.