Examples of mxChildChange


Examples of com.mxgraph.model.mxGraphModel.mxChildChange

      {
        break;
      }
      else if (change instanceof mxChildChange)
      {
        mxChildChange cc = (mxChildChange) change;

        if (cc.getParent() == null)
        {
          result.addAll(mxGraphModel.getDescendants(model,
              cc.getChild()));
        }
      }
      else if (change instanceof mxVisibleChange)
      {
        Object cell = ((mxVisibleChange) change).getCell();
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

      fireEvent(new mxEventObject(mxEvent.ROOT));
    }
    else if (change instanceof mxChildChange)
    {
      mxChildChange cc = (mxChildChange) change;

      // Repaints the parent area if it is a rendered cell (vertex or
      // edge) otherwise only the child area is repainted, same holds
      // if the parent and previous are the same object, in which case
      // only the child area needs to be repainted (change of order)
      if (!ignoreDirty)
      {
        if (cc.getParent() != cc.getPrevious())
        {
          if (model.isVertex(cc.getParent())
              || model.isEdge(cc.getParent()))
          {
            result = getBoundingBox(cc.getParent(), true, true);
          }

          if (model.isVertex(cc.getPrevious())
              || model.isEdge(cc.getPrevious()))
          {
            if (result != null)
            {
              result.add(getBoundingBox(cc.getPrevious(), true,
                  true));
            }
            else
            {
              result = getBoundingBox(cc.getPrevious(), true,
                  true);
            }
          }
        }

        if (result == null)
        {
          result = getBoundingBox(cc.getChild(), true, true);
        }
      }

      if (invalidate)
      {
        if (cc.getParent() != null)
        {
          view.clear(cc.getChild(), false, true);
        }
        else
        {
          removeStateForCell(cc.getChild());
        }
      }
    }
    else if (change instanceof mxTerminalChange)
    {
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

      {
        break;
      }
      else if (change instanceof mxChildChange)
      {
        mxChildChange cc = (mxChildChange) change;

        if (cc.getParent() == null)
        {
          result.addAll(mxGraphModel.getDescendants(model,
              cc.getChild()));
        }
      }
      else if (change instanceof mxVisibleChange)
      {
        Object cell = ((mxVisibleChange) change).getCell();
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

      fireEvent(new mxEventObject(mxEvent.ROOT));
    }
    else if (change instanceof mxChildChange)
    {
      mxChildChange cc = (mxChildChange) change;

      // Repaints the parent area if it is a rendered cell (vertex or
      // edge) otherwise only the child area is repainted, same holds
      // if the parent and previous are the same object, in which case
      // only the child area needs to be repainted (change of order)
      if (!ignoreDirty)
      {
        if (cc.getParent() != cc.getPrevious())
        {
          if (model.isVertex(cc.getParent())
              || model.isEdge(cc.getParent()))
          {
            result = getBoundingBox(cc.getParent(), true, true);
          }

          if (model.isVertex(cc.getPrevious())
              || model.isEdge(cc.getPrevious()))
          {
            if (result != null)
            {
              result.add(getBoundingBox(cc.getPrevious(), true,
                  true));
            }
            else
            {
              result = getBoundingBox(cc.getPrevious(), true,
                  true);
            }
          }
        }

        if (result == null)
        {
          result = getBoundingBox(cc.getChild(), true, true);
        }
      }

      if (invalidate)
      {
        if (cc.getParent() != null)
        {
          view.clear(cc.getChild(), false, true);
        }
        else
        {
          removeStateForCell(cc.getChild());
        }
      }
    }
    else if (change instanceof mxTerminalChange)
    {
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

    mxIGraphModel model = getGraph().getModel();
    Set<Object> result = new HashSet<Object>();

    if (change instanceof mxChildChange)
    {
      mxChildChange cc = (mxChildChange) change;
      Object parent = model.getParent(cc.getChild());

      if (cc.getChild() != null)
      {
        result.add(cc.getChild());
      }

      if (parent != null)
      {
        result.add(parent);
      }

      if (cc.getPrevious() != null)
      {
        result.add(cc.getPrevious());
      }
    }
    else if (change instanceof mxTerminalChange
        || change instanceof mxGeometryChange)
    {
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

  /**
   * Constructs a new model codec.
   */
  public mxChildChangeCodec()
  {
    this(new mxChildChange(), new String[] { "model", "child",
        "previousIndex" }, new String[] { "parent", "previous" }, null);
  }
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

  @Override
  public Node afterEncode(mxCodec enc, Object obj, Node node)
  {
    if (obj instanceof mxChildChange)
    {
      mxChildChange change = (mxChildChange) obj;
      Object child = change.getChild();

      if (isReference(obj, "child", child, true))
      {
        // Encodes as reference (id)
        mxCodec.setAttribute(node, "child", enc.getId(child));
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

   */
  public Node beforeDecode(mxCodec dec, Node node, Object into)
  {
    if (into instanceof mxChildChange)
    {
      mxChildChange change = (mxChildChange) into;

      if (node.getFirstChild() != null
          && node.getFirstChild().getNodeType() == Node.ELEMENT_NODE)
      {
        // Makes sure the original node isn't modified
        node = node.cloneNode(true);

        Node tmp = node.getFirstChild();
        change.setChild(dec.decodeCell(tmp, false));

        Node tmp2 = tmp.getNextSibling();
        tmp.getParentNode().removeChild(tmp);
        tmp = tmp2;

        while (tmp != null)
        {
          tmp2 = tmp.getNextSibling();

          if (tmp.getNodeType() == Node.ELEMENT_NODE)
          {
            // Ignores all existing cells because those do not need
            // to be re-inserted into the model. Since the encoded
            // version of these cells contains the new parent, this
            // would leave to an inconsistent state on the model
            // (ie. a parent change without a call to
            // parentForCellChanged).
            String id = ((Element) tmp).getAttribute("id");

            if (dec.lookup(id) == null)
            {
              dec.decodeCell(tmp, true);
            }
          }

          tmp.getParentNode().removeChild(tmp);
          tmp = tmp2;
        }
      }
      else
      {
        String childRef = ((Element) node).getAttribute("child");
        change.setChild((mxICell) dec.getObject(childRef));
      }
    }

    return node;
  }
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

  @Override
  public Object afterDecode(mxCodec dec, Node node, Object obj)
  {
    if (obj instanceof mxChildChange)
    {
      mxChildChange change = (mxChildChange) obj;

      // Cells are encoded here after a complete transaction so the previous
      // parent must be restored on the cell for the case where the cell was
      // added. This is needed for the local model to identify the cell as a
      // new cell and register the ID.
      ((mxICell) change.getChild()).setParent((mxICell) change
          .getPrevious());
      change.setPrevious(change.getParent());
      change.setPreviousIndex(change.getIndex());
    }

    return obj;
  }
View Full Code Here

Examples of com.mxgraph.model.mxGraphModel.mxChildChange

      {
        break;
      }
      else if (change instanceof mxChildChange)
      {
        mxChildChange cc = (mxChildChange) change;

        if (cc.getParent() == null)
        {
          result.addAll(mxGraphModel.getDescendants(model,
              cc.getChild()));
        }
      }
      else if (change instanceof mxVisibleChange)
      {
        Object cell = ((mxVisibleChange) change).getCell();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.