Skip to content

Commit 55dbe3f

Browse files
author
Vlad Balin
committed
Intruduced aspect-based structure
1 parent 71c30b8 commit 55dbe3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+899
-6384
lines changed

docs/Aggregation_Tree.html

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<!DOCTYPE html>
2+
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
3+
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
4+
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
5+
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
6+
<head>
7+
<title>Aggregation Tree - Type-R</title>
8+
<meta name="description" content="Universal state management framework" />
9+
<meta name="author" content="Vlad Balin">
10+
<meta charset="UTF-8">
11+
<link rel="icon" href="themes/daux/img/favicon-navy.png" type="image/x-icon">
12+
<!-- Mobile -->
13+
<meta name="apple-mobile-web-app-capable" content="yes" />
14+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
15+
16+
<!-- Font -->
17+
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700&subset=latin,cyrillic-ext,cyrillic' rel='stylesheet' type='text/css'>
18+
<!-- CSS -->
19+
<link href='themes/daux/css/theme-navy.min.css' rel='stylesheet' type='text/css'>
20+
<!-- Tipue Search -->
21+
<link href="tipuesearch/tipuesearch.css" rel="stylesheet">
22+
23+
<!--[if lt IE 9]>
24+
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
25+
<![endif]-->
26+
</head>
27+
<body class="">
28+
29+
<header class="Navbar hidden-print">
30+
<a class="Navbar__brand" href="index.html">Type-R</a>
31+
32+
<div class="Search">
33+
<svg class="Search__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451 451"><path d="M447.05 428l-109.6-109.6c29.4-33.8 47.2-77.9 47.2-126.1C384.65 86.2 298.35 0 192.35 0 86.25 0 .05 86.3.05 192.3s86.3 192.3 192.3 192.3c48.2 0 92.3-17.8 126.1-47.2L428.05 447c2.6 2.6 6.1 4 9.5 4s6.9-1.3 9.5-4c5.2-5.2 5.2-13.8 0-19zM26.95 192.3c0-91.2 74.2-165.3 165.3-165.3 91.2 0 165.3 74.2 165.3 165.3s-74.1 165.4-165.3 165.4c-91.1 0-165.3-74.2-165.3-165.4z"/></svg>
34+
<input type="search" id="tipue_search_input" class="Search__field" placeholder="Search..." autocomplete="on" results=25 autosave=text_search>
35+
</div>
36+
</header>
37+
<div class="Columns content">
38+
<aside class="Columns__left Collapsible">
39+
<div class="Collapsible__container">
40+
<button type="button" class="Button Collapsible__trigger">
41+
<span class="Collapsible__trigger--bar"></span>
42+
<span class="Collapsible__trigger--bar"></span>
43+
<span class="Collapsible__trigger--bar"></span>
44+
</button>
45+
</div>
46+
47+
<div class="Collapsible__content">
48+
<!-- Navigation -->
49+
<ul class='Nav'><li class='Nav__item '><a href="Getting_Started.html">Getting Started</a></li><li class='Nav__item '><a href="Overview.html">Overview</a></li><li class='Nav__item has-children'><a href="Record/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Record</a><ul class='Nav'><li class='Nav__item '><a href="Record/Overview.html">Overview</a></li><li class='Nav__item '><a href="Record/Aggregation_tree.html">Aggregation tree</a></li><li class='Nav__item '><a href="Record/Updates_and_change_events.html">Updates and change events</a></li><li class='Nav__item '><a href="Record/Validation.html">Validation</a></li><li class='Nav__item '><a href="Record/Custom_serialization.html">Custom serialization</a></li><li class='Nav__item '><a href="Record/id_ and_id-references.html">id and id-references</a></li></ul></li><li class='Nav__item has-children'><a href="Collection/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Collection</a><ul class='Nav'><li class='Nav__item '><a href="Collection/Overview.html">Overview</a></li><li class='Nav__item '><a href="Collection/Proxied_array_methods.html">Proxied array methods</a></li><li class='Nav__item '><a href="Collection/Iteration_methods.html">Iteration methods</a></li><li class='Nav__item '><a href="Collection/Sorted_collections.html">Sorted collections</a></li><li class='Nav__item '><a href="Collection/Serialization.html">Serialization</a></li><li class='Nav__item '><a href="Collection/Updates_and_Events.html">Updates and Events</a></li><li class='Nav__item '><a href="Collection/Validation.html">Validation</a></li></ul></li><li class='Nav__item Nav__item--active'><a href="Aggregation_Tree.html">Aggregation Tree</a></li><li class='Nav__item '><a href="Serialization.html">Serialization</a></li><li class='Nav__item '><a href="Validation.html">Validation</a></li><li class='Nav__item '><a href="Events.html">Events</a></li><li class='Nav__item '><a href="Mixins.html">Mixins</a></li></ul>
50+
51+
<div class="Links">
52+
<hr/>
53+
<a href="https://github.com/Volicon/React-MVx/issues" target="_blank">Help/Support/Bugs</a>
54+
<br />
55+
<a href="http://volicon.com" target="_blank">Made by Volicon (a Verizon company)</a>
56+
<br />
57+
58+
<div class="CodeToggler">
59+
<hr/>
60+
<a class="CodeToggler__button CodeToggler__button--main" href="#">Show Code Blocks Inline</a><br>
61+
</div>
62+
63+
<hr/>
64+
<div class="Twitter">
65+
<iframe allowtransparency="true" frameborder="0" scrolling="no" style="width:162px; height:20px;" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=gaperton&amp;show_count=false"></iframe>
66+
<br />
67+
<br />
68+
</div>
69+
</div>
70+
</div>
71+
</aside>
72+
<div class="Columns__right ">
73+
<div class="Columns__right__content">
74+
<div class="doc_content">
75+
<article class="Page">
76+
77+
<div class="Page__header">
78+
<h1>Aggregation Tree</h1>
79+
<span style="float: right; font-size: 10px; color: gray;">
80+
<a href="https://github.com/Volicon/React-MVx/blob/develop/docs/07_Aggregation_Tree.md" target="_blank">Edit on GitHub</a>
81+
</span>
82+
</div>
83+
84+
85+
<div class="s-content">
86+
<p>Records can have attributes holding other Records and Collections, forming indefinitely nested data structures of arbitrary complexity.
87+
To create nested record or collection you should just mention its type in attribute's type annotation.</p>
88+
<pre><code class="language-javascript">import { Record } from 'type-r'
89+
90+
@define class User extends Record {
91+
static attributes = {
92+
name : String,
93+
email : String,
94+
isActive : true
95+
}
96+
}
97+
98+
@define class UsersListState extends Record {
99+
static attributes = {
100+
users : User.Collection
101+
}
102+
}
103+
</code></pre>
104+
<p>All nested records and collections are <em>aggregated</em> by default and behave as integral parts of the containing record. Aggregated attributes are <em>exclusively owned</em> by the record, and taken with it together form an <em>ownerhip tree</em>. Many operations are performed recursively on aggregated elements:</p>
105+
<ul>
106+
<li>They are created when the owner record is created.</li>
107+
<li>They are cloned when the record is cloned.</li>
108+
<li>They are disposed when the record is disposed.</li>
109+
<li>They are validated as part of the record.</li>
110+
<li>They are serialized as nested JSON.</li>
111+
</ul>
112+
<h1 id="page_Shared+objects">Shared objects</h1>
113+
<p>Record's attributes can hold the records and collections from <em>other</em> aggregation trees if they are marked as <code>shared</code>.</p>
114+
<h3 id="page_attr+%3A+RecordOrCollection.shared"><code>attrDef</code> attr : RecordOrCollection.shared</h3>
115+
<p>Record's attribute with a reference to the shared model or collection.</p>
116+
<ul>
117+
<li>It's initialized with <code>null</code>
118+
</li>
119+
<li>It's not cloned when the record is cloned (just the reference is copied over).</li>
120+
<li>It's not disposed when the record is disposed.</li>
121+
<li>It's not validated as part of the record (always valid by default)</li>
122+
<li>It's excluded from serialization.</li>
123+
</ul>
124+
<pre><code class="language-javascript">@define class UsersListState extends Record {
125+
static attributes = {
126+
users : User.Collection,
127+
selected : User.shared // Can be assigned with the user from this.users
128+
}
129+
}
130+
</code></pre>
131+
<h3 id="page_attr+%3A+Collection.Refs"><code>attrDef</code> attr : Collection.Refs</h3>
132+
<h3 id="page_new+Collection.Refs%28%29">new Collection.Refs()</h3>
133+
<p>Collection of references to shared records, which <em>does not aggregate</em> its elements. In constrast to the <code>Collection.shared</code>, <code>Collection.Refs</code> creates an instance of collection which <em>is the part the parent record</em>. Still, its items are not validated and serialized.</p>
134+
<pre><code>@define class MyRecord extends Record {
135+
static attributes = {
136+
notCloned : SomeCollection.shared, // Reference to the _shared collection_ object.
137+
cloned : SomeCollection.Refs // _Aggregated_ collection of references to the _shared records_.
138+
}
139+
</code></pre>
140+
<h1 id="page_Aggregation+tree+methods">Aggregation tree methods</h1>
141+
<h3 id="page_recordOrCollection.getOwner%28%29">recordOrCollection.getOwner()</h3>
142+
<p>Return the reference to the record's owner, or <code>null</code> if record is not the part of aggregation tree.</p>
143+
<p>Due to the nature of <em>aggregation</em>, an object may have one and only one owner.</p>
144+
<h3 id="page_recordOrCollection.clone%28%29">recordOrCollection.clone()</h3>
145+
<p>Clone the record and all aggregated records and collections.</p>
146+
<p>The whole aggregation tree will be recursively cloned, references to shared members will copied.</p>
147+
<h3 id="page_record.assignFrom%28+otherRecord+%29">record.assignFrom( otherRecord )</h3>
148+
<h3 id="page_collection.assignFrom%28+otherCollection+%29">collection.assignFrom( otherCollection )</h3>
149+
<p>Recursively assign the record and its aggregated members with values from <code>otherRecord</code>.
150+
This operation is similar to <code>record.clone()</code>, but instead of <em>creation</em> of the cloned record it makes an <em>existing</em> record to be the copy
151+
of other record.</p>
152+
<p>The whole aggregation tree will be recursively assigned, references to shared members will copied.</p>
153+
<h3 id="page_recordOrCollection.dispose%28%29">recordOrCollection.dispose()</h3>
154+
<p>Recursively dispose the record and its aggregated members. &quot;Dispose&quot; means that elements of the aggregation tree will unsubscribe from all event sources. It's crucial to prevent memory leaks in SPA.</p>
155+
<p>The whole aggregation tree will be recursively disposed, shared members won't.</p>
156+
</div>
157+
158+
<nav>
159+
<ul class="Pager">
160+
<li class=Pager--prev><a href="Collection/Validation.html">Previous</a></li> <li class=Pager--next><a href="Serialization.html">Next</a></li> </ul>
161+
</nav>
162+
</article>
163+
164+
</div>
165+
</div>
166+
</div>
167+
</div>
168+
169+
170+
<!-- jQuery -->
171+
<script src="themes/daux/js/jquery-1.11.3.min.js"></script>
172+
173+
<!-- hightlight.js -->
174+
<script src="themes/daux/js/highlight.pack.js"></script>
175+
<script>hljs.initHighlightingOnLoad();</script>
176+
177+
<!-- JS -->
178+
179+
<script src="themes/daux/js/daux.js"></script>
180+
181+
<!-- Tipue Search -->
182+
<script type="text/javascript" src="tipuesearch/tipuesearch.js"></script>
183+
184+
<script>
185+
window.onunload = function(){}; // force $(document).ready to be called on back/forward navigation in firefox
186+
$(function() {
187+
tipuesearch({
188+
'base_url': ''
189+
});
190+
});
191+
</script>
192+
193+
</body>
194+
</html>

docs/Collection/Iteration_methods.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
<div class="Collapsible__content">
4848
<!-- Navigation -->
49-
<ul class='Nav'><li class='Nav__item '><a href="../Getting_Started.html">Getting Started</a></li><li class='Nav__item '><a href="../Overview.html">Overview</a></li><li class='Nav__item has-children'><a href="../General_concepts/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>General concepts</a><ul class='Nav'><li class='Nav__item '><a href="../General_concepts/Overview.html">Overview</a></li><li class='Nav__item '><a href="../General_concepts/Aggregation_tree.html">Aggregation tree</a></li><li class='Nav__item '><a href="../General_concepts/Updates_and_change_events.html">Updates and change events</a></li><li class='Nav__item '><a href="../General_concepts/Serialization.html">Serialization</a></li><li class='Nav__item '><a href="../General_concepts/Validation.html">Validation</a></li></ul></li><li class='Nav__item has-children'><a href="../Record/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Record</a><ul class='Nav'><li class='Nav__item '><a href="../Record/Overview.html">Overview</a></li><li class='Nav__item '><a href="../Record/Aggregation_tree.html">Aggregation tree</a></li><li class='Nav__item '><a href="../Record/Updates_and_change_events.html">Updates and change events</a></li><li class='Nav__item '><a href="../Record/Validation.html">Validation</a></li><li class='Nav__item '><a href="../Record/Serialization.html">Serialization</a></li><li class='Nav__item '><a href="../Record/id_ and_id-references.html">id and id-references</a></li></ul></li><li class='Nav__item Nav__item--open has-children'><a href="../Collection/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Collection</a><ul class='Nav'><li class='Nav__item '><a href="../Collection/Overview.html">Overview</a></li><li class='Nav__item '><a href="../Collection/Proxied_array_methods.html">Proxied array methods</a></li><li class='Nav__item Nav__item--active'><a href="../Collection/Iteration_methods.html">Iteration methods</a></li><li class='Nav__item '><a href="../Collection/Sorted_collections.html">Sorted collections</a></li><li class='Nav__item '><a href="../Collection/Serialization.html">Serialization</a></li><li class='Nav__item '><a href="../Collection/Updates_and_Events.html">Updates and Events</a></li><li class='Nav__item '><a href="../Collection/Validation.html">Validation</a></li></ul></li><li class='Nav__item '><a href="../Events.html">Events</a></li><li class='Nav__item '><a href="../Mixins.html">Mixins</a></li></ul>
49+
<ul class='Nav'><li class='Nav__item '><a href="../Getting_Started.html">Getting Started</a></li><li class='Nav__item '><a href="../Overview.html">Overview</a></li><li class='Nav__item has-children'><a href="../Record/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Record</a><ul class='Nav'><li class='Nav__item '><a href="../Record/Overview.html">Overview</a></li><li class='Nav__item '><a href="../Record/Aggregation_tree.html">Aggregation tree</a></li><li class='Nav__item '><a href="../Record/Updates_and_change_events.html">Updates and change events</a></li><li class='Nav__item '><a href="../Record/Validation.html">Validation</a></li><li class='Nav__item '><a href="../Record/Custom_serialization.html">Custom serialization</a></li><li class='Nav__item '><a href="../Record/id_ and_id-references.html">id and id-references</a></li></ul></li><li class='Nav__item Nav__item--open has-children'><a href="../Collection/Overview.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Collection</a><ul class='Nav'><li class='Nav__item '><a href="../Collection/Overview.html">Overview</a></li><li class='Nav__item '><a href="../Collection/Proxied_array_methods.html">Proxied array methods</a></li><li class='Nav__item Nav__item--active'><a href="../Collection/Iteration_methods.html">Iteration methods</a></li><li class='Nav__item '><a href="../Collection/Sorted_collections.html">Sorted collections</a></li><li class='Nav__item '><a href="../Collection/Serialization.html">Serialization</a></li><li class='Nav__item '><a href="../Collection/Updates_and_Events.html">Updates and Events</a></li><li class='Nav__item '><a href="../Collection/Validation.html">Validation</a></li></ul></li><li class='Nav__item '><a href="../Aggregation_Tree.html">Aggregation Tree</a></li><li class='Nav__item '><a href="../Serialization.html">Serialization</a></li><li class='Nav__item '><a href="../Validation.html">Validation</a></li><li class='Nav__item '><a href="../Events.html">Events</a></li><li class='Nav__item '><a href="../Mixins.html">Mixins</a></li></ul>
5050

5151
<div class="Links">
5252
<hr/>

0 commit comments

Comments
 (0)