|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.opencms.widgets.CmsSelectWidgetOption
public class CmsSelectWidgetOption
An option of a select type widget.
If options are passed from XML content schema definitions as widget configuration options, the following syntax is used for defining the option values:
value='{text}' default='{true|false}' option='{text}' help='{text}|{more option definitions}
For example:
value='value1' default='true' option='option1' help='help1'|value='value2' option='option2' help='help2'
The elements default, option and help are all optional, only a
value must be present in the input.
There should be only one default set to true
in the input, if more than one is detected, only the first default found is actually used.
If no option is given, the value of option defaults to the value of the given value.
If no help is given, the default is null.
Shortcut syntax options:
If you don't specify the value key, the value is assumed to start at the first position of an
option definition. In this case the value must not be surrounded by the ' chars.
Example: value='some value' default='true' can also be written as some value default='true'.
Only if you use the short value definition as described above, a default value can be marked with a *
at the end of the value definition.
Example: value='some value' default='true' can also be written as some value*.
Only if you use the short value definition as described above, you can also append the option
to the value using a :. In this case no ' must surround the option.
Please keep in mind that in this case the value
itself can not longer contain a : char, since it would then be interpreted as a delimiter.
Example: value='some value' option='some option' can also be written as some value:some option.
Any combinations of the above described shortcuts are allowed in the configuration option String. Here are some more examples of valid configuration option Strings:
1*|2|3|4|5|6|7
1 default='true'|2|3|4|5|6|7
value='1' default='true'|value='2'|value='3'
value='1'|2*|value='3'
1*:option text|2|3|4
1* option='option text' help='some'|2|3|4
Please note: If an entry in the configuration String is malformed, this error is silently ignored (but written
to the log channel of this class at INFOlevel.
| Constructor Summary | |
|---|---|
CmsSelectWidgetOption(String value)
Creates a new select option for the given value. |
|
CmsSelectWidgetOption(String value,
boolean isDefault)
Creates a new select option form the given values. |
|
CmsSelectWidgetOption(String value,
boolean isDefault,
String optionText)
Creates a new select option form the given values. |
|
CmsSelectWidgetOption(String value,
boolean isDefault,
String optionText,
String helpText)
Creates a new select option form the given values. |
|
| Method Summary | |
|---|---|
static String |
createConfigurationString(List<CmsSelectWidgetOption> options)
Returns a select widget configuration String created from the given list of select options. |
boolean |
equals(Object obj)
|
static CmsSelectWidgetOption |
getDefaultOption(List<CmsSelectWidgetOption> options)
Returns the default option from the given list of select options, or null in case there is no default option in the given list. |
static List<CmsSelectWidgetOption> |
getDefaultOptions(List<CmsSelectWidgetOption> options)
Returns a list of default options from the given list of select options. |
String |
getHelp()
Returns the (optional) help text of this select option. |
String |
getOption()
Returns the option text of this select option. |
String |
getValue()
Returns the value of this select option. |
int |
hashCode()
|
boolean |
isDefault()
Returns true if this is the default value of the selection. |
static List<CmsSelectWidgetOption> |
parseOptions(String input)
Parses a widget configuration String for select option values. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CmsSelectWidgetOption(String value)
value - the value of this select option
public CmsSelectWidgetOption(String value,
boolean isDefault)
value - the value of this select optionisDefault - indicates if this is the default value of the selection (default is false)
public CmsSelectWidgetOption(String value,
boolean isDefault,
String optionText)
value - the value of this select optionisDefault - indicates if this is the default value of the selection (default is false)optionText - the (optional) display text of this select option
public CmsSelectWidgetOption(String value,
boolean isDefault,
String optionText,
String helpText)
value - the value of this select optionisDefault - indicates if this is the default value of the selection (default is false)optionText - the (optional) display text of this select optionhelpText - the (optional) help text of this select option| Method Detail |
|---|
public static String createConfigurationString(List<CmsSelectWidgetOption> options)
If an element found in the given list is not of type
, it is ignored.CmsSelectWidgetOption
options - the list of select options to create the configuration String for
public static CmsSelectWidgetOption getDefaultOption(List<CmsSelectWidgetOption> options)
null in case there is no default option in the given list.
If an element found in the given list is not of type
, this is ignored.CmsSelectWidgetOption
options - the list of select options to get the default from
null in case there is no default optionpublic static List<CmsSelectWidgetOption> getDefaultOptions(List<CmsSelectWidgetOption> options)
If an element found in the given list is not of type
, this is ignored.CmsSelectWidgetOption
options - the list of select options to get the default from
CmsSelectWidgetOption objectspublic static List<CmsSelectWidgetOption> parseOptions(String input)
If the input is null or empty, a
is returned.Collections.EMPTY_LIST
Please note: No exception is thrown in case the input is malformed, all malformed entries are silently ignored.
input - the widget input string to parse
CmsSelectWidgetOption elementspublic boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public String getHelp()
public String getOption()
If this has not been set, the result of is returned,
there will always be a result other than getValue()null returned.
public String getValue()
public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean isDefault()
true if this is the default value of the selection.
true if this is the default value of the selectionpublic String toString()
toString in class ObjectObject.toString()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||