<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxClipboard"></a>mxClipboard</h1><divclass=CBody><p>Singleton that implements a clipboard for graph cells.</p><h4class=CHeading>Example</h4><blockquote><preclass="prettyprint">mxClipboard.copy(graph);
mxClipboard.paste(graph2);</pre></blockquote><p>This copies the selection cells from the graph to the clipboard and pastes them into graph2.</p><p>For fine-grained control of the clipboard data the <ahref="../view/mxGraph-js.html#mxGraph.canExportCell"class=LFunctionid=link16onMouseOver="ShowTip(event, 'tt12', 'link16')"onMouseOut="HideTip('tt12')">mxGraph.canExportCell</a> and <ahref="../view/mxGraph-js.html#mxGraph.canImportCell"class=LFunctionid=link17onMouseOver="ShowTip(event, 'tt13', 'link17')"onMouseOut="HideTip('tt13')">mxGraph.canImportCell</a> functions can be overridden.</p><p>To restore previous parents for pasted cells, the implementation for <ahref="#mxClipboard.copy"class=LFunctionid=link18onMouseOver="ShowTip(event, 'tt10', 'link18')"onMouseOut="HideTip('tt10')">copy</a> and <ahref="#mxClipboard.paste"class=LFunctionid=link19onMouseOver="ShowTip(event, 'tt11', 'link19')"onMouseOut="HideTip('tt11')">paste</a> can be changed as follows.</p><blockquote><preclass="prettyprint">mxClipboard.copy = function(graph, cells)
};</pre></blockquote><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxClipboard">mxClipboard</a></td><tdclass=SDescription>Singleton that implements a clipboard for graph cells.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxClipboard.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.STEPSIZE"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">STEPSIZE</a></td><tdclass=SDescription>Defines the step size to offset the cells after each paste operation. </td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxClipboard.insertCount"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">insertCount</a></td><tdclass=SDescription>Counts the number of times the clipboard data has been inserted.</td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.cells"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">cells</a></td><tdclass=SDescription>Holds the array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">mxCells</a> currently in the clipboard.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxClipboard.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.setCells"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">setCells</a></td><tdclass=SDescription>Sets the cells in the clipboard. </td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxClipboard.getCells"id=link6onMouseOver="ShowTip(event, 'tt6', 'link6')"onMouseOut="HideTip('tt6')">getCells</a></td><tdclass=SDescription>Returns the cells in the clipboard.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.isEmpty"id=link7onMouseOver="ShowTip(event, 'tt7', 'link7')"onMouseOut="HideTip('tt7')">isEmpty</a></td><tdclass=SDescription>Returns true if the clipboard currently has not data stored.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxClipboard.cut"id=link8onMouseOver="ShowTip(event, 'tt8', 'link8')"onMouseOut="HideTip('tt8')">cut</a></td><tdclass=SDescription>Cuts the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link9onMouseOver="ShowTip(event, 'tt4', 'link9')"onMouseOut="HideTip('tt4')">mxCells</a> from the specified graph. </td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.removeCells"id=link10onMouseOver="ShowTip(event, 'tt9', 'link10')"onMouseOut="HideTip('tt9')">removeCells</a></td><tdclass=SDescription>Hook to remove the given cells from the given graph after a cut operation.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxClipboard.copy"id=link11onMouseOver="ShowTip(event, 'tt10', 'link11')"onMouseOut="HideTip('tt10')">copy</a></td><tdclass=SDescription>Copies the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link12onMouseOver="ShowTip(event, 'tt4', 'link12')"onMouseOut="HideTip('tt4')">mxCells</a> from the specified graph to <ahref="#mxClipboard.cells"class=LVariableid=link13onMouseOver="ShowTip(event, 'tt3', 'link13')"onMouseOut="HideTip('tt3')">cells</a>. </td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.paste"id=link14onMouseOver="ShowTip(event, 'tt11', 'link14')"onMouseOut="HideTip('tt11')">paste</a></td><tdclass=SDescription>Pastes the <ahref="#mxClipboard.cells"class=LVariableid=link15onMouseOver="ShowTip(event, 'tt3', 'link15')"onMouseOut="HideTip('tt3')">cells</a> into the specified graph restoring the relation to <parents>, if possible. </td></tr></table></div></div><!--END_ND_SUMMAR
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.STEPSIZE"></a>STEPSIZE</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">STEPSIZE: 10</td></tr></table></blockquote><p>Defines the step size to offset the cells after each paste operation. Default is 10.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.insertCount"></a>insertCount</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">insertCount: 1</td></tr></table></blockquote><p>Counts the number of times the clipboard data has been inserted.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.cells"></a>cells</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">cells: null</td></tr></table></blockquote><p>Holds the array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link20onMouseOver="ShowTip(event, 'tt4', 'link20')"onMouseOut="HideTip('tt4')">mxCells</a> currently in the clipboard.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.setCells"></a>setCells</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>setCells: function(</td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the cells in the clipboard. Fires a <ahref="mxEvent-js.html#mxEvent.CHANGE"class=LVariableid=link21onMouseOver="ShowTip(event, 'tt14', 'link21')"onMouseOut="HideTip('tt14')">mxEvent.CHANGE</a> event.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.getCells"></a>getCells</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">getCells: function()</td></tr></table></blockquote><p>Returns the cells in the clipboard.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.isEmpty"></a>isEmpty</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">isEmpty: function()</td></tr></table></blockquote><p>Returns true if the clipboard currently has not data stored.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.cut"></a>cut</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>cut: function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Cuts the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link22onMouseOver="ShowTip(event, 'tt4', 'link22')"onMouseOut="HideTip('tt4')">mxCells</a> from the specified graph. If cells is null then the selection cells of the graph will be used. Returns the cells that have been cut from the graph.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>graph</td><tdclass=CDLDescription><ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link23onMouseOver="ShowTip(event, 'tt15', 'link23')"onMouseOut="HideTip('tt15')">mxGraph</a> that contains the cells to be cut.</td></tr><tr><tdclass=CDLEntry>cells</td><tdclass=CDLDescription>Optional array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link24onMouseOver="ShowTip(event, 'tt4', 'link24')"onMouseOut="HideTip('tt4')">mxCells</a> to be cut.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.removeCells"></a>removeCells</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>removeCells: function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook to remove the given cells from the given graph after a cut operation.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>graph</td><tdclass=CDLDescription><ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link25onMouseOver="ShowTip(event, 'tt15', 'link25')"onMouseOut="HideTip('tt15')">mxGraph</a> that contains the cells to be cut.</td></tr><tr><tdclass=CDLEntry>cells</td><tdclass=CDLDescription>Array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link26onMouseOver="ShowTip(event, 'tt4', 'link26')"onMouseOut="HideTip('tt4')">mxCells</a> to be cut.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.copy"></a>copy</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>copy: function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Copies the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link27onMouseOver="ShowTip(event, 'tt4', 'link27')"onMouseOut="HideTip('tt4')">mxCells</a> from the specified graph to <ahref="#mxClipboard.cells"class=LVariableid=link28onMouseOver="ShowTip(event, 'tt3', 'link28')"onMouseOut="HideTip('tt3')">cells</a>. Returns the original array of cells that has been cloned. Descendants of cells in the array are ignored.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>graph</td><tdclass=CDLDescription><ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link29onMouseOver="ShowTip(event, 'tt15', 'link29')"onMouseOut="HideTip('tt15')">mxGraph</a> that contains the cells to be copied.</td></tr><tr><tdclass=CDLEntry>cells</td><tdclass=CDLDescription>Optional array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link30onMouseOver="ShowTip(event, 'tt4', 'link30')"onMouseOut="HideTip('tt4')">mxCells</a> to be copied.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.paste"></a>paste</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>paste: function(</td><tdclass="PParameter prettyprint "nowrap>graph</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Pastes the <ahref="#mxClipboard.cells"class=LVariableid=link31onMouseOver="ShowTip(event, 'tt3', 'link31')"onMouseOut="HideTip('tt3')">cells</a> into the specified graph restoring the relation to <parents>, if possible. If the parents are no longer in the graph or invisible then the cells are added to the graph’s default or into the swimlane under the cell’s new location if one exists. The cells are added to the graph using <ahref="../view/mxGraph-js.html#mxGraph.importCells"class=LFunctionid=link32onMouseOver="ShowTip(event, 'tt16', 'link32')"onMouseOut="HideTip('tt16')">mxGraph.importCells</a> and returned.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>graph</td><tdclass=CDLDescription><ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link33onMouseOver="ShowTip(event, 'tt15', 'link33')"onMouseOut="HideTip('tt15')">mxGraph</a> to paste the <ahref="#mxClipboard.cells"class=LVariableid=link34onMouseOver="ShowTip(event, 'tt3', 'link34')"onMouseOut="HideTip('tt3')">cells</a> into.</td></tr></table></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">STEPSIZE: 10</td></tr></table></blockquote>Defines the step size to offset the cells after each paste operation. </div></div><divclass=CToolTipid="tt2"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">insertCount: 1</td></tr></table></blockquote>Counts the number of times the clipboard data has been inserted.</div></div><divclass=CToolTipid="tt3"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">cells: null</td></tr></table></blockquote>Holds the array of mxCells currently in the clipboard.</div></div><divclass=CToolTipid="tt4"><divclass=CClass>Cells are the elements of the graph model. </div></div><divclass=CToolTipid="tt5"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>setCells: function(</td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Sets the cells in the clipboard. </div></div><divclass=CToolTipid="tt6"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">getCells: function()</td></tr></table></blockquote>Returns the cells in the clipboard.</div></div><divclass=CToolTipid="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><tdclass="prettyprint">isEmpty: function()</td></tr></table></blockquote>Returns true if the clipboard currently has not data stored.</div></div><divclass=CToolTipid="tt8"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>cut: function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Cuts the given array of mxCells from the specified graph. </div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>removeCells: function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Hook to remove the given cells from the given graph after a cut operation.</div></div><divclass=CToolTipid="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>copy: function(</td><tdclass="PParameter prettyprint "nowrap>graph,</td></tr><tr><td></td><tdclass="PParameter prettyprint "nowrap>cells</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Copies the given array of mxCells from the specified graph to cells. </div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass="PBeforeParameters prettyprint "nowrap>paste: function(</td><tdclass="PParameter prettyprint "nowrap>graph</td><tdclass="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Pastes the cells into the specified graph restoring the relation to parents, if possible. </div></div><divclass=CToolTipid="tt1