com.github.fluorumlabs.disconnect.vaadin.DatePicker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of disconnect-vaadin Show documentation
Show all versions of disconnect-vaadin Show documentation
Vaadin components bindings for Disconnect Zero
The newest version!
package com.github.fluorumlabs.disconnect.vaadin;
import com.github.fluorumlabs.disconnect.core.annotations.WebComponent;
import com.github.fluorumlabs.disconnect.polymer.mixins.HasGestureEventListeners;
import com.github.fluorumlabs.disconnect.polymer.types.BooleanPropertyChangeEvent;
import com.github.fluorumlabs.disconnect.vaadin.elements.DatePickerElement;
import com.github.fluorumlabs.disconnect.vaadin.mixins.HasControlStateMixin;
import com.github.fluorumlabs.disconnect.vaadin.mixins.HasDatePickerMixin;
import com.github.fluorumlabs.disconnect.vaadin.mixins.HasElementMixin;
import com.github.fluorumlabs.disconnect.zero.component.*;
import com.github.fluorumlabs.disconnect.zero.observable.ObservableEvent;
import js.web.dom.Element;
import javax.annotation.Nullable;
/**
* <vaadin-date-picker>
is a date selection field which includes a scrollable
* month calendar view.
*
* <vaadin-date-picker label="Birthday"></vaadin-date-picker>
*
* datePicker.value = '2016-03-02';
*
* When the selected value
is changed, a value-changed
event is triggered.
*
* Styling
* The following shadow DOM parts are available for styling:
*
*
*
* Part name Description Theme for Element
*
*
* text-field
Input element vaadin-date-picker
* clear-button
Clear button vaadin-date-picker
* toggle-button
Toggle button vaadin-date-picker
* overlay-content
The overlay element vaadin-date-picker
* overlay-header
Fullscreen mode
* header vaadin-date-picker-overlay-content
* label
Fullscreen mode value/label vaadin-date-picker-overlay-content
* clear-button
Fullscreen mode clear
* button vaadin-date-picker-overlay-content
* toggle-button
Fullscreen mode toggle
* button vaadin-date-picker-overlay-content
* years-toggle-button
Fullscreen mode years scroller
* toggle vaadin-date-picker-overlay-content
* months
Months scroller vaadin-date-picker-overlay-content
* years
Years scroller vaadin-date-picker-overlay-content
* toolbar
Footer bar with buttons vaadin-date-picker-overlay-content
* today-button
Today button vaadin-date-picker-overlay-content
* cancel-button
Cancel button vaadin-date-picker-overlay-content
* month
Month calendar vaadin-date-picker-overlay-content
* year-number
Year number vaadin-date-picker-overlay-content
* year-separator
Year separator vaadin-date-picker-overlay-content
* month-header
Month title vaadin-month-calendar
* weekdays
Weekday container vaadin-month-calendar
* weekday
Weekday element vaadin-month-calendar
* week-numbers
Week numbers container vaadin-month-calendar
* week-number
Week number element vaadin-month-calendar
* date
Date element vaadin-month-calendar
*
*
* See
* ThemableMixin – how to apply styles for shadow parts
*
* The following state attributes are available for styling:
*
*
*
* Attribute Description Part name
*
*
* invalid
Set when the element is invalid :host
* opened
Set when the date selector overlay is opened :host
* readonly
Set when the element is readonly :host
* disabled
Set when the element is disabled :host
* today
Set on the date corresponding to the current day date
* focused
Set on the focused date date
* disabled
Set on the date out of the allowed range date
* selected
Set on the selected date date
*
*
* If you want to replace the default input field with a custom implementation, you should use the
* <vaadin-date-picker-light>
element.
*
* In addition to <vaadin-date-picker>
itself, the following internal
* components are themable:
*
*
* <vaadin-text-field>
* <vaadin-date-picker-overlay>
* <vaadin-date-picker-overlay-content>
* <vaadin-month-calendar>
*
* Note: the theme
attribute value set on <vaadin-date-picker>
is
* propagated to the internal themable components listed above.
*/
@WebComponent
public class DatePicker extends AbstractComponent
implements HasElementMixin,
HasControlStateMixin,
HasDatePickerMixin,
HasGestureEventListeners,
HasSlots,
HasStyle, HasComponents> {
public DatePicker() {
super(DatePickerElement.TAGNAME());
}
/**
* Focussable element used by vaadin-control-state-mixin
*/
public Element focusElement() {
return getNode().getFocusElement();
}
/**
* Set to true to display the clear icon which clears the input.
*/
public boolean clearButtonVisible() {
return getNode().isClearButtonVisible();
}
/**
* Set to true to display the clear icon which clears the input.
*/
public DatePicker clearButtonVisible(boolean clearButtonVisible) {
getNode().setClearButtonVisible(clearButtonVisible);
return this;
}
/**
* Set to true to disable this element.
*/
public boolean disabled() {
return getNode().isDisabled();
}
/**
* Set to true to disable this element.
*/
public DatePicker disabled(boolean disabled) {
getNode().setDisabled(disabled);
return this;
}
/**
* The error message to display when the input is invalid.
*/
@Nullable
public String errorMessage() {
return getNode().getErrorMessage();
}
/**
* The error message to display when the input is invalid.
*/
public DatePicker errorMessage(String errorMessage) {
getNode().setErrorMessage(errorMessage);
return this;
}
/**
* A placeholder string in addition to the label. If this is set, the label will always float.
*/
@Nullable
public String placeholder() {
return getNode().getPlaceholder();
}
/**
* A placeholder string in addition to the label. If this is set, the label will always float.
*/
public DatePicker placeholder(String placeholder) {
getNode().setPlaceholder(placeholder);
return this;
}
/**
* Set to true to make this element read-only.
*/
public boolean readonly() {
return getNode().isReadonly();
}
/**
* Set to true to make this element read-only.
*/
public DatePicker readonly(boolean readonly) {
getNode().setReadonly(readonly);
return this;
}
/**
* This property is set to true when the control value invalid.
*/
public boolean invalid() {
return getNode().isInvalid();
}
/**
* This property is set to true when the control value invalid.
*/
public DatePicker invalid(boolean invalid) {
getNode().setInvalid(invalid);
return this;
}
/**
* Fired when the invalid
property changes.
*/
public ObservableEvent invalidChangedEvent() {
return createEvent("invalid-changed");
}
public HasSlots.Container prefixSlot() {
return slotted("prefix");
}
}