com.vaadin.ui.

Class DateTimeField

    • Constructor Detail

      • DateTimeField

        public DateTimeField()

        Constructs an empty DateTimeField with no caption.

      • DateTimeField

        public DateTimeField​(String caption,
                             LocalDateTime value)

        Constructs a new DateTimeField with the given caption and initial text contents.

        Parameters:

        caption - the caption String for the editor.

        value - the LocalDateTime value.

      • DateTimeField

        public DateTimeField​(String caption)

        Constructs an empty DateTimeField with caption.

        Parameters:

        caption - the caption of the datefield.

      • DateTimeField

        public DateTimeField​(HasValue.ValueChangeListener<LocalDateTime> valueChangeListener)

        Constructs a new DateTimeField with a value change listener.

        The listener is called when the value of this DateTimeField is changed either by the user or programmatically.

        Parameters:

        valueChangeListener - the value change listener, not null

      • DateTimeField

        public DateTimeField​(String caption,
                             HasValue.ValueChangeListener<LocalDateTime> valueChangeListener)

        Constructs a new DateTimeField with the given caption and a value change listener.

        The listener is called when the value of this DateTimeField is changed either by the user or programmatically.

        Parameters:

        caption - the caption for the field

        valueChangeListener - the value change listener, not null

      • DateTimeField

        public DateTimeField​(String caption,
                             LocalDateTime value,
                             HasValue.ValueChangeListener<LocalDateTime> valueChangeListener)

        Constructs a new DateTimeField with the given caption, initial text contents and a value change listener.

        The listener is called when the value of this DateTimeField is changed either by the user or programmatically.

        Parameters:

        caption - the caption for the field

        value - the value for the field, not null

        valueChangeListener - the value change listener, not null

    • Method Detail

      • getPlaceholder

        public String getPlaceholder()

        Returns the current placeholder text.

        Returns:

        the placeholder text

        See Also:

        setPlaceholder(String)

      • setPlaceholder

        public void setPlaceholder​(String placeholder)

        Sets the placeholder text. The placeholder is text that is displayed when the field would otherwise be empty, to prompt the user for input.

        Parameters:

        placeholder - the placeholder text to set

      • getState

        protected LocalDateTimeFieldState getState()

        Description copied from class: AbstractComponent

        Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().

        Overrides:

        getState in class AbstractLocalDateTimeField

        Returns:

        updated component shared state

      • isTextFieldEnabled

        public boolean isTextFieldEnabled()

        Checks whether the text field is enabled (default) or not.

        Returns:

        true if the text field is enabled, false otherwise.

        See Also:

        setTextFieldEnabled(boolean)

      • setTextFieldEnabled

        public void setTextFieldEnabled​(boolean state)

        Enables or disables the text field. By default the text field is enabled. Disabling it causes only the button for date selection to be active, thus preventing the user from entering invalid dates. See issue 6790.

        Parameters:

        state - true to enable text field, false to disable it.

      • setAssistiveText

        public void setAssistiveText​(String description)

        Set a description that explains the usage of the Widget for users of assistive devices.

        Parameters:

        description - String with the description

      • getAssistiveText

        public String getAssistiveText()

        Get the description that explains the usage of the Widget for users of assistive devices.

        Returns:

        String with the description