Class JavascriptSettingProducer
- java.lang.Object
-
- org.silverpeas.core.web.util.viewgenerator.html.JavascriptSettingProducer
-
public class JavascriptSettingProducer extends Object
This tool permits the creates dynamically javascript settings that javascript plugins can used easily.
The generated javascript settings will be an instance of SilverpeasPluginSettings defined into silverpeas.js- Author:
- Yohann Chastagnier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JavascriptSettingProducer
add(String key, boolean value)
Adds given key / value.JavascriptSettingProducer
add(String key, Number value)
Adds given key / value.JavascriptSettingProducer
add(String key, String value)
Adds given key / value.protected <T> JavascriptSettingProducer
add(String key, Stream<T> values, boolean valuesAreStrings)
Adds given key / value which will be an array of values.JavascriptSettingProducer
add(org.silverpeas.kernel.bundle.SilverpeasBundle bundle, String... keys)
Adds given keys from the given bundle.String
produce()
The name of the javascript variable that represents the instance of the bundle.
Please ensure that it is unique.static JavascriptSettingProducer
settingVariableName(String jsSettingVariableName)
Initializes the setting producer by specifying the name of the javascript variable that represents the settings.
-
-
-
Method Detail
-
settingVariableName
public static JavascriptSettingProducer settingVariableName(String jsSettingVariableName)
Initializes the setting producer by specifying the name of the javascript variable that represents the settings.- Parameters:
jsSettingVariableName
- the javascript variable name of the bundle.- Returns:
- the initialized producer instance.
-
add
public JavascriptSettingProducer add(org.silverpeas.kernel.bundle.SilverpeasBundle bundle, String... keys)
Adds given keys from the given bundle.- Parameters:
bundle
- the bundle from which the messages must be extracted.keys
- the requested message keys.- Returns:
- itself.
-
add
protected <T> JavascriptSettingProducer add(String key, Stream<T> values, boolean valuesAreStrings)
Adds given key / value which will be an array of values.- Parameters:
key
- the key to add.values
- the values to set.valuesAreStrings
- indicates if the values must be registered as string.- Returns:
- itself.
-
add
public JavascriptSettingProducer add(String key, String value)
Adds given key / value.- Parameters:
key
- the key to add.value
- the string value associated to the key.- Returns:
- itself.
-
add
public JavascriptSettingProducer add(String key, boolean value)
Adds given key / value.- Parameters:
key
- the key to add.value
- the boolean value associated to the key.- Returns:
- itself.
-
add
public JavascriptSettingProducer add(String key, Number value)
Adds given key / value.- Parameters:
key
- the key to add.value
- the number value associated to the key.- Returns:
- itself.
-
produce
public String produce()
The name of the javascript variable that represents the instance of the bundle.
Please ensure that it is unique.- Returns:
- the javascript as string.
-
-