Package com.mxgraph.view

Examples of com.mxgraph.view.mxCellState


   * or outgoing. Default is false.
   */
  public Object getConstraint(Object key, Object cell, Object edge,
      boolean source)
  {
    mxCellState state = graph.getView().getState(cell);
    Map<String, Object> style = (state != null) ? state.getStyle() : graph
        .getCellStyle(cell);

    return (style != null) ? style.get(key) : null;
  }
View Full Code Here


    // Checks for oversize label bounding box and corrects
    // the return value accordingly
    if (useBoundingBox)
    {
      mxCellState state = graph.getView().getState(vertex);

      if (state != null)
      {
        double scale = graph.getView().getScale();
        mxRectangle tmp = state.getBoundingBox();

        double dx0 = (tmp.getX() - state.getX()) / scale;
        double dy0 = (tmp.getY() - state.getY()) / scale;
        double dx1 = (tmp.getX() + tmp.getWidth() - state.getX() - state
            .getWidth()) / scale;
        double dy1 = (tmp.getY() + tmp.getHeight() - state.getY() - state
            .getHeight()) / scale;

        geo = new mxRectangle(geo.getX() + dx0, geo.getY() + dy0,
            geo.getWidth() - dx0 + dx1, geo.getHeight() + -dy0
                + dy1);
View Full Code Here

      mxGraphView graphView = graph.getView();

      // Checks for oversize labels and offset the result
      if (useBoundingBox)
      {
        mxCellState state = graphView.getState(vertex);

        if (state != null)
        {
          double scale = graph.getView().getScale();
          mxRectangle box = state.getBoundingBox();

          if (state.getBoundingBox().getX() < state.getX())
          {
            x += (state.getX() - box.getX()) / scale;
            result.setWidth(box.getWidth());
          }
          if (state.getBoundingBox().getY() < state.getY())
          {
            y += (state.getY() - box.getY()) / scale;
            result.setHeight(box.getHeight());
          }
        }
      }
View Full Code Here

    int childCount = model.getChildCount(parent);

    for (int i = 0; i < childCount; i++)
    {
      Object cell = model.getChildAt(parent, i);
      mxCellState state = view.getState(cell);

      if (state != null)
      {
        if (!isVertexIgnored(cell))
        {
View Full Code Here

    model.beginUpdate();
    try
    {
      for (int i = 0; i < e.length; i++)
      {
        mxCellState edge = (mxCellState) e[i];

        if (edge != null && edge.getLabelBounds() != null)
        {
          for (int j = 0; j < v.length; j++)
          {
            mxCellState vertex = (mxCellState) v[j];

            if (vertex != null)
            {
              avoid(edge, vertex);
            }
View Full Code Here

    for (int i = 0; i < childNum; i++)
    {
      Object currVertex = vertices[i];

      vertexValue = (int) costFunction.getCost(new mxCellState(view, currVertex, null));

      if (vertexValue == value)
      {
        return currVertex;
      }
View Full Code Here

      aGraphCopy.setGraph(graphCopy);
      aGraphCopy.setGenerator(aGraph.getGenerator());
      aGraphCopy.setProperties(aGraph.getProperties());

      Object newVertex = getVertexWithValue(aGraphCopy,
          (int) aGraph.getGenerator().getCostFunction().getCost(new mxCellState(graph.getView(), vertex, null)));

      graphCopy.removeCells(new Object[] { newVertex }, true);
      Object[][] oldComponents = getGraphComponents(aGraph);
      Object[][] newComponents = getGraphComponents(aGraphCopy);
View Full Code Here

    mxGraph graph = aGraph.getGraph();
    mxIGraphModel model = graph.getModel();
    mxCostFunction costFunction = aGraph.getGenerator().getCostFunction();
    mxGraphView view = graph.getView();

    int srcValue = (int) costFunction.getCost(new mxCellState(view, aGraph.getTerminal(edge, true), null));
    int destValue = (int) costFunction.getCost(new mxCellState(view, aGraph.getTerminal(edge, false), null));

    if (aGraph.getTerminal(edge, false) != null || aGraph.getTerminal(edge, true) != null)
    {
      Object[] cells = model.cloneCells(aGraph.getChildCells(graph.getDefaultParent(), true, true), true);
      mxGraphModel modelCopy = new mxGraphModel();
      mxGraph graphCopy = new mxGraph(modelCopy);
      graphCopy.addCells(cells);
      mxAnalysisGraph aGraphCopy = new mxAnalysisGraph();
      aGraphCopy.setGraph(graphCopy);
      aGraphCopy.setGenerator(aGraph.getGenerator());
      aGraphCopy.setProperties(aGraph.getProperties());

      Object[] edges = aGraphCopy.getChildEdges(aGraphCopy.getGraph().getDefaultParent());
      Object currEdge = edges[0];
      mxCostFunction costFunctionCopy = aGraphCopy.getGenerator().getCostFunction();
      mxGraphView viewCopy = graphCopy.getView();

      int currSrcValue = (int) costFunctionCopy.getCost(new mxCellState(viewCopy, aGraphCopy.getTerminal(currEdge, true), null));
      int currDestValue = (int) costFunctionCopy.getCost(new mxCellState(viewCopy, aGraphCopy.getTerminal(currEdge, false), null));
      int i = 0;

      while (currSrcValue != srcValue || currDestValue != destValue)
      {
        i++;
View Full Code Here

    {
      int i = 0;
      double last = 0;
      int childCount = model.getChildCount(parent);
      double value = (horizontal) ? x : y;
      mxCellState pstate = graph.getView().getState(parent);

      if (pstate != null)
      {
        value -= (horizontal) ? pstate.getX() : pstate.getY();
      }

      for (i = 0; i < childCount; i++)
      {
        Object child = model.getChildAt(parent, i);
View Full Code Here

   *
   */
  protected String getEdgeId(Object edge)
  {
    mxGraphView view = graph.getView();
    mxCellState state = view.getState(edge);
    Object src = (state != null) ? state.getVisibleTerminal(true) : view
        .getVisibleTerminal(edge, true);
    Object trg = (state != null) ? state.getVisibleTerminal(false) : view
        .getVisibleTerminal(edge, false);

    if (src instanceof mxICell && trg instanceof mxICell)
    {
      String srcId = mxCellPath.create((mxICell) src);
View Full Code Here

TOP

Related Classes of com.mxgraph.view.mxCellState

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.