October 2017
Intermediate to advanced
280 pages
6h 50m
English
Enough of theory! Let's build a component tree based on the class hierarchy illustrated in the preceding diagram. This way, we will demonstrate how we can take advantage of the composite pattern for building a user interface using simplified syntax. We will take a look at a similar example in the context of Angular in Chapter 5, Getting Started with Angular Components and Directives:
Composite c1 = new Composite(); Composite c2 = new Composite(); Composite c3 = new Composite(); c1.components.push(c2); c1.components.push(c3); Leaf l1 = new Leaf(); Leaf l2 = new Leaf(); Leaf l3 = new Leaf(); c2.components.push(l1); c2.components.push(l2); c3.components.push(l3);
The preceding pseudocode creates three instances of the ...
Read now
Unlock full access