This class calls the server to get orders and shows them in a List
component. When the user clicks one order, this class sends an order selected Event to
all the Objects that are registered as listeners of that event.
This class is similar to the ServiceOrders.as (viewed in detail in the first tutorial)
We chose not to extend from ServiceOrders and extend from AbstractView insted.
| private | List | serviceOrders | |
| private | ComboBox | statusComboBox | |
| private | TextInput | license | |
| private | RecordSet | workOrders | |
| private | Connector | orderSelectedConnector | |
| private | Service | workOrdersService |
WorkOrderView() |
| public | fillComboBox(r:ResultEvent) | ||
| public | reportError(fault:FaultEvent) | ||
| public | static | FILTER_FUNCTION(record:Object, obj:Object) | |
| public | filterWorkOrders(r:ResultEvent) | ||
| public | change() | ||
| public | selectionChange() | ||
| public | updateOrderEvent(event:Number) | ||
| public | updateStatus(r:ResultEvent) | ||
| private | onLoad() | ||
| private | init() | ||
| private | createConnection() |
private serviceOrders:List
An instance of List that has been initialized on the stage with instance name serviceOrders.
private statusComboBox:ComboBox
An instance of ComboBox that has been initialized on the stage with instance name statusComboBox.
private license:TextInput
An instance of TextInput that has been initialized on the stage with instance name license.
private workOrders:RecordSet
A local reference of the recordset received from the server with the list of orders
private orderSelectedConnector:Connector
A connector used to notify when an order is selected
- See Also
- TrioMotor.orderSelected
private workOrdersService:Service
A Service object that connects to the CFC mx.services.workOrder
WorkOrderView()
public fillComboBox(r:ResultEvent):Void
Description: fills the statusComboBox with the query received
Assumptions: - We expect a query as a parameter with the columns STATUS_NAME and STATUS_ID
Data structures:RecordSet
Globals: uses statusComboBox
Calls: bindFormatStrings() in the DataGlue
Is Called by: the server via RelayResponder in response to the getStatusCodes() call
- Parameters
r (ResultEvent)- A RecorSet object- Returns
- void
public reportError(fault:FaultEvent):Void
Description: traces errors in the case problems ocurr
Assumptions: none
Globals: none
Calls: none
Is Called by: This function is called byRelayResponder when an Error ocurrs
- Parameters
fault (FaultEvent)-- Returns
- Void
static public FILTER_FUNCTION(record:Object,
obj:Object):Boolean
Description: A custom function for filtering recordsets
Assumptions: record has the properties: STATUS_ID and LICENSE. And obj has the properties txt and id
Globals: none
Calls: none
Is Called by: filter() in the workOrders recordSet inside the filterWorkOrders method
- Parameters
record (Object)- An item from the RecordSetobj (Object)-- Returns
- Boolean
public filterWorkOrders(r:ResultEvent):Void
Description: filters the List serviceOrders when the user writes in the txt field and/or selects the comboBox
Assumptions: - A RecordSet as a parameter with the columns LICENSE, WORK_ORDER_ID, and STATUS_NAME
- serviceOrders has been already instantiated on the stage
- orderSelectedConnector is instantiated
Data structures:RecordSet
Globals: uses workOrders, serviceOrders, statusComboBox
_root.workOrder( this is a global variable that it's set in the html and passed through flash vars)
Calls: serviceOrders: addItem(), removeAll(), and getItemAt()
filter() in workOrders
fireEvent() in orderSelectedConnector
Is Called by: the server via RelayResponder in response to the getWorkOrders() call and by the method change()
- Parameters
r (ResultEvent)- A query Object- Returns
- void
public change():Void
Description: Calls filterWorkOrders when dropDown is selected or text is typed in the TextInput
Assumptions: none
Globals: none
Calls: filterWorkOrders()
Is Called by: statusComboBox and license because this class is registered as a listener of the change event in both components
- Returns
- Void
public selectionChange():Void
Description: Sends an event to all the registered listeners in the connector orderSelectedConnector
Assumptions: orderSelectedConnector is intantiated
Globals: uses serviceOrders
Calls: fireEvent() in the orderSelectedConnector
Is Called by: The List serviceOrders because this class is registered as a listener of the change event via a proxy Object see #onLoad
- Returns
- Void
public updateOrderEvent(event:Number):Void
Description: requests the information of the order that needs an update to the server. This usually happens when the user clicks notify in the DetaiView and the order changes the status, therefore it needs to be updated
Assumptions: workOrdersService is intantiated
Globals: uses workOrdersService
Calls: getWorkOrderDetail() in the workOrdersService, a method on the CFC mx.services.workOrder
Is Called by: application.updateOrder Connector because this is registered as a listener of it.
- Parameters
event (Number)- Work order- Returns
- Void
- See Also
- TrioMotor.updateOrder
public updateStatus(r:ResultEvent):Void
Description: updates the status of the item received in the list
Assumptions: - We expect a RecordSet as a parameter with the columns STATUS_NAME, LICENSE, and WORK_ORDER_ID with only one item
Data structures:RecordSet
Globals: uses serviceOrders and orderSelectedConnector
Calls: fireEvent() in the orderSelectedConnector
Is Called by: the server via RelayResponder in response to the getWorkOrderDetail() call
- Parameters
r (ResultEvent)- A RecorSet Object- Returns
- Void
private onLoad():Void
Description: Registers this class as a listener of the event change in the following components:
license, serviceOrders, and statusComboBox
Assumptions: license, serviceOrders, and statusComboBox have already been instantiated on the stage
Globals: Uses the following globals:
license, statusComboBox, serviceOrders
Calls: addEventListener() in serviceOrders, statusComboBox, and license
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
private init():Void
Description: Registers this object as listener of update order event in the Connector updateOrder. Calls the create connection method to connect with the server
Assumptions: application is already instantiated
Globals: uses application, orderSelectedConnector
Calls: addListener() in the application.updateOrder. And createConnection()
Is Called by: setApplication() in its super class AbstractView
- Returns
- Void
private createConnection():Void
Description: Creates a connection with the server to the CFC mx.services.workOrder and the CFC mx.services.statusCode and gets the work orders and the status codes from those Services
Assumptions: application is already instantiated
Globals: uses application and workOrdersService
Calls: getWorkOrders() in workOrdersService ( this is a call to the CFC mx.services.workOrder)
getStatusCodes() in status_Code ( this is a call to the CFC mx.services.statusCode)
Is Called by: init()
- Returns
- Void