maxGraph/java/docs/com/mxgraph/io/mxCodec.html

870 lines
33 KiB
HTML

<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.5) on Tue Mar 31 13:43:30 UTC 2020 -->
<title>mxCodec (mxGraph 4.1.1 API Specification)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2020-03-31">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="mxCodec (mxGraph 4.1.1 API Specification)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":9,"i17":10,"i18":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/mxCodec.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><p><b>mxGraph 4.1.1</b></p></div>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">com.mxgraph.io</a></div>
<h2 title="Class mxCodec" class="title">Class mxCodec</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.mxgraph.io.mxCodec</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public class <span class="typeNameLabel">mxCodec</span>
extends java.lang.Object</pre>
<div class="block">XML codec for Java object graphs. In order to resolve forward references
when reading files the XML document that contains the data must be passed
to the constructor.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected org.w3c.dom.Document</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#document">document</a></span></code></th>
<td class="colLast">
<div class="block">Holds the owner document of the codec.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected java.util.Map&lt;java.lang.String,&#8203;org.w3c.dom.Node&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#elements">elements</a></span></code></th>
<td class="colLast">
<div class="block">Maps from IDs to elements.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#encodeDefaults">encodeDefaults</a></span></code></th>
<td class="colLast">
<div class="block">Specifies if default values should be encoded.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#objects">objects</a></span></code></th>
<td class="colLast">
<div class="block">Maps from IDs to objects.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">mxCodec</a></span>()</code></th>
<td class="colLast">
<div class="block">Constructs an XML encoder/decoder with a new owner document.</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.w3c.dom.Document)">mxCodec</a></span>&#8203;(org.w3c.dom.Document&nbsp;document)</code></th>
<td class="colLast">
<div class="block">Constructs an XML encoder/decoder for the specified owner document.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addElement(org.w3c.dom.Node)">addElement</a></span>&#8203;(org.w3c.dom.Node&nbsp;node)</code></th>
<td class="colLast">
<div class="block">Adds the given element to <elements> if it has an ID.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#decode(org.w3c.dom.Node)">decode</a></span>&#8203;(org.w3c.dom.Node&nbsp;node)</code></th>
<td class="colLast">
<div class="block">Decodes the given XML node using <a href="#decode(org.w3c.dom.Node,java.lang.Object)"><code>decode(Node, Object)</code></a>.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#decode(org.w3c.dom.Node,java.lang.Object)">decode</a></span>&#8203;(org.w3c.dom.Node&nbsp;node,
java.lang.Object&nbsp;into)</code></th>
<td class="colLast">
<div class="block">Decodes the given XML node.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../model/mxICell.html" title="interface in com.mxgraph.model">mxICell</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#decodeCell(org.w3c.dom.Node,boolean)">decodeCell</a></span>&#8203;(org.w3c.dom.Node&nbsp;node,
boolean&nbsp;restoreStructures)</code></th>
<td class="colLast">
<div class="block">Decodes cells that have been encoded using inversion, ie.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>org.w3c.dom.Node</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#encode(java.lang.Object)">encode</a></span>&#8203;(java.lang.Object&nbsp;obj)</code></th>
<td class="colLast">
<div class="block">Encodes the specified object and returns the resulting XML node.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#encodeCell(com.mxgraph.model.mxICell,org.w3c.dom.Node,boolean)">encodeCell</a></span>&#8203;(<a href="../model/mxICell.html" title="interface in com.mxgraph.model">mxICell</a>&nbsp;cell,
org.w3c.dom.Node&nbsp;node,
boolean&nbsp;includeChildren)</code></th>
<td class="colLast">
<div class="block">Encoding of cell hierarchies is built-into the core, but is a
higher-level function that needs to be explicitely used by the
respective object encoders (eg.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>org.w3c.dom.Document</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getDocument()">getDocument</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the owner document of the codec.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>org.w3c.dom.Node</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getElementById(java.lang.String)">getElementById</a></span>&#8203;(java.lang.String&nbsp;id)</code></th>
<td class="colLast">
<div class="block">Returns the element with the given ID from the document.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getId(java.lang.Object)">getId</a></span>&#8203;(java.lang.Object&nbsp;obj)</code></th>
<td class="colLast">
<div class="block">Returns the ID of the specified object.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getObject(java.lang.String)">getObject</a></span>&#8203;(java.lang.String&nbsp;id)</code></th>
<td class="colLast">
<div class="block">Returns the decoded object for the element with the specified ID in
<a href="#document"><code>document</code></a>.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getObjects()">getObjects</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns the object lookup table.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insertIntoGraph(com.mxgraph.model.mxICell)">insertIntoGraph</a></span>&#8203;(<a href="../model/mxICell.html" title="interface in com.mxgraph.model">mxICell</a>&nbsp;cell)</code></th>
<td class="colLast">
<div class="block">Inserts the given cell into its parent and terminal cells.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEncodeDefaults()">isEncodeDefaults</a></span>()</code></th>
<td class="colLast">
<div class="block">Returns if default values of member variables should be encoded.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#lookup(java.lang.String)">lookup</a></span>&#8203;(java.lang.String&nbsp;id)</code></th>
<td class="colLast">
<div class="block">Hook for subclassers to implement a custom lookup mechanism for cell IDs.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#putObject(java.lang.String,java.lang.Object)">putObject</a></span>&#8203;(java.lang.String&nbsp;id,
java.lang.Object&nbsp;object)</code></th>
<td class="colLast">
<div class="block">Assoiates the given object with the given ID.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#reference(java.lang.Object)">reference</a></span>&#8203;(java.lang.Object&nbsp;obj)</code></th>
<td class="colLast">
<div class="block">Hook for subclassers to implement a custom method for retrieving IDs from
objects.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setAttribute(org.w3c.dom.Node,java.lang.String,java.lang.Object)">setAttribute</a></span>&#8203;(org.w3c.dom.Node&nbsp;node,
java.lang.String&nbsp;attribute,
java.lang.Object&nbsp;value)</code></th>
<td class="colLast">
<div class="block">Sets the attribute on the specified node to value.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setDocument(org.w3c.dom.Document)">setDocument</a></span>&#8203;(org.w3c.dom.Document&nbsp;value)</code></th>
<td class="colLast">
<div class="block">Sets the owner document of the codec.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setEncodeDefaults(boolean)">setEncodeDefaults</a></span>&#8203;(boolean&nbsp;encodeDefaults)</code></th>
<td class="colLast">
<div class="block">Sets if default values of member variables should be encoded.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="document">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>document</h4>
<pre>protected&nbsp;org.w3c.dom.Document document</pre>
<div class="block">Holds the owner document of the codec.</div>
</li>
</ul>
<a id="objects">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>objects</h4>
<pre>protected&nbsp;java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt; objects</pre>
<div class="block">Maps from IDs to objects.</div>
</li>
</ul>
<a id="elements">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>elements</h4>
<pre>protected&nbsp;java.util.Map&lt;java.lang.String,&#8203;org.w3c.dom.Node&gt; elements</pre>
<div class="block">Maps from IDs to elements.</div>
</li>
</ul>
<a id="encodeDefaults">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>encodeDefaults</h4>
<pre>protected&nbsp;boolean encodeDefaults</pre>
<div class="block">Specifies if default values should be encoded. Default is false.</div>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mxCodec</h4>
<pre>public&nbsp;mxCodec()</pre>
<div class="block">Constructs an XML encoder/decoder with a new owner document.</div>
</li>
</ul>
<a id="&lt;init&gt;(org.w3c.dom.Document)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>mxCodec</h4>
<pre>public&nbsp;mxCodec&#8203;(org.w3c.dom.Document&nbsp;document)</pre>
<div class="block">Constructs an XML encoder/decoder for the specified owner document.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>document</code> - Optional XML document that contains the data. If no document
is specified then a new document is created using mxUtils.createDocument</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getDocument()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDocument</h4>
<pre class="methodSignature">public&nbsp;org.w3c.dom.Document&nbsp;getDocument()</pre>
<div class="block">Returns the owner document of the codec.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the owner document.</dd>
</dl>
</li>
</ul>
<a id="setDocument(org.w3c.dom.Document)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDocument</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setDocument&#8203;(org.w3c.dom.Document&nbsp;value)</pre>
<div class="block">Sets the owner document of the codec.</div>
</li>
</ul>
<a id="isEncodeDefaults()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEncodeDefaults</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;isEncodeDefaults()</pre>
<div class="block">Returns if default values of member variables should be encoded.</div>
</li>
</ul>
<a id="setEncodeDefaults(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEncodeDefaults</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setEncodeDefaults&#8203;(boolean&nbsp;encodeDefaults)</pre>
<div class="block">Sets if default values of member variables should be encoded.</div>
</li>
</ul>
<a id="getObjects()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getObjects</h4>
<pre class="methodSignature">public&nbsp;java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;&nbsp;getObjects()</pre>
<div class="block">Returns the object lookup table.</div>
</li>
</ul>
<a id="putObject(java.lang.String,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putObject</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;putObject&#8203;(java.lang.String&nbsp;id,
java.lang.Object&nbsp;object)</pre>
<div class="block">Assoiates the given object with the given ID.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>id</code> - ID for the object to be associated with.</dd>
<dd><code>object</code> - Object to be associated with the ID.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the given object.</dd>
</dl>
</li>
</ul>
<a id="getObject(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getObject</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;getObject&#8203;(java.lang.String&nbsp;id)</pre>
<div class="block">Returns the decoded object for the element with the specified ID in
<a href="#document"><code>document</code></a>. If the object is not known then <a href="#lookup(java.lang.String)"><code>lookup(String)</code></a>
is used to find an object. If no object is found, then the element with
the respective ID from the document is parsed using <a href="#decode(org.w3c.dom.Node)"><code>decode(Node)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>id</code> - ID of the object to be returned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the object for the given ID.</dd>
</dl>
</li>
</ul>
<a id="lookup(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lookup</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;lookup&#8203;(java.lang.String&nbsp;id)</pre>
<div class="block">Hook for subclassers to implement a custom lookup mechanism for cell IDs.
This implementation always returns null.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>id</code> - ID of the object to be returned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the object for the given ID.</dd>
</dl>
</li>
</ul>
<a id="getElementById(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getElementById</h4>
<pre class="methodSignature">public&nbsp;org.w3c.dom.Node&nbsp;getElementById&#8203;(java.lang.String&nbsp;id)</pre>
<div class="block">Returns the element with the given ID from the document.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>id</code> - ID of the element to be returned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the element for the given ID.</dd>
</dl>
</li>
</ul>
<a id="addElement(org.w3c.dom.Node)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addElement</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;addElement&#8203;(org.w3c.dom.Node&nbsp;node)</pre>
<div class="block">Adds the given element to <elements> if it has an ID.</div>
</li>
</ul>
<a id="getId(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getId</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;getId&#8203;(java.lang.Object&nbsp;obj)</pre>
<div class="block">Returns the ID of the specified object. This implementation calls
reference first and if that returns null handles the object as an
mxCell by returning their IDs using mxCell.getId. If no ID exists for
the given cell, then an on-the-fly ID is generated using
mxCellPath.create.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>obj</code> - Object to return the ID for.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the ID for the given object.</dd>
</dl>
</li>
</ul>
<a id="reference(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reference</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;reference&#8203;(java.lang.Object&nbsp;obj)</pre>
<div class="block">Hook for subclassers to implement a custom method for retrieving IDs from
objects. This implementation always returns null.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>obj</code> - Object whose ID should be returned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns the ID for the given object.</dd>
</dl>
</li>
</ul>
<a id="encode(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encode</h4>
<pre class="methodSignature">public&nbsp;org.w3c.dom.Node&nbsp;encode&#8203;(java.lang.Object&nbsp;obj)</pre>
<div class="block">Encodes the specified object and returns the resulting XML node.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>obj</code> - Object to be encoded.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns an XML node that represents the given object.</dd>
</dl>
</li>
</ul>
<a id="decode(org.w3c.dom.Node)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decode</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;decode&#8203;(org.w3c.dom.Node&nbsp;node)</pre>
<div class="block">Decodes the given XML node using <a href="#decode(org.w3c.dom.Node,java.lang.Object)"><code>decode(Node, Object)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>node</code> - XML node to be decoded.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns an object that represents the given node.</dd>
</dl>
</li>
</ul>
<a id="decode(org.w3c.dom.Node,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decode</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;decode&#8203;(org.w3c.dom.Node&nbsp;node,
java.lang.Object&nbsp;into)</pre>
<div class="block">Decodes the given XML node. The optional "into" argument specifies an
existing object to be used. If no object is given, then a new
instance is created using the constructor from the codec.
The function returns the passed in object or the new instance if no
object was given.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>node</code> - XML node to be decoded.</dd>
<dd><code>into</code> - Optional object to be decodec into.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Returns an object that represents the given node.</dd>
</dl>
</li>
</ul>
<a id="encodeCell(com.mxgraph.model.mxICell,org.w3c.dom.Node,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encodeCell</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;encodeCell&#8203;(<a href="../model/mxICell.html" title="interface in com.mxgraph.model">mxICell</a>&nbsp;cell,
org.w3c.dom.Node&nbsp;node,
boolean&nbsp;includeChildren)</pre>
<div class="block">Encoding of cell hierarchies is built-into the core, but is a
higher-level function that needs to be explicitely used by the
respective object encoders (eg. mxModelCodec, mxChildChangeCodec
and mxRootChangeCodec). This implementation writes the given cell
and its children as a (flat) sequence into the given node. The
children are not encoded if the optional includeChildren is false.
The function is in charge of adding the result into the given node
and has no return value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cell</code> - mxCell to be encoded.</dd>
<dd><code>node</code> - Parent XML node to add the encoded cell into.</dd>
<dd><code>includeChildren</code> - Boolean indicating if the method
should include all descendents.</dd>
</dl>
</li>
</ul>
<a id="decodeCell(org.w3c.dom.Node,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decodeCell</h4>
<pre class="methodSignature">public&nbsp;<a href="../model/mxICell.html" title="interface in com.mxgraph.model">mxICell</a>&nbsp;decodeCell&#8203;(org.w3c.dom.Node&nbsp;node,
boolean&nbsp;restoreStructures)</pre>
<div class="block">Decodes cells that have been encoded using inversion, ie. where the
user object is the enclosing node in the XML, and restores the group
and graph structure in the cells. Returns a new <mxCell> instance
that represents the given node.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>node</code> - XML node that contains the cell data.</dd>
<dd><code>restoreStructures</code> - Boolean indicating whether the graph
structure should be restored by calling insert and insertEdge on the
parent and terminals, respectively.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Graph cell that represents the given node.</dd>
</dl>
</li>
</ul>
<a id="insertIntoGraph(com.mxgraph.model.mxICell)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>insertIntoGraph</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;insertIntoGraph&#8203;(<a href="../model/mxICell.html" title="interface in com.mxgraph.model">mxICell</a>&nbsp;cell)</pre>
<div class="block">Inserts the given cell into its parent and terminal cells.</div>
</li>
</ul>
<a id="setAttribute(org.w3c.dom.Node,java.lang.String,java.lang.Object)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setAttribute</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;setAttribute&#8203;(org.w3c.dom.Node&nbsp;node,
java.lang.String&nbsp;attribute,
java.lang.Object&nbsp;value)</pre>
<div class="block">Sets the attribute on the specified node to value. This is a
helper method that makes sure the attribute and value arguments
are not null.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>node</code> - XML node to set the attribute for.</dd>
<dd><code>attribute</code> - Name of the attribute whose value should be set.</dd>
<dd><code>value</code> - New value of the attribute.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/mxCodec.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><p><b>mxGraph 4.1.1</b></p></div>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small><font size=1>Copyright (c) 2010-2017 <a href="http://www.jgraph.com/"
target="_blank">Gaudenz Alder, JGraph Ltd</a>. All rights reserved.</font></small></p>
</footer>
</body>
</html>