\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
}\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
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
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
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
+ 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