Package com.mxgraph.model

Examples of com.mxgraph.model.mxCell


   */
 
  private int counter = 0;
 
  protected void moveShape(AbstractView<?> viewObject, Point localPoint) {
    mxCell cell = getCell(viewObject);
    if (cell != null) {
      modelGraph.moveCells(new Object[]{cell},
          localPoint.getX() - cell.getGeometry().getX(),
          localPoint.getY() - cell.getGeometry().getY());
      repaint(viewObject);
    }
    //asc: just for better visualization
    if(counter == 100){
      modelGraph.repaint();
View Full Code Here


   *
   * @param graphCell
   * @return
   */
  protected void updateShape(AbstractView<?> viewObject) {
    mxCell cell = getCell(viewObject);
    if (cell != null) {
      modelGraph.resizeCell(cell,
          new mxRectangle(viewObject.getX(), viewObject.getY(),
              viewObject.getWidth(), viewObject.getHeight()));
      repaint(viewObject);
View Full Code Here

  }
 


  protected Point2D getPositionOf(AbstractView<?> graphCell) {
    mxCell cell = getCell(graphCell);
    if (cell == null) {
      throw new IllegalStateException(
          "Cannot get position of cell - cell not part of the graphController: "
              + graphCell);
    }
    return cell.getGeometry().getPoint();
  }
View Full Code Here

  protected void addShape(AbstractView<?> graphCell) {
    mxGraphics2DCanvas.putShape(graphCell.getShapeName(), graphCell);

    Rectangle2D bounds = graphCell.getInitialBounds();
    mxCell cell = (mxCell) modelGraph.insertVertex(
        getZLevelLayer(graphCell.getZLevel()),
        graphCell.getShapeName(), graphCell, bounds.getX(),
        bounds.getY(), bounds.getWidth(), bounds.getHeight(),
        graphCell.getStyle());
    mapper.add(graphCell, cell);
View Full Code Here

   */
  protected void addEdges(AbstractView<?> way) {
    mxGraphics2DCanvas.putShape(way.getShapeName(), way);
    ArrayList<mxCell> edgeList = new ArrayList<mxCell>();
    for (EdgeModel e : way.getEdges()) {
      mxCell from = mapper.getFirstCell(e.getFromNode());
      mxCell to = mapper.getFirstCell(e.getToNode());
      if (from != null && to != null) {
        mxCell e1 = (mxCell) modelGraph.insertEdge(
            getZLevelLayer(way.getZLevel()), way.getShapeName(),
            way, from, to, way.getStyle());
        edgeList.add(e1);
      }
    }
View Full Code Here

    }
  }

  protected void addDecorationTo(AbstractView<?> view,
      AbstractButton decoration) {
    mxCell cell = mapper.getFirstCell(view.getModelElement());
    graphController.getComponent().addCellOverlay(cell, decoration);
  }
View Full Code Here

    graphController.getComponent().addCellOverlay(cell, decoration);
  }

  protected void removeDecorationFrom(AbstractView<?> view,
      AbstractButton decoration) {
    mxCell cell = mapper.getFirstCell(view.getModelElement());
    graphController.getComponent().removeCellOverlay(cell, decoration);
  }
View Full Code Here

    mxCell cell = mapper.getFirstCell(view.getModelElement());
    graphController.getComponent().removeCellOverlay(cell, decoration);
  }

  protected void removeDecorationFrom(AbstractView<?> view) {
    mxCell cell = mapper.getFirstCell(view.getModelElement());
    graphController.getComponent().removeCellOverlays(cell);
  }
View Full Code Here

      }

      @SuppressWarnings("unchecked")
      @Override
      public GraphicsView<ModelElement> getDraggedView(Point dragOrigin) {
        mxCell cell = (mxCell) graphView.getCellAt(dragOrigin.x, dragOrigin.y);

        if (isDragPossible(cell)) {
          return (GraphicsView<ModelElement>) cell.getValue();
        }
        return null;
      }

      @Override
View Full Code Here

   */
  public void onModelCleared() {
    // disconnect all signals
    final Object[] items = graphModel.items();
    for (final Object item : items) {
      mxCell cell = (mxCell) item;
      if (cell.getValue() instanceof Observable) {
        ((Observable) cell.getValue()).deleteObserver(this);
      }
    }

    itemsToUpdate.clear();
    graphModel.clear();
View Full Code Here

TOP

Related Classes of com.mxgraph.model.mxCell

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.