Class CmsWidgetUtil

java.lang.Object
org.opencms.acacia.shared.CmsWidgetUtil

public class CmsWidgetUtil extends Object
Helper with methods commonly used in editor widgets.
  • Constructor Details

  • 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

      public 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".
      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 of
      defaultValue - 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 Map<String,String> parsePipeSeparatedConfigString(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