OverviewSingleDeprecatedPropertiesEventsXSL Parameters

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
boolean
allowDate(y : int, m : int, d : int)
This method can be overridden on an instance of a DatePicker to control which dates are selectable in the calendar popup.
int
Returns STATEVALID if this date picker is not required or if it is required and its value is not null, otherwise returns STATEINVALID.
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.
String
Returns the text label to show in this date picker when no date is selected.
int
Returns the jsxfirstweekday field
String | int
Returns the jsxformat field
String
getIcon(strDefault : String)
Returns the URL to use for the clickable image that triggers the calendar to display.
String
Returns the value of this form field (the string displayed in the text box).
String
void
setDate(date : Date)
Set the date value of this form field
void
Sets the text label to show in this date picker when no date is selected.
void
setFirstDayOfWeek(jsxfirstweekday : int)
Sets the jsxfirstweekday field
void
setFormat(jsxformat : String | int)
Sets the format of this date picker.
void
setIcon(strPath : String)
Sets the URL to use for the clickable image that triggers the calendar to display.
jsx3.gui.DatePicker
setValue(vntValue : String | Date | int)
Sets the value of this date picker.
Methods Inherited From jsx3.gui.Form
doKeyBinding, doReset, getDisabledBackgroundColor, getDisabledColor, getEnabled, getKeyBinding, getRequired, getValidationState, setDisabledBackgroundColor, setDisabledColor, setEnabled, setKeyBinding, setRequired, setValidationState
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCDFAttribute, getCDFId, 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, setCDFAttribute, setCDFId, 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, getRendered, insertHTML, onAfterPaint, onAfterRestoreView, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute
Methods Inherited From jsx3.app.Model
adoptChild, assembleFromXML, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getDynamicProperty, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onChildAdded, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, selectDescendants, setChild, setDynamicProperty, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc, toXMLElm
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

allowDate

boolean allowDate(y : int, m : int, d : int)
This method can be overridden on an instance of a DatePicker to control which dates are selectable in the calendar popup. Any dates for which this method returns false will not be selectable in the popup. This default implementation always returns true.

Parameters:

ythe full year
mthe month (0-11)
dthe day of the month

Returns:

 

Since:

3.9.1

doValidate

int doValidate()
Returns STATEVALID if this date picker is not required or if it is required and its value is not null, otherwise returns STATEINVALID.

Returns:

 

Overrides:

doValidate in jsx3.gui.Form

See Also:

jsx3.gui.Form.STATEVALID, jsx3.gui.Form.STATEINVALID

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:

 

getDefaultText

String getDefaultText()
Returns the text label to show in this date picker when no date is selected. If this method returns null then the string representation of the date format is used by default.

Returns:

 

Since:

3.9.1

getFirstDayOfWeek

int getFirstDayOfWeek()
Returns the jsxfirstweekday field

Returns:

jsxfirstweekday  

getFormat

String | int getFormat()
Returns the jsxformat field

Returns:

jsxformat  

getIcon

String getIcon(strDefault : String)
Returns the URL to use for the clickable image that triggers the calendar to display.

Parameters:

strDefault

Returns:

 

Since:

3.7

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 date value of this form field

Parameters:

datemay be null to clear the value of the form field

setDefaultText

void setDefaultText(label : String)
Sets the text label to show in this date picker when no date is selected. This label should not be parsable by the date format of this control.

Parameters:

label

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.DateFormat. The provided format may also be an integer, in which case it is intepreted as one of of the fields of DateFormat - 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

setIcon

void setIcon(strPath : String)
Sets the URL to use for the clickable image that triggers the calendar to display. If not provided, the default system image will be used. The recommended image size is 13 x 18 pixels.

Parameters:

strPathThis URL will be resolved relative to the project path.

Since:

3.7

setValue

jsx3.gui.DatePicker setValue(vntValue : String | Date | int)
Sets the value of this date picker. This method updates the view immediately.

Parameters:

vntValue

Returns:

this object  

Overrides:

setValue in jsx3.gui.Form