com.triomotor.views

Parts

extends: AbstractView

This class is the view of the second tab in the TabView class.
Shows the Tree with parts to allow user to select a part to add to an order

See Also
TabView

Property Summary

private TreepartsTree
private TextInputpartInput
private TextInputidInput
private TextInputskuInput
private TextInputstkInput
private TextInputlaborInput
private TextInputpriceInput
private TextInputqtyInput
private TextAreadescArea
private ButtonaddBut
private ServiceremoteServer
private ObjectselectedPart
private ConnectornewPart

Constructor Summary

Parts()

Method Summary

public showCats(r:ResultEvent)
public change()
public click()
public nullshowDetail(r:ResultEvent)
private onLoad()
private setConnection()

Property Details

partsTree

private partsTree:Tree

A Tree instance that has been initialized on the stage with instance name partsTree

partInput

private partInput:TextInput

A TextInput instance that has been initialized on the stage with instance name partInput

idInput

private idInput:TextInput

A TextInput instance that has been initialized on the stage with instance name idInput

skuInput

private skuInput:TextInput

A TextInput instance that has been initialized on the stage with instance name skuInput

stkInput

private stkInput:TextInput

A TextInput instance that has been initialized on the stage with instance name stkInput

laborInput

private laborInput:TextInput

A TextInput instance that has been initialized on the stage with instance name laborInput

priceInput

private priceInput:TextInput

A TextInput instance that has been initialized on the stage with instance name priceInput

qtyInput

private qtyInput:TextInput

A TextInput instance that has been initialized on the stage with instance name qtyInput

descArea

private descArea:TextArea

A TextArea instance that has been initialized on the stage with instance name descArea

addBut

private addBut:Button

A Button instance that has been initialized on the stage with instance name addBut

remoteServer

private remoteServer:Service

A service Object that has a link to the server component "mx.services.part"

selectedPart

private selectedPart:Object

An Object where the item that we receive from the server is stored

newPart

private newPart:Connector

A Connector used to send a newPartEvent to the listener components registered

See Also
TrioMotor.newPart

Constructor Details

Parts

Parts()

Method Details

showCats

public showCats(r:ResultEvent):Void

Description: Sets the dataProvider of the tree with the XML Object received from the server Assumptions: partsTree is instantiated on the stage
XML received from the server has the structure of a tree Globals: uses partsTree Calls: none
Is Called by: This function is called by the server via RelayResponder in response to the getParts() call

Parameters
r (ResultEvent) - xml Object that represent the tree data
Returns
Void

change

public change():Void

Description: makes a call to the server when the user selects an item in the Tree. Creates a RelayResponder to bind the response from the server to the function showDetail()
Assumptions: remoteServer is instantiated
Globals: uses remoteServer
Calls: getPartDetail() on the remoteServer Object
Is Called by: This function is called by Tree when the user selects an item

Returns
Void

click

public click():Void

Description: If a selected part is available, a copy of that is created and a new property QTY is assigned with the value of the qtyInput field. Then, a new Event is fired to the newPart Connector
Assumptions: newPart is instantiated
Globals: uses selectedPart and newPart
Calls: fireEvent() on the newPart Connector
Is Called by: This function is called by the Button "addBut" when the user clicks on it

Returns
Void
See Also
TrioMotor.newPart

showDetail

public showDetail(r:ResultEvent)

Description: Populates the textFields with the data received from the server and keeps a reference of the part in the selectedPart member Assumptions: A query received from the server has only one item with the following properties:
PART_NAME, PART_ID, SKU, LABOR, PRICE, DESC, IN_STOCK_DATE Globals: uses the followings globals:
selectedPart, partInput, idInput, skuInput, laborInput, priceInput, descArea, qtyInput, stkInput Calls: none
Is Called by: This function is called by the server via RelayResponder in response to the getPartDetail() call

Parameters
r (ResultEvent) - RecordSet with only one item
Returns
Void
See Also
TrioMotor.newPart

onLoad

private onLoad():Void

Description: Registers itself as a listener of the tree and the button. Calls the method to connect to the server and changes the property of the XML to ignore blank spaces
Assumptions: partsTree and addBut are instantiated on the stage
Globals: instantiates partsTree
uses addBut and partsTree
Calls: addEventListener() in the partsTree
addEventListener() in the addBut
setConnection()
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
See Also
TrioMotor.newPart

setConnection

private setConnection():Void

Description: Creates a connection to the component "mx.services.part" and calls the method getParts() to populate the tree. Map the result of this call to the method showCats()
Assumptions: none
Globals: instantiates remoteServer
Calls: getParts() in the remoteServer Service
Is Called by: onLoad()

Returns
Void