Author: gseitz
Date: Thu Jan  3 13:13:10 2008
New Revision: 608630

URL: http://svn.apache.org/viewvc?rev=608630&view=rev
Log:
WICKET-1252

Modified:
    
wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java

Modified: 
wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java?rev=608630&r1=608629&r2=608630&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
 Thu Jan  3 13:13:10 2008
@@ -20,6 +20,7 @@
 import java.text.DateFormatSymbols;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -58,15 +59,15 @@
  * only be used with components that either implement [EMAIL PROTECTED] 
ITextFormatProvider} or that use
  * [EMAIL PROTECTED] DateConverter} configured with an instance of [EMAIL 
PROTECTED] SimpleDateFormat} (like Wicket's
  * default configuration has).<br/>
- * 
+ *
  * To use, simply add a new instance to your component, which would typically 
a TextField, like
  * [EMAIL PROTECTED] DateTextField}.<br/>
- * 
+ *
  * The CalendarNavigator can be configured by overriding [EMAIL PROTECTED] 
#configure(Map)} and setting the
  * property or by returning <code>true</code> for [EMAIL PROTECTED] 
#enableMonthYearSelection()}.
- * 
+ *
  * @see http://developer.yahoo.com/yui/calendar/
- * 
+ *
  * @author eelcohillenius
  */
 public class DatePicker extends AbstractBehavior implements IHeaderContributor
@@ -284,7 +285,7 @@
         * Check that this behavior can get a date format out of the component 
it is coupled to. It
         * checks whether [EMAIL PROTECTED] #getDatePattern()} produces a 
non-null value. If that method returns
         * null, and exception will be thrown
-        * 
+        *
         * @param component
         *            the component this behavior is being coupled to
         * @throws UnableToDetermineFormatException
@@ -300,7 +301,7 @@
 
        /**
         * Set widget property if the array is null and has a length greater 
than 0.
-        * 
+        *
         * @param widgetProperties
         * @param key
         * @param array
@@ -315,7 +316,7 @@
 
        /**
         * Whether to position the date picker relative to the trigger icon.
-        * 
+        *
         * @return If true, the date picker is aligned with the left position 
of the icon, and with the
         *         top right under. If false, the date picker will skip 
positioning and will let you do
         *         the positioning yourself. Returns true by default.
@@ -329,7 +330,7 @@
         * Append javascript to the initialization function for the YUI widget. 
Can be used by
         * subclasses to conveniently extend configuration without having to 
write a separate
         * contribution.
-        * 
+        *
         * @param markupId
         *            The markup id of the calendar component
         * @param javascriptId
@@ -352,7 +353,7 @@
         * [EMAIL PROTECTED] super#setWidgetProperties(Properties)} first. If 
you don't call that, be aware that
         * you will have to call [EMAIL PROTECTED] #localize(Map)} manually if 
you like localized strings to be
         * added.
-        * 
+        *
         * @param widgetProperties
         *            the current widget properties
         */
@@ -385,7 +386,7 @@
        /**
         * Filter all empty elements (workaround for [EMAIL PROTECTED] 
DateFormatSymbols} returning arrays with
         * empty elements).
-        * 
+        *
         * @param array
         *            array to filter
         * @return filtered array (without null or empty string elements)
@@ -409,7 +410,7 @@
 
        /**
         * Gets the id of the component that the calendar widget will get 
attached to.
-        * 
+        *
         * @return The DOM id of the component
         */
        protected final String getComponentMarkupId()
@@ -419,7 +420,7 @@
 
        /**
         * Gets the date pattern to use for putting selected values in the 
coupled component.
-        * 
+        *
         * @return The date pattern
         */
        protected String getDatePattern()
@@ -449,7 +450,7 @@
        /**
         * Gets the escaped DOM id that the calendar widget will get attached 
to. All non word
         * characters (\W) will be removed from the string.
-        * 
+        *
         * @return The DOM id of the calendar widget - same as the component's 
markup id + 'Dp'}
         */
        protected final String getEscapedComponentMarkupId()
@@ -459,7 +460,7 @@
 
        /**
         * Gets the id of the icon that triggers the popup.
-        * 
+        *
         * @return The id of the icon
         */
        protected final String getIconId()
@@ -469,7 +470,7 @@
 
        /**
         * Gets the style of the icon that triggers the popup.
-        * 
+        *
         * @return The style of the icon, e.g. 'cursor: point' etc.
         */
        protected String getIconStyle()
@@ -479,7 +480,7 @@
 
        /**
         * Gets the url for the popup button. Users can override to provide 
their own icon URL.
-        * 
+        *
         * @return the url to use for the popup button/ icon
         */
        protected CharSequence getIconUrl()
@@ -489,7 +490,7 @@
 
        /**
         * Gets the locale that should be used to configure this widget.
-        * 
+        *
         * @return By default the locale of the bound component.
         */
        protected Locale getLocale()
@@ -500,9 +501,10 @@
        /**
         * Configure the localized strings for the datepicker widget. This 
implementation uses
         * [EMAIL PROTECTED] DateFormatSymbols} and some slight string 
manupilation to get the strings for months
-        * and week days. It should work well for most locales.
+        * and week days. Also, the first week day is set according to the 
[EMAIL PROTECTED] Locale} returned by
+        * [EMAIL PROTECTED] #getLocale()}. It should work well for most 
locales.
         * <p>
-        * This method is called from [EMAIL PROTECTED] 
#configureWidgetProperties(Map)} and can be overriden if
+        * This method is called from [EMAIL PROTECTED] 
#configureWidgetProperties(Map)} and can be overridden if
         * you want to customize setting up the localized strings but are happy 
with the rest of
         * [EMAIL PROTECTED] #configureWidgetProperties(Map)}'s behavior. Note 
that you can call (overridable)
         * method [EMAIL PROTECTED] #getLocale()} to get the locale that should 
be used for setting up the widget.
@@ -513,7 +515,7 @@
         * 
href="http://developer.yahoo.com/yui/examples/calendar/japan/1.html";>Japanese</a>
 examples
         * for more info.
         * </p>
-        * 
+        *
         * @param widgetProperties
         *            the current widget properties
         */
@@ -529,6 +531,9 @@
                setWidgetProperty(widgetProperties, "WEEKDAYS_MEDIUM", 
filterEmpty(dfSymbols
                                .getShortWeekdays()));
                setWidgetProperty(widgetProperties, "WEEKDAYS_LONG", 
filterEmpty(dfSymbols.getWeekdays()));
+
+               widgetProperties.put("START_WEEKDAY", new 
Integer(Calendar.getInstance(getLocale())
+                               .getFirstDayOfWeek() - 1));
        }
 
        /**
@@ -536,7 +541,7 @@
         * calling the associated component's onchange Javascript event 
handler. You can for instance
         * attach an [EMAIL PROTECTED] AjaxEventBehavior} to that component to 
get a call back to the server. The
         * default is true.
-        * 
+        *
         * @return if true, notifies the associated component when a date is 
selected
         */
        protected boolean notifyComponentOnDateSelected()
@@ -547,7 +552,7 @@
        /**
         * Makes a copy of the provided array and for each element copy the 
substring 0..len to the new
         * array
-        * 
+        *
         * @param array
         *            array to copy from
         * @param len
@@ -582,7 +587,7 @@
        /**
         * Indicates whether plain text is rendered or two select boxes are 
used to allow direct
         * selection of month and year.
-        * 
+        *
         * @return <code>true</code> if select boxes should be rendered to 
allow month and year
         *         selection.<br/><code>false</code> to render just plain text.
         */
@@ -593,7 +598,7 @@
 
        /**
         * Indicates whether the calendar should be hidden after a date was 
selected.
-        * 
+        *
         * @return <code>true</code> (default) if the calendar should be hidden 
after the date
         *         selection <br/><code>false</code> if the calendar should 
remain visible after the
         *         date selection.
@@ -605,7 +610,7 @@
 
        /**
         * Indicates whether the calendar should be rendered after it has been 
loaded.
-        * 
+        *
         * @return <code>true</code> if the calendar should be rendered after 
it has been loaded.<br/><code>false</code>
         *         (default) if it's initially hidden.
         */
@@ -620,16 +625,16 @@
         * and initialized. To refer to the actual Calendar DOM object, use 
<code>${calendar}</code>
         * in your code.<br/>See <a 
href="http://developer.yahoo.com/yui/calendar/";>the widget's
         * documentation</a> for more information about the YUI Calendar.<br/> 
Example:
-        * 
+        *
         * <pre>
         * protected String getAdditionalJavascript()
         * {
         *      return &quot;${calendar}.addRenderer(\&quot;10/3\&quot;, 
${calendar}.renderCellStyleHighlight1);&quot;;
         * }
         * </pre>
-        * 
+        *
         * @return a String containing additional Javascript code
-        * 
+        *
         */
        protected String getAdditionalJavascript()
        {


Reply via email to