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:49:51 UTC

git commit: WICKET-5228 Add method getFirstDayOfWeek to DatePicker class

Updated Branches:
  refs/heads/wicket-6.x 5ada2c75c -> 6cb3994ae


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/6cb3994a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6cb3994a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6cb3994a

Branch: refs/heads/wicket-6.x
Commit: 6cb3994ae42b076524a204eb2a334e4487f4a59d
Parents: 5ada2c7
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:46:13 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/6cb3994a/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 7fbd56c..01d0155 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