This class is in charge of painting and updating the Bays. Sends an Event through the bayChange Connector when a change occurs
| private | Graphics | recommended | |
| private | Graphics | reserved | |
| private | Graphics | selected | |
| private | Number | y = 12 | |
| private | Number | height = 13 | |
| private | Number | rgbSelected = 0x8F1622 | |
| private | Number | rgbRecommended = 0xFED32C | |
| private | Number | rgbReserved = 0x000000 | |
| private | Number | rgbBorder = 0x5A728E | |
| private | Number | rgbHightLight = 0xFFEFB0 | |
| private | Number | rgbVerticalHLight = 0xffffff | |
| private | Array | recommendedHours | |
| private | Number | selectionSize = 0 | |
| private | MovieClip | recommendedBtn | |
| private | Connector | bayChange | |
| private | Date | selectedDate | |
| private | Number | bayNumber |
BaySchedule() |
| public | bayChangeEvent(event) | ||
| public | setData(data:Array) | ||
| public | setSelectionSize(value:Number) | ||
| public | setBayNumber(n:Number) | ||
| public | setSelectedDate(d:Date) | ||
| private | onLoad() | ||
| private | init() | ||
| private | setBarsStyle() | ||
| private | onSelected() | ||
| private | drawReserved(startTime:Number, totalLength:Number) | ||
| private | drawRecommended(startTime:Number, totalLength:Number) | ||
| private | drawSelected(startTime:Number, totalLength:Number) | ||
| private | drawRecommendedSpaces() | ||
| private | arrangeRecommendedSpace(startTime:Number, totalLength:Number) |
private recommended:Graphics
Graphics object to draw the recommended chart
private reserved:Graphics
Graphics object to draw the reserved chart
private selected:Graphics
Graphics object to draw the selected chart
private y:Number = 12
Y Position, defaults to 12
private height:Number = 13
height, defaults to 13
private rgbSelected:Number = 0x8F1622
Selected color, defaults to 0x8F1622 (Red)
private rgbRecommended:Number = 0xFED32C
Recommended color, defaults to 0xFED32C (yellow)
private rgbReserved:Number = 0x000000
Reserved color, defaults to black
private rgbBorder:Number = 0x5A728E
border color, its default value is 0x5A728E
private rgbHightLight:Number = 0xFFEFB0
HightLight color, its default value is 0xFFEFB0
private rgbVerticalHLight:Number = 0xffffff
Vertical HightLight color, its default value is white
private recommendedHours:Array
Array of Objects containing a list of recommended hours
private selectionSize:Number = 0
The size of the selected graph to render (it's the same as the total labor hours)
private recommendedBtn:MovieClip
A reference to the recommended clip that we use as a button to know where the user clicks.
private bayChange:Connector
A connector that is called whenever a change in the bay occurs
private selectedDate:Date
the Current date selected in the calendar
private bayNumber:Number
unique number for this specific bay
BaySchedule()
public bayChangeEvent(event):Void
Description: When the bay changes, the selected Graphic is cleared
Assumptions: selected is already instantiated
Globals: uses selected (Graphics)
Calls: clearAll() in the Graphics selected
Is Called by: The Connector bayChange
- Parameters
event -- Returns
- Void
public setData(data:Array):Void
Description: Draws the reserved and Recommended spaces with the data received
Assumptions: reserved is already instantiated
Globals: uses reserved and recommendedHours
Calls: clearAll() in the Graphics reserved
drawReserved(), arrangeRecommendedSpace(), drawRecommendedSpaces()
Is Called by: showDetail() in the Scheduling class.
This call is executed when the data is received from the server
- Parameters
data (Array)-- Returns
- Void
public setSelectionSize(value:Number):Void
Description: sets selectionSize and draws recommended spaces
selectionSize is the amount of hours of the current order
Assumptions: none
Globals: uses selectionSize
Calls: drawRecommendedSpaces()
Is Called by: totalLabor Connector
- Parameters
value (Number)-- Returns
- Void
public setBayNumber(n:Number):Void
Description: sets the bay Number
Globals: uses bayNumber
Calls: none
Is Called by: init() in the Scheduling class
- Parameters
n (Number)- Bay number used for identification- Returns
- none
public setSelectedDate(d:Date):Void
Description: Sets the selected day
Globals: uses selectedDate
Calls: none
Is Called by: setSelectedDate() in the Scheduling class
- Parameters
d (Date)- current Date selected by the user- Returns
- Void
- See Also
- Scheduling.setSelectedDate
private onLoad():Void
Description: Creates a button that fires onSelected() when the user clicks the recommended Graphic. Call setBarsStyle() to create the Graphics Objects and instantiates recommendedHours with a default whole space
Globals: instantiates the following globals:
recommendedHours, recommendedBtn
Calls: getClip() of recommended Graphic
setBarsStyle()
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 a listener of totalLabor and bayChange
Globals: instantiates the global bayChange and uses application
Calls: addListener() in the totalLabor and bayChange Connectors
Is Called by: This function is called by setApplication() in its super class AbstractView
- Returns
- void
private setBarsStyle():Void
Description: Creates the Graphics Object and sets its properties: color, position, background color, border color and hightLight color
Globals: instantiates the following globals:
reserved, recommended, selected
Calls: setLocation() and setColor() in the Graphics Objects
Is Called by: This function is called by onLoad()
- Returns
- void
private onSelected():Void
Description: Gets the position of the mouse to know where to draw the selected bar. Checks if this position is available and if the bar fits well; if not, makes the necessary changes.
Creates an Object with the bay data and fires a bayChange Event with that Object as a parameter. Then draws the selected bar Assumptions: bayChange is instantiated
Globals: uses the following globals:
recommendedHours, bayChange, selectionSize
Calls: drawSelected() fireEvent() in the Connector bayChange
Is Called by: recommendedBtn.onRelease() This Event is executed when the user clicks the recommended Graphic
- Returns
- Void
private drawReserved(startTime:Number,
totalLength:Number):Void
Description: Draws the reserved bar
Assumptions: reserved is instantiated
Globals: uses the globals reserved
Calls: fillRect() in the reserved Graphic
Is Called by: setData()
- Parameters
startTime (Number)-totalLength (Number)-- Returns
- Void
private drawRecommended(startTime:Number,
totalLength:Number):Void
Description: Draws the recommended bar
Assumptions: recommended is instantiated
Globals: uses recommended
Calls: draw3DRect(), setColor(), and fillRect() in the recommended Graphic
Is Called by: drawRecommendedSpaces()
- Parameters
startTime (Number)-totalLength (Number)-- Returns
- Void
private drawSelected(startTime:Number,
totalLength:Number):Void
Description: Draws the selected bar
Assumptions: selected is instantiated
Globals: uses selected
Calls: draw3DRect(), setColor(),fillRect() in the selected Graphic
Is Called by: onSelected()
- Parameters
startTime (Number)-totalLength (Number)-- Returns
- Void
private drawRecommendedSpaces():Void
Description: Clears recommended and selected and calls drawRecommended() for each recommended bar that are in the list of recommendedHours
Assumptions: recommended and selected are instantiated
Globals: uses recommended, selected and recommendedHours
Calls: drawRecommended(), clearAll() in recommended, clearAll() in selected
Is Called by: setData(), setSelectionSize()
- Returns
- Void
private arrangeRecommendedSpace(startTime:Number,
totalLength:Number):Void
Description: Splits the recommendedHour object that contains the startTime and totalLength to reflect the new values. Subtracts the space received from the List of recommendedHours
Assumptions: recommendedHours at least has one item
Globals: uses recommendedHours
Calls: none
Is Called by: setData()
- Parameters
startTime (Number)-totalLength (Number)-- Returns
- void