org.apache.beehive.netui.tags.javascript
Class ScriptRequestState

Object
  extended by ScriptRequestState
All Implemented Interfaces:
Serializable

public class ScriptRequestState
extends Object
implements Serializable

Provides tag specific support for the HTML tags so they can create JavaScript. There is a bundle which contains all of the Java Script. This bundle will be cached inside this class. THe properties file does not get i18n support.

See Also:
Serialized Form

Field Summary
static String JAVASCRIPT_STATUS
          This is the name of a request scoped attribute that contains the status of what JavaScript processing has taken place.
 
Method Summary
static ScriptRequestState getScriptRequestState(HttpServletRequest request)
          This method will return the javaScriptUtils that is assocated with this request.
static String getString(String aKey, Object[] args)
          Returns the string specified by aKey from the errors.properties bundle.
 boolean isFeatureWritten(CoreScriptFeature feature)
           
 String mapLegacyTagId(IScriptReporter scriptReporter, String tagId, String value)
          This method will add a tagId and value to the ScriptRepoter TagId map.
 String mapTagId(IScriptReporter scriptReporter, String tagId, String realId, String realName)
           
 void writeFeature(IScriptReporter scriptReporter, AbstractRenderAppender results, CoreScriptFeature feature, boolean singleInstance, boolean inline, Object[] args)
           
 void writeFeature(IScriptReporter scriptReporter, AbstractRenderAppender results, String featureKey, Object[] args)
           
 String writeNetuiNameFunctions(IScriptReporter scriptReporter, boolean writeLegacy, boolean writeId, boolean writeName)
           
static void writeScriptBlock(ServletRequest req, AbstractRenderAppender results, String script)
          This is a static method that will write a consistent look/feel to the tags and comment markup that appears around the JavaScript.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAVASCRIPT_STATUS

public static final String JAVASCRIPT_STATUS
This is the name of a request scoped attribute that contains the status of what JavaScript processing has taken place.

See Also:
Constant Field Values
Method Detail

getScriptRequestState

public static ScriptRequestState getScriptRequestState(HttpServletRequest request)
This method will return the javaScriptUtils that is assocated with this request. If this doesn't exist, it will be created before it is returned.

Parameters:
request - the HttpServletRequest associated with this request
Returns:
a ScriptRequestState assocated with the request

getString

public static String getString(String aKey,
                               Object[] args)
Returns the string specified by aKey from the errors.properties bundle.

Parameters:
aKey - The key for the message pattern in the bundle.
args - The args to use in the message format.

isFeatureWritten

public boolean isFeatureWritten(CoreScriptFeature feature)

writeFeature

public void writeFeature(IScriptReporter scriptReporter,
                         AbstractRenderAppender results,
                         String featureKey,
                         Object[] args)
Parameters:
scriptReporter -
results -
featureKey -
args -

writeFeature

public void writeFeature(IScriptReporter scriptReporter,
                         AbstractRenderAppender results,
                         CoreScriptFeature feature,
                         boolean singleInstance,
                         boolean inline,
                         Object[] args)
Parameters:
scriptReporter -
results -
feature -
singleInstance -
inline -
args -

mapTagId

public String mapTagId(IScriptReporter scriptReporter,
                       String tagId,
                       String realId,
                       String realName)
Parameters:
scriptReporter -
tagId -
realId -
realName -
Returns:
String

mapLegacyTagId

public String mapLegacyTagId(IScriptReporter scriptReporter,
                             String tagId,
                             String value)
This method will add a tagId and value to the ScriptRepoter TagId map. The a ScriptContainer tag will create a JavaScript table that allows the container, such as a portal, to rewrite the id so it's unique. The real name may be looked up based upon the tagId. If the no ScriptReporter is found, a script string will be returned to the caller so they can output the script block.

Parameters:
tagId -
value -
Returns:
String

writeNetuiNameFunctions

public String writeNetuiNameFunctions(IScriptReporter scriptReporter,
                                      boolean writeLegacy,
                                      boolean writeId,
                                      boolean writeName)
Parameters:
scriptReporter -
writeLegacy -
writeId -
writeName -
Returns:
String

writeScriptBlock

public static void writeScriptBlock(ServletRequest req,
                                    AbstractRenderAppender results,
                                    String script)
This is a static method that will write a consistent look/feel to the tags and comment markup that appears around the JavaScript.

Parameters:
results - the InternalStringBuilder that will have the <script> tag written into
script - the JavaScript block