An abstract date picker.
Basedatepicker is an abstract class from which you can build a fully functional month-based datepicker from. When creating an implementation of the basedatepicker, it is expected that certain methods from basedatepicker, basedatepickerday and basedatepickerweek will be overridden to provide full functionality of a datepicker. For datepicker, these methods include doSpaceUp(), doEnterUp(), and optionally setMonthToShow(). See the source code of datepicker for a more extensive example. See also basedatepickerday and basedatepickerweek
<canvas height="200">
<class name="myday"
extends="basedatepickerday"
bgcolor="green"
width="20"
height="20">
<handler name="onclick">
<![CDATA[
if( !this.disabled ) {
this.setAttribute('selected', true);
}
]]>
</handler>
<text text="${parent.daynum}"
visible="${!parent.disabled}"
opacity="${parent.selectable ? 1 : .3 }"/>
</class>
<class name="myweek" extends="basedatepickerweek">
<simplelayout axis="x" spacing="1"/>
</class>
<class name="mydatepicker"
extends="basedatepicker"
weekclass="myweek"
dayclass="myday"
xinset="0"
yinset="0">
<method name="setMonthToShow" args="month, year">
super.setMonthToShow(month,year);
this.display.month.datapath.setXPath(
"datepicker_strings_en:/months/month[@index='" + month + "']/@full" );
this.display.year.setText( year );
</method>
<handler name="onselecteddate">
if( this.selecteddate != null ) {
this.selected.year.setText( this.selecteddate.getFullYear() );
this.selected.month.datapath.setXPath(
"datepicker_strings_en:/months/month[@index='" +
this.selecteddate.getMonth() + "']/@full" );
this.selected.date.setText( this.selecteddate.getDate() );
}
</handler>
<view options="ignorelayout">
<text width="20" height="20" bgcolor="red" text="S"/>
<text width="20" height="20" bgcolor="red" text="M"/>
<text width="20" height="20" bgcolor="red" text="T"/>
<text width="20" height="20" bgcolor="red" text="W"/>
<text width="20" height="20" bgcolor="red" text="T"/>
<text width="20" height="20" bgcolor="red" text="F"/>
<text width="20" height="20" bgcolor="red" text="S"/>
<simplelayout axis="x" spacing="1"/>
</view>
<view>
<button text="previous" onclick="classroot.showPreviousMonth()"/>
<button text="next" onclick="classroot.showNextMonth()"/>
<simplelayout axis="x"/>
</view>
<view name="display">
<text> Showing: </text>
<text name="month" datapath="." resize="true"/>
<text name="year" resize="true"/>
<simplelayout axis="x" spacing="2"/>
</view>
<view name="selected">
<text> Selected: </text>
<text name="month" datapath="." resize="true"/>
<text name="date" resize="true"/>
<text name="year" resize="true"/>
<simplelayout axis="x" spacing="2"/>
</view>
<simplelayout axis="y" placement="content" spacing="1" inset="20"/>
<simplelayout axis="y"/>
</class>
<mydatepicker/>
</canvas>
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| dayclass | Tag & JS | expression | any | setter | |
|
The dayclass to use for this basedatepicker |
|||||
|
|
|||||
| earliestdate | Tag & JS | expression | any | setter | |
|
The earliest date that is selectable. |
|||||
|
|
|||||
| latestdate | Tag & JS | expression | any | setter | |
|
The latest date that is selectable. |
|||||
|
|
|||||
| selecteddate | Tag & JS | expression | any | setter | |
|
The Date that is currently selected. |
|||||
|
|
|||||
| selecteddatepickerday | Tag & JS | expression | any | null | setter |
|
The datepickerday which has been selected. |
|||||
|
|
|||||
| showingdate | Tag & JS | expression | any | null | setter |
|
A Date object which represents the month to be shown. |
|||||
|
|
|||||
| showingmonth | Tag & JS | number | Number | null | setter |
|
The month that is currently showing in the datepicker. |
|||||
|
|
|||||
| showingyear | Tag & JS | number | Number | null | setter |
|
The year that is currently showing in the datepicker. |
|||||
|
|
|||||
| weekclass | Tag & JS | expression | any | setter | |
|
The weekclass to use for this basedatepicker |
|||||
|
|
|||||
| xinset | Tag & JS | number | Number | null | setter |
|
The number if pixels from this.x to show the datepicker days |
|||||
|
|
|||||
| yinset | Tag & JS | number | Number | null | setter |
|
The number if pixels from this.y to show the datepicker days |
|||||
|
|
|||||
doesenter, enabled, hasdefault, isdefault, style, styleable, text
class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes
aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset
| focusOnDay() | ||
| basedatepicker.focusOnDay(week, day) | ||
|
Set the focus on the given day |
||
| Parameters | ||
| Name | Type | Desc |
| week | The week that contains the day to set focus to. Valid values are 0-5 | |
| day | The day in the given week to set foocus to. Valid values are 0-6 | |
|
|
||
| focusOnFirstDayInMonth() | ||
| basedatepicker.focusOnFirstDayInMonth() | ||
|
Notify the first day of the month that it has recieved focus. |
||
|
|
| focusOnLastDayInMonth() | ||
| basedatepicker.focusOnLastDayInMonth() | ||
|
Notify the last day of the month that it has recieved focus. |
||
|
|
| getNumberOfDaysInMonth() | ||
| basedatepicker.getNumberOfDaysInMonth(month, year) | ||
|
Returns the number of days in a given month. |
||
| Parameters | ||
| Name | Type | Desc |
| month | The month that you want to get the number of days for. | |
| year | The year of the month that you want to get the number of days for. | |
|
|
||
| handleKeyDown() | ||
| basedatepicker.handleKeyDown(k) | ||
|
This method is called when a key goes down from the basedatepicker |
||
| Parameters | ||
| Name | Type | Desc |
| k | The key that went down | |
|
|
||
| handleKeyUp() | ||
| basedatepicker.handleKeyUp(k) | ||
|
This method is called when a key goes up from the basedatepicker |
||
| Parameters | ||
| Name | Type | Desc |
| k | The key that went up | |
|
|
||
| init() | ||
| basedatepicker.init() | ||
|
|
| isDayDisabled() | ||
| basedatepicker.isDayDisabled(week, day) | ||
|
Finds out if a given day for a given week is selected. |
||
| Parameters | ||
| Name | Type | Desc |
| week | The week in the month that contains the day to check. Valid values are 0-5 | |
| day | The day in the given week to check. Valid values are 0-6 | |
| Returns | ||
| Type | Desc | |
| boolean | true if the given day is disabled, else false | |
|
|
||
| isLastWeekInMonth() | ||
| basedatepicker.isLastWeekInMonth(w) | ||
|
Determines if the given week is the last week in the month |
||
| Parameters | ||
| Name | Type | Desc |
| w | The week to check | |
|
|
||
| removeFocusFromDay() | ||
| basedatepicker.removeFocusFromDay(week, day) | ||
|
Remove the focus from a day |
||
| Parameters | ||
| Name | Type | Desc |
| week | The week that contains the day to remove focus from. Valid values are 0-5 | |
| day | The day in the given week to remove foocus from. Valid values are 0-6 | |
|
|
||
| selectFocusDay() | ||
| basedatepicker.selectFocusDay() | ||
|
Select the day that has focus |
||
|
|
| setMonthToShow() | ||
| basedatepicker.setMonthToShow(newMonth, newYear) | ||
|
Set the month to show in the basedatepicker. |
||
| Parameters | ||
| Name | Type | Desc |
| newMonth | The month of the year to show | |
| newYear | The year of the month to show | |
|
|
||
| setSelecteddatepickerday() | ||
| basedatepicker.setSelecteddatepickerday(d) | ||
|
Sets the currently selected basedatepickerday. If a previous basedatepickerday was selected, it is unselected, and told to become unselected |
||
| Parameters | ||
| Name | Type | Desc |
| d | None | |
|
|
||
| setStartingDay() | ||
| basedatepicker.setStartingDay(d, max) | ||
|
Sets day number that the first day of the month should have, and all subsequent days. Days that are less than 1 or are larger than max will not be selectable or shown. This method assumes that this.showingmonth and this.showingyear are current. |
||
| Parameters | ||
| Name | Type | Desc |
| d | The day of the month to start with. Negative numbers are ok. | |
| max | The max number of day to show. This is the number of days in the current month. | |
|
|
||
| showNextMonth() | ||
| basedatepicker.showNextMonth() | ||
|
Show the next month in the datepicker |
||
|
|
| showPreviousMonth() | ||
| basedatepicker.showPreviousMonth() | ||
|
Show the previous month in the datepicker |
||
|
|
doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, setStyle, setTint, updateDefault
animate, applyConstraint, applyData, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption
addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, init, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize
| Events |
onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony
Copyright © 2002-2007 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.