| Package | vegas.models.maps |
| Class | public class OrderedMapModelObject |
| Inheritance | OrderedMapModelObject MapModelObject CoreModelObject CoreModel CoreEventDispatcher Object |
| Property | Defined By | ||
|---|---|---|---|
![]() | channel : String [read-only]
Indicates the channel of this dispatcher if this instance is global. | CoreEventDispatcher | |
![]() | id : *
Returns the id of this IModelObject. | CoreModel | |
| loop : Boolean = true
Indicates if the next and previous method loops when the internal ordered iterator can find a next or previous value object. | OrderedMapModelObject | ||
![]() | security : Boolean = true
This property defined if the setCurrentVO method can accept the same vo in argument as the current one. | CoreModelObject | |
| Property | Defined By | ||
|---|---|---|---|
| _it : PageByPageIterator
The internal iterator to show the pictures. | OrderedMapModelObject | ||
![]() | _map : Map
The internal map of this model. | MapModelObject | |
![]() | _sAddType : String
The internal ModelObjectEvent type use in the addVO method. | MapModelObject | |
![]() | _sRemoveType : String
The internal ModelObjectEvent type use in the removeVO method. | MapModelObject | |
![]() | _sUpdateType : String
The internal ModelObjectEvent type when the update event type is use. | MapModelObject | |
| Method | Defined By | ||
|---|---|---|---|
OrderedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)
Creates a new OrderedMapModelObject instance. | OrderedMapModelObject | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0.0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target. | CoreEventDispatcher | |
![]() | addVO(vo:ValueObject):void
Inserts a value object in the model. | MapModelObject | |
clear():void [override]
Clear the model. | OrderedMapModelObject | ||
![]() | contains(vo:ValueObject):Boolean
Returns true if the model contains the specified ValueObject. | MapModelObject | |
![]() | containsByID(id:*):Boolean
Returns true if the model contains the specified id key in argument. | MapModelObject | |
![]() | containsByProperty(propName:String, value:*):Boolean
Returns true if the model contains the specified attribute value. | MapModelObject | |
![]() |
Returns and creates a new empty ModelObjectEvent. | CoreModelObject | |
![]() | dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow. | CoreEventDispatcher | |
![]() |
Returns the current ValueObject selected in this model. | CoreModelObject | |
![]() |
Returns the internal system.events.EventDispatcher reference. | CoreEventDispatcher | |
![]() | getEventTypeADD():String
Returns the event name use in the addVO method. | MapModelObject | |
![]() | getEventTypeBEFORE_CHANGE():String
Returns the event name use in the setCurrentVO method before is changed. | CoreModelObject | |
![]() | getEventTypeCHANGE():String
Returns the event name use in the setVO method. | CoreModelObject | |
![]() | getEventTypeCLEAR():String
Returns the event name use in the clear method. | CoreModelObject | |
![]() | getEventTypeREMOVE():String
Returns the event name use in the removeVO method. | MapModelObject | |
![]() | getEventTypeUPDATE():String
Returns the event name use in the updateVO method. | MapModelObject | |
![]() |
Returns the internal map of this model. | MapModelObject | |
![]() | getVO(id:*):ValueObject
Returns the ValueObject defined by the id passed in argument. | MapModelObject | |
![]() | getVOByProperty(propName:String, value:*):ValueObject
Returns a ValueObject if the model contains a ValueObject with the specified member. | MapModelObject | |
![]() | hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | CoreEventDispatcher | |
hasNext():Boolean
Returns true if the model has more elements. | OrderedMapModelObject | ||
hasPrevious():Boolean
Checks to see if there is a previous element that can be iterated to. | OrderedMapModelObject | ||
![]() | initEventType():void [override]
This method is invoked in the constructor of the class to initialize all events. | MapModelObject | |
[override]
Initialize the internal Map instance in the constructor of the class. | OrderedMapModelObject | ||
![]() | isEmpty():Boolean
Returns true if the model is empty. | MapModelObject | |
![]() | isGlobal():Boolean
Indicates if the dispatcher use a global event flow. | CoreEventDispatcher | |
![]() | isLocked():Boolean
Returns true if the object is locked. | CoreEventDispatcher | |
![]() |
Returns the iterator of this model. | MapModelObject | |
![]() | lock():void
Locks the object. | CoreEventDispatcher | |
next():void
Sets the next value object in the model. | OrderedMapModelObject | ||
![]() | notifyAdd(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject is inserted in the model. | MapModelObject | |
![]() | notifyBeforeChange(vo:ValueObject):void
Notify a ModelObjectEvent before the current ValueObject selected in the model is changed. | CoreModelObject | |
![]() | notifyChange(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject change in the model. | CoreModelObject | |
![]() | notifyClear():void
Notify a ModelObjectEvent when the model is cleared. | CoreModelObject | |
![]() | notifyRemove(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject is removed in the model. | MapModelObject | |
![]() | notifyUpdate(vo:ValueObject):void
Notify a ModelObjectEvent when a ValueObject is updated in the model. | MapModelObject | |
previous():void
Sets the previous value object in the model. | OrderedMapModelObject | ||
![]() | registerEventListener(type:String, listener:*, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Allows the registration of event listeners on the event target (Function or EventListener). | CoreEventDispatcher | |
![]() | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object. | CoreEventDispatcher | |
![]() | removeVO(vo:ValueObject):void
Removes a value object in the model. | MapModelObject | |
reset():void
Reset the internal iterator of the model. | OrderedMapModelObject | ||
run(... arguments):void [override]
Resets the model and run the model to select the next value object register in the model. | OrderedMapModelObject | ||
seek(vo:ValueObject):void
Seek the model and select the specified value Object. | OrderedMapModelObject | ||
setCurrentVO(vo:ValueObject):void [override]
Sets the current ValueObject selected in this model. | OrderedMapModelObject | ||
![]() | setEventDispatcher(dispatcher:EventDispatcher):void
Sets the internal EventDispatcher reference. | CoreEventDispatcher | |
![]() | setEventTypeADD(type:String):void
Sets the event name use in the addVO method. | MapModelObject | |
![]() | setEventTypeBEFORE_CHANGE(type:String):void
Returns the event name use in the setCurrentVO method before is changed. | CoreModelObject | |
![]() | setEventTypeCHANGE(type:String):void
Returns the event name use in the setVO method. | CoreModelObject | |
![]() | setEventTypeCLEAR(type:String):void
Returns the event name use in the clear method. | CoreModelObject | |
![]() | setEventTypeREMOVE(type:String):void
Sets the event name use in the removeVO method. | MapModelObject | |
![]() | setEventTypeUPDATE(type:String):void
Sets the event name use in the addVO method. | MapModelObject | |
![]() | setGlobal(flag:Boolean = false, channel:String = null):void
Sets if the instance use a global system.events.EventDispatcher to dispatch this events, if the flag value is false the instance use a local EventDispatcher. | CoreEventDispatcher | |
![]() |
Sets the internal map of this model. | MapModelObject | |
![]() | size():Number
Returns the number of ValueObject in this model. | MapModelObject | |
![]() | supports(value:*):Boolean
Returns true if the IValidator object validate the value. | CoreModelObject | |
![]() | unlock():void
Unlocks the display. | CoreEventDispatcher | |
![]() | unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void
Removes a listener (Function or EventListener object) from the EventDispatcher object. | CoreEventDispatcher | |
![]() | updateVO(vo:ValueObject):void
Update a value object in the model. | MapModelObject | |
![]() | validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid. | CoreModelObject | |
![]() | willTrigger(type:String):Boolean
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | CoreEventDispatcher | |
| _it | property |
protected var _it:PageByPageIteratorThe internal iterator to show the pictures.
| loop | property |
public var loop:Boolean = trueIndicates if the next and previous method loops when the internal ordered iterator can find a next or previous value object.
| OrderedMapModelObject | () | Constructor |
public function OrderedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)Creates a new OrderedMapModelObject instance.
Parametersglobal:Boolean (default = true) — the flag to use a global event flow or a local event flow.
| |
channel:String (default = null) — (optional) the name of the global event flow if the global argument is true.
| |
id:* (default = null) — the id of this model.
|
| clear | () | method |
override public function clear():voidClear the model.
| hasNext | () | method |
public function hasNext():Boolean
Returns true if the model has more elements.
Boolean — true if the model has more elements.
|
| hasPrevious | () | method |
public function hasPrevious():BooleanChecks to see if there is a previous element that can be iterated to.
ReturnsBoolean — true if the iterator has more elements.
|
| initializeMap | () | method |
override public function initializeMap():MapInitialize the internal Map instance in the constructor of the class.
ReturnsMap |
| next | () | method |
public function next():voidSets the next value object in the model.
| previous | () | method |
public function previous():voidSets the previous value object in the model. If no value object is selected in the model this method invoke the next() method to select the first value object.
| reset | () | method |
public function reset():voidReset the internal iterator of the model.
| run | () | method |
override public function run(... arguments):voidResets the model and run the model to select the next value object register in the model.
Parameters
... arguments |
| seek | () | method |
public function seek(vo:ValueObject):voidSeek the model and select the specified value Object.
Parameters
vo:ValueObject — The value object reference to seek the model.
|
ArgumentError — if the passed-in ValueObject isn't register in the model.
|
| setCurrentVO | () | method |
override public function setCurrentVO(vo:ValueObject):void
Sets the current ValueObject selected in this model.
Parameters
vo:ValueObject |
package examples
{
import vegas.events.ModelObjectEvent;
import vegas.models.maps.OrderedMapModelObject;
import vegas.vo.FilterVO;
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class OrderedMapModelObjectExample extends Sprite
{
public function OrderedMapModelObjectExample()
{
model = new OrderedMapModelObject() ;
model.addEventListener( ModelObjectEvent.ADD_VO , debug ) ;
model.addEventListener( ModelObjectEvent.CHANGE_VO , debug ) ;
var count:uint = 4 ;
for (var i:int ; i < count ; i++ )
{
model.addVO( new FilterVO( { id : i , filter : i << 1 } ) ) ;
}
model.run() ;
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
}
public var model:OrderedMapModelObject ;
public function debug( e:ModelObjectEvent ):void
{
trace( "type:" + e.type + " vo:" + e.getVO() ) ;
}
public function keyDown( e:KeyboardEvent ):void
{
var code:uint = e.keyCode ;
switch( code )
{
case Keyboard.LEFT :
{
model.previous() ;
trace( "hasPrevious:" + model.hasPrevious() ) ;
break ;
}
case Keyboard.RIGHT :
{
model.next() ;
trace( "hasNext:" + model.hasNext() ) ;
break ;
}
case Keyboard.SPACE :
{
model.loop = !model.loop ;
trace( "loop:" + model.loop ) ;
break ;
}
}
}
}
}