|
you have a set of display properties (state properties that are reflected in the UI) |
1.1. - a widget class should be able to declare which of its state properties affect display
1.1.1. - of the state properties that affect display...
|
which are updated by the client code |
|
which are handled as inputs by the generator specified by the html state property |
|
some display state properties may be handled by both the generator and client code |
if (property values are modified) {
displayPropertiesModified = /* code to determine this */
if (displayPropertiesModified.length) {
displayPropertiesOnlyReflectedByRenderWereModified = /* code to determine this */
if (displayPropertiesOnlyReflectedByRenderWereModified && can re-render DOME) {
unwireUi ();
remove DOM
re-render DOM and insert
wireUi ();
remove properties handled by re-render from displayPropertiesModified
}
if (displayPropertiesModified.length) {
}
}
1.2. - html state property
|
string, being a template into which a limited set of params are substituted |
|
a function, which can generate the HTML, and which receives no parameters but which is called as a method on the instance (so can access property values) |
|
an instance of a generator class |
5.1. - thoughts
|
generators should be able to require any module in order to accomplish generating their output |
|
generators should be able to use JavaScript templates, or other means |
|
generators should be able to be used in a context outside of the Web, Web pages, and browsers |
|
widgets should be able to use generators to generate their markup |
|
the same class of widget should be able to use any number of generators, and theoretically, different widget classes should be able to use the same generator |
|
a generator should be able to leverage other generators in the process of generating their output |
|
generators should be able to declare their input interface |
5.2. Uize.Generator (base class)
5.3. Uize.Generator.Basic (utilizing basic substitution)
EXAMPLE
Uize.Generator.Basic ({
params:['property1','property2'],
templateStr:'This template supports [#property1] and [#property2]'
});
5.4. Uize.Generator.Tokenized
|
params |
|
templateStr |
|
tokenNaming |
EXAMPLE
Uize.Generator.Tokenized ({
params:['property1','property2'],
templateStr:'This template supports {property1} and {property2}',
tokenNaming:'{KEY}'
})
5.5. Uize.Generator.Population
|
params |
|
templateStr |
|
templateItem |
EXAMPLE
Uize.Generator.Population ({
params:['property1','property2'],
templateStr:'This template supports property1Value and property2Value',
templateItem:{
property1:'property1Value',
property2:'property2Value'
}
})
5.6. Uize.Generator.Function
EXAMPLE
Uize.Generator.Function ({
params:['property1','property2'],
generator:
function (_params) {
return 'This template supports ' + _params.property1 + ' and ' + _params.property2;
}
});
5.7. Uize.Generator.Ajax
EXAMPLE
Uize.Generator.Ajax ({
params:['property1','property2'],
url:'service/getcomponent?'
});
NOTES
|
provides a system for expressing dynamically loaded HTML through service |
|
should it require its own instance of Uize.Comm.Ajax |
|
no, because it should be able to use whatever the protocol is that's in use? |
|
should defer to page's environment for URLs and comm |
5.8. Uize.Generator.Async
5.8.1. requires a...
|
comm object |
|
environment for URLs |
5.8.1.1. - or...
maybe it just requires a loader...
|
to provide the maximum flexibility, the only thing that an async generator needs is a loader |
Uize.Generator.Http