summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarPanel.java16
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupCalendar.java12
2 files changed, 26 insertions, 2 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarPanel.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarPanel.java
index 482c9c6b22..205f4c1822 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarPanel.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarPanel.java
@@ -420,7 +420,12 @@ public class CalendarPanel extends FlexTable implements MouseListener,
cal.datefield.getCurrentDate().getYear() + 1900,
cal.datefield.isImmediate());
- updateCalendar();
+ if (datefield instanceof ITextualDate) {
+ ((ToolkitOverlay) getParent()).hide();
+ } else {
+ updateCalendar();
+ }
+
} catch (final NumberFormatException e) {
// Not a number, ignore and stop here
return;
@@ -462,4 +467,13 @@ public class CalendarPanel extends FlexTable implements MouseListener,
public List getEntries(Date date, int resolution);
}
+ /**
+ * Sets focus to Calendar panel.
+ *
+ * @param focus
+ */
+ public void setFocus(boolean focus) {
+ nextYear.setFocus(focus);
+ }
+
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupCalendar.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupCalendar.java
index 30d9595edf..098967b8d9 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupCalendar.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupCalendar.java
@@ -35,7 +35,7 @@ public class IPopupCalendar extends ITextualDate implements Paintable,
add(calendarToggle);
calendar = new CalendarPanel(this);
- popup = new ToolkitOverlay(true);
+ popup = new ToolkitOverlay(true, true);
popup.setStyleName(IDateField.CLASSNAME + "-popup");
popup.setWidget(calendar);
popup.addPopupListener(this);
@@ -83,6 +83,7 @@ public class IPopupCalendar extends ITextualDate implements Paintable,
// fix size
popup.setWidth(w + "px");
popup.setHeight(h + "px");
+ setFocus(true);
}
});
}
@@ -101,4 +102,13 @@ public class IPopupCalendar extends ITextualDate implements Paintable,
}
}
+ /**
+ * Sets focus to Calendar panel.
+ *
+ * @param focus
+ */
+ public void setFocus(boolean focus) {
+ calendar.setFocus(focus);
+ }
+
}