Package com.mxgraph.model

Examples of com.mxgraph.model.mxGraphModel$Filter


    List<Filter> keyFilters = new ArrayList<Filter>();
    if (query.hasFilter()) {
      keyFilters.add(query.getFilter());
    }
    if (lastKey != null) {
      Filter lowerBound = DatastoreHelper.makeFilter(DatastoreHelper.KEY_PROPERTY_NAME,
          PropertyFilter.Operator.GREATER_THAN_OR_EQUAL,
          DatastoreHelper.makeValue(lastKey)).build();
      keyFilters.add(lowerBound);
    }
    if (nextKey != null) {
      Filter upperBound = DatastoreHelper.makeFilter(DatastoreHelper.KEY_PROPERTY_NAME,
          PropertyFilter.Operator.LESS_THAN,
          DatastoreHelper.makeValue(nextKey)).build();
      keyFilters.add(upperBound);
    }
    return Query.newBuilder(query).setFilter(makeFilter(keyFilters)).build();
View Full Code Here


  /**
   * Constructs a new model codec.
   */
  public mxModelCodec()
  {
    this(new mxGraphModel());
  }
View Full Code Here

  protected void encodeObject(mxCodec enc, Object obj, Node node)
  {
    if (obj instanceof mxGraphModel)
    {
      Node rootNode = enc.document.createElement("root");
      mxGraphModel model = (mxGraphModel) obj;
      enc.encodeCell((mxICell) model.getRoot(), rootNode, true);
      node.appendChild(rootNode);
    }
  }
View Full Code Here

  public Node beforeDecode(mxCodec dec, Node node, Object into)
  {
    if (node instanceof Element)
    {
      Element elt = (Element) node;
      mxGraphModel model = null;

      if (into instanceof mxGraphModel)
      {
        model = (mxGraphModel) into;
      }
      else
      {
        model = new mxGraphModel();
      }

      // Reads the cells into the graph model. All cells
      // are children of the root element in the node.
      Node root = elt.getElementsByTagName("root").item(0);
      mxICell rootCell = null;

      if (root != null)
      {
        Node tmp = root.getFirstChild();

        while (tmp != null)
        {
          mxICell cell = dec.decodeCell(tmp, true);

          if (cell != null && cell.getParent() == null)
          {
            rootCell = cell;
          }

          tmp = tmp.getNextSibling();
        }

        root.getParentNode().removeChild(root);
      }

      // Sets the root on the model if one has been decoded
      if (rootCell != null)
      {
        model.setRoot(rootCell);
      }
    }

    return node;
  }
View Full Code Here

   * @param model Model that contains the graph data
   */
  public mxGraph(mxIGraphModel model, mxStylesheet stylesheet)
  {
    selectionModel = createSelectionModel();
    setModel((model != null) ? model : new mxGraphModel());
    setStylesheet((stylesheet != null) ? stylesheet : createStylesheet());
    setView(createGraphView());
  }
View Full Code Here

   * @param model Model that contains the graph data
   */
  public mxGraph(mxIGraphModel model, mxStylesheet stylesheet)
  {
    selectionModel = createSelectionModel();
    setModel((model != null) ? model : new mxGraphModel());
    setStylesheet((stylesheet != null) ? stylesheet : createStylesheet());
    setView(createGraphView());
  }
View Full Code Here

  public static boolean isCyclicUndirected(mxAnalysisGraph aGraph)
  {
    mxGraph graph = aGraph.getGraph();
    mxIGraphModel model = graph.getModel();
    Object[] cells = model.cloneCells(aGraph.getChildCells(graph.getDefaultParent(), true, true), true);
    mxGraphModel modelCopy = new mxGraphModel();
    mxGraph graphCopy = new mxGraph(modelCopy);
    Object parentCopy = graphCopy.getDefaultParent();
    graphCopy.addCells(cells);
    //    mxAnalysisGraph aGraphCopy = new mxAnalysisGraph(graphCopy, aGraph.getGenerator(), aGraph.getProperties());
    mxAnalysisGraph aGraphCopy = new mxAnalysisGraph();
View Full Code Here

  public static boolean isCyclicDirected(mxAnalysisGraph aGraph)
  {
    mxGraph graph = aGraph.getGraph();
    mxIGraphModel model = graph.getModel();
    Object[] cells = model.cloneCells(aGraph.getChildCells(graph.getDefaultParent(), true, true), true);
    mxGraphModel modelCopy = new mxGraphModel();
    mxGraph graphCopy = new mxGraph(modelCopy);
    Object parentCopy = graphCopy.getDefaultParent();
    graphCopy.addCells(cells);
    mxAnalysisGraph aGraphCopy = new mxAnalysisGraph();
    aGraphCopy.setGraph(graphCopy);
View Full Code Here

    mxIGraphModel model = graph.getModel();

    if (aGraph.getEdges(vertex, null, true, true, false, true).length >= 2)
    {
      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());
View Full Code Here

    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++;
        currEdge = edges[i];
        currSrcValue = Integer.parseInt((String) modelCopy.getValue(aGraphCopy.getTerminal(currEdge, true)));
        currDestValue = Integer.parseInt((String) modelCopy.getValue(aGraphCopy.getTerminal(currEdge, false)));
      }

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

TOP

Related Classes of com.mxgraph.model.mxGraphModel$Filter

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.