Class MonthPicker.MonthPickerI18n
java.lang.Object
org.vaadin.addons.componentfactory.monthpicker.MonthPicker.MonthPickerI18n
- All Implemented Interfaces:
Serializable
- Enclosing class:
MonthPicker
A class that contains internationalization settings for the
MonthPicker component.
This allows customizing month names, labels, and parsing/formatting patterns for the value input field.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the list of custom formats that are used for formatting the year-month displayed in the text field, and for parsing the user inputGets the labels of the months.Gets the name of the months.Gets the short labels of the months.Sets a single format pattern to be used for both displaying and parsing values.setFormats(String primaryFormat, String... additionalParsingFormats) Sets a primary format and additional parsing formats for interpreting user input.setMonthLabels(List<String> monthLabels) Sets the labels of the months, to be shown in the calendar overlay.setMonthNames(List<String> monthNames) Sets the name of the months, starting from January and ending on December.setShortMonthNames(List<String> shortMonthNames) Sets the short names of the months.
-
Constructor Details
-
MonthPickerI18n
public MonthPickerI18n()
-
-
Method Details
-
getMonthNames
Gets the name of the months.- Returns:
- the month names
-
setMonthNames
Sets the name of the months, starting from January and ending on December. These are used for parsing and formatting, when the long month name pattern ("MMMM") is used.- Parameters:
monthNames- the month names- Returns:
- this instance for method chaining
-
getMonthLabels
Gets the labels of the months.- Returns:
- the month labels
-
setMonthLabels
Sets the labels of the months, to be shown in the calendar overlay.- Parameters:
monthLabels- the month labels- Returns:
- this instance for method chaining
-
getShortMonthNames
Gets the short labels of the months.- Returns:
- the short month labels
-
setShortMonthNames
Sets the short names of the months. These are used for parsing and formatting, when the short month name pattern ("MMM") is used.- Parameters:
shortMonthNames- the short month names- Returns:
- this instance for method chaining
-
getFormats
Get the list of custom formats that are used for formatting the year-month displayed in the text field, and for parsing the user input- Returns:
- list of date patterns or null
-
setFormat
Sets a single format pattern to be used for both displaying and parsing values.YY- 2-digit yearYYYY- 4-digit yearM- 1- or 2-digit monthMM- 2-digit month (with leading zero)MMM- short month name (requires the i18n short month names to be set)MMMM- long month name (requires the i18n month names to be set)
- Parameters:
format- a string pattern using year-month symbols (e.g.,"MM-YYYY")- Returns:
- this instance for method chaining
- See Also:
-
setFormats
public MonthPicker.MonthPickerI18n setFormats(String primaryFormat, String... additionalParsingFormats) Sets a primary format and additional parsing formats for interpreting user input.The primary format is used for both formatting and parsing. If parsing fails using the primary format, additional formats are used in order.
Format patterns may include:
YY- 2-digit yearYYYY- 4-digit yearM- 1- or 2-digit monthMM- 2-digit month (with leading zero)MMM- short month name (requires the i18n short month names to be set)MMMM- long month name (requires the i18n month names to be set)
- Parameters:
primaryFormat- the main format used for formatting and parsingadditionalParsingFormats- fallback formats used for parsing only- Returns:
- this instance for method chaining
-