class com.senocular.display

LayoutManager

Extends: EventDispatcher

Class Information

Author
Trevor McCauley, www.senocular.com
Version
1.0.0
Description
The LayoutManager class is used to help layout instances keep up to date. By registering a diaplay object with a LayoutManager instance, a layout object is created and associated with that display object. This layout object can then be recognized when a parent display object within the display list with a layout is updated and update itself with that parent's changes. Additionally, by using LayoutManager.initializeAutoUpdate(), with a reference to stage the RENDER event will be used to automatically update registered layouts at the end of a frame when they've changed. When registered layouts change, the LayoutManager will dispatch a CHANGE event.

The LayoutManager works through instances as well as a singleton. If you do not want to manage multiple instances of LayoutManager, you can call LayoutManager methods directly from the LayoutManager class (meaning the class has two sets of methods, one set for instances and one set static).

Use of the LayoutManager is optional for layouts. If you do not use the LayoutManager class, then you will need to make sure to call draw() for all of your layouts to make sure they are properly updated.
Constructors
LayoutManager() Constructor. Creates a new LayoutManager instance from which you can register layouts for diaply objects. As an alternative to making your own LayoutManager instances, you can also use the static methods from the LayoutManager class to handle all layouts.
Methods
getInstance() Returns the LayoutManager instance associated with the LayoutManager class if the LayoutManager is being used as a singleton.
registerNewLayout() Registers a display object with a layout. As a registered layout, it will be available for updates if the Layout class is initialized with auto updates and for propagation of changes from parent layouts. If the target display object already has a registered layout for this same LayoutManager, that layout is returned. If the target is registered to another layout manager, it will continue to be registered to that layout manager with a separate layout instance.
getLayout() Returns the current layout object associated with the passed display object. If no layout has been registered for that object, null is returned.
unregisterLayout() Unregisters a display object's layout. As a registered layout, it will be available for updates if the LayoutManager class is initialized with auto updates and for propagation of changes from parent layouts. When unregistered, updates will have to be made manually.
isRegisteredLayout() Determines if the display object has a registered layout.
initializeAutoUpdate() Initializes the Layout class to perform automatic updates for all registered layouts. Updates happen during the RENDER event and only occur if there was a change in a layout. If already initialized the Layout class for auto updates and want to stop the auto updates, call initializeAutoUpdate again but pass null instead of a reference to the stage.
draw() Draws and updates all layouts in the layout manager
registerNewLayout() Registers a display object with a layout. As a registered layout, it will be available for updates if the Layout class is initialized with auto updates and for propagation of changes from parent layouts. If the target display object already has a registered layout for this same LayoutManager, that layout is returned. If the target is registered to another layout manager, it will continue to be registered to that layout manager with a separate layout instance.
getLayout() Returns the current layout object associated with the passed display object. If no layout has been registered for that object, null is returned.
unregisterLayout() Unregisters a display object's layout. As a registered layout, it will be available for updates if the LayoutManager class is initialized with auto updates and for propagation of changes from parent layouts. When unregistered, updates will have to be made manually.
isRegisteredLayout() Determines if the display object has a registered layout.
initializeAutoUpdate() Initializes the Layout class to perform automatic updates for all registered layouts. Updates happen during the RENDER event and only occur if there was a change in a layout. If already initialized the Layout class for auto updates and want to stop the auto updates, call initializeAutoUpdate again but pass null instead of a reference to the stage.
draw() Draws and updates all layouts in the layout manager

Constructors

LayoutManager()

public function LayoutManager()
Constructor. Creates a new LayoutManager instance from which you can register layouts for diaply objects. As an alternative to making your own LayoutManager instances, you can also use the static methods from the LayoutManager class to handle all layouts.

Methods

getInstance()

public static function getInstance():LayoutManager
Returns the LayoutManager instance associated with the LayoutManager class if the LayoutManager is being used as a singleton.

registerNewLayout()

public static function registerNewLayout(target:DisplayObject, useDefaultChangeHandler:Boolean = false):Layout
Registers a display object with a layout. As a registered layout, it will be available for updates if the Layout class is initialized with auto updates and for propagation of changes from parent layouts. If the target display object already has a registered layout for this same LayoutManager, that layout is returned. If the target is registered to another layout manager, it will continue to be registered to that layout manager with a separate layout instance.
Parameters:
targetThe display object to get a layout for.
changeHandlerIf a new Layout instance is created, this handler will be used to update the target during the CHANGE event [optional].

getLayout()

public static function getLayout(target:DisplayObject):Layout
Returns the current layout object associated with the passed display object. If no layout has been registered for that object, null is returned.
Parameters:
targetThe display object to get a layout for.

unregisterLayout()

public static function unregisterLayout(target:DisplayObject):Layout
Unregisters a display object's layout. As a registered layout, it will be available for updates if the LayoutManager class is initialized with auto updates and for propagation of changes from parent layouts. When unregistered, updates will have to be made manually.
Parameters:
targetThe display object to unregister from the manager.

isRegisteredLayout()

public static function isRegisteredLayout(target:DisplayObject):Boolean
Determines if the display object has a registered layout.
Parameters:
targetA display object to check if registered to this LayoutManager instance.

initializeAutoUpdate()

public static function initializeAutoUpdate(stage:Stage):void
Initializes the Layout class to perform automatic updates for all registered layouts. Updates happen during the RENDER event and only occur if there was a change in a layout. If already initialized the Layout class for auto updates and want to stop the auto updates, call initializeAutoUpdate again but pass null instead of a reference to the stage.
Parameters:
stageA reference to the stage to be used to allow for updates in the RENDER event.

draw()

public static function draw():void
Draws and updates all layouts in the layout manager

registerNewLayout()

public function registerNewLayout(target:DisplayObject, useDefaultChangeHandler:Boolean = false):Layout
Registers a display object with a layout. As a registered layout, it will be available for updates if the Layout class is initialized with auto updates and for propagation of changes from parent layouts. If the target display object already has a registered layout for this same LayoutManager, that layout is returned. If the target is registered to another layout manager, it will continue to be registered to that layout manager with a separate layout instance.
Parameters:
targetThe display object to get a layout for.
changeHandlerIf a new Layout instance is created, this handler will be used to update the target during the CHANGE event [optional].

getLayout()

public function getLayout(target:DisplayObject):Layout
Returns the current layout object associated with the passed display object. If no layout has been registered for that object, null is returned.
Parameters:
targetThe display object to get a layout for.

unregisterLayout()

public function unregisterLayout(target:DisplayObject):Layout
Unregisters a display object's layout. As a registered layout, it will be available for updates if the LayoutManager class is initialized with auto updates and for propagation of changes from parent layouts. When unregistered, updates will have to be made manually.
Parameters:
targetThe display object to unregister from the manager.

isRegisteredLayout()

public function isRegisteredLayout(target:DisplayObject):Boolean
Determines if the display object has a registered layout.
Parameters:
targetA display object to check if registered to this LayoutManager instance.

initializeAutoUpdate()

public function initializeAutoUpdate(stage:Stage):void
Initializes the Layout class to perform automatic updates for all registered layouts. Updates happen during the RENDER event and only occur if there was a change in a layout. If already initialized the Layout class for auto updates and want to stop the auto updates, call initializeAutoUpdate again but pass null instead of a reference to the stage.
Parameters:
stageA reference to the stage to be used to allow for updates in the RENDER event.

draw()

public function draw():void
Draws and updates all layouts in the layout manager

Page generated: 11:10 pm on July 31, 2007