Package org.opencms.acacia.shared
Class CmsWidgetUtil
- java.lang.Object
-
- org.opencms.acacia.shared.CmsWidgetUtil
-
public class CmsWidgetUtil extends java.lang.Object
Helper with methods commonly used in editor widgets.
-
-
Constructor Summary
Constructors Constructor Description CmsWidgetUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
generatePipeSeparatedConfigString(java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.lang.String,java.lang.String> configOptions, java.lang.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 java.lang.String
getStringOption(java.util.Map<java.lang.String,java.lang.String> configOptions, java.lang.String optionKey, java.lang.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.static java.util.Map<java.lang.String,java.lang.String>
parsePipeSeparatedConfigString(java.lang.String configString)
Parses a pipe-separated config string into a map, converting all keys to lowercase.
-
-
-
Constructor Detail
-
CmsWidgetUtil
public CmsWidgetUtil()
-
-
Method Detail
-
generatePipeSeparatedConfigString
public static java.lang.String generatePipeSeparatedConfigString(java.util.Map<java.lang.String,java.lang.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.- Parameters:
options
- the map with the config options.- Returns:
- the options as pipe separated string.
-
getBooleanOption
public static boolean getBooleanOption(java.util.Map<java.lang.String,java.lang.String> configOptions, java.lang.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".- 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 java.lang.String getStringOption(java.util.Map<java.lang.String,java.lang.String> configOptions, java.lang.String optionKey, java.lang.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
public static java.util.Map<java.lang.String,java.lang.String> parsePipeSeparatedConfigString(java.lang.String configString)
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
-
-