]> source.dussan.org Git - vaadin-framework.git/commitdiff
different kind of fix for #5592
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 16 Sep 2010 13:43:24 +0000 (13:43 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 16 Sep 2010 13:43:24 +0000 (13:43 +0000)
svn changeset:14965/svn branch:6.4

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

index 40c9887c8337d1dd6aba28899b6429f6fe346c39..6ffa66d6cda138d96969ddaee10d7dfb82d3445d 100644 (file)
@@ -134,8 +134,6 @@ public class VCalendarPanel extends FocusableFlexTable implements
 \r
     private FlexTable days = new FlexTable();\r
 \r
-    /* Needed to identify resolution changes */\r
-    private int oldResolution = 0;\r
     private int resolution = VDateField.RESOLUTION_YEAR;\r
 \r
     private int focusedRow;\r
@@ -290,10 +288,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
     }\r
 \r
     public void setResolution(int resolution) {\r
-        if (resolution != this.resolution) {\r
-            oldResolution = this.resolution;\r
-            this.resolution = resolution;\r
-        }\r
+        this.resolution = resolution;\r
     }\r
 \r
     private boolean isReadonly() {\r
@@ -591,14 +586,12 @@ public class VCalendarPanel extends FocusableFlexTable implements
             buildCalendarBody();\r
         }\r
 \r
-        if (isTimeSelectorNeeded()\r
-                && (time == null || resolution != oldResolution)) {\r
+        if (isTimeSelectorNeeded() && time == null) {\r
             time = new VTime();\r
             setWidget(2, 0, time);\r
             getFlexCellFormatter().setColSpan(2, 0, 5);\r
             getFlexCellFormatter().setStyleName(2, 0,\r
                     VDateField.CLASSNAME + "-calendarpanel-time");\r
-            oldResolution = resolution;\r
         } else if (isTimeSelectorNeeded()) {\r
             time.updateTimes();\r
         } else if (time != null) {\r
@@ -1230,8 +1223,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
             focusedDate = (Date) value.clone();\r
         }\r
 \r
-        // Re-render calendar if the resolution or the month or year has changed\r
-        if (oldResolution != resolution || oldValue == null || value == null\r
+        // Re-render calendar if month or year has changed\r
+        if (oldValue == null || value == null\r
                 || oldValue.getYear() != value.getYear()\r
                 || oldValue.getMonth() != value.getMonth()) {\r
             renderCalendar();\r
index 35151cf4c3f35d97c6348477b28b3fab457631ca..281b5a8df40650103ce09cb22391728c214d4fbb 100644 (file)
@@ -24,10 +24,10 @@ import com.vaadin.terminal.gwt.client.ApplicationConnection;
 import com.vaadin.terminal.gwt.client.DateTimeService;\r
 import com.vaadin.terminal.gwt.client.Paintable;\r
 import com.vaadin.terminal.gwt.client.UIDL;\r
+import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusChangeListener;\r
 import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusOutListener;\r
 import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.SubmitListener;\r
 import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.TimeChangeListener;\r
-import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.FocusChangeListener;\r
 \r
 /**\r
  * Represents a date selection component with a text field and a popup date\r
@@ -160,7 +160,13 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field,
                 + resolutionToString(currentResolution));\r
         calendar.setDateTimeService(getDateTimeService());\r
         calendar.setShowISOWeekNumbers(isShowISOWeekNumbers());\r
-        calendar.setResolution(currentResolution);\r
+        if (calendar.getResolution() != currentResolution) {\r
+            calendar.setResolution(currentResolution);\r
+            if (calendar.getDate() != null) {\r
+                // force re-render when changing resolution only\r
+                calendar.renderCalendar();\r
+            }\r
+        }\r
         calendarToggle.setEnabled(enabled);\r
 \r
         if (currentResolution <= RESOLUTION_MONTH) {\r