Package org.openbravo.client.kernel
Class StaticResourceComponent
- java.lang.Object
-
- org.openbravo.client.kernel.BaseComponent
-
- org.openbravo.client.kernel.StaticResourceComponent
-
- All Implemented Interfaces:
Component
public class StaticResourceComponent extends BaseComponent
The component in charge of generating the static Javascript resources.- Author:
- mtaal, iperdomo
-
-
Field Summary
Fields Modifier and Type Field Description static String
GEN_TARGET_LOCATION
-
Fields inherited from class org.openbravo.client.kernel.BaseComponent
adcs
-
-
Constructor Summary
Constructors Constructor Description StaticResourceComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
generate()
Generates the content of the component which is sent to the client for execution/rendering.protected String
generateResult(String staticResourceFileName)
Returns the result of the component generation.Object
getData()
String
getETag()
An ETag is a hash-like string which is used to determine if content has changed since the last request for the content.String
getId()
String
getStaticResourceFileName()
-
Methods inherited from class org.openbravo.client.kernel.BaseComponent
bypassAuthentication, createComponent, getADCS, getApplicationName, getContentType, getContextUrl, getDependencies, getLastModified, getModule, getModulePackageName, getParameter, getParameterNames, getParameters, getSafeValue, hasParameter, isClassicMode, isInDevelopment, isInDevelopment, isJavaScriptComponent, nullifyModuleCache, setContextUrl, setDependencies, setId, setParameters, stripHost
-
-
-
-
Field Detail
-
GEN_TARGET_LOCATION
public static final String GEN_TARGET_LOCATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getData
public Object getData()
- Specified by:
getData
in classBaseComponent
- Returns:
- returns this instance
- See Also:
BaseComponent.getData()
-
getETag
public String getETag()
Description copied from interface:Component
An ETag is a hash-like string which is used to determine if content has changed since the last request for the content. See this link for more information. Note for language specific components the etag has to encode the language (id) also! See (OBContext.getLanguage()
) to get the current language.- Specified by:
getETag
in interfaceComponent
- Overrides:
getETag
in classBaseComponent
- Returns:
- a unique hash for the content generated
-
generate
public String generate()
Description copied from interface:Component
Generates the content of the component which is sent to the client for execution/rendering.- Specified by:
generate
in interfaceComponent
- Specified by:
generate
in classBaseComponent
- Returns:
- the generated javascript which is send back to the client
-
generateResult
protected String generateResult(String staticResourceFileName)
Returns the result of the component generation. This method should be overridden by the classes extending this one in order to return its own result.- Parameters:
staticResourceFileName
- The name of the static resource file already generated by the component.- Returns:
- a String containing the result of the component generation. By default, it returns a
javascript expression that writes an
<script>
that imports the generated static resource file.
-
getId
public String getId()
- Specified by:
getId
in interfaceComponent
- Overrides:
getId
in classBaseComponent
- Returns:
- the id of the component, see the id description in the root of this class.
-
getStaticResourceFileName
public String getStaticResourceFileName()
- Returns:
- all static resources needed by the application and placed in the top of the application page, in order based on module dependencies and using an unique version string to force client side reload or caching.
-
-