Packageorg.spicefactory.parsley.context
Classpublic class ViewSettingsBuilder
InheritanceViewSettingsBuilder Inheritance Object
Implements org.spicefactory.parsley.context.SetupPart

Builder for settings related to view wiring.



Public Methods
 MethodDefined By
  
addViewLifecycle(viewType:Class, lifecycle:Class, ... params):ContextBuilderSetup
Adds a lifecycle handler class for a particular type of view component.
ViewSettingsBuilder
  
Indicates whether components should automatically be removed from the Context when they are removed from the stage.
ViewSettingsBuilder
  
Indicates whether view root should automatically be removed from the Context when they are removed from the stage.
ViewSettingsBuilder
  
Indicates whether view components will be automatically wired to the Context.
ViewSettingsBuilder
  
Sets the filter responsible for selecting views that should be autowired to the Context.
ViewSettingsBuilder
  
The view processor service registration for these settings.
ViewSettingsBuilder
Method Detail
addViewLifecycle()method
public function addViewLifecycle(viewType:Class, lifecycle:Class, ... params):ContextBuilderSetup

Adds a lifecycle handler class for a particular type of view component. This hook allows to control the lifecycle differently than with the default handler. An example use case is an AIR window which has unreliable stage events, so that it is safer to listen to its CLOSE event instead.

The specified lifecylce class must implement the ViewLifecycle interface.

Parameters

viewType:Class — the class for which to use the specified lifecycle class (this includes subclasses)
 
lifecycle:Class — the lifecycle class to instantiate for each view instance
 
... params — parameters to get passed to the constructor of the lifecylce class

Returns
ContextBuilderSetup — the original setup instance for method chaining
autoremoveComponents()method 
public function autoremoveComponents(value:Boolean):ContextBuilderSetup

Indicates whether components should automatically be removed from the Context when they are removed from the stage. The default value is true. When set to false the component must dispatch a custom "removeView" event type to signal that it wishes to be removed from the Context. When set to true the removedFromStage event will be used instead. The framework will ignore intermediate stage events caused by LayoutManagers performing some kind of reparenting to make it more robust.

Parameters

value:Boolean — whether components should automatically be removed from the Context when they are removed from the stage

Returns
ContextBuilderSetup — the original setup instance for method chaining
autoremoveViewRoots()method 
public function autoremoveViewRoots(value:Boolean):ContextBuilderSetup

Indicates whether view root should automatically be removed from the Context when they are removed from the stage. The default value is true. When set to false the view root must dispatch a custom "removeView" event type to signal that it wishes to be removed from the Context. When set to true the removedFromStage event will be used instead. The framework will ignore intermediate stage events caused by LayoutManagers performing some kind of reparenting to make it more robust.

The difference to the setting for component removal is that a view root is the actual display object that listens to bubbling events from the components below. If you are using the <ContextBuilder> MXML tag then the component it is placed upon automatically becomes a view root for the Context created by that builder. Further view roots for popups or windows may be added explicitly through ViewManager.addViewRoot().

Parameters

value:Boolean — whether view roots should automatically be removed from the Context when they are removed from the stage

Returns
ContextBuilderSetup — the original setup instance for method chaining
autowireComponents()method 
public function autowireComponents(value:Boolean):ContextBuilderSetup

Indicates whether view components will be automatically wired to the Context. The default value is false. If set to true the only requirement for a view to get wired is that a corresponding %lt;View> tag is added to the MXML or XML configuration. When set to false the component must explicitly signal that it wishes to get wired to the Context through dispatching a "configureView" event of adding a <parsley:Configure/> tag.

Parameters

value:Boolean — whether view components will be automatically wired to the Context

Returns
ContextBuilderSetup — the original setup instance for method chaining
autowireFilter()method 
public function autowireFilter(filter:ViewAutowireFilter):ContextBuilderSetup

Sets the filter responsible for selecting views that should be autowired to the Context.

The framework has a builtin autowire filter that automatically picks those components that have a matching %lt;View> tag in the MXML or XML configuration. If you want to rely on this behaviour you just have to call autowireComponents(true) on this builder. A custom filter can be used to apply a different behaviour, like picking components simply based on class or package names.

Parameters

filter:ViewAutowireFilter — the filter responsible for selecting views that should be autowired to the Context

Returns
ContextBuilderSetup — the original setup instance for method chaining
viewProcessor()method 
public function viewProcessor():ServiceBuilder

The view processor service registration for these settings. This hook allows to install alternative implementations to be used for processing all views in the associated Context and its children unless overwritten in a child.

When specifying an implementation or decorator for this service, it must implement the ViewProcessor interface.

Returns
ServiceBuilder — the builder for specifying the implementation or decorators for the ViewProcessor