com.ibm.etools.pd.widget.viewer
Class ECMAScriptGenerator

java.lang.Object
  |
  +--com.ibm.etools.pd.widget.viewer.ECMAScriptGenerator

public class ECMAScriptGenerator
extends java.lang.Object

ECMAScriptGenerator generates the (ECMA 1.0-compliant) JavaScript functions needed to support browser-based user interaction with GraphicDocumentGenerators that generate Scalable Vector Graphics (SVG).


Constructor Summary
ECMAScriptGenerator()
           
 
Method Summary
 java.lang.String generateClientSnifferVariables()
          Generates browser information variables for use in browser specific code.
 java.lang.String generateCookieFunctions()
          Generates an event handler for reading and writing cookies.
 java.lang.String generateGetCurrentValuesFunction()
          Generates a function which returns the current preference values
 java.lang.String generateGetPalettesFunction()
          Generates a function which returns the set of available palettes.
 java.lang.String generateGetPreferencesFunction(java.lang.String type)
          Generates an event handler which retrieves user preference styles from cookie
 java.lang.String generateGlobalVariables()
          Generates global variables for use in HTML functions.
 java.lang.String generateInitFunction(java.util.Hashtable palettes, java.lang.String currentPalette, java.lang.String currentFont, java.lang.String type)
          Generates an event handler which performs initialization functions.
 java.lang.String generateInspectFunction()
          Generates an event handler which allows the object attributes to be returned as a string for debugging purposes, for example, in an "alert".
 java.lang.String generateOpenPreferencePageFunction(java.lang.String url, java.lang.String src, java.lang.String name, java.lang.String width, java.lang.String height)
          Generates an event handler which opens a new browser window on the content "url" + "src" with the specified "name", "width" and "height".
 java.lang.String generatePieChartHelperFunctions()
          Generates helper functions used for pie charts.
 java.lang.String generateResetStylesFunction()
          Generates an event handler which resets the graphic user preference styles to their former values.
 java.lang.String generateStorePreferencesFunction(java.lang.String type)
          Generates an event handler which stores user preference styles in cookie
 java.lang.String generateToggleVisibilityFunction(int sets, java.lang.String type)
          Generates an event handler which toggles the visibility attribute of the group/element with the specified "id".
 java.lang.String generateUpdateLegendStylesFunction(int sets, java.lang.String type)
          Generates an event handler which updates the graphic legend with user preference styles.
 java.lang.String generateUpdateStylesFunction(int sets, java.lang.String type, boolean hasLegend)
          Generates an event handler which updates the graphic with user preference styles.
 java.lang.String generateUseNetscapePreferencePage(java.lang.String url, java.lang.String src, java.lang.String name, java.lang.String pageWidth, java.lang.String pageHeight)
          Generates a function which launches the NS 4.7 preference page.
 java.lang.String generateXYChartHelperFunctions()
          Generates helper functions used for XY-style charts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ECMAScriptGenerator

public ECMAScriptGenerator()
Method Detail

generateClientSnifferVariables

public java.lang.String generateClientSnifferVariables()
Generates browser information variables for use in browser specific code.


generateGlobalVariables

public java.lang.String generateGlobalVariables()
Generates global variables for use in HTML functions.


generateInitFunction

public java.lang.String generateInitFunction(java.util.Hashtable palettes,
                                             java.lang.String currentPalette,
                                             java.lang.String currentFont,
                                             java.lang.String type)
Generates an event handler which performs initialization functions. Typically assigned as the "onload" event handler.

Parameters:
palettes - the available data set color palettes
type - the graphic type

generateOpenPreferencePageFunction

public java.lang.String generateOpenPreferencePageFunction(java.lang.String url,
                                                           java.lang.String src,
                                                           java.lang.String name,
                                                           java.lang.String width,
                                                           java.lang.String height)
Generates an event handler which opens a new browser window on the content "url" + "src" with the specified "name", "width" and "height".

Parameters:
url - the URL to the folder which contains "src"
src - the content file
name - the name of the new window
width - the width of the new window
height - the height of the new window

generateUseNetscapePreferencePage

public java.lang.String generateUseNetscapePreferencePage(java.lang.String url,
                                                          java.lang.String src,
                                                          java.lang.String name,
                                                          java.lang.String pageWidth,
                                                          java.lang.String pageHeight)
Generates a function which launches the NS 4.7 preference page. Extension classes should not use this for custom preference pages.

Parameters:
url - the URL to the folder which contains "src"
src - the content file
name - the name of the new window

generateGetPalettesFunction

public java.lang.String generateGetPalettesFunction()
Generates a function which returns the set of available palettes.


generateGetCurrentValuesFunction

public java.lang.String generateGetCurrentValuesFunction()
Generates a function which returns the current preference values


generateToggleVisibilityFunction

public java.lang.String generateToggleVisibilityFunction(int sets,
                                                         java.lang.String type)
Generates an event handler which toggles the visibility attribute of the group/element with the specified "id".

Parameters:
type - the graphic type

generateXYChartHelperFunctions

public java.lang.String generateXYChartHelperFunctions()
Generates helper functions used for XY-style charts.


generatePieChartHelperFunctions

public java.lang.String generatePieChartHelperFunctions()
Generates helper functions used for pie charts.


generateResetStylesFunction

public java.lang.String generateResetStylesFunction()
Generates an event handler which resets the graphic user preference styles to their former values.


generateUpdateLegendStylesFunction

public java.lang.String generateUpdateLegendStylesFunction(int sets,
                                                           java.lang.String type)
Generates an event handler which updates the graphic legend with user preference styles.

Parameters:
sets - the number of data sets displayed by the graphic legend
type - the graphic type

generateUpdateStylesFunction

public java.lang.String generateUpdateStylesFunction(int sets,
                                                     java.lang.String type,
                                                     boolean hasLegend)
Generates an event handler which updates the graphic with user preference styles.

Parameters:
sets - the number of data sets displayed by the graphic
type - the graphic type

generateGetPreferencesFunction

public java.lang.String generateGetPreferencesFunction(java.lang.String type)
Generates an event handler which retrieves user preference styles from cookie

Parameters:
type - the graphic type

generateStorePreferencesFunction

public java.lang.String generateStorePreferencesFunction(java.lang.String type)
Generates an event handler which stores user preference styles in cookie

Parameters:
type - the graphic type

generateInspectFunction

public java.lang.String generateInspectFunction()
Generates an event handler which allows the object attributes to be returned as a string for debugging purposes, for example, in an "alert".


generateCookieFunctions

public java.lang.String generateCookieFunctions()
Generates an event handler for reading and writing cookies.