Package org.opencms.acacia.shared
Class CmsWidgetUtil
java.lang.Object
org.opencms.acacia.shared.CmsWidgetUtil
Helper with methods commonly used in editor widgets.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
generatePipeSeparatedConfigString
(Map<String, String> options) Generates a pipe separated option string from the map, e.g., for {key1 -> value1, key2 -> null, key3 -> value3} the string "key1=value1|key2|key3=value3" will be generated.static boolean
getBooleanOption
(Map<String, String> configOptions, String optionKey) Returns a flag, indicating if a boolean option is set, i.e., it is in the map and has value null or (case-insensitive) "true".static String
Returns the value of an option, or the default if the value is null or the key is not part of the map.parsePipeSeparatedConfigString
(String configString) Parses a pipe-separated config string into a map, converting all keys to lowercase.
-
Constructor Details
-
CmsWidgetUtil
public CmsWidgetUtil()
-
-
Method Details
-
generatePipeSeparatedConfigString
Generates a pipe separated option string from the map, e.g., for {key1 -> value1, key2 -> null, key3 -> value3} the string "key1=value1|key2|key3=value3" will be generated.- Parameters:
options
- the map with the config options.- Returns:
- the options as pipe separated string.
-
getBooleanOption
Returns a flag, indicating if a boolean option is set, i.e., it is in the map and has value null or (case-insensitive) "true".- Parameters:
configOptions
- the map with the config options.optionKey
- the boolean option to check.- Returns:
- a flag, indicating if a boolean option is set
-
getStringOption
public static String getStringOption(Map<String, String> configOptions, String optionKey, String defaultValue) Returns the value of an option, or the default if the value is null or the key is not part of the map.- Parameters:
configOptions
- the map with the config options.optionKey
- the option to get the value ofdefaultValue
- the default value to return if the option is not set.- Returns:
- the value of an option, or the default if the value is null or the key is not part of the map.
-
parsePipeSeparatedConfigString
Parses a pipe-separated config string into a map, converting all keys to lowercase. E.g., for "Key1=Value1|KEY2|key3=value3" the map {key1 -> Value1, key2 -> null, key3 -> value3} is returned- Parameters:
configString
- the config string to parse- Returns:
- the config options from the string as map
-