Yahoo! UI Library

Calendar  2.5.2

Yahoo! UI Library > calendar > YAHOO.widget.CalendarNavigator

Show Private Show Protected

Class YAHOO.widget.CalendarNavigator

The CalendarNavigator is used along with a Calendar/CalendarGroup to provide a Month/Year popup navigation control, allowing the user to navigate to a specific month/year in the Calendar/CalendarGroup without having to scroll through months sequentially

Constructor

YAHOO.widget.CalendarNavigator ( cal )
Parameters:
cal <Calendar|CalendarGroup> The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached.

Properties

cal - {Calendar|CalendarGroup}

The Calendar/CalendarGroup instance to which the navigator belongs

cancelEl - HTMLElement

Reference to the HTMLElement used to hide the navigator without updating the Calendar/Calendar group

errorEl - HTMLElement

Reference to the HTMLElement used to display validation errors

firstCtrl - HTMLElement

Reference to the first focusable control in the navigator (by default monthEl)

id - String

The unique ID for this CalendarNavigator instance

lastCtrl - HTMLElement

Reference to the last focusable control in the navigator (by default cancelEl)

maskEl - HTMLElement

Reference to the HTMLElement used to render the navigator's mask

monthEl - HTMLElement

Reference to the HTMLElement used to input the month

navEl - HTMLElement

Reference to the HTMLElement used to render the navigator's bounding box

submitEl - HTMLElement

Reference to the HTMLElement used to update the Calendar/Calendar group with the month/year values

YAHOO.widget.CalendarNavigator.CANCEL_SUFFIX - static final String

The suffix added to the Navigator's ID, to generate a unique ID for the "Cancel" button.

YAHOO.widget.CalendarNavigator.CLASSES - static Object

YAHOO.widget.CalendarNavigator.CLASSES contains constants for the class values applied to the CalendarNaviatgator's DOM elements

YAHOO.widget.CalendarNavigator.CLASSES.BUTTON - static String

Class applied to buttons wrapping element

YAHOO.widget.CalendarNavigator.CLASSES.BUTTONS - static String

Class applied to the submit/cancel button's bounding box

YAHOO.widget.CalendarNavigator.CLASSES.DEFAULT - static String

Class applied to default controls

YAHOO.widget.CalendarNavigator.CLASSES.ERROR - static String

Class applied to the validation error area's bounding box

YAHOO.widget.CalendarNavigator.CLASSES.INVALID - static String

Class applied to controls with invalid data (e.g. a year input field with invalid an year)

YAHOO.widget.CalendarNavigator.CLASSES.MASK - static String

Class applied to the Navigator mask's bounding box

YAHOO.widget.CalendarNavigator.CLASSES.MONTH - static String

Class applied to the month label/control bounding box

YAHOO.widget.CalendarNavigator.CLASSES.MONTH_CTRL - static String

Class applied to the month input control

YAHOO.widget.CalendarNavigator.CLASSES.NAV - static String

Class applied to the Calendar Navigator's bounding box

YAHOO.widget.CalendarNavigator.CLASSES.NAV_VISIBLE - static String

Class applied to the Calendar/CalendarGroup's bounding box to indicate the Navigator is currently visible

YAHOO.widget.CalendarNavigator.CLASSES.YEAR - static String

Class applied to the year label/control bounding box

YAHOO.widget.CalendarNavigator.CLASSES.YEAR_CTRL - static String

Class applied to the year input control

YAHOO.widget.CalendarNavigator.ERROR_SUFFIX - static final String

The suffix added to the Navigator's ID, to generate a unique ID for the error bounding box.

YAHOO.widget.CalendarNavigator.ID_SUFFIX - static final String

The suffix added to the Calendar/CalendarGroup's ID, to generate a unique ID for the Navigator and it's bounding box.

YAHOO.widget.CalendarNavigator.MONTH_SUFFIX - static final String

The suffix added to the Navigator's ID, to generate a unique ID for the month control.

YAHOO.widget.CalendarNavigator.SUBMIT_SUFFIX - static final String

The suffix added to the Navigator's ID, to generate a unique ID for the "Submit" button.

YAHOO.widget.CalendarNavigator.TRIM - static RegExp

Regular expression used to trim strings

YAHOO.widget.CalendarNavigator.UPDATE_DELAY - static Number

Artificial delay (in ms) between the time the Navigator is hidden and the Calendar/CalendarGroup state is updated. Allows the user the see the Calendar/CalendarGroup page changing. If set to 0 the Calendar/CalendarGroup page will be updated instantly

YAHOO.widget.CalendarNavigator.YEAR_SUFFIX - static final String

The suffix added to the Navigator's ID, to generate a unique ID for the year control.

YAHOO.widget.CalendarNavigator.YR_MAJOR_INC - static Number

The amount by which to increment the current year value, when the page up/down key is pressed on the year control

YAHOO.widget.CalendarNavigator.YR_MAX_DIGITS - static Number

The number of digits to which the year input control is to be limited.

YAHOO.widget.CalendarNavigator.YR_MINOR_INC - static Number

The amount by which to increment the current year value, when the arrow up/down key is pressed on the year control

YAHOO.widget.CalendarNavigator.YR_PATTERN - static RegExp

Regular expression used to validate the year input

yearEl - HTMLElement

Reference to the HTMLElement used to input the year

Methods

applyKeyListeners

void applyKeyListeners ( )
Attaches DOM listeners for keyboard support. Tab/Shift-Tab looping, Enter Key Submit on Year element, Up/Down/PgUp/PgDown year increment on Year element

NOTE: MacOSX Safari 2.x doesn't let you tab to buttons and MacOSX Gecko does not let you tab to buttons or select controls, so for these browsers, Tab/Shift-Tab looping is limited to the elements which can be reached using the tab key.

Returns: void

applyListeners

void applyListeners ( )
Attaches DOM event listeners to the rendered elements

The method will call applyKeyListeners, to setup keyboard specific listeners

Returns: void

cancel

void cancel ( )
Hides the navigator and mask, without updating the Calendar/CalendarGroup's state
Returns: void

clearError

void clearError ( )
Clears the navigator's error message and hides the error panel
Returns: void

clearErrors

void clearErrors ( )
Clears all validation and error messages in the UI
Returns: void

clearYearError

void clearYearError ( )
Removes the validation error UI for the year control
Returns: void

createMask

void createMask ( )
Creates the Mask HTMLElement and appends it to the Calendar/CalendarGroups container.
Returns: void

createNav

void createNav ( )
Creates the navigator's containing HTMLElement, it's contents, and appends the containg element to the Calendar/CalendarGroup's container.
Returns: void

destroy

void destroy ( )
Destroys the Navigator object and any HTML references
Returns: void

erase

void erase ( )
Removes all renderered HTML elements for the Navigator from the DOM, purges event listeners and clears (nulls) any property references to HTML references
Returns: void

getMonth

Number getMonth ( )
Returns the current month set on the navigator Note: This may not be the month set in the UI, if the UI contains an invalid value.
Returns: Number
The Navigator's current month index

getYear

Number getYear ( )
Returns the current year set on the navigator Note: This may not be the year set in the UI, if the UI contains an invalid value.
Returns: Number
The Navigator's current year value

hide

void hide ( )
Hides the navigator and mask The show method will fire the Calendar/CalendarGroup's beforeHideNav event and hideNav events
Returns: void

hideMask

void hideMask ( )
Hides the navigator's mask element
Returns: void

init

void init ( cal )
Init lifecycle method called as part of construction
Parameters:
cal <Calendar> The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached
Returns: void

purgeKeyListeners

void purgeKeyListeners ( )
Removes/purges DOM listeners for keyboard support
Returns: void

purgeListeners

void purgeListeners ( )
Removes/purges DOM event listeners from the rendered elements
Returns: void

render

void render ( )
Renders the HTML for the navigator, adding it to the document and attaches event listeners if it has not already been rendered.
Returns: void

renderButton

String renderButton ( )
Renders the submit/cancel buttons for the navigator
Returns: String
The HTML created for the Button UI

renderNavContents

Array renderNavContents ( html )
Renders the contents of the navigator
Parameters:
html <Array> The HTML buffer to append the HTML to.
Returns: Array
A reference to the buffer passed in.

renderYear

Array renderYear ( html )
Renders the year label and control for the navigator
Parameters:
html <Array> The HTML buffer to append the HTML to.
Returns: Array
A reference to the buffer passed in.

setError

void setError ( msg )
Displays an error message in the Navigator's error panel
Parameters:
msg <String> The error message to display
Returns: void

setInitialFocus

void setInitialFocus ( )
Sets the initial focus, based on the configured value
Returns: void

setMonth

void setMonth ( nMonth )
Sets the current month on the Navigator, and updates the UI
Parameters:
nMonth <Number> The month index, from 0 (Jan) through 11 (Dec).
Returns: void

setYear

void setYear ( nYear )
Sets the current year on the Navigator, and updates the UI. If the provided year is invalid, it will not be set.
Parameters:
nYear <Number> The full year value to set the Navigator to.
Returns: void

setYearError

void setYearError ( )
Displays the validation error UI for the year control
Returns: void

show

void show ( )
Displays the navigator and mask, updating the input controls to reflect the currently set month and year. The show method will invoke the render method if the navigator has not been renderered already, allowing for lazy rendering of the control. The show method will fire the Calendar/CalendarGroup's beforeShowNav and showNav events
Returns: void

showMask

void showMask ( )
Displays the navigator's mask element
Returns: void

submit

void submit ( )
Updates the Calendar/CalendarGroup's pagedate with the currently set month and year if valid.

If the currently set month/year is invalid, a validation error will be displayed and the Calendar/CalendarGroup's pagedate will not be updated.

Returns: void

validate

Boolean validate ( )
Validates the current state of the UI controls
Returns: Boolean
true, if the current UI state contains valid values, false if not


Copyright © 2007 Yahoo! Inc. All rights reserved.