public class DatePicker extends Behavior
AbstractTextComponent.ITextFormatProvider or that use
DateConverter configured with an instance of SimpleDateFormat (like Wicket's
default configuration has).DateTextField.configure(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map) and setting the
property or by returning true for enableMonthYearSelection().| Modifier and Type | Field and Description |
|---|---|
static String |
FORMAT_DATE
Format to be used when configuring YUI calendar.
|
static String |
FORMAT_PAGEDATE
For specifying which page (month/year) to show in the calendar, use this format for the date.
|
| Constructor and Description |
|---|
DatePicker()
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterRender(Component component) |
protected boolean |
alignWithIcon()
Whether to position the date picker relative to the trigger icon.
|
protected boolean |
autoHide()
Indicates whether the calendar should be hidden when the user clicks on an area of the
document outside of the dialog.
|
void |
bind(Component component) |
protected void |
configure(Map<String,Object> widgetProperties,
IHeaderResponse response,
Map<String,Object> initVariables)
Gives overriding classes the option of adding (or even changing/ removing) configuration
properties for the javascript widget.
|
protected boolean |
enableMonthYearSelection()
Indicates whether plain text is rendered or two select boxes are used to allow direct
selection of month and year.
|
protected String[] |
filterEmpty(String[] stringArray)
Filter all empty elements (workaround for
DateFormatSymbols returning arrays with
empty elements). |
protected String |
getAdditionalJavaScript()
Override this method to further customize the YUI Calendar with additional JavaScript code.
|
protected String |
getComponentMarkupId()
Gets the id of the component that the calendar widget will get attached to.
|
protected String |
getDatePattern()
Gets the date pattern to use for putting selected values in the coupled component.
|
protected String |
getEscapedComponentMarkupId()
Gets the escaped DOM id that the calendar widget will get attached to.
|
protected int |
getFirstDayOfWeek(Locale locale)
Gets the first day of week of a given locale.
|
protected CharSequence |
getIconAltText()
Gets the icon alt text for the datepicker icon
|
protected String |
getIconId()
Gets the id of the icon that triggers the popup.
|
protected String |
getIconStyle()
Gets the style of the icon that triggers the popup.
|
protected CharSequence |
getIconTitle()
Gets the title attribute of the datepicker icon
|
protected CharSequence |
getIconUrl()
Gets the url for the popup button.
|
protected Locale |
getLocale()
Gets the locale that should be used to configure this widget.
|
protected boolean |
hideOnSelect()
Indicates whether the calendar should be hidden after a date was selected.
|
protected boolean |
includeYUILibraries()
Controls whether or not datepicker will contribute YUI libraries to the page as part of its
rendering lifecycle.
|
boolean |
isEnabled(Component component) |
protected void |
localize(Map<String,Object> widgetProperties,
IHeaderResponse response,
Map<String,Object> initVariables)
Configure the localized strings for the datepicker widget.
|
protected boolean |
notifyComponentOnDateSelected()
Whether to notify the associated component when a date is selected.
|
void |
renderHead(Component component,
IHeaderResponse response) |
protected void |
renderHeadInit(IHeaderResponse response)
Renders yui & wicket calendar js module loading.
|
protected boolean |
renderOnLoad()
Indicates whether the calendar should be rendered after it has been loaded.
|
DatePicker |
setAutoHide(boolean autoHide) |
DatePicker |
setShowOnFieldClick(boolean show) |
protected boolean |
showOnFieldClick()
Indicates whether the calendar should be shown when corresponding text input is clicked.
|
protected String[] |
substring(String[] array,
int len)
Makes a copy of the provided array and for each element copy the substring 0..len to the new
array
|
protected String[] |
substring(String[] array,
int start,
int len)
Makes a copy of the provided array and for each element copy the substring 0..len to the new
array
|
beforeRender, canCallListenerInterface, detach, getStatelessHint, isTemporary, onComponentTag, onConfigure, onEvent, onException, onRemove, unbindpublic static String FORMAT_DATE
public static String FORMAT_PAGEDATE
public void afterRender(Component component)
afterRender in class Behaviorprotected boolean includeYUILibraries()
false.true by default.public void renderHead(Component component, IHeaderResponse response)
renderHead in interface IComponentAwareHeaderContributorrenderHead in class Behaviorprotected void renderHeadInit(IHeaderResponse response)
response - header responseprotected boolean alignWithIcon()
protected void configure(Map<String,Object> widgetProperties, IHeaderResponse response, Map<String,Object> initVariables)
localize(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map) manually if you like localized strings to be added.widgetProperties - the current widget propertiesresponse - the header responseinitVariables - variables passed to the Wicket.DateTime.init() js methodprotected final String[] filterEmpty(String[] stringArray)
DateFormatSymbols returning arrays with
empty elements).stringArray - array to filterprotected final String getComponentMarkupId()
protected String getDatePattern()
protected final String getEscapedComponentMarkupId()
protected final String getIconId()
protected String getIconStyle()
protected CharSequence getIconTitle()
protected CharSequence getIconAltText()
protected CharSequence getIconUrl()
protected Locale getLocale()
protected void localize(Map<String,Object> widgetProperties, IHeaderResponse response, Map<String,Object> initVariables)
DateFormatSymbols and some slight string manipulation to get the strings for months
and week days. Also, the first week day is set according to the Locale returned by
getLocale(). It should work well for most locales.
This method is called from configure(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map) and can be overridden if
you want to customize setting up the localized strings but are happy with the rest of
configure(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map)'s behavior. Note that you can call (overridable)
method getLocale() to get the locale that should be used for setting up the widget.
See YUI Calendar's German and Japanese examples for more info.
widgetProperties - the current widget propertiesresponse - the header responseinitVariables - variables passed to the Wicket.DateTime.init() js methodprotected int getFirstDayOfWeek(Locale locale)
protected boolean notifyComponentOnDateSelected()
AjaxEventBehavior to that component to get a call back to the server. The
default is true.protected final String[] substring(String[] array, int len)
array - array to copy fromlen - size of substring for each element to copyprotected final String[] substring(String[] array, int start, int len)
array - array to copy fromstart - start position of the substringlen - size of substring for each element to copyprotected boolean enableMonthYearSelection()
true if select boxes should be rendered to allow month and year
selection.false to render just plain text.protected boolean hideOnSelect()
true (default) if the calendar should be hidden after the date selection false if the calendar should remain visible after the date selection.protected boolean showOnFieldClick()
true false (default)public DatePicker setShowOnFieldClick(boolean show)
show - a flag indicating whether to show the picker on click eventthis instance to be able to chain calls#showOnFieldClick()}protected boolean autoHide()
true false (default)public DatePicker setAutoHide(boolean autoHide)
autoHide - a flag indicating whether to hide the picker on click eventthis instance to be able to chain calls#autoHide()}protected boolean renderOnLoad()
true if the calendar should be rendered after it has been loaded.false (default) if it's initially hidden.protected String getAdditionalJavaScript()
${calendar} in
your code.
protected String getAdditionalJavaScript()
{
return "${calendar}.addRenderer(\"10/3\", ${calendar}.renderCellStyleHighlight1);";
}
Copyright © 2006–2016 Apache Software Foundation. All rights reserved.