diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-03-22 11:34:39 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-03-22 11:34:39 +0000 |
commit | 5abcfae71f8c32d5209f1d9cc6870f50b69dd6fa (patch) | |
tree | c60e54e437ef9c60407b48ea260a07b9418277f8 /src/com/vaadin/ui/DateField.java | |
parent | a77594d16f1bdb951a2c0247214e44aadd6d9a78 (diff) | |
download | vaadin-framework-5abcfae71f8c32d5209f1d9cc6870f50b69dd6fa.tar.gz vaadin-framework-5abcfae71f8c32d5209f1d9cc6870f50b69dd6fa.zip |
Fix for #3492 - DateField should have an option to show week numbers
svn changeset:12004/svn branch:6.3
Diffstat (limited to 'src/com/vaadin/ui/DateField.java')
-rw-r--r-- | src/com/vaadin/ui/DateField.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java index 3c21630f0e..4f69b37de6 100644 --- a/src/com/vaadin/ui/DateField.java +++ b/src/com/vaadin/ui/DateField.java @@ -19,6 +19,7 @@ import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; +import com.vaadin.terminal.gwt.client.ui.VDateField; import com.vaadin.terminal.gwt.client.ui.VPopupCalendar; import com.vaadin.terminal.gwt.client.ui.VTextualDate; @@ -122,6 +123,11 @@ public class DateField extends AbstractField implements private boolean lenient = false; + /** + * Determines if week numbers are shown in the date selector. + */ + private boolean showISOWeekNumbers = false; + /* Constructors */ /** @@ -213,6 +219,7 @@ public class DateField extends AbstractField implements } target.addAttribute("type", type); + target.addAttribute(VDateField.WEEK_NUMBERS, isShowISOWeekNumbers()); // Gets the calendar final Calendar calendar = getCalendar(); @@ -557,7 +564,7 @@ public class DateField extends AbstractField implements } /** - * Specifies whether or not date/time interpretation is to be lenient. + * Returns whether date/time interpretation is to be lenient. Lenient * * @see #setLenient(boolean) * @@ -586,4 +593,26 @@ public class DateField extends AbstractField implements removeListener(BLUR_EVENT, BlurEvent.class, listener); } + /** + * Checks whether ISO 8601 week numbers are shown in the date selector. + * + * @return true if week numbers are shown, false otherwise. + */ + public boolean isShowISOWeekNumbers() { + return showISOWeekNumbers; + } + + /** + * Sets the visibility of ISO 8601 week numbers in the date selector. ISO + * 8601 defines that a week always starts with a Monday so the week numbers + * are only shown if this is the case. + * + * @param showWeekNumbers + * true if week numbers should be shown, false otherwise. + */ + public void setShowISOWeekNumbers(boolean showWeekNumbers) { + showISOWeekNumbers = showWeekNumbers; + requestRepaint(); + } + } |