]> source.dussan.org Git - vaadin-framework.git/commitdiff
Comment improvements related to #6718
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 27 Jan 2012 13:50:35 +0000 (13:50 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Fri, 27 Jan 2012 13:50:35 +0000 (13:50 +0000)
svn changeset:22794/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java

index 3b74232112b393820b4044f4f2de723f2f258d02..fb5070d9a265739141b7baa231c073434ddf61e7 100644 (file)
@@ -72,7 +72,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
 \r
     /**\r
      * FocusChangeListener is notified when the panel changes its _focused_\r
-     * value. It can be set with\r
+     * value.\r
      */\r
     public interface FocusChangeListener {\r
         void focusChanged(Date focusedDate);\r
@@ -191,21 +191,22 @@ public class VCalendarPanel extends FocusableFlexTable implements
     }\r
 \r
     /**\r
-     * Sets the focus to given day of current time. Used when moving in the\r
-     * calender with the keyboard.\r
+     * Sets the focus to given date in the current view. Used when moving in the\r
+     * calendar with the keyboard.\r
      * \r
      * @param date\r
-     *            The day number from by Date.getDate()\r
+     *            A Date representing the day of month to be focused. Must be\r
+     *            one of the days currently visible.\r
      */\r
-    private void focusDay(Date day) {\r
+    private void focusDay(Date date) {\r
         // Only used when calender body is present\r
         if (resolution > VDateField.RESOLUTION_MONTH) {\r
             if (focusedDay != null) {\r
                 focusedDay.removeStyleDependentName(CN_FOCUSED);\r
             }\r
 \r
-            if (day != null && focusedDate != null) {\r
-                focusedDate.setTime(day.getTime());\r
+            if (date != null && focusedDate != null) {\r
+                focusedDate.setTime(date.getTime());\r
                 int rowCount = days.getRowCount();\r
                 for (int i = 0; i < rowCount; i++) {\r
                     int cellCount = days.getCellCount(i);\r
@@ -213,7 +214,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
                         Widget widget = days.getWidget(i, j);\r
                         if (widget != null && widget instanceof Day) {\r
                             Day curday = (Day) widget;\r
-                            if (curday.getDate().equals(day)) {\r
+                            if (curday.getDate().equals(date)) {\r
                                 curday.addStyleDependentName(CN_FOCUSED);\r
                                 focusedDay = curday;\r
                                 focusedRow = i;\r
@@ -227,9 +228,12 @@ public class VCalendarPanel extends FocusableFlexTable implements
     }\r
 \r
     /**\r
-     * Sets the selection hightlight to a given date of current time\r
+     * Sets the selection highlight to a given day in the current view\r
      * \r
      * @param date\r
+     *            A Date representing the day of month to be selected. Must be\r
+     *            one of the days currently visible.\r
+     * \r
      */\r
     private void selectDate(Date date) {\r
         if (selectedDay != null) {\r
@@ -1526,6 +1530,9 @@ public class VCalendarPanel extends FocusableFlexTable implements
 \r
     }\r
 \r
+    /**\r
+     * A widget representing a single day in the calendar panel.\r
+     */\r
     private class Day extends InlineHTML {\r
         private static final String BASECLASS = VDateField.CLASSNAME\r
                 + "-calendarpanel-day";\r
@@ -1672,6 +1679,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
             if (day != null) {\r
                 Date date = day.getDate();\r
                 int id = date.getDate();\r
+                // Zero or negative ids map to days of the preceding month,\r
+                // past-the-end-of-month ids to days of the following month\r
                 if (date.getMonth() < displayedMonth.getMonth()) {\r
                     id -= DateTimeService.getNumberOfDaysInMonth(date);\r
                 } else if (date.getMonth() > displayedMonth.getMonth()) {\r
@@ -1744,8 +1753,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
             return time.ampm.getElement();\r
         }\r
         if (subPart.startsWith(SUBPART_DAY)) {\r
-            // can be less than 1 or greater than the number of days in the current month\r
-            // these map to the "off-month" days\r
+            // Zero or negative ids map to days in the preceding month,\r
+            // past-the-end-of-month ids to days in the following month\r
             int dayOfMonth = Integer.parseInt(subPart.substring(SUBPART_DAY\r
                     .length()));\r
             Date date = new Date(displayedMonth.getYear(),\r