Examples of mxCell


Examples of com.mxgraph.model.mxCell

    for (Object vertex : vertexes)
    {
      List<mxGmlNode> Gmlnodes = gmlGraph.getNodes();

      mxCell v = (mxCell) vertex;
      String id = v.getId();

      mxGmlNode gmlNode = new mxGmlNode(id, null);
      addNodeData(gmlNode, v);
      Gmlnodes.add(gmlNode);
      gmlGraph.setNodes(Gmlnodes);
View Full Code Here

Examples of com.mxgraph.model.mxCell

      Object parent, mxGraph graph)
  {
    Object[] edges = graph.getChildEdges(parent);
    for (Object edge : edges)
    {
      mxCell e = (mxCell) edge;
      mxCell source = (mxCell) e.getSource();
      mxCell target = (mxCell) e.getTarget();

      String sourceName = "";
      String targetName = "";
      String sourcePort = "";
      String targetPort = "";
      sourceName = source != null ? source.getId() : "";
      targetName = target != null ? target.getId() : "";

      //Get the graph view that contains the states
      mxGraphView view = graph.getView();
      mxPoint sourceConstraint = null;
      mxPoint targetConstraint = null;
View Full Code Here

Examples of com.mxgraph.model.mxCell

  /**
   * Constructs a new cell codec.
   */
  public mxCellCodec()
  {
    this(new mxCell(), null, new String[] { "parent", "source", "target" },
        null);
  }
View Full Code Here

Examples of com.mxgraph.model.mxCell

   */
  public Node afterEncode(mxCodec enc, Object obj, Node node)
  {
    if (obj instanceof mxCell)
    {
      mxCell cell = (mxCell) obj;

      if (cell.getValue() instanceof Node)
      {
        // Wraps the graphical annotation up in the
        // user object (inversion) by putting the
        // result of the default encoding into
        // a clone of the user object (node type 1)
        // and returning this cloned user object.
        Element tmp = (Element) node;
        node = enc.getDocument().importNode((Node) cell.getValue(),
            true);
        node.appendChild(tmp);

        // Moves the id attribute to the outermost
        // XML node, namely the node which denotes
View Full Code Here

Examples of com.mxgraph.model.mxCell

  {
    Element inner = (Element) node;

    if (obj instanceof mxCell)
    {
      mxCell cell = (mxCell) obj;
      String classname = getName();
      String nodeName = node.getNodeName();
     
      // Handles aliased names
      if (!nodeName.equals(classname))
      {
        String tmp = mxCodecRegistry.aliases.get(nodeName);
       
        if (tmp != null)
        {
          nodeName = tmp;
        }
      }

      if (!nodeName.equals(classname))
      {
        // Passes the inner graphical annotation node to the
        // object codec for further processing of the cell.
        Node tmp = inner.getElementsByTagName(classname).item(0);

        if (tmp != null && tmp.getParentNode() == node)
        {
          inner = (Element) tmp;

          // Removes annotation and whitespace from node
          Node tmp2 = tmp.getPreviousSibling();

          while (tmp2 != null && tmp2.getNodeType() == Node.TEXT_NODE)
          {
            Node tmp3 = tmp2.getPreviousSibling();

            if (tmp2.getTextContent().trim().length() == 0)
            {
              tmp2.getParentNode().removeChild(tmp2);
            }

            tmp2 = tmp3;
          }

          // Removes more whitespace
          tmp2 = tmp.getNextSibling();

          while (tmp2 != null && tmp2.getNodeType() == Node.TEXT_NODE)
          {
            Node tmp3 = tmp2.getPreviousSibling();

            if (tmp2.getTextContent().trim().length() == 0)
            {
              tmp2.getParentNode().removeChild(tmp2);
            }

            tmp2 = tmp3;
          }

          tmp.getParentNode().removeChild(tmp);
        }
        else
        {
          inner = null;
        }

        // Creates the user object out of the XML node
        Element value = (Element) node.cloneNode(true);
        cell.setValue(value);
        String id = value.getAttribute("id");

        if (id != null)
        {
          cell.setId(id);
          value.removeAttribute("id");
        }
      }
      else
      {
        cell.setId(((Element) node).getAttribute("id"));
      }

      // Preprocesses and removes all Id-references
      // in order to use the correct encoder (this)
      // for the known references to cells (all).
View Full Code Here

Examples of com.mxgraph.model.mxCell

   * @param cells
   * @return Returns a new group cell.
   */
  public Object createGroupCell(Object[] cells)
  {
    mxCell group = new mxCell("", new mxGeometry(), null);
    group.setVertex(true);
    group.setConnectable(false);

    return group;
  }
View Full Code Here

Examples of com.mxgraph.model.mxCell

   */
  public Object createVertex(Object parent, String id, Object value,
      double x, double y, double width, double height, String style)
  {
    mxGeometry geometry = new mxGeometry(x, y, width, height);
    mxCell vertex = new mxCell(value, geometry, style);

    vertex.setId(id);
    vertex.setVertex(true);
    vertex.setConnectable(true);

    return vertex;
  }
View Full Code Here

Examples of com.mxgraph.model.mxCell

   * @return Returns the new edge to be inserted.
   */
  public Object createEdge(Object parent, String id, Object value,
      Object source, Object target, String style)
  {
    mxCell edge = new mxCell(value, new mxGeometry(), style);

    edge.setId(id);
    edge.setEdge(true);
    edge.getGeometry().setRelative(true);

    return edge;
  }
View Full Code Here

Examples of com.mxgraph.model.mxCell

    public Object createEdge(Object parent, String id, Object value,
        Object source, Object target, String style)
    {
      if (edgeTemplate != null)
      {
        mxCell edge = (mxCell) cloneCells(new Object[] { edgeTemplate })[0];
        edge.setId(id);

        return edge;
      }

      return super.createEdge(parent, id, value, source, target, style);
View Full Code Here

Examples of com.mxgraph.model.mxCell

    mxGeometry geometry = new mxGeometry(0, 0, width, height);
    geometry.setTerminalPoint(new mxPoint(0, height), true);
    geometry.setTerminalPoint(new mxPoint(width, 0), false);
    geometry.setRelative(true);

    mxCell cell = new mxCell(value, geometry, style);
    cell.setEdge(true);

    addTemplate(name, icon, cell);
  }
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.