Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
|
Config(Object owner ) |
Config |
|
|
addProperty(String key , Object propertyObject ) : void |
Config |
Adds a property to the Config Object's private config hash. |
|
alreadySubscribed<static>(YAHOO.util.CustomEvent evt , Function fn , Object obj ) : Boolean |
Config |
<static> Checks to determine if a particular function/Object pair are already subscribed to the specified Custo... |
|
applyConfig(Object userConfig , Boolean init ) : void |
Config |
Applies a key-value Object literal to the configuration, replacing any existing values, and queueing the property eve... |
|
checkBoolean(Object val ) : Boolean |
Config |
Validates that the value passed in is a Boolean. |
|
checkNumber(Object val ) : Boolean |
Config |
Validates that the value passed in is a number. |
|
fireQueue() : void |
Config |
Fires the normalized list of queued property change events |
|
getConfig() : Object |
Config |
Returns a key-value configuration map of the values currently set in the Config Object. |
|
getProperty(String key ) : Object |
Config |
Returns the value of specified property. |
|
init(Object owner ) : void |
Config |
Initializes the configuration Object and all of its local members. |
|
outputEventQueue() : String |
Config |
Returns a string representation of the Config object's current CustomEvent queue |
|
queueProperty(String key , String value ) : Boolean |
Config |
Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
mov... |
|
refireEvent(String key ) : void |
Config |
Fires the event for a property using the property's current value. |
|
refresh() : void |
Config |
Refires the events for all configuration properties using their current values. |
|
resetProperty(String key ) : Boolean |
Config |
Resets the specified property's value to its initial value. |
|
setProperty(String key , String value , Boolean silent ) : Boolean |
Config |
Sets the value of a property. If the silent property is passed as true, the property's event will not be fired. |
|
subscribeToConfigEvent(String key , Function handler , Object obj , Boolean override ) : Boolean |
Config |
Subscribes an external handler to the change event for any given property. |
|
toString() : String |
Config |
Returns a string representation of the Config object |
|
unsubscribeFromConfigEvent(String key , Function handler , Object obj ) : Boolean |
Config |
Unsubscribes an external handler from the change event for any given property. |
addProperty
public function addProperty(String key
, Object propertyObject
)
Adds a property to the Config Object's private config hash.
This method is defined by Config.
alreadySubscribed<static>
public function alreadySubscribed<static>(YAHOO.util.CustomEvent evt
, Function fn
, Object obj
)
<static> Checks to determine if a particular function/Object pair are already subscribed to the specified CustomEvent
Parameters:
evt
: YAHOO.util.CustomEventThe CustomEvent for which to check the subscriptions
fn
: FunctionThe function to look for in the subscribers list
obj
: ObjectThe execution scope Object for the subscription
Returns:
This method is defined by Config.
applyConfig
public function applyConfig(Object userConfig
, Boolean init
)
Applies a key-value Object literal to the configuration, replacing any existing values, and queueing the property events.
Although the values will be set, fireQueue() must be called for their associated events to execute.
Parameters:
userConfig
: ObjectThe configuration Object literal
init
: BooleanWhen set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.
Returns:
This method is defined by Config.
checkBoolean
public function checkBoolean(Object val
)
Validates that the value passed in is a Boolean.
Parameters:
val
: ObjectThe value to validate
Returns:
This method is defined by Config.
checkNumber
public function checkNumber(Object val
)
Validates that the value passed in is a number.
Parameters:
val
: ObjectThe value to validate
Returns:
This method is defined by Config.
fireQueue
public function fireQueue()
Fires the normalized list of queued property change events
This method is defined by Config.
getConfig
public function getConfig()
Returns a key-value configuration map of the values currently set in the Config Object.
This method is defined by Config.
getProperty
public function getProperty(String key
)
Returns the value of specified property.
Parameters:
key
: StringThe name of the property
Returns:
This method is defined by Config.
init
public function init(Object owner
)
Initializes the configuration Object and all of its local members.
This method is defined by Config.
outputEventQueue
public function outputEventQueue()
Returns a string representation of the Config object's current CustomEvent queue
This method is defined by Config.
queueProperty
public function queueProperty(String key
, String value
)
Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
moved from its current position to the end of the queue.
This method is defined by Config.
refireEvent
public function refireEvent(String key
)
Fires the event for a property using the property's current value.
Parameters:
key
: StringThe name of the property
Returns:
This method is defined by Config.
refresh
public function refresh()
Refires the events for all configuration properties using their current values.
This method is defined by Config.
resetProperty
public function resetProperty(String key
)
Resets the specified property's value to its initial value.
Parameters:
key
: StringThe name of the property
Returns:
This method is defined by Config.
setProperty
public function setProperty(String key
, String value
, Boolean silent
)
Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
Parameters:
key
: StringThe name of the property
value
: StringThe value to set the property to
silent
: BooleanWhether the value should be set silently, without firing the property event.
Returns:
This method is defined by Config.
subscribeToConfigEvent
public function subscribeToConfigEvent(String key
, Function handler
, Object obj
, Boolean override
)
Subscribes an external handler to the change event for any given property.
Parameters:
key
: StringThe property name
handler
: FunctionThe handler function to use subscribe to the property's event
obj
: ObjectThe Object to use for scoping the event handler (see CustomEvent documentation)
override
: BooleanOptional. If true, will override "this" within the handler to map to the scope Object passed into the method.
Returns:
This method is defined by Config.
toString
public function toString()
Returns a string representation of the Config object
This method is defined by Config.
unsubscribeFromConfigEvent
public function unsubscribeFromConfigEvent(String key
, Function handler
, Object obj
)
Unsubscribes an external handler from the change event for any given property.
This method is defined by Config.