![]() |
![]() |
||||||
|
|||||||
You can mix elements of any built-in type with object elements that represent instances of user-defined classes. Together, they allow you to create object compositions of arbitrary complexity. Dynamic Object Composition Object composition using markup is often more flexible than using a component that is frozen at compile time. Dynamically generated markup provides an opportunity to change the composition and configuration of objects on the fly. See Advanced Table Features for some striking examples of how you can change object configurations using just markup data. Object composition using markup also enables you to dynamically compose new types of objects out of loosely-coupled reusable classes. As an example, we could reuse the numeric spinner and month picker, that we developed earlier, to create a “Date Picker” similar to the following: ![]() The listing for the Date Picker view is shown below: Make this object in eNode Sandbox. The result should be similar to the following: ![]() The object elements whose id attributes are equal to monthController and yearController, are both realized as instances of the class com.enode.xalt.Sequencer. However, both objects are configured differently. The sequence property of the former is an instance of com.enode.calendar.MonthModel, while that of the latter is an instance of com.enode.xalt.IntegerTextModel. For details on these model classes, see Synthesizing a Spinner. Repeating Pattern The Model-View-Controller Pattern repeats at the component level. The component in this case is the “Date Picker”. But what we have shown above is just the view portion of the component. We could build the remaining pieces of the “Date Picker”, and call it a day, but we decided to go ahead and build an even larger component — a Calendar. |
|||||||
|
Copyright © 2002 eNode, Inc. All Rights Reserved. |