Packagegs.display.view
Classpublic class BaseFormView
InheritanceBaseFormView Inheritance BaseView Inheritance GSClip Inheritance flash.display.MovieClip
SubclassesBaseErrorView

The BaseFormView class defines the base form view should implement, to follow a good pattern of the most commonly used form functionality.



Public Properties
 PropertyDefined by
  cancelButton : MovieClip
A cancel button.
BaseFormView
  confirmButton : MovieClip
A confirm button.
BaseFormView
 Inheritedcontroller : *
A controller for this view.
BaseView
  deleteButton : MovieClip
A delete button.
BaseFormView
  errorViews : MovieClip
A container for BaseErrorView's to show and hide during validation.
BaseFormView
  noButton : MovieClip
A no button.
BaseFormView
  okButton : MovieClip
An ok button.
BaseFormView
  onCancel : Function
A function delegate you should use and call when the user cancels the form operation and any validation has passed.
BaseFormView
  onConfirm : Function
A function delegate you should use and call when the user confirms the form operation and any validation has passed.
BaseFormView
  onDelete : Function
A function delegate you should use and call when the user agrees to delete (something) and any validation has passed.
BaseFormView
  onNo : Function
A function delegate you should use and call when the user declines the form operation and any validation has passed.
BaseFormView
  onOK : Function
A function delegate you should use and call when the user ok's a form operatoin and any validation has passed.
BaseFormView
  onYes : Function
A function delegate you should use and call when the user agrees to the form operation and any validation has passed.
BaseFormView
 Inheritedstage : Stage
StageRef.stage (gs.util.StageRef)
GSClip
  yesButton : MovieClip
A yes button.
BaseFormView
Public Methods
 MethodDefined by
  
Constructor for CoreFormView instances.
BaseFormView
 Inherited
dispose():void
Override this method and write your own dispose logic.
BaseView
  
hide():void
Hide this form view - this calls removeKeyMappings() and deselectField().
BaseFormView
  
hideButtons():void
Hide's any form buttons that are currently visible.
BaseFormView
  
Override this method, and use as the the click event handler for a "confirm" button - validate this form and then call the onConfirm delegate function.
BaseFormView
  
Override this method, and use as the the click event handler for a "delete" button - validate this form and then call the onDelete delegate function.
BaseFormView
  
onNoClick():void
Override this method, and use as the the click event handler for a "no" button - validate this form and then call the onNo delegate function.
BaseFormView
  
onOKClick():void
Override this method, and use as the click event handler for an "ok" button - validate this form and then call the onOK delegate function.
BaseFormView
  
onYesClick():void
Override this method, and use as the the click event handler for a "yes" button - validate this form and then call the onYes delegate function.
BaseFormView
  
show():void
Show this form view - this calls addKeyMappings() and selectField().
BaseFormView
  
showButtons(buttons:uint):void
Show any button, (yes,no,confirm,delete,ok,cancel) based off of what is or'ed (|) together - for each button that is shown, it calls the appropriate method (showOKButton, showYesButton, etc), which you could override if needed.
BaseFormView
Protected Methods
 MethodDefined by
 Inherited
Override this method, and use the event manager to add event handlers on your objects.
BaseView
  
Override this and add key event mappings with the keyboard event manager.
BaseFormView
  
Override this method and implement a modal blocker, which can then be called when a sub form view is shown and this view needs to be blocked from interaction.
BaseFormView
  
Override this and do some deselect logic for the form fields.
BaseFormView
  
Hides the cancel button.
BaseFormView
  
Hides the confirm button.
BaseFormView
  
Hides the delete button.
BaseFormView
  
hideNoButton():void
Hides the no button.
BaseFormView
  
hideOKButton():void
Hides the ok button.
BaseFormView
  
Hides the yes button.
BaseFormView
 Inherited
init():void
Initialize this view - called from the constructor.
BaseView
 Inherited
onActivate():void
Override this method to hook into the activate event.
BaseView
 Inherited
Override this method to hook into the added to stage event.
BaseView
 Inherited
onDeactive():void
Override this method to hook into the deactivate event.
BaseView
 Inherited
onMouseLeave():void
A method you can override to hook into the mouse leve event.
BaseView
 Inherited
Override this method to hook into the removed from stage event.
BaseView
 Inherited
onResize():void
Override this method to hook into resize events from the stage.
BaseView
 Inherited
Override this method, and remove events from objects that were registered with the event manager.
BaseView
  
Override this and remove key event mappings with the keyboard event manager.
BaseFormView
  
selectField():void
Override this and do some select/focus logic for the form field.
BaseFormView
  
Shows the cancel button, (sets visible to true), override to use something other than visible.
BaseFormView
  
Shows the confirm button, (sets visible to true), override to use something other than visible.
BaseFormView
  
Shows the delete button, (sets visible to true), override to use something other than visible.
BaseFormView
  
showNoButton():void
Shows the no button, (sets visible to true), override to use something other than visible.
BaseFormView
  
showOKButton():void
Shows the ok button, (sets visible to true), override to use something other than visible.
BaseFormView
  
Shows the yes button, (sets visible to true), override to use something other than visible.
BaseFormView
  
Override this method, and disable a modal blocker.
BaseFormView
  
validate():Boolean
Override this and do some form validation.
BaseFormView
Public Constants
 ConstantDefined by
  CANCEL_BTN : int = 1
[static] The mask that turns on the cancel button.
BaseFormView
  CONFIRM_BTN : int = 4
[static] The mask that turns on the confirm button.
BaseFormView
  DELETE_BTN : int = 32
[static] The mask that turns on the delete button.
BaseFormView
  NO_BTN : int = 16
[static] The mask that turns on the no button.
BaseFormView
  OK_BTN : int = 2
[static] The mask that turns on the ok button.
BaseFormView
  YES_BTN : int = 8
[static] The mask that turns on the yes button.
BaseFormView
Property detail
cancelButtonproperty
public var cancelButton:MovieClip

A cancel button.

confirmButtonproperty 
public var confirmButton:MovieClip

A confirm button.

deleteButtonproperty 
public var deleteButton:MovieClip

A delete button.

errorViewsproperty 
public var errorViews:MovieClip

A container for BaseErrorView's to show and hide during validation.

noButtonproperty 
public var noButton:MovieClip

A no button.

okButtonproperty 
public var okButton:MovieClip

An ok button.

onCancelproperty 
public var onCancel:Function

A function delegate you should use and call when the user cancels the form operation and any validation has passed.

onConfirmproperty 
public var onConfirm:Function

A function delegate you should use and call when the user confirms the form operation and any validation has passed.

onDeleteproperty 
public var onDelete:Function

A function delegate you should use and call when the user agrees to delete (something) and any validation has passed.

onNoproperty 
public var onNo:Function

A function delegate you should use and call when the user declines the form operation and any validation has passed.

onOKproperty 
public var onOK:Function

A function delegate you should use and call when the user ok's a form operatoin and any validation has passed.

onYesproperty 
public var onYes:Function

A function delegate you should use and call when the user agrees to the form operation and any validation has passed.

yesButtonproperty 
public var yesButton:MovieClip

A yes button.

Constructor detail
BaseFormView()constructor
public function BaseFormView()

Constructor for CoreFormView instances.

Method detail
addKeyMappings()method
protected function addKeyMappings():void

Override this and add key event mappings with the keyboard event manager.

This is called when the view is shown.

blockForInput()method 
protected function blockForInput():void

Override this method and implement a modal blocker, which can then be called when a sub form view is shown and this view needs to be blocked from interaction.

deselectField()method 
protected function deselectField():void

Override this and do some deselect logic for the form fields.

This is called with the view is hidden.

hide()method 
public override function hide():void

Hide this form view - this calls removeKeyMappings() and deselectField().

hideButtons()method 
public function hideButtons():void

Hide's any form buttons that are currently visible.

hideCancelButton()method 
protected function hideCancelButton():void

Hides the cancel button.

hideConfirmButton()method 
protected function hideConfirmButton():void

Hides the confirm button.

hideDeleteButton()method 
protected function hideDeleteButton():void

Hides the delete button.

hideNoButton()method 
protected function hideNoButton():void

Hides the no button.

hideOKButton()method 
protected function hideOKButton():void

Hides the ok button.

hideYesButton()method 
protected function hideYesButton():void

Hides the yes button.

onConfirmClick()method 
public function onConfirmClick():void

Override this method, and use as the the click event handler for a "confirm" button - validate this form and then call the onConfirm delegate function.


Example
Correctly using a delegate function:
 
   public class MyFormView extends BaseFormView
   {
       
       public var confirm:MovieClip;
       public var email:TextField;
       
       public function MyFormView()
       {
           super();
       }
       
       override protected function addEventHandlers():void
       {
           em.handleEvents(confirm,this,"onConfirm");
       }
       
       override protected function removeEventHandlers():void
       {
           em.disposeEvents(confirm);
       }
       
       override protected function validate():Boolean
       {
           if(!utils.string.isemail(email.text))
           {
               errorViews.badEmail.showAndHide(3000); //see BaseErrorView for showAndHide()
               return false;
           }
           return true;
       }
       
       override public function onConfirmClick():void
       {
           super.onConfirmClick();
           
           //in this case, the delegate function (onConfirm) 
           //would have to accept one parameter - an email.
           //This pattern is taken from apple's cocoa
           //framework. This type of pattern is extremly
           //useful, and leads to less bugs and good design.
           if(validate()) onConfirm(email.text);
       }
   }
   

onDeleteClick()method 
public function onDeleteClick():void

Override this method, and use as the the click event handler for a "delete" button - validate this form and then call the onDelete delegate function.

onNoClick()method 
public function onNoClick():void

Override this method, and use as the the click event handler for a "no" button - validate this form and then call the onNo delegate function.

onOKClick()method 
public function onOKClick():void

Override this method, and use as the click event handler for an "ok" button - validate this form and then call the onOK delegate function.

onYesClick()method 
public function onYesClick():void

Override this method, and use as the the click event handler for a "yes" button - validate this form and then call the onYes delegate function.

removeKeyMappings()method 
protected function removeKeyMappings():void

Override this and remove key event mappings with the keyboard event manager.

This is called when the view is hidden.

selectField()method 
protected function selectField():void

Override this and do some select/focus logic for the form field.

The is called when the view is shown.

show()method 
public override function show():void

Show this form view - this calls addKeyMappings() and selectField().

showButtons()method 
public function showButtons(buttons:uint):void

Show any button, (yes,no,confirm,delete,ok,cancel) based off of what is or'ed (|) together - for each button that is shown, it calls the appropriate method (showOKButton, showYesButton, etc), which you could override if needed.

Parameters
buttons:uint

Example
Showing combinations of buttons:
 
   myView.showButtons(BaseFormView.OK_BTN|BaseFormView.CANCEL_BTN);
   myView.showButtons(BaseFormView.YES_BTN|BaseFormView.NO_BTN);
   

showCancelButton()method 
protected function showCancelButton():void

Shows the cancel button, (sets visible to true), override to use something other than visible.

showConfirmButton()method 
protected function showConfirmButton():void

Shows the confirm button, (sets visible to true), override to use something other than visible.

showDeleteButton()method 
protected function showDeleteButton():void

Shows the delete button, (sets visible to true), override to use something other than visible.

showNoButton()method 
protected function showNoButton():void

Shows the no button, (sets visible to true), override to use something other than visible.

showOKButton()method 
protected function showOKButton():void

Shows the ok button, (sets visible to true), override to use something other than visible.

showYesButton()method 
protected function showYesButton():void

Shows the yes button, (sets visible to true), override to use something other than visible.

unblockFromInput()method 
protected function unblockFromInput():void

Override this method, and disable a modal blocker.

validate()method 
protected function validate():Boolean

Override this and do some form validation.

Returns
Boolean
Constant detail
CANCEL_BTNconstant
public static const CANCEL_BTN:int = 1

The mask that turns on the cancel button.

CONFIRM_BTNconstant 
public static const CONFIRM_BTN:int = 4

The mask that turns on the confirm button.

DELETE_BTNconstant 
public static const DELETE_BTN:int = 32

The mask that turns on the delete button.

NO_BTNconstant 
public static const NO_BTN:int = 16

The mask that turns on the no button.

OK_BTNconstant 
public static const OK_BTN:int = 2

The mask that turns on the ok button.

YES_BTNconstant 
public static const YES_BTN:int = 8

The mask that turns on the yes button.