Class JavascriptBundleProducer


  • public class JavascriptBundleProducer
    extends Object
    This tool permits the creates dynamically javascript bundles that javascript plugins can used easily.
    The generated javascript bundle will be an instance of SilverpeasPluginBundle defined into silverpeas.js
    Author:
    Yohann Chastagnier
    • Method Detail

      • bundleVariableName

        public static JavascriptBundleProducer bundleVariableName​(String jsBundleVariableName)
        Initializes the bundle producer by specifying the name of the javascript variable that represents the bundle.
        Parameters:
        jsBundleVariableName - the javascript variable name of the bundle.
        Returns:
        the initialized producer instance.
      • add

        public JavascriptBundleProducer add​(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

        public JavascriptBundleProducer add​(String key,
                                            String value)
        Adds given key / value.
        Parameters:
        key - the key to add.
        value - the boolean 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.