planetj.html
Class JavaScriptManager

java.lang.Object
  extended byplanetj.html.JavaScriptManager

public class JavaScriptManager
extends java.lang.Object


Field Summary
static java.lang.String DEFAULT_JAVASCRIPT_SOURCE_PATH
           
static java.lang.String JAVASCRIPT_DATE_PICKER_SOURCE_FILE_DECLARED
           
static java.lang.String JAVASCRIPT_EDITABLE_SELECT_SOURCE_FILE_DECLARED
           
static java.lang.String JAVASCRIPT_OPERATION_INCLUDED
           
static java.lang.String JAVASCRIPT_REQUEST_VALIDATION_ENABLED
           
static java.lang.String JAVASCRIPT_VALIDATION_SOURCE_FILE_DECLARED
           
static java.lang.String JS_FLAG_INCLUDE_DATAENGINE_OBJECTS
           
static java.lang.String ON_BLUR
           
static java.lang.String ON_CHANGE
           
static java.lang.String ON_CLICK
           
static java.lang.String ON_FOCUS
           
static java.lang.String ON_SELECT
           
static java.lang.String RETURN_MAGIC_REQUEST
           
 
Method Summary
static java.lang.StringBuffer ensureEditableSelectSourceFileIsDeclared(java.lang.StringBuffer sb, HttpServletRequest req)
          We only need to declare the JavaScript editableSelect source file once.
static java.lang.StringBuffer ensureJavaScriptDatePickerSourceFileIsDeclared(java.lang.StringBuffer sb, HttpServletRequest req)
          We only need to declare the JavaScript DatePicker source file once.
static java.lang.StringBuffer ensureJavaScriptOperationIsIncluded(java.lang.StringBuffer html, HttpServletRequest request)
          We only need to include JavaScript for Operations once.
static java.lang.StringBuffer ensureJavaScriptValidationSourceFileIsDeclared(java.lang.StringBuffer sb, HttpServletRequest req)
          We only need to declare the JavaScript Validation source file once.
static java.lang.StringBuffer generateDatePicker(java.lang.StringBuffer sb, java.lang.String id, Field field, HttpServletRequest req)
          This will generate the DatePicker.
static java.lang.StringBuffer generateDatePickerSourceReferences(java.lang.StringBuffer sb)
          This will generate source references for DatePicker JavaScript files.
static java.lang.StringBuffer generateEditableSelectSourceReferences(java.lang.StringBuffer sb)
          This will generate source references for EditableSelect JavaScript files.
static java.lang.StringBuffer generateOperationJavaScript(java.lang.StringBuffer html)
          This will generate JavaScript used for Operations.
static java.lang.StringBuffer generateValidationFieldJavaScript(java.lang.StringBuffer sb, Field pField, boolean fieldHasPossibleValues, HttpServletRequest req, HttpServletResponse res)
          This will generate the java script for a field.
static java.lang.StringBuffer generateValidationFieldJavaScript(java.lang.StringBuffer sb, Field pField, HttpServletRequest req, HttpServletResponse res)
           
static java.lang.StringBuffer generateValidationSourceReferences(java.lang.StringBuffer sb)
          This will generate source references for Validation JavaScript files.
static java.lang.String getJavaScriptSourcePath()
          This is the path to DataEngine JavaScript files Creation date: (5/17/2002 12:37:10 PM)
static boolean isIncludeDataEngineJavaScriptObjects(HttpServletRequest request)
          Check to see if DataEngine JavaScript objects are to be included in generation of the page.
static boolean isJavaScriptGlobalValidationEnabled()
          Returns whether the global value for JS Validation.
static boolean isValidatableDateFormat(java.lang.String pDateFormat)
          Returns true if our date validation supports pDateFormat Creation date: (5/17/2002 6:07:32 PM)
static void setIncludeDataEngineJavaScriptObjects(boolean includeJSObjects, HttpServletRequest request)
          Set whether or not DataEngine JavaScript objects are to be included in generation of the page.
static void setJavaScriptGlobalValidationEnabled(boolean newJavaScriptGlobalValidation)
          Sets the global value for JS Validation.
static void setJavaScriptSourcePath(java.lang.String newJavaScriptSourcePath)
          This is the path to DataEngine JavaScript files Creation date: (5/17/2002 12:37:10 PM)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JS_FLAG_INCLUDE_DATAENGINE_OBJECTS

public static final java.lang.String JS_FLAG_INCLUDE_DATAENGINE_OBJECTS
See Also:
Constant Field Values

JAVASCRIPT_OPERATION_INCLUDED

public static final java.lang.String JAVASCRIPT_OPERATION_INCLUDED
See Also:
Constant Field Values

JAVASCRIPT_VALIDATION_SOURCE_FILE_DECLARED

public static final java.lang.String JAVASCRIPT_VALIDATION_SOURCE_FILE_DECLARED
See Also:
Constant Field Values

JAVASCRIPT_DATE_PICKER_SOURCE_FILE_DECLARED

public static final java.lang.String JAVASCRIPT_DATE_PICKER_SOURCE_FILE_DECLARED
See Also:
Constant Field Values

JAVASCRIPT_EDITABLE_SELECT_SOURCE_FILE_DECLARED

public static final java.lang.String JAVASCRIPT_EDITABLE_SELECT_SOURCE_FILE_DECLARED
See Also:
Constant Field Values

JAVASCRIPT_REQUEST_VALIDATION_ENABLED

public static final java.lang.String JAVASCRIPT_REQUEST_VALIDATION_ENABLED
See Also:
Constant Field Values

DEFAULT_JAVASCRIPT_SOURCE_PATH

public static final java.lang.String DEFAULT_JAVASCRIPT_SOURCE_PATH

ON_CHANGE

public static final java.lang.String ON_CHANGE
See Also:
Constant Field Values

ON_BLUR

public static final java.lang.String ON_BLUR
See Also:
Constant Field Values

ON_FOCUS

public static final java.lang.String ON_FOCUS
See Also:
Constant Field Values

ON_SELECT

public static final java.lang.String ON_SELECT
See Also:
Constant Field Values

ON_CLICK

public static final java.lang.String ON_CLICK
See Also:
Constant Field Values

RETURN_MAGIC_REQUEST

public static final java.lang.String RETURN_MAGIC_REQUEST
See Also:
Constant Field Values
Method Detail

ensureEditableSelectSourceFileIsDeclared

public static java.lang.StringBuffer ensureEditableSelectSourceFileIsDeclared(java.lang.StringBuffer sb,
                                                                              HttpServletRequest req)
We only need to declare the JavaScript editableSelect source file once. This method will check to see if its already been declared.

If for some reason you delclare the editableSelect.js file in your JSP, you could call req.setAttribute(JavaScriptManager.EDITABLE_SELECT_SOURCE_FILE_DECLARED, new Boolean(true)) and this would prevent the file from being declared twice. Creation date: (5/17/2002 8:42:14 PM)

Returns:
StringBuffer that was passed in.

ensureJavaScriptDatePickerSourceFileIsDeclared

public static java.lang.StringBuffer ensureJavaScriptDatePickerSourceFileIsDeclared(java.lang.StringBuffer sb,
                                                                                    HttpServletRequest req)
We only need to declare the JavaScript DatePicker source file once. This method will check to see if its already been declared.

If for some reason you delclare the datepicker.js file in your JSP, you could call req.setAttribute(JavaScriptManager.JAVASCRIPT_DATE_PICKER_SOURCE_FILE_DECLARED, new Boolean(true)) and this would prevent the file from being declared twice. Creation date: (5/17/2002 8:42:14 PM)

Returns:
StringBuffer that was passed in.

ensureJavaScriptOperationIsIncluded

public static java.lang.StringBuffer ensureJavaScriptOperationIsIncluded(java.lang.StringBuffer html,
                                                                         HttpServletRequest request)
We only need to include JavaScript for Operations once. This method will check to see if its already been included.


ensureJavaScriptValidationSourceFileIsDeclared

public static java.lang.StringBuffer ensureJavaScriptValidationSourceFileIsDeclared(java.lang.StringBuffer sb,
                                                                                    HttpServletRequest req)
We only need to declare the JavaScript Validation source file once. This method will check to see if its already been declared.

If for some reason you delclare the fieldValidation.js file in your JSP, you could call req.setAttribute(JavaScriptManager.JAVASCRIPT_VALIDATION_SOURCE_FILE_DECLARED, new Boolean(true)) and this would prevent the file from being declared twice. Creation date: (5/17/2002 11:01:55 AM)

Returns:
StringBuffer that was passed in.

generateDatePicker

public static java.lang.StringBuffer generateDatePicker(java.lang.StringBuffer sb,
                                                        java.lang.String id,
                                                        Field field,
                                                        HttpServletRequest req)
                                                 throws CMException
This will generate the DatePicker. Creation date: (5/17/2002 6:03:30 PM)

Parameters:
sb - java.lang.StringBuffer
Returns:
java.lang.StringBuffer
Throws:
CMException

generateDatePickerSourceReferences

public static java.lang.StringBuffer generateDatePickerSourceReferences(java.lang.StringBuffer sb)
This will generate source references for DatePicker JavaScript files. Creation date: (5/17/2002 6:03:30 PM)

Parameters:
sb - java.lang.StringBuffer
Returns:
java.lang.StringBuffer

generateEditableSelectSourceReferences

public static java.lang.StringBuffer generateEditableSelectSourceReferences(java.lang.StringBuffer sb)
This will generate source references for EditableSelect JavaScript files.

Parameters:
sb - java.lang.StringBuffer
Returns:
java.lang.StringBuffer

generateOperationJavaScript

public static java.lang.StringBuffer generateOperationJavaScript(java.lang.StringBuffer html)
This will generate JavaScript used for Operations.


generateValidationFieldJavaScript

public static java.lang.StringBuffer generateValidationFieldJavaScript(java.lang.StringBuffer sb,
                                                                       Field pField,
                                                                       HttpServletRequest req,
                                                                       HttpServletResponse res)
                                                                throws CMException
Throws:
CMException

generateValidationFieldJavaScript

public static java.lang.StringBuffer generateValidationFieldJavaScript(java.lang.StringBuffer sb,
                                                                       Field pField,
                                                                       boolean fieldHasPossibleValues,
                                                                       HttpServletRequest req,
                                                                       HttpServletResponse res)
                                                                throws CMException
This will generate the java script for a field. Creation date: (5/17/2002 6:03:30 PM)

Parameters:
sb - java.lang.StringBuffer
pField - Field
Returns:
java.lang.StringBuffer
Throws:
CMException

generateValidationSourceReferences

public static java.lang.StringBuffer generateValidationSourceReferences(java.lang.StringBuffer sb)
This will generate source references for Validation JavaScript files. Creation date: (5/17/2002 6:03:30 PM)

Parameters:
sb - java.lang.StringBuffer
Returns:
java.lang.StringBuffer

getJavaScriptSourcePath

public static java.lang.String getJavaScriptSourcePath()
This is the path to DataEngine JavaScript files Creation date: (5/17/2002 12:37:10 PM)

Returns:
java.lang.String

isIncludeDataEngineJavaScriptObjects

public static boolean isIncludeDataEngineJavaScriptObjects(HttpServletRequest request)
Check to see if DataEngine JavaScript objects are to be included in generation of the page.

Returns:

setIncludeDataEngineJavaScriptObjects

public static void setIncludeDataEngineJavaScriptObjects(boolean includeJSObjects,
                                                         HttpServletRequest request)
Set whether or not DataEngine JavaScript objects are to be included in generation of the page.


isJavaScriptGlobalValidationEnabled

public static boolean isJavaScriptGlobalValidationEnabled()
Returns whether the global value for JS Validation.

JavaScript is validation on the client. We have a JavaScript file currently out in ../dataengine/js/fieldValidation.js In this file we are validating each generic field type. Refer to that file for details.

There are 3 levels of witch a user can set the JavaScript validation on or off.

1) A user can statically set a boolean on JavaScriptManager.setJavaScriptGlobalValidation(or) which will set the default for the entire JVM. This defaults to true, meaning we are enabling JavaScript validation by default. However, this global default can be overriden by ->

2) A user can set a value on the HttpServletRequest which will override the GlobalValidation. This would normally be done from a JSP or Servlet where you only want certain JSP's to use JavaScript validation. An example would be if you need to turn off JS validation for most of you Applications/JSPs, then you would set the global variable defined in 1) to false. Then if you had a few JSPs that could use JS validation, you would make a call similiar to request.setAttribute(JavaScriptManager.JAVASCRIPT_REQUEST_VALIDATION_ENABLED, new Boolean(or)); However, sometimes you need to be able to turn JS validation on and off on a field by field basis so ->

3) A user can set a value on an HTMLField which will override the GlobalValidation and the RequestValidation. You would use this in a case where you had some fields on a single JSP that needed JS validation and some that didn't. To set JS validation on a field you would call the instanceMethod HTMLField.setJavaScriptFieldValidation(or) You can ask an HTLMField if its JavaScript validation is enabled and it will consider 1), 2), and 3), above and return the appropriate boolean. You do this by calling isJavaScriptValidationEnabled(HttpServletRequest)

Creation date: (5/16/2002 1:56:31 PM)

Returns:
boolean

isValidatableDateFormat

public static boolean isValidatableDateFormat(java.lang.String pDateFormat)
Returns true if our date validation supports pDateFormat Creation date: (5/17/2002 6:07:32 PM)

Parameters:
pDateFormat - java.lang.String
Returns:
boolean

setJavaScriptGlobalValidationEnabled

public static void setJavaScriptGlobalValidationEnabled(boolean newJavaScriptGlobalValidation)
Sets the global value for JS Validation.

JavaScript is validation on the client. We have a JavaScript file currently out in ../dataengine/js/fieldValidation.js In this file we are validating each generic field type. Refer to that file for details.

There are 3 levels of witch a user can set the JavaScript validation on or off.

1) A user can statically set a boolean on JavaScriptManager.setJavaScriptGlobalValidation(or) which will set the default for the entire JVM. This defaults to true, meaning we are enabling JavaScript validation by default. However, this global default can be overriden by ->

2) A user can set a value on the HttpServletRequest which will override the GlobalValidation. This would normally be done from a JSP or Servlet where you only want certain JSP's to use JavaScript validation. An example would be if you need to turn off JS validation for most of you Applications/JSPs, then you would set the global variable defined in 1) to false. Then if you had a few JSPs that could use JS validation, you would make a call similiar to request.setAttribute(JavaScriptManager.JAVASCRIPT_REQUEST_VALIDATION_ENABLED, new Boolean(or)); However, sometimes you need to be able to turn JS validation on and off on a field by field basis so ->

3) A user can set a value on an HTMLField which will override the GlobalValidation and the RequestValidation. You would use this in a case where you had some fields on a single JSP that needed JS validation and some that didn't. To set JS validation on a field you would call the instanceMethod HTMLField.setJavaScriptFieldValidation(or) You can ask an HTLMField if its JavaScript validation is enabled and it will consider 1), 2), and 3), above and return the appropriate boolean. You do this by calling isJavaScriptValidationEnabled(HttpServletRequest)

Creation date: (5/16/2002 1:56:31 PM)

Parameters:
newJavaScriptGlobalValidation - boolean

setJavaScriptSourcePath

public static void setJavaScriptSourcePath(java.lang.String newJavaScriptSourcePath)
This is the path to DataEngine JavaScript files Creation date: (5/17/2002 12:37:10 PM)

Parameters:
newJavaScriptSourcePath - java.lang.String