OverviewSingleDeprecated

jsx3.gui

class DatePicker

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Painted
      ->jsx3.gui.Block
        ->jsx3.gui.DatePicker

All Implemented Interfaces:

jsx3.gui.Form, jsx3.gui.Interactive, jsx3.util.EventDispatcher

class DatePicker
extends jsx3.gui.Block
A form element that allows for the selection of an arbitrary date by showing a navigable calendar.

This control is localized to the server locale. Users with computers set to other locales may see a version of the control appropriate for their locale.

This class uses the jsx3.util.DateFormat class to both format and parse dates. Dates are formatted before they are displayed in the text box of the date picker. Dates are parsed after a user manually changes the text in the text box. Parsing with DateFormat is fairly strict. If parsing fails, the value of the date picker is unchanged and the displayed value refreshes.

The calendar calculates dates in the time of the local machine, not UTC (Greenwich Mean Time). Date values chosen with the calendar are always 0h:00m local time.

Date pickers publish the following model events:

Since:

3.0

See Also:

jsx3.util.DateFormat, jsx3.app.Server.getLocale()

Field Summary
static String
Deprecated. This value is now localized.
static int
Deprecated. This value is now localized.
Constructor Summary
void
init(strName : String, intLeft : int | String, intTop : int | String, intWidth : int | String, intHeight : int | String)
The instance initializer.
Method Summary
int
void
Shows the calendar for this date picker and places focus within the calendar as though the user had clicked on the show calendar button.
Date
Returns the current value of this form field as a JavaScript Date object.
int
Returns the jsxfirstweekday field
String | int
Returns the jsxformat field
String
Returns the value of this form field (the string displayed in the text box).
String
void
setDate(date : Date)
set the value of this form field
void
setFirstDayOfWeek(jsxfirstweekday : int)
Sets the jsxfirstweekday field
void
setFormat(jsxformat : String | int)
Sets the format of this date picker.
Methods Inherited From jsx3.gui.Form
doKeyBinding, doReset, getDisabledBackgroundColor, getDisabledColor, getEnabled, getKeyBinding, getRequired, getValidationState, setDisabledBackgroundColor, setDisabledColor, setEnabled, setKeyBinding, setRequired, setValidationState, setValue
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCSSOverride, getClassName, getColor, getCursor, getDimensions, getDisplay, getFontName, getFontSize, getFontWeight, getHeight, getIndex, getLeft, getMargin, getOverflow, getPadding, getRelativePosition, getTagName, getText, getTextAlign, getTip, getTop, getVisibility, getWidth, getZIndex, hideMask, setBackground, setBackgroundColor, setBorder, setCSSOverride, setClassName, setColor, setCursor, setDimensions, setDisplay, setFontName, setFontSize, setFontWeight, setHeight, setIndex, setLeft, setMargin, setOverflow, setPadding, setRelativePosition, setTagName, setText, setTextAlign, setTip, setTop, setVisibility, setWidth, setZIndex, showMask
Methods Inherited From jsx3.gui.Interactive
doEvent, getCanDrag, getCanDrop, getCanMove, getCanSpy, getEvent, getEvents, getMenu, hasEvent, registerHotKey, removeEvent, removeEvents, setCanDrag, setCanDrop, setCanMove, setCanSpy, setEvent, setMenu, setSpyStyles, showSpy
Methods Inherited From jsx3.gui.Painted
focus, getAbsolutePosition, getAttribute, getAttributes, getDynamicProperty, getRendered, insertHTML, onAfterPaint, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute, setDynamicProperty
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

DEFAULT_FORMAT

static String DEFAULT_FORMAT
Deprecated. This value is now localized.
The default date format when none is specified for an instance of this class.

DEFAULT_WEEK_START

static int DEFAULT_WEEK_START
Deprecated. This value is now localized.
The default day of the start of a week when none is specified for an instance of this class. Sunday.
Constructor Detail

init

void init(strName : String, intLeft : int | String, intTop : int | String, intWidth : int | String, intHeight : int | String)
The instance initializer.

Parameters:

strNameunique name distinguishing this object from all other JSX GUI objects in the JSX application
intLefteither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
intTopeither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
intWidtheither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
intHeighteither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
Method Detail

doValidate

int doValidate()

Returns:

 

Overrides:

doValidate in jsx3.gui.Form

focusCalendar

void focusCalendar()
Shows the calendar for this date picker and places focus within the calendar as though the user had clicked on the show calendar button. The calendar hides automatically when focus leaves the calendar.

getDate

Date getDate()
Returns the current value of this form field as a JavaScript Date object.

Returns:

 

getFirstDayOfWeek

int getFirstDayOfWeek()
Returns the jsxfirstweekday field

Returns:

jsxfirstweekday  

getFormat

String | int getFormat()
Returns the jsxformat field

Returns:

jsxformat  

getValue

String getValue()
Returns the value of this form field (the string displayed in the text box).

Returns:

 

Overrides:

getValue in jsx3.gui.Form

paint

String paint()

Returns:

 

Overrides:

paint in jsx3.gui.Block

setDate

void setDate(date : Date)
set the value of this form field

Parameters:

datemay be null to clear the value of the form field

setFirstDayOfWeek

void setFirstDayOfWeek(jsxfirstweekday : int)
Sets the jsxfirstweekday field

Parameters:

jsxfirstweekdaythe new value for jsxfirstweekday

setFormat

void setFormat(jsxformat : String | int)
Sets the format of this date picker. The format should conform to the syntax of jsx3.util.DatePicker. The provided format may also be an integer, in which case it is intepreted as one of of the fields of DatePicker - SHORT, MEDIUM, LONG, or FULL - and the displayed format will be localized accordingly.

Parameters:

jsxformatthe new format.

See Also:

jsx3.util.DateFormat, jsx3.util.DateFormat.SHORT, jsx3.util.DateFormat.MEDIUM, jsx3.util.DateFormat.LONG, jsx3.util.DateFormat.FULL