com.vaadin.ui.InlineDateTimeField Maven / Gradle / Ivy
/*
* Copyright (C) 2000-2024 Vaadin Ltd
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See for the full
* license.
*/
package com.vaadin.ui;
import java.time.LocalDateTime;
import com.vaadin.shared.ui.datefield.InlineDateTimeFieldState;
/**
* A date time entry component, which displays the actual date selector inline.
*
* @see AbstractLocalDateTimeField
* @see DateTimeField
* @author Vaadin Ltd.
* @since 8.0
*/
public class InlineDateTimeField extends AbstractLocalDateTimeField {
/**
* Constructs an empty InlineDateTimeField
with no caption.
*/
public InlineDateTimeField() {
super();
}
/**
* Constructs a new InlineDateTimeField
with the given caption
* and initial text contents.
*
* @param caption
* the caption String
for the editor.
* @param value
* the LocalDate value.
*/
public InlineDateTimeField(String caption, LocalDateTime value) {
super(caption, value);
}
/**
* Constructs an empty InlineDateTimeField
with caption.
*
* @param caption
* the caption of the datefield.
*/
public InlineDateTimeField(String caption) {
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();
}
@Override
protected InlineDateTimeFieldState getState(boolean markAsDirty) {
return (InlineDateTimeFieldState) super.getState(markAsDirty);
}
}