com.triomotor

TrioMotor

extends: MovieClip

This class is the main class in the project. A reference to an instance of this class will be set as application in all the AbstractViews.
This class creates the different Connectors for communication between components and provides a global path for establishing a connection with the components (CFC) in the server.

See Also
Connector

Property Summary

public ConnectortotalLabor
public ConnectorbayChange
public ConnectornewPart
public ConnectororderSelected
public ConnectorupdateOrder
private AbstractViewworkOrder
private AbstractViewdetail
private AbstractViewcustomerInfo
private AbstractViewtabs
private StringalternativePath = "http://192.168.1.102/flashservices/gateway"
private ArrayorderReceivedListeners
private ServiceserviceWorkOrder
public Voidpath

Constructor Summary

TrioMotor()

Method Summary

public orderSelectedEvent(id:String)
public broadcastOrderReceived(r:ResultEvent)
public addOrderReceivedListener(lis:OrderReceivedListener)
public removeOrderReceivedListener(lis:OrderReceivedListener)
private init()
private onLoad()

Property Details

totalLabor

public totalLabor:Connector

DetailView sends totalLaborEvent BaySchedule receives totalLaborEvent in setSelectionSize

bayChange

public bayChange:Connector

BaySchedule sends and receives bayChangeEvent DetailView receives bayChangeEvent

newPart

public newPart:Connector

Parts send newPartEvent DetailView receives newPartEvent

orderSelected

public orderSelected:Connector

WorkOrderView sends orderSelectedEvent TrioMotor receives newPartEvent

updateOrder

public updateOrder:Connector

DetailView sends updateOrderEvent WorkOrderDisplay receives updateOrderEvent

workOrder

private workOrder:AbstractView

A workOrderDisplay instance that has been initialized on the stage (TrioMotor Clip) with the name workOrder as its instance name

detail

private detail:AbstractView

A DetailView instance that has been initialized on the stage (TrioMotor Clip) with the name detail as its instance name

customerInfo

private customerInfo:AbstractView

A CustomeInformation instance that has been initialized on the stage (TrioMotor Clip) with the name customerInfo as its instance name

tabs

private tabs:AbstractView

A TabView instance that has been initialized on the stage (TrioMotor Clip) with the name tabs as its instance name

alternativePath

private alternativePath:String = "http://192.168.1.102/flashservices/gateway"

This is an alternativePath that can be used if you are testing the Movie inside the flash IDE. By default we use the flashvars parameter in the HTML but if we want to test it outside the browser we need an alternative path

orderReceivedListeners

private orderReceivedListeners:Array

This Array will hold all the listeners that register for the result of the remote call to the service (CFC) getWorkOrderDetail. All the elements in this Array must implements the interface OrderReceivedListener

See Also
OrderReceivedListener

serviceWorkOrder

private serviceWorkOrder:Service

A Service object that will connect to mx.services.workOrder to request the getWorkOrderDetail method

path

public path:Void

Description: Sets the path variable
Globals: sets alternativePath
Calls: none
Is Called by: none

Constructor Details

TrioMotor

TrioMotor()

Description: A simple constructor that calls the init method
Calls: init()

Method Details

orderSelectedEvent

public orderSelectedEvent(id:String):Void

Description: Calls server to request the method getWorkOrderDetail and set a relayResponder to broadcastOrderReceived
Assumptions: the serviceWorkOrder are already instantiated
Globals: uses serviceWorkOrder
Calls: getWorkOrderDetail() in the server (CFC)
Is Called by: The Connector orderSelected

Parameters
id (String) -
Returns
Void

broadcastOrderReceived

public broadcastOrderReceived(r:ResultEvent):Void

Description: Broadcasts the result from the server (getWorkOrderDetail()) to all the listeners inside the Array orderReceivedListeners and pass the first item of the query
Assumptions: - We expect a query as a parameter with only one row. If it contains more, they will be discarded.
- The orderReceivedListeners are already instantiated
Data structures:RecordSet
Globals: Uses orderReceivedListeners
Calls: onOrderReceived() in all the register listeners
Is Called by: This function is called by the server via RelayResponder in response to the getWorkOrderDetail() call

Parameters
r (ResultEvent) -
Returns
void

addOrderReceivedListener

public addOrderReceivedListener(lis:OrderReceivedListener):Void

Description: Adds the listener to the Array orderReceivedListeners
Assumptions: - The lis object has implemented the OrderReceivedListener interface
- The orderReceivedListeners are already instantiated Data structures:Array
Globals: adds an item to orderReceivedListeners
Calls: none
Is Called by: Listeners such as: DetailView, CustomerInformation, Information

Parameters
lis (OrderReceivedListener) -
Returns
Void

removeOrderReceivedListener

public removeOrderReceivedListener(lis:OrderReceivedListener):Void

Description: removes the listener from the Array orderReceivedListeners
Assumptions: - The lis object has implemented the OrderReceivedListener interface
- The orderReceivedListeners are already instantiated
Data structures:Array
Globals: removes an item from orderReceivedListeners
Calls: none
Is Called by: none

Parameters
lis (OrderReceivedListener) -
Returns
void

init

private init():Void

Description: Creates a new array to hold the listeners and creates a server connection to the CFC mx.services.workOrder via new Service()
Sets the global styles for the entire application
Globals: instantiates orderReceivedListeners, uses path and _global.style
Data structures:Array
Calls: none
Is Called by: The TrioMotor constructor

Returns
Void

onLoad

private onLoad():Void

Description: Instantiates the five Connectors. It's register as a listener of the orderSelected Connector.
Set the application on workOrder, customerInfo, detail, and tabs
Assumptions: The views have already been instantiated on the stage
Globals: Instantiates the following globals:
totalLabor, bayChange, newPart, orderSelected, updateOrder
Calls: setApplication() in the following Views: workOrder, customerInfo, detail, tabs
Is Called by: This function is called automatically by the player when this object is completely loaded. This is possible because this class extends from the MovieClip Class

Returns
Void