com.stratelia.webactiv.util.viewGenerator.html
Class JavascriptBundleProducer

java.lang.Object
  extended by com.stratelia.webactiv.util.viewGenerator.html.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 Summary
 JavascriptBundleProducer add(ResourceLocator bundle, String... keys)
          Adds given keys from the given bundle.
static JavascriptBundleProducer bundleVariableName(String jsBundleVariableName)
          Initializes the bundle producer by specifying the name of the javascript variable that represents the bundle.
static String fromCoreTemplate(String pathSuffix, String templateName, String language)
          Gets the javascript bundle content from the string template repository and according to given parameters.
 String produce()
          The name of the javascript variable that represents the instance of the bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromCoreTemplate

public static String fromCoreTemplate(String pathSuffix,
                                      String templateName,
                                      String language)
Gets the javascript bundle content from the string template repository and according to given parameters.

Parameters:
pathSuffix - the path suffix behind the root path "core" of string template repository.
templateName - the template name (so the filename without the language ("_fr" for example) and without extension.
language - the requested language content.
Returns:
the initialized producer instance.

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(ResourceLocator 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.

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.


Copyright © 2016 Silverpeas. All Rights Reserved.