Packagevegas.models.maps
Classpublic class OrderedMapModelObject
InheritanceOrderedMapModelObject Inheritance MapModelObject Inheritance CoreModelObject Inheritance CoreModel Inheritance CoreEventDispatcher Inheritance Object

This map model object is ordered with a previous and next methods inside.

View the examples



Public Properties
 PropertyDefined By
 Inheritedchannel : String
[read-only] Indicates the channel of this dispatcher if this instance is global.
CoreEventDispatcher
 Inheritedid : *
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
 Inheritedsecurity : Boolean = true
This property defined if the setCurrentVO method can accept the same vo in argument as the current one.
CoreModelObject
Protected Properties
 PropertyDefined By
  _it : PageByPageIterator
The internal iterator to show the pictures.
OrderedMapModelObject
 Inherited_map : Map
The internal map of this model.
MapModelObject
 Inherited_sAddType : String
The internal ModelObjectEvent type use in the addVO method.
MapModelObject
 Inherited_sRemoveType : String
The internal ModelObjectEvent type use in the removeVO method.
MapModelObject
 Inherited_sUpdateType : String
The internal ModelObjectEvent type when the update event type is use.
MapModelObject
Public Methods
 MethodDefined By
  
OrderedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)
Creates a new OrderedMapModelObject instance.
OrderedMapModelObject
 Inherited
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
 Inherited
Inserts a value object in the model.
MapModelObject
  
clear():void
[override] Clear the model.
OrderedMapModelObject
 Inherited
contains(vo:ValueObject):Boolean
Returns true if the model contains the specified ValueObject.
MapModelObject
 Inherited
containsByID(id:*):Boolean
Returns true if the model contains the specified id key in argument.
MapModelObject
 Inherited
containsByProperty(propName:String, value:*):Boolean
Returns true if the model contains the specified attribute value.
MapModelObject
 Inherited
Returns and creates a new empty ModelObjectEvent.
CoreModelObject
 Inherited
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
CoreEventDispatcher
 Inherited
Returns the current ValueObject selected in this model.
CoreModelObject
 Inherited
Returns the internal system.events.EventDispatcher reference.
CoreEventDispatcher
 Inherited
Returns the event name use in the addVO method.
MapModelObject
 Inherited
Returns the event name use in the setCurrentVO method before is changed.
CoreModelObject
 Inherited
Returns the event name use in the setVO method.
CoreModelObject
 Inherited
Returns the event name use in the clear method.
CoreModelObject
 Inherited
Returns the event name use in the removeVO method.
MapModelObject
 Inherited
Returns the event name use in the updateVO method.
MapModelObject
 Inherited
Returns the internal map of this model.
MapModelObject
 Inherited
Returns the ValueObject defined by the id passed in argument.
MapModelObject
 Inherited
getVOByProperty(propName:String, value:*):ValueObject
Returns a ValueObject if the model contains a ValueObject with the specified member.
MapModelObject
 Inherited
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
 Inherited
[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
 Inherited
isEmpty():Boolean
Returns true if the model is empty.
MapModelObject
 Inherited
isGlobal():Boolean
Indicates if the dispatcher use a global event flow.
CoreEventDispatcher
 Inherited
isLocked():Boolean
Returns true if the object is locked.
CoreEventDispatcher
 Inherited
Returns the iterator of this model.
MapModelObject
 Inherited
lock():void
Locks the object.
CoreEventDispatcher
  
next():void
Sets the next value object in the model.
OrderedMapModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject is inserted in the model.
MapModelObject
 Inherited
Notify a ModelObjectEvent before the current ValueObject selected in the model is changed.
CoreModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject change in the model.
CoreModelObject
 Inherited
Notify a ModelObjectEvent when the model is cleared.
CoreModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject is removed in the model.
MapModelObject
 Inherited
Notify a ModelObjectEvent when a ValueObject is updated in the model.
MapModelObject
  
previous():void
Sets the previous value object in the model.
OrderedMapModelObject
 Inherited
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
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
CoreEventDispatcher
 Inherited
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
  
[override] Sets the current ValueObject selected in this model.
OrderedMapModelObject
 Inherited
Sets the internal EventDispatcher reference.
CoreEventDispatcher
 Inherited
setEventTypeADD(type:String):void
Sets the event name use in the addVO method.
MapModelObject
 Inherited
setEventTypeBEFORE_CHANGE(type:String):void
Returns the event name use in the setCurrentVO method before is changed.
CoreModelObject
 Inherited
setEventTypeCHANGE(type:String):void
Returns the event name use in the setVO method.
CoreModelObject
 Inherited
setEventTypeCLEAR(type:String):void
Returns the event name use in the clear method.
CoreModelObject
 Inherited
setEventTypeREMOVE(type:String):void
Sets the event name use in the removeVO method.
MapModelObject
 Inherited
setEventTypeUPDATE(type:String):void
Sets the event name use in the addVO method.
MapModelObject
 Inherited
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
 Inherited
setMap(m:Map):void
Sets the internal map of this model.
MapModelObject
 Inherited
size():Number
Returns the number of ValueObject in this model.
MapModelObject
 Inherited
supports(value:*):Boolean
Returns true if the IValidator object validate the value.
CoreModelObject
 Inherited
unlock():void
Unlocks the display.
CoreEventDispatcher
 Inherited
unregisterEventListener(type:String, listener:*, useCapture:Boolean = false):void
Removes a listener (Function or EventListener object) from the EventDispatcher object.
CoreEventDispatcher
 Inherited
Update a value object in the model.
MapModelObject
 Inherited
validate(value:*):void
Evaluates the specified value and throw a TypeError object if the value is not valid.
CoreModelObject
 Inherited
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
Protected Methods
 MethodDefined By
 Inherited
Creates and returns the internal EventDispatcher reference (this method is invoked in the constructor).
CoreEventDispatcher
Property Detail
_itproperty
protected var _it:PageByPageIterator

The internal iterator to show the pictures.

loopproperty 
public var loop:Boolean = true

Indicates if the next and previous method loops when the internal ordered iterator can find a next or previous value object.

Constructor Detail
OrderedMapModelObject()Constructor
public function OrderedMapModelObject(global:Boolean = true, channel:String = null, id:* = null)

Creates a new OrderedMapModelObject instance.

Parameters
global: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.
Method Detail
clear()method
override public function clear():void

Clear the model.

hasNext()method 
public function hasNext():Boolean

Returns true if the model has more elements.

Returns
Booleantrue if the model has more elements.
hasPrevious()method 
public function hasPrevious():Boolean

Checks to see if there is a previous element that can be iterated to.

Returns
Booleantrue if the iterator has more elements.
initializeMap()method 
override public function initializeMap():Map

Initialize the internal Map instance in the constructor of the class.

Returns
Map
next()method 
public function next():void

Sets the next value object in the model.

previous()method 
public function previous():void

Sets 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():void

Reset the internal iterator of the model.

run()method 
override public function run(... arguments):void

Resets 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):void

Seek the model and select the specified value Object.

Parameters

vo:ValueObject — The value object reference to seek the model.


Throws
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

Examples
Example
     
     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 ;
                     }
                 }
             }
         }
     }