From 07814a2b556eff6bd14959cee81a9b3dcd105bb7 Mon Sep 17 00:00:00 2001 From: caalador Date: Mon, 30 Jan 2017 08:16:44 +0200 Subject: Add convenience constructors to new components (#598) (#8351) Add convenience constructors (#598) Added convenience constructors to ui components that have been reimplemented for Vaadin 8 --- .../java/com/vaadin/ui/InlineDateTimeField.java | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'server/src/main/java/com/vaadin/ui/InlineDateTimeField.java') diff --git a/server/src/main/java/com/vaadin/ui/InlineDateTimeField.java b/server/src/main/java/com/vaadin/ui/InlineDateTimeField.java index 2c4cf290b3..fecfd346e4 100644 --- a/server/src/main/java/com/vaadin/ui/InlineDateTimeField.java +++ b/server/src/main/java/com/vaadin/ui/InlineDateTimeField.java @@ -59,6 +59,58 @@ public class InlineDateTimeField extends AbstractLocalDateTimeField { super(caption); } + /** + * Constructs a new {@code InlineDateTimeField} with a value change listener. + *

+ * The listener is called when the value of this {@code InlineDateTimeField} is + * changed either by the user or programmatically. + * + * @param valueChangeListener + * the value change listener, not {@code null} + */ + public InlineDateTimeField(ValueChangeListener valueChangeListener) { + super(); + addValueChangeListener(valueChangeListener); + } + + /** + * Constructs a new {@code InlineDateTimeField} with the given caption and a value + * change listener. + *

+ * The listener is called when the value of this {@code InlineDateTimeField} is + * changed either by the user or programmatically. + * + * @param caption + * the caption for the field + * @param valueChangeListener + * the value change listener, not {@code null} + */ + public InlineDateTimeField(String caption, + ValueChangeListener valueChangeListener) { + this(valueChangeListener); + setCaption(caption); + } + + /** + * Constructs a new {@code InlineDateTimeField} with the given caption, initial + * text contents and a value change listener. + *

+ * The listener is called when the value of this {@code InlineDateTimeField} is + * changed either by the user or programmatically. + * + * @param caption + * the caption for the field + * @param value + * the value for the field, not {@code null} + * @param valueChangeListener + * the value change listener, not {@code null} + */ + public InlineDateTimeField(String caption, LocalDateTime value, + ValueChangeListener valueChangeListener) { + this(caption, value); + addValueChangeListener(valueChangeListener); + } + @Override protected InlineDateTimeFieldState getState() { return (InlineDateTimeFieldState) super.getState(); -- cgit v1.2.3