<!-- 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=link13onMouseOver="ShowTip(event, 'tt10', 'link13')"onMouseOut="HideTip('tt10')">mxGraph.canExportCell</a> and <ahref="../view/mxGraph-js.html#mxGraph.canImportCell"class=LFunctionid=link14onMouseOver="ShowTip(event, 'tt11', 'link14')"onMouseOut="HideTip('tt11')">mxGraph.canImportCell</a> functions can be overridden.</p><p>To restore previous parents for pasted cells, the implementation for <ahref="#mxClipboard.copy"class=LFunctionid=link15onMouseOver="ShowTip(event, 'tt7', 'link15')"onMouseOut="HideTip('tt7')">copy</a> and <ahref="#mxClipboard.paste"class=LFunctionid=link16onMouseOver="ShowTip(event, 'tt9', 'link16')"onMouseOut="HideTip('tt9')">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">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">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">cells</a></td><tdclass=SDescription>Holds the array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">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=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">setCells</a></td><tdclass=SDescription>Sets the cells in the clipboard. </td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxClipboard.getCells"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">getCells</a></td><tdclass=SDescription>Returns the cells in the clipboard.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.isEmpty"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">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=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">cut</a></td><tdclass=SDescription>Cuts the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link6onMouseOver="ShowTip(event, 'tt1', 'link6')"onMouseOut="HideTip('tt1')">mxCells</a> from the specified graph. </td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.removeCells"id=link7onMouseOver="ShowTip(event, 'tt6', 'link7')"onMouseOut="HideTip('tt6')">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=link8onMouseOver="ShowTip(event, 'tt7', 'link8')"onMouseOut="HideTip('tt7')">copy</a></td><tdclass=SDescription>Copies the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link9onMouseOver="ShowTip(event, 'tt1', 'link9')"onMouseOut="HideTip('tt1')">mxCells</a> from the specified graph to <ahref="#mxClipboard.cells"class=LVariableid=link10onMouseOver="ShowTip(event, 'tt8', 'link10')"onMouseOut="HideTip('tt8')">cells</a>.Returns the original array of cells that has been cloned.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxClipboard.paste"id=link11onMouseOver="ShowTip(event, 'tt9', 'link11')"onMouseOut="HideTip('tt9')">paste</a></td><tdclass=SDescription>Pastes the <ahref="#mxClipboard.cells"class=LVariableid=link12onMouseOver="ShowTip(event, 'tt8', 'link12')"onMouseOut="HideTip('tt8')">cells</a> into the specified graph restoring the relation to <parents>, if possible. </td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxClipboard.STEPSIZE"></a>STEPSIZE</h3><divclass=CBody><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><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><p>Holds the array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link17onMouseOver="ShowTip(event, 'tt1', 'link17')"onMouseOut="HideTip('tt1')">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 prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>setCells: function(</td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the cells in the clipboard. Fires a <ahref="mxEvent-js.html#mxEvent.CHANGE"class=LVariableid=link18onMouseOver="ShowTip(event, 'tt12', 'link18')"onMouseOut="HideTip('tt12')">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 prettyprint"><tr><td>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 prettyprint"><tr><td>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 prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>cut: function(</td><tdclass=PParameternowrap>graph,</td></tr><tr><td></td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Cuts the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link19onMouseOver="ShowTip(event, 'tt1', 'link19')"onMouseOut="HideTip('tt1')">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=link20onMouseOver="ShowTip(event, 'tt13', 'link20')"onMouseOut="HideTip('tt13')">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=link21onMouseOver="ShowTip(event, 'tt1', 'link21')"onMouseOut="HideTip('tt1')">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 prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>removeCells: function(</td><tdclass=PParameternowrap>graph,</td></tr><tr><td></td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</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=link22onMouseOver="ShowTip(event, 'tt13', 'link22')"onMouseOut="HideTip('tt13')">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=link23onMouseOver="ShowTip(event, 'tt1', 'link23')"onMouseOut="HideTip('tt1')">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 prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>copy: function(</td><tdclass=PParameternowrap>graph,</td></tr><tr><td></td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Copies the given array of <ahref="../model/mxCell-js.html#mxCell"class=LClassid=link24onMouseOver="ShowTip(event, 'tt1', 'link24')"onMouseOut="HideTip('tt1')">mxCells</a> from the specified graph to <ahref="#mxClipboard.cells"class=LVariableid=link25onMouseOver="ShowTip(event, 'tt8', 'link25')"onMouseOut="HideTip('tt8')">cells</a>.Returns the original array of cells that has been cloned.</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=link26onMouseOver="ShowTip(event, 'tt13', 'link26')"onMouseOut="HideTip('tt13')">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=link27onMouseOver="ShowTip(event, 'tt1', 'link27')"onMouseOut="HideTip('tt1')">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 prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>paste: function(</td><tdclass=PParameternowrap>graph</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Pastes the <ahref="#mxClipboard.cells"class=LVariableid=link28onMouseOver="ShowTip(event, 'tt8', 'link28')"onMouseOut="HideTip('tt8')">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=link29onMouseOver="ShowTip(event, 'tt14', 'link29')"onMouseOut="HideTip('tt14')">mxGraph.importCells</a>.</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=link30onMouseOver="ShowTip(event, 'tt13', 'link30')"onMouseOut="HideTip('tt13')">mxGraph</a> to paste the <ahref="#mxClipboard.cells"class=LVariableid=link31onMouseOver="ShowTip(event, 'tt8', 'link31')"onMouseOut="HideTip('tt8')">cells</a> into.</td></tr></table></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CClass>Cells are the elements of the graph model. </div></div><divclass=CToolTipid="tt2"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>setCells: function(</td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Sets the cells in the clipboard. </div></div><divclass=CToolTipid="tt3"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>getCells: function()</td></tr></table></blockquote>Returns the cells in the clipboard.</div></div><divclass=CToolTipid="tt4"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>isEmpty: function()</td></tr></table></blockquote>Returns true if the clipboard currently has not data stored.</div></div><divclass=CToolTipid="tt5"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>cut: function(</td><tdclass=PParameternowrap>graph,</td></tr><tr><td></td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Cuts the given array of mxCells from the specified graph. </div></div><divclass=CToolTipid="tt6"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>removeCells: function(</td><tdclass=PParameternowrap>graph,</td></tr><tr><td></td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</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="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>copy: function(</td><tdclass=PParameternowrap>graph,</td></tr><tr><td></td><tdclass=PParameternowrap>cells</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Copies the given array of mxCells from the specified graph to cells.Returns the original array of cells that has been cloned.</div></div><divclass=CToolTipid="tt8"><divclass=CVariable>Holds the array of mxCells currently in the clipboard.</div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>paste: function(</td><tdclass=PParameternowrap>graph</td><tdclass=PAfterParametersnowrap>)</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="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGraph.prototype.canExportCell = function(</td><tdclass=PParameternowrap>cell</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns true if the given cell may be exported to the clipboard. </div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGraph.prototype.canImportCell = function(</td><tdclass=PParameternowrap>cell</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns true if the given cell