Packageat.controls
Classpublic class BrandSwitcher
InheritanceBrandSwitcher Inheritance mx.containers.HBox

A component for switching brands.

By passing in a dataProvider of brands, the BrandSwitcher will create buttons that when clicked will get all of the indications for that brand and display a submenu of indications, to switch to directly.

The components dataProvider is set to run DataInterface.getBrands() by default to retrieve all of the current brands.

The BrandSwitcher does not need to have a width or height set as it will automatically size itself based on the data passed into it. One can be set if desired.

Default MXML PropertydataProvider



Public Properties
 PropertyDefined by
  dataProvider : Object
The dataProvider is passed directly to the brandRepeater.
BrandSwitcher
  debugMode : Boolean = false
Outputs useful information for debugging this component for developers when true.
BrandSwitcher
  fadeDuration : int = 300
The amount of time it takes for the default menuHideEffect and menuShowEffect takes to fade in and out respectively.
BrandSwitcher
  menuHideDuration : int = 3000
The amount of time before the indicationMenu hides itself, in miliseconds.
BrandSwitcher
  rolledOverBrandTitle : String = ""
String for the title of the last brand button that was rolled over.
BrandSwitcher
  sectionButtonHeight : Number = 17
The height of the section buttons.
BrandSwitcher
  sectionButtonWidth : Number = 64
The width of the section buttons.
BrandSwitcher
Protected Properties
 PropertyDefined by
  brandColor : uint
Holder for the current section
BrandSwitcher
  brandDescProps : Object
The properties for the brand repeater.
BrandSwitcher
  brandRepeater : Repeater
The repeater for the brand buttons.
BrandSwitcher
  indicationMenu : VBox
The drop-down menu to list the indications.
BrandSwitcher
  indicationPoint : Point
[read-only] The x, y coordinates for the indicationMenu.
BrandSwitcher
  indicationRepeater : Repeater
The repeater for the indication buttons.
BrandSwitcher
  timer : Timer
The timer to keep track of the hiding of the indicationMenu.
BrandSwitcher
Public Methods
 MethodDefined by
  
Constructor.
BrandSwitcher
  
brandClickHandler(e:MouseEvent):void
Handles the click from one of the brand buttons in the brandRepeater.
BrandSwitcher
  
indicationClickHandler(e:MouseEvent):void
Handles the click from a button in the indicationMenu.
BrandSwitcher
  
mouseOutHandler(e:MouseEvent):void
BrandSwitcher
  
mouseOverHandler(e:MouseEvent):void
BrandSwitcher
Protected Methods
 MethodDefined by
  
handleBrandEnd(e:FlexEvent = null):void
Sets the backgroundColor for the buttons in the brandRepeater based on the color attribute in the dataProvider.
BrandSwitcher
  
handleIndicationEnd(e:FlexEvent = null):void
Sets the backgroundColor for the buttons in the indicationRepeater based on the brandColor.
BrandSwitcher
  
handleMenuMouseOut(e:MouseEvent):void
Sets the timer when the mouse is no longer over the dropped-down indicationMenu.
BrandSwitcher
  
handleMenuMouseOver(e:MouseEvent):void
Stops the timer if the mouse is moved over the indicationMenu
BrandSwitcher
  
hideMenu(e:Event = null):void
Hides the menu and stops the timer by setting the visibility to false of the indicationMenu.
BrandSwitcher
  
showMenu(xPos:Number):void
Displays the indicationMenu by setting the visibility.
BrandSwitcher
Events
 EventSummaryDefined by
   Dispatched when a brand button is clicked.BrandSwitcher
   Dispatched when an indication button is clicked.BrandSwitcher
   Dispatched when a either a brand, or an indication is clicked.BrandSwitcher
Styles
 StyleDescriptionDefined by
  
brandSwitcherButtonStyleName
Type: String   CSS Inheritance: no
The styleName for each of the buttons in the brandRepeater. The default value is "brandSwitcherButtonStyle".
BrandSwitcher
  
indicationMenuStyleName
Type: String   CSS Inheritance: no
The styleNamefor the drop-down indicationMenu. The default value is "indicationMenuStyle".
BrandSwitcher
  
indicationSwitcherButtonStyleName
Type: String   CSS Inheritance: no
The styleName for each of the buttons in the indicationRepeater. The default value is "indicationSwitcherButtonStyle".
BrandSwitcher
Effects
 EffectDescriptionDefined by
  
menuHideEffect
Triggering event: menuHide
Played when the menu becomes invisible.
BrandSwitcher
  
menuShowEffect
Triggering event: menuShow
Played when the menu becomes visible.
BrandSwitcher
Property detail
brandColorproperty
protected var brandColor:uint

Holder for the current section

brandDescPropsproperty 
protected var brandDescProps:Object

The properties for the brand repeater.

brandRepeaterproperty 
protected var brandRepeater:Repeater

The repeater for the brand buttons.

dataProviderproperty 
dataProvider:Object  [read-write]

The dataProvider is passed directly to the brandRepeater.

This requires a XMLList of brands.

If not specified, the component runs DataInterface.getBrands() and sets that as the dataProvider by default.

Implementation
    public function get dataProvider():Object
    public function set dataProvider(value:Object):void

Example
   <brand id="1".../>
   <brand id="2".../>
   <brand id="3".../>

debugModeproperty 
public var debugMode:Boolean = false

Outputs useful information for debugging this component for developers when true.

The output is typically in the form of trace statements and Alerts.

The default value is false.

fadeDurationproperty 
public var fadeDuration:int = 300

The amount of time it takes for the default menuHideEffect and menuShowEffect takes to fade in and out respectively.

The default value is 300.

indicationMenuproperty 
protected var indicationMenu:VBox

The drop-down menu to list the indications.

indicationPointproperty 
indicationPoint:Point  [read-only]

The x, y coordinates for the indicationMenu.

This property can be used as the source for data binding.

Implementation
    protected function get indicationPoint():Point
indicationRepeaterproperty 
protected var indicationRepeater:Repeater

The repeater for the indication buttons.

menuHideDurationproperty 
public var menuHideDuration:int = 3000

The amount of time before the indicationMenu hides itself, in miliseconds.

The default value is 3000.

rolledOverBrandTitleproperty 
public var rolledOverBrandTitle:String = ""

String for the title of the last brand button that was rolled over.

The default value is "".

This property can be used as the source for data binding.

sectionButtonHeightproperty 
public var sectionButtonHeight:Number = 17

The height of the section buttons.

The default value is 17.

sectionButtonWidthproperty 
public var sectionButtonWidth:Number = 64

The width of the section buttons.

The default value is 64.

timerproperty 
protected var timer:Timer

The timer to keep track of the hiding of the indicationMenu.

Constructor detail
BrandSwitcher()constructor
public function BrandSwitcher()

Constructor.

Method detail
brandClickHandler()method
public function brandClickHandler(e:MouseEvent):void

Handles the click from one of the brand buttons in the brandRepeater.

Parameters
e:MouseEvent — The MouseEvent
handleBrandEnd()method 
protected function handleBrandEnd(e:FlexEvent = null):void

Sets the backgroundColor for the buttons in the brandRepeater based on the color attribute in the dataProvider.

Parameters
e:FlexEvent (default = null) — The REPEAT_END event
handleIndicationEnd()method 
protected function handleIndicationEnd(e:FlexEvent = null):void

Sets the backgroundColor for the buttons in the indicationRepeater based on the brandColor.

Parameters
e:FlexEvent (default = null) — The REPEAT_END event

See also

handleMenuMouseOut()method 
protected function handleMenuMouseOut(e:MouseEvent):void

Sets the timer when the mouse is no longer over the dropped-down indicationMenu.

Parameters
e:MouseEvent — The mouse event
handleMenuMouseOver()method 
protected function handleMenuMouseOver(e:MouseEvent):void

Stops the timer if the mouse is moved over the indicationMenu

Parameters
e:MouseEvent — The mouse event
hideMenu()method 
protected function hideMenu(e:Event = null):void

Hides the menu and stops the timer by setting the visibility to false of the indicationMenu.

This triggers the menuHideEffect property which is set to Fade by default.

Parameters
e:Event (default = null) — The event
indicationClickHandler()method 
public function indicationClickHandler(e:MouseEvent):void

Handles the click from a button in the indicationMenu.

Parameters
e:MouseEvent — The MouseEvent
mouseOutHandler()method 
public function mouseOutHandler(e:MouseEvent):void

Parameters
e:MouseEvent
mouseOverHandler()method 
public function mouseOverHandler(e:MouseEvent):void

Parameters
e:MouseEvent
showMenu()method 
protected function showMenu(xPos:Number):void

Displays the indicationMenu by setting the visibility.

This triggers the menuShowEffect property which is set to Fade by default.

Parameters
xPos:Number — The brand button clicked on, to derive the x position
Event detail
brandChangeevent 
Event object type: at.events.EveDataChangeEvent

Dispatched when a brand button is clicked. The event's data property has the following XML format:

<brand title="Brand A" brandID="1" color="#333333">
<indication title="Brand A Indication" indicationID="6" titleAbbr="BI1"/>
<indication title="Brand A Indication" indicationID="11" titleAbbr="BI2"/>
</brand>

indicationChangeevent  
Event object type: at.events.EveDataChangeEvent

Dispatched when an indication button is clicked. The event's data property has the following XML format:

<indication title="Brandera Value" indicationID="11" titleAbbr="BRV"/>

itemClickevent  
Event object type: mx.events.ItemClickEvent

Dispatched when a either a brand, or an indication is clicked. If a brand button is clicked, the event's item property has the following XML format:

<brand id="1" title="Brand A" color="#333333"/>

If a sub-button (indication) is clicked, the event's item property has the following XML format:

<indication title="Brand A Indication" indicationID="6" titleAbbr="BAI"/>