Class RuntimeResolver
- All Implemented Interfaces:
IRuntimeResolver
A component's style and dstyle properties are StylesReferences. A predefined name (*name) is its own class name on the client; any other name references a module .iiziStyle and becomes a class name only once IGProp.resolveRuntimeReferences(IRuntimeResolver) has asked this resolver for it, which the owner of the client tree does before every transaction is prepared for sending. The first time a Styles is asked for, it is looked up from the resolver container and a StylesCnr, named by a counter, is added to the client root's $styles container (created on demand), holding a communicating ProxyPropCnr of the Styles and the reference name in the string ref. The client builds the CSS class .iz_<name> from that container, and the component's reference is sent as <name>.
The Designer subclass adds what only the Designer needs: the proxy's root parent when a module model is present, and a listener on the style file so that a move, rename or disposal drops the client Styles for the next resolve to re-create. The Server uses this class as is: a loaded application's styles never change, and the proxy's own source-removed callback covers the removal of a Styles.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA Styles that a reference resolved to, with its counterpart in the client tree.Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionRuntimeResolver(PropCnr resolver, PropCnr root) Constructs the runtime resolver.Method Summary
Modifier and TypeMethodDescriptionprotected PropCnrCreates the client root's Styles container, namedAtom.STYLES, the first time a Styles is resolved and the root has none.voiddispose()Disposes of the resolver: every client Styles is removed.protected booleanisStylesSource(Styles styles) Checks that the property a reference resolved to is a Styles a reference may use: a module style, whose parent is a file container in the Designer or the module's style directory container in the Server, directly or through its folders, and never a component's own styles - the ruleStylesReferencesvalidates a reference by,StylesReferences.isStylesParent(PropCnr).protected voidCalled when a Styles has been resolved for the first time and its client counterpart created, before the counterpart is added to the client root.protected voidCalled when a client Styles is removed, before its container leaves the client root.protected final voidRemoves the client Styles of a source Styles, if present.resolveStylesReference(String stylesName) Resolves references for the Style name.
Field Details
resolver
The resolver property: the root of the tree the references are looked up from, or any property in a tree whose root resolves them.root
The root property container of the client.
Constructor Details
RuntimeResolver
Method Details
dispose
public void dispose()Disposes of the resolver: every client Styles is removed.remove
Removes the client Styles of a source Styles, if present. The next resolve of a reference to it creates a new one.- Parameters:
styles- The source Styles.
resolveStylesReference
Resolves references for the Style name.- Specified by:
resolveStylesReferencein interfaceIRuntimeResolver- Parameters:
stylesName- The Styles referenced.- Returns:
- The Runtime name to use for the Style as Class Name, null means not found.
isStylesSource
Checks that the property a reference resolved to is a Styles a reference may use: a module style, whose parent is a file container in the Designer or the module's style directory container in the Server, directly or through its folders, and never a component's own styles - the ruleStylesReferencesvalidates a reference by,StylesReferences.isStylesParent(PropCnr).- Parameters:
styles- The Styles found.- Returns:
- true if it may be used, false otherwise.
createStylesContainer
Creates the client root's Styles container, namedAtom.STYLES, the first time a Styles is resolved and the root has none.- Returns:
- The container, a plain
PropCnr.
onClientStylesAdded
Called when a Styles has been resolved for the first time and its client counterpart created, before the counterpart is added to the client root.- Parameters:
cs- The client Styles.
onClientStylesRemoved
Called when a client Styles is removed, before its container leaves the client root.- Parameters:
cs- The client Styles.