You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/06/17 11:46:13 UTC
[2/2] git commit: WICKET-5228 Add method getFirstDayOfWeek to
DatePicker class
WICKET-5228 Add method getFirstDayOfWeek to DatePicker class
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/0a4d050f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/0a4d050f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/0a4d050f
Branch: refs/heads/master
Commit: 0a4d050fc4794c378a2e53a0e64db7903ae2b1a7
Parents: 5ba6165
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Jun 17 11:45:42 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Jun 17 11:45:42 2013 +0200
----------------------------------------------------------------------
.../wicket/extensions/yui/calendar/DatePicker.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/0a4d050f/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
index 3fccd8b..05397a3 100644
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
+++ b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
@@ -587,7 +587,7 @@ public class DatePicker extends Behavior
filterEmpty(dfSymbols.getShortWeekdays()));
setWidgetProperty(i18nVariables, "WEEKDAYS_LONG", filterEmpty(dfSymbols.getWeekdays()));
- i18nVariables.put("START_WEEKDAY", Calendar.getInstance(locale).getFirstDayOfWeek() - 1);
+ i18nVariables.put("START_WEEKDAY", getFirstDayOfWeek(locale));
if (Locale.SIMPLIFIED_CHINESE.equals(locale) || Locale.TRADITIONAL_CHINESE.equals(locale))
{
@@ -615,6 +615,16 @@ public class DatePicker extends Behavior
}
/**
+ * Gets the first day of week of a given locale.
+ *
+ * @return By default the first day of week accordingly to Calendar class.
+ */
+ protected int getFirstDayOfWeek(Locale locale)
+ {
+ return Calendar.getInstance(locale).getFirstDayOfWeek() - 1;
+ }
+
+ /**
* Whether to notify the associated component when a date is selected. Notifying is done by
* calling the associated component's onchange JavaScript event handler. You can for instance
* attach an {@link AjaxEventBehavior} to that component to get a call back to the server. The