public class SelectOption extends Object implements Serializable, Copyable<SelectOption>
SelectField
.Modifier and Type | Class and Description |
---|---|
static interface |
SelectOption.SelectOptionEnum
An enum interface used as a method for defining a finite list of
SelectOption . |
Constructor and Description |
---|
SelectOption() |
SelectOption(SelectOption option) |
SelectOption(String value,
InternationalizedMessage label) |
SelectOption(String value,
String labelKey) |
Modifier and Type | Method and Description |
---|---|
SelectOption |
attribute(String key,
Object value) |
protected boolean |
canEqual(Object other) |
SelectOption |
color(String color) |
SelectOption |
copy() |
boolean |
equals(Object o) |
static List<SelectOption> |
fromAllLocales()
Returns the list of all installed locales converted to
SelectOption . |
static List<SelectOption> |
fromEnums(SelectOption.SelectOptionEnum[] optionEnums)
Factory method to generate a set of
SelectOption from the passed enumeration. |
static List<SelectOption> |
fromLocales(List<Locale> locales)
Returns the list of the specified locales converted to
SelectOption . |
static List<SelectOption> |
fromTimeZones()
Returns the list of all
ZoneId.getAvailableZoneIds() converted to SelectOption . |
static List<SelectOption> |
fromTimeZones(Set<String> zoneIds)
Returns the list of the specified time-zones converted to
SelectOption . |
Map<String,Object> |
getAttributes() |
String |
getColor()
Optional color to display alongside the label
|
InternationalizedMessage |
getLabel()
The user-friendly text that the user sees as the select option
|
String |
getValue()
The underlying form value that the user selects
|
int |
hashCode() |
SelectOption |
label(InternationalizedMessage label) |
SelectOption |
label(String labelKey) |
SelectOption |
value(String value) |
public SelectOption()
public SelectOption(String value, InternationalizedMessage label)
public SelectOption(SelectOption option)
public SelectOption copy()
copy
in interface Copyable<SelectOption>
public SelectOption value(String value)
public SelectOption label(InternationalizedMessage label)
public SelectOption label(String labelKey)
public SelectOption color(String color)
public SelectOption attribute(String key, Object value)
public static List<SelectOption> fromEnums(SelectOption.SelectOptionEnum[] optionEnums)
SelectOption
from the passed enumeration.optionEnums
- the enumspublic static List<SelectOption> fromAllLocales()
SelectOption
.SelectOption
Locale.getAvailableLocales()
,
fromLocales(List)
public static List<SelectOption> fromLocales(List<Locale> locales)
SelectOption
.
The value is retrieved from Locale.toLanguageTag()
. The label represents the message
property e.g. "locales.en-GB=English (GB)", where "en-GB" is retrieved from
Locale.toLanguageTag()
.locales
- the locales to convertSelectOption
public static List<SelectOption> fromTimeZones()
ZoneId.getAvailableZoneIds()
converted to SelectOption
.ZoneId.getAvailableZoneIds()
converted to SelectOption
public static List<SelectOption> fromTimeZones(Set<String> zoneIds)
SelectOption
.
The value is the time-zone ID. The label represents the message property e.g.
"time.zone.id.america_new_york=America/New_York".zoneIds
- the list of zone IDsSelectOption
public String getValue()
public InternationalizedMessage getLabel()
The user-friendly text that the user sees as the select option
This label can be a message key for I18n concerns
public String getColor()
protected boolean canEqual(Object other)
Copyright © 2021. All rights reserved.