UNPKG

gojs

Version:

Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams

745 lines 61.2 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Group | GoJS API</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../../assets/css/bootstrap.min.css"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <!-- non-fixed navbar --> <nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top"> <div class="container-fluid"> <div class="navbar-header"> <div class="navheader-container"> <div class="navheader-collapse" data-toggle="collapse" data-target="#navbar"> <a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> </div> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="../../index.html">Home</a></li> <li><a href="../../learn/index.html">Learn</a></li> <li><a href="../../samples/index.html">Samples</a></li> <li><a href="../../intro/index.html">Intro</a></li> <li><a href="../../api/index.html" target="api">API</a></li> <li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li> <li><a href="../../download.html">Download</a></li> <li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li> <li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li> <li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li> <li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="tsd-page-header"> <div class="tsd-page-toolbar"> <div class="container-fluid plr15"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">GoJS API</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container-fluid plr15"> <div class="top-copyright"> <!--<b>GoJS</b>&reg; Diagramming Components<br/>version &lt;br/&gt;version 2.1.18 for TypeScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a>--> <b>GoJS</b>&reg; Diagramming Components<br/>version 2.1.18<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a> </div> <div> <h1>Class Group</h1> </div> </div> </div> </div> </header> <div class="container-fluid container-main plr15"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <a href="GraphObject.html" class="tsd-signature-type">GraphObject</a> <ul class="tsd-hierarchy"> <li> <a href="Panel.html" class="tsd-signature-type">Panel</a> <ul class="tsd-hierarchy"> <li> <a href="Part.html" class="tsd-signature-type">Part</a> <ul class="tsd-hierarchy"> <li> <a href="Node.html" class="tsd-signature-type">Node</a> <ul class="tsd-hierarchy"> <li> <span class="target">Group</span> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </section> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <p>A Group is a <a href="Node.html">Node</a> that can contain a subgraph of <a href="Node.html">Node</a>s and <a href="Link.html">Link</a>s, which are members of the group.</p> <p class="box"> For more discussion, see <a href="../../intro/groups.html">Introduction to Groups</a>. See samples that make use of Groups in the <a href="../../samples/index.html#groups">samples index</a>. <p>Although you can create a Group and <a href="Diagram.html#add">Diagram.add</a> it to a Diagram, this does not update the Model. It is more common to create a group by adding a node data object to the model by calling <a href="Model.html#addNodeData">Model.addNodeData</a>. For example:</p> <pre><code class="hljs js"> myDiagram.startTransaction(<span class="hljs-string">"make new group"</span>); myDiagram.model.addNodeData({ <span class="hljs-attr">key</span>: <span class="hljs-string">"Omega"</span>, <span class="hljs-attr">isGroup</span>: <span class="hljs-literal">true</span> }); myDiagram.commitTransaction(<span class="hljs-string">"make new group"</span>);</code></pre> <p>This will cause a Group to be created (copying the template found in <a href="Diagram.html#groupTemplateMap">Diagram.groupTemplateMap</a>), added to the Diagram in some <a href="Layer.html">Layer</a> (based on <a href="Part.html#layerName">Part.layerName</a>), and bound to the group data (resulting in <a href="Panel.html#data">Panel.data</a> referring to that group data object). Note that the JavaScript object includes setting <code>isGroup</code> to true, to indicate that the object represents a Group rather than a regular Node or simple Part.</p> <p>The member Parts of a Group, which you can access as the <a href="Group.html#memberParts">memberParts</a> collection, belong to the group but are not in the visual tree of the group. All <a href="Part.html">Part</a>s are directly in <a href="Layer.html">Layer</a>s -- they cannot be inside a <a href="Panel.html">Panel</a>. This allows group member parts to be in layers different from the group&#39;s layer.</p> <p>You can change the membership of a <a href="Node.html">Node</a> or a simple <a href="Part.html">Part</a> in a Group by setting its <a href="Part.html#containingGroup">Part.containingGroup</a> property. This is done automatically for you by the diagram if you initialize the <code>group</code> property on the node data in the model to be the key of the containing group node data. Thus you should do something like:</p> <pre><code class="hljs js"> myDiagram.startTransaction(<span class="hljs-string">"add new member"</span>); myDiagram.model.addNodeData({ <span class="hljs-attr">group</span>: someexistinggroup.data.key, ... }); myDiagram.commitTransaction(<span class="hljs-string">"add new member"</span>);</code></pre> <p>where you would make sure the node data object included all of the properties you need. You can also change the relationship dynamically by calling <a href="GraphLinksModel.html#setGroupKeyForNodeData">GraphLinksModel.setGroupKeyForNodeData</a>.</p> <p>The membership of <a href="Link.html">Link</a>s is computed automatically for you by the diagram based on the membership of the connected <a href="Node.html">Node</a>s. For example, if the <a href="Link.html#fromNode">Link.fromNode</a> is a top-level node but the <a href="Link.html#toNode">Link.toNode</a> is a member of a group, the link is a top-level link. If the two connected nodes both belong to the same group, the link is a member of that group. If the two connected nodes belong to different groups, the link belongs to the common container group, if there is any. Note that if a link connects a member of a group with the group itself, the link is a member of that group.</p> <p>All of the group-member relationships effectively form a tree structure. These properties and methods are useful in navigating these relationships:</p> <ul> <li><a href="Part.html#containingGroup">Part.containingGroup</a></li> <li><a href="Part.html#isTopLevel">Part.isTopLevel</a></li> <li><a href="Part.html#findTopLevelPart">Part.findTopLevelPart</a></li> <li><a href="Part.html#findSubGraphLevel">Part.findSubGraphLevel</a></li> <li><a href="Part.html#findCommonContainingGroup">Part.findCommonContainingGroup</a></li> <li><a href="Group.html#memberParts">memberParts</a></li> <li><a href="Group.html#findSubGraphParts">findSubGraphParts</a></li> <li><a href="Group.html#findExternalLinksConnected">findExternalLinksConnected</a></li> <li><a href="Group.html#findExternalNodesConnected">findExternalNodesConnected</a></li> </ul> <p>As the membership of a group changes, you may want to update the appearance of the group. You can set the <a href="Group.html#memberAdded">memberAdded</a> and <a href="Group.html#memberRemoved">memberRemoved</a> properties to be functions that are called. These functions must not modify any membership relationships -- these function properties just exist to update the appearance of the Group.</p> <p>You can control whether certain Nodes are added to a Group by <a href="CommandHandler.html#groupSelection">CommandHandler.groupSelection</a> or <a href="Group.html#addMembers">addMembers</a> or <a href="CommandHandler.html#addTopLevelParts">CommandHandler.addTopLevelParts</a> by affecting the result of <a href="CommandHandler.html#isValidMember">CommandHandler.isValidMember</a>, which is responsible for deciding whether it is OK to add a Node to a Group or to remove a Node from a Group to be a top-level node. You can override that predicate on CommandHandler, but it is easier to set the <a href="Group.html#memberValidation">memberValidation</a> or <a href="CommandHandler.html#memberValidation">CommandHandler.memberValidation</a> functional property.</p> <p class="box"> For a more general discussion of validation, see <a href="../../intro/validation.html">Introduction to Validation</a>. <p>The area occupied by the subgraph is represented in the group&#39;s visual tree by a <a href="Placeholder.html">Placeholder</a>. As the group <a href="Group.html#placeholder">placeholder</a> grows and shrinks based on the sizes and positions of the member nodes and links, the group will grow and shrink accordingly. The placeholder is always the <a href="Part.html#locationObject">Part.locationObject</a>, although you may specify any <a href="Spot.html">Spot</a> as the <a href="Part.html#locationSpot">Part.locationSpot</a>. A Group need not have a placeholder, but it may have at most one.</p> <p>A group has its own <a href="Group.html#layout">layout</a> property that is used to position the member nodes and route the member links.</p> <p>The Group class also supports the notion of expanding and collapsing the subgraph, causing the member nodes and links to be shown or hidden. Principally this is a matter of setting <a href="Group.html#isSubGraphExpanded">isSubGraphExpanded</a>. Changes to this property will result in calls to <a href="Group.html#collapseSubGraph">collapseSubGraph</a> or <a href="Group.html#expandSubGraph">expandSubGraph</a>, as appropriate.</p> <p>If you want to change the appearance of the group you can do so in a function that you assign to the <a href="Group.html#subGraphExpandedChanged">subGraphExpandedChanged</a> property. This function must not modify any member relationships or expand or collapse any groups -- the functional property just exists to update the appearance of the Group.</p> <p class="box"> For more discussion and examples, see <a href="../../intro/subgraphs.html">SubGraphs</a>. <p>If you want the user to be able to create a Group out of the currently selected Parts using the <a href="CommandHandler.html#groupSelection">CommandHandler.groupSelection</a> command, you need to first set the <a href="CommandHandler.html#archetypeGroupData">CommandHandler.archetypeGroupData</a> property to a data object with <code>isGroup</code> set to true. If you want the user to be able to ungroup a Group, using the <a href="CommandHandler.html#ungroupSelection">CommandHandler.ungroupSelection</a> command, you need to set <a href="Group.html#ungroupable">ungroupable</a> to true.</p> <p class="box"> For more discussion and examples, see <a href="../../intro/groups.html">Groups</a>, <a href="../../intro/subgraphs.html">SubGraphs</a>, and <a href="../../intro/sizedGroups.html">Sized Groups</a>. <p>Only Groups that are in Diagrams can have member Parts or connections via Links. Templates should not be connected with Links, be labels of Links, be members of Groups, have any member Parts, or have any Adornments.</p> </div> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Group.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Properties</h3> <ul class="tsd-index-list"> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#computesBoundsAfterDrag" class="tsd-kind-icon">computes<wbr>Bounds<wbr>After<wbr>Drag</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#computesBoundsIncludingLinks" class="tsd-kind-icon">computes<wbr>Bounds<wbr>Including<wbr>Links</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#computesBoundsIncludingLocation" class="tsd-kind-icon">computes<wbr>Bounds<wbr>Including<wbr>Location</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#handlesDragDropForMembers" class="tsd-kind-icon">handles<wbr>Drag<wbr>Drop<wbr>For<wbr>Members</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#isSubGraphExpanded" class="tsd-kind-icon">is<wbr>Sub<wbr>Graph<wbr>Expanded</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#layout" class="tsd-kind-icon">layout</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#memberAdded" class="tsd-kind-icon">member<wbr>Added</a></li> <li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="Group.html#memberParts" class="tsd-kind-icon">member<wbr>Parts</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#memberRemoved" class="tsd-kind-icon">member<wbr>Removed</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#memberValidation" class="tsd-kind-icon">member<wbr>Validation</a></li> <li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="Group.html#placeholder" class="tsd-kind-icon">placeholder</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#subGraphExpandedChanged" class="tsd-kind-icon">sub<wbr>Graph<wbr>Expanded<wbr>Changed</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#ungroupable" class="tsd-kind-icon">ungroupable</a></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Group.html#wasSubGraphExpanded" class="tsd-kind-icon">was<wbr>Sub<wbr>Graph<wbr>Expanded</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#addMembers" class="tsd-kind-icon">add<wbr>Members</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#canAddMembers" class="tsd-kind-icon">can<wbr>Add<wbr>Members</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#canUngroup" class="tsd-kind-icon">can<wbr>Ungroup</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#collapseSubGraph" class="tsd-kind-icon">collapse<wbr>Sub<wbr>Graph</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#ensureBounds" class="tsd-kind-icon">ensure<wbr>Bounds</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#expandSubGraph" class="tsd-kind-icon">expand<wbr>Sub<wbr>Graph</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#findExternalLinksConnected" class="tsd-kind-icon">find<wbr>External<wbr>Links<wbr>Connected</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#findExternalNodesConnected" class="tsd-kind-icon">find<wbr>External<wbr>Nodes<wbr>Connected</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#findSubGraphParts" class="tsd-kind-icon">find<wbr>Sub<wbr>Graph<wbr>Parts</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="Group.html#move" class="tsd-kind-icon">move</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class"> <a name="constructor" class="tsd-anchor"></a> <h3> constructor </h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">new <wbr>Group<span class="tsd-signature-symbol">(</span>type<span class="tsd-signature-symbol">?: </span><a href="PanelLayout.html" class="tsd-signature-type">PanelLayout</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Group.html" class="tsd-signature-type">Group</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Constructs an empty Group with no visual elements and no member parts; normally a Group will have some visual elements surrounding a <a href="Placeholder.html">Placeholder</a>.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> type: <a href="PanelLayout.html" class="tsd-signature-type">PanelLayout</a></h5> <div class="tsd-comment tsd-typography"> <p>if not supplied, the default Panel type is <a href="Panel.html#static-Position">Panel.Position</a>.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="Group.html" class="tsd-signature-type">Group</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Properties</h2> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="computesBoundsAfterDrag" class="tsd-anchor"></a> <h3> computes<wbr>Bounds<wbr>After<wbr>Drag <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether the size of the area of the <a href="Group.html">Group</a>&#39;s <a href="Group.html#placeholder">placeholder</a> should remain the same during a <a href="DraggingTool.html">DraggingTool</a> move until a drop occurs. Groups within temporary layers (such as new Groups during a drag-copy) are unaffected by this property.</p> <p>In other words, when the value is true, re-computing the bounds of the members is suspended until a drop occurs, at which time the border is recomputed, perhaps not including some members that had been dragged out and reparented. The initial value is false.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="computesBoundsIncludingLinks" class="tsd-anchor"></a> <h3> computes<wbr>Bounds<wbr>Including<wbr>Links <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether a <a href="Group.html#placeholder">placeholder</a>&#39;s bounds includes the bounds of member Links. The default value is true. If this is false, only non-Link member Parts are used to compute the Placeholder&#39;s bounds in document coordinates.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="computesBoundsIncludingLocation" class="tsd-anchor"></a> <h3> computes<wbr>Bounds<wbr>Including<wbr>Location <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether a <a href="Group.html#placeholder">placeholder</a>&#39;s bounds includes the previous Group.location. The default value is false.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="handlesDragDropForMembers" class="tsd-anchor"></a> <h3> handles<wbr>Drag<wbr>Drop<wbr>For<wbr>Members <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether drag-and-drop events may be bubbled up to this Group if not handled by member Parts. The default value is false -- each Node or Link that is a member of the Group needs to define its own <a href="GraphObject.html#mouseDragEnter">GraphObject.mouseDragEnter</a>, <a href="GraphObject.html#mouseDragLeave">GraphObject.mouseDragLeave</a>, and <a href="GraphObject.html#mouseDrop">GraphObject.mouseDrop</a> event handlers if you want dragging/dropping on a member part to act as if the user were acting on the group.</p> <p>This is currently restricted to only call the mouseDragEnter, mouseDragLeave, and mouseDrop event handlers defined on the whole Group, not on any element inside the Group&#39;s visual tree.</p> <dl class="tsd-comment-tags"> <dt>since</dt> <dd><p>1.5</p> </dd> </dl> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="isSubGraphExpanded" class="tsd-anchor"></a> <h3> is<wbr>Sub<wbr>Graph<wbr>Expanded <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether the subgraph contained by this group is expanded. Changing this property&#39;s value will call <a href="Group.html#collapseSubGraph">collapseSubGraph</a> or <a href="Group.html#expandSubGraph">expandSubGraph</a>, and also will call the value of <a href="Group.html#subGraphExpandedChanged">subGraphExpandedChanged</a> if it is a function.</p> <p>The initial value is true -- this group&#39;s member parts are shown.</p> <p>There is an analogous property for expanded/collapsed trees of <a href="Node.html">Node</a>s and <a href="Link.html">Link</a>s: <a href="Node.html#isTreeExpanded">Node.isTreeExpanded</a>.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="layout" class="tsd-anchor"></a> <h3> layout <span class="tsd-signature-symbol">: </span><a href="Layout.html" class="tsd-signature-type">Layout</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the <a href="Layout.html">Layout</a> used to position all of the immediate member nodes and links in this group. By default this property is an instance of <a href="Layout.html">Layout</a> -- no special layout is used, which just makes sure each member node has a valid location.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="memberAdded" class="tsd-anchor"></a> <h3> member<wbr>Added <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">thisGroup</span><span class="tsd-signature-symbol">: </span><a href="Group.html" class="tsd-signature-type">Group</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">newPart</span><span class="tsd-signature-symbol">: </span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the function that is called after a member <a href="Part.html">Part</a> has been added to this Group. It is typically used to modify the appearance of the group. The first argument will be this Group. The second argument will be a Part, typically a Node, but may be a simple Part or a Link.</p> <p>If the value is a function, that function must not modify any membership relationships. The member Part has already been added -- trying to remove it or adding or removing another member or the Group itself may produce undefined behavior.</p> <p>The default value is null -- no function is called.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"> <a name="memberParts" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagReadOnly">Read-only</span> member<wbr>Parts <span class="tsd-signature-symbol">: </span><a href="Iterator.html" class="tsd-signature-type">Iterator</a><span class="tsd-signature-symbol">&lt;</span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">&gt;</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This read-only property returns an iterator over the member <a href="Part.html">Part</a>s of this Group. Setting <a href="Part.html#containingGroup">Part.containingGroup</a> to refer to this Group will add that part to this collection. The Parts can be <a href="Node.html">Node</a>s, <a href="Link.html">Link</a>s, <a href="Group.html">Group</a>s, or simple <a href="Part.html">Part</a>s.</p> <p>A template should not have any member parts.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="memberRemoved" class="tsd-anchor"></a> <h3> member<wbr>Removed <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">thisGroup</span><span class="tsd-signature-symbol">: </span><a href="Group.html" class="tsd-signature-type">Group</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">oldPart</span><span class="tsd-signature-symbol">: </span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the function that is called after a member <a href="Part.html">Part</a> has been removed from this Group. It is typically used to modify the appearance of the group. The first argument will be this Group. The second argument will be a Part, typically a Node, but may be a simple Part or a Link.</p> <p>If the value is a function, that function must not modify any membership relationships. The member Part has already been removed -- trying to add it or adding or removing another member or the Group itself may produce undefined behavior.</p> <p>The default value is null -- no function is called.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="memberValidation" class="tsd-anchor"></a> <h3> member<wbr>Validation <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">thisGroup</span><span class="tsd-signature-symbol">: </span><a href="Group.html" class="tsd-signature-type">Group</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">part</span><span class="tsd-signature-symbol">: </span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the predicate that determines whether or not a Part may become a member of this group. If this is non-null, the predicate is called in addition to any <a href="CommandHandler.html#memberValidation">CommandHandler.memberValidation</a> predicate.</p> <p>The default predicate is null, which is equivalent to simply returning true. The first argument will be this Group. The second argument will be a Part, typically a Node, but will not be a Link or an Adornment.</p> <p>The function, if supplied, must not have any side-effects.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class"> <a name="placeholder" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagReadOnly">Read-only</span> placeholder <span class="tsd-signature-symbol">: </span><a href="Placeholder.html" class="tsd-signature-type">Placeholder</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This read-only property returns a <a href="Placeholder.html">Placeholder</a> that this group may contain in its visual tree.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="subGraphExpandedChanged" class="tsd-anchor"></a> <h3> sub<wbr>Graph<wbr>Expanded<wbr>Changed <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">thisGroup</span><span class="tsd-signature-symbol">: </span><a href="Group.html" class="tsd-signature-type">Group</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets the function that is called when <a href="Group.html#isSubGraphExpanded">isSubGraphExpanded</a> has changed value. The argument to that function will be this Group.</p> <p>If the value is a function, that function must not expand or collapse any groups. The Group has already been expanded or collapsed -- trying to change it again may produce undefined behavior.</p> <p>The default value is null -- no function is called.</p> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="ungroupable" class="tsd-anchor"></a> <h3> ungroupable <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether the user may ungroup this group. The initial value is false.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Group.html#canUngroup">canUngroup</a></p> </dd> </dl> </div> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class"> <a name="wasSubGraphExpanded" class="tsd-anchor"></a> <h3> was<wbr>Sub<wbr>Graph<wbr>Expanded <span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Gets or sets whether the subgraph starting at this group had been collapsed by a call to <a href="Group.html#expandSubGraph">expandSubGraph</a> on the containing <a href="Group.html">Group</a>. The initial value is false.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Group.html#isSubGraphExpanded">isSubGraphExpanded</a></p> </dd> </dl> </div> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="addMembers" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> add<wbr>Members </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">add<wbr>Members<span class="tsd-signature-symbol">(</span>coll<span class="tsd-signature-symbol">: </span><a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">&gt;</span>, check<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Add the <a href="Part.html">Part</a>s in the given collection as members of this Group for those Parts for which <a href="CommandHandler.html#isValidMember">CommandHandler.isValidMember</a> returns true. If the check argument to this method is not supplied or false, this will set <a href="Part.html#containingGroup">Part.containingGroup</a> on each part unconditionally, not calling <a href="CommandHandler.html#isValidMember">CommandHandler.isValidMember</a>.</p> <p>The CommandHandler predicate will use <a href="CommandHandler.html#memberValidation">CommandHandler.memberValidation</a> and <a href="Group.html#memberValidation">memberValidation</a>, if either or both are defined.</p> <p>At this time there is no &quot;removeMembers&quot; method. If you want to make a collection of Parts to be top-level parts, not members of any Group but still in the Diagram, call <a href="CommandHandler.html#addTopLevelParts">CommandHandler.addTopLevelParts</a>. If you want to remove a collection of Parts not only from a Group but from the whole Diagram, call <a href="Diagram.html#removeParts">Diagram.removeParts</a>.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>coll: <a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">&gt;</span></h5> </li> <li> <h5><span class="tsd-flag ts-flagOptional">Optional</span> check: <span class="tsd-signature-type">boolean</span></h5> <div class="tsd-comment tsd-typography"> <p>whether to call <a href="CommandHandler.html#isValidMember">CommandHandler.isValidMember</a> to confirm that it is valid to add the Part to be a member of this Group.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>true if all non-Links were added to this Group; false if some Parts or Nodes were not able to be added.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="canAddMembers" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> can<wbr>Add<wbr>Members </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">can<wbr>Add<wbr>Members<span class="tsd-signature-symbol">(</span>coll<span class="tsd-signature-symbol">: </span><a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>See if the given collection of <a href="Part.html">Part</a>s contains non-Links all for which <a href="CommandHandler.html#isValidMember">CommandHandler.isValidMember</a> returns true.</p> <p>The CommandHandler predicate will use <a href="CommandHandler.html#memberValidation">CommandHandler.memberValidation</a> and <a href="Group.html#memberValidation">memberValidation</a>, if either or both are defined.</p> <p>This does not check <a href="Diagram.html#isReadOnly">Diagram.isReadOnly</a> or <a href="Model.html#isReadOnly">Model.isReadOnly</a>, but commands and tools should check those properties.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>coll: <a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="Part.html" class="tsd-signature-type">Part</a><span class="tsd-signature-symbol">&gt;</span></h5> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>true.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="canUngroup" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagVirtual">Virtual</span> can<wbr>Ungroup </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">can<wbr>Ungroup<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>This predicate returns true if <a href="Group.html#ungroupable">ungroupable</a> is true, if the layer&#39;s <a href="Layer.html#allowUngroup">Layer.allowUngroup</a> is true, and if the diagram&#39;s <a href="Diagram.html#allowUngroup">Diagram.allowUngroup</a> is true.</p> <p>This does not check <a href="Diagram.html#isReadOnly">Diagram.isReadOnly</a> or <a href="Model.html#isReadOnly">Model.isReadOnly</a>, but commands and tools should check those properties.</p> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>true if the user may ungroup this object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="collapseSubGraph" class="tsd-anchor"></a> <h3> collapse<wbr>Sub<wbr>Graph </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">collapse<wbr>Sub<wbr>Graph<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Hide each of the member nodes and links of this group, and recursively collapse any member groups. This changes the value of <a href="Part.html#isVisible">Part.isVisible</a> of the whole subgraph and the parts owned by those member nodes and links. However, this group&#39;s visibility is unchanged.</p> <p>This sets <a href="Group.html#isSubGraphExpanded">isSubGraphExpanded</a> to false on this group and on all of the nested <a href="Group.html">Group</a>s. For those nested <a href="Group.html">Group</a>s that were expanded, <a href="Group.html#wasSubGraphExpanded">wasSubGraphExpanded</a> is set to true.</p> <p>To collapse trees made of <a href="Node.html">Node</a>s and <a href="Link.html">Link</a>s, use <a href="Node.html#collapseTree">Node.collapseTree</a>.</p> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="ensureBounds" class="tsd-anchor"></a> <h3> <span class="tsd-flag ts-flagOverride">Override</span> ensure<wbr>Bounds </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">ensure<wbr>Bounds<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Measures if needed to make sure the <a href="GraphObject.html#measuredBounds">GraphObject.measuredBounds</a> and <a href="GraphObject.html#naturalBounds">GraphObject.naturalBounds</a> are all real numbers, primarily to get the actual width and height. <a href="GraphObject.html#actualBounds">GraphObject.actualBounds</a> will get a real width and height, but the x and y values may continue to be <code>NaN</code> if they were that way beforehand.</p> <p>This is sometimes necessary to call when defining custom layouts or implementing virtualization, so that it can work with the actual size of the nodes.</p> <p>For efficiency, do not call this method unnecessarily.</p> <dl class="tsd-comment-tags"> <dt>since</dt> <dd><p>1.6</p> </dd> </dl> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="expandSubGraph" class="tsd-anchor"></a> <h3> expand<wbr>Sub<wbr>Graph </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">expand<wbr>Sub<wbr>Graph<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Show each member node and link, and perhaps recursively expand nested subgraphs. This may change the value of <a href="Part.html#isVisible">Part.isVisible</a> of the whole subgraph and the parts owned by those member nodes and links. However, this group&#39;s visibility is unchanged.</p> <p>This sets <a href="Group.html#isSubGraphExpanded">isSubGraphExpanded</a> to true on this group and on all of the nested <a href="Group.html">Group</a>s. This will expand a nested group only if its <a href="Group.html#wasSubGraphExpanded">wasSubGraphExpanded</a> property was true.</p> <p>To expand trees made of <a href="Node.html">Node</a>s and <a href="Link.html">Link</a>s, use <a href="Node.html#expandTree">Node.expandTree</a>.</p> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"> <a name="findExternalLinksConnected" class="tsd-anchor"></a> <h3> find<wbr>External<wbr>Links<wbr>Connected </h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">find<wbr>External<wbr>Links<wbr>Connected<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Iterator.html" class="tsd-signature-type">Iterator</a><span class="tsd-signature-symbol">&lt;</span><a href="Link.html" class="tsd-signature-type">Link</a><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <div class="tsd-comment tsd-typography"> <p>Returns an iterator over all of the <a href="Link.html">Link</a>s that connect with this group or any node contained by this group, in either direction, but that are not internal to this group.</p> <p>Links that are contained by this group (even in nested groups) are not included in the result collection.</p> <dl class="tsd-comment-tags"> <dt>see</dt> <dd><p><a href="Node.html#findLinksConnected">Node.findLinksConnected</a></p> </dd> <dt>since</dt> <dd><p>1.3</p> </dd> </dl> </div> <h4 class="tsd-returns-title">Returns <a href="Iterator.html" class="tsd-signature-type">Iterator</a><span class="tsd-signature-symbol">&lt;</span><a href="Link.html" class="tsd-signature-type">Link</a><span class="tsd-signature-symbol">&gt;</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-m