EchoPoint
1.0

echopoint
Class JavaScriptInclude

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.Container
          extended byechopoint.EchoPointComponent
              extended byechopoint.JavaScriptInclude
All Implemented Interfaces:
MouseCursorable, ReflectionSetter, java.io.Serializable, ToolTipPopUpSupport, nextapp.echo.ToolTipSupport

public class JavaScriptInclude
extends EchoPointComponent

The JavaScriptInclude component allows custom JavaScript to be included inline or in the onload/unload event of the page or in the head section of the page.

This component is useful for "running" any abitary client side scipt. For example you could show an alert dialog "alert('What the story?')" or even open a disconnected client window "window.open('http://echopoint.sf.net')"

If this component is not enabled or visible, then no JavaScript will be output.

Dont forget the quote the script if appropriate, using echopoint.util.QuoterKit

Author:
Brad Baker
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class echopoint.EchoPointComponent
EchoPointComponent.NestedStyleInfo
 
Field Summary
static int INCLUDE_INHEAD
          This includes JavaScript in the HEAD section of the page
static int INCLUDE_INLINE
          This includes JavaScript inline to where the component is placed
static int INCLUDE_ONLOAD
          This includes JavaScript in the onload event of the page
static int INCLUDE_ONUNLOAD
          This includes JavaScript in the unload event of the page
static java.lang.String INCLUDE_TYPE_CHANGED_PROPERTY
           
static java.lang.String SCRIPT_CHANGED_PROPERTY
          Property Names
 
Fields inherited from class echopoint.EchoPointComponent
STYLE_TOOL_TIP_TEXT, TOOL_TIP_TEXT_CHANGED_PROPERTY, toolTipPopUp
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Constructor Summary
JavaScriptInclude()
          Creates a JavaScriptInclude, with no script and an inline include type.
JavaScriptInclude(java.lang.String script)
          Creates a JavaScriptInclude, with no script and an INCLUDE_INLINE include type.
JavaScriptInclude(java.lang.String script, int includeType)
          Creates a JavaScriptInclude, with the specified script and include type.
 
Method Summary
 int getIncludeType()
          Returns the include type.
 java.lang.String getScript()
          Returns the client side JavaScript.
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setIncludeType(int includeType)
          Sets the include type to be use.
 void setScript(java.lang.String newValue)
          Sets the client side scipt to be executed on the client.
 
Methods inherited from class echopoint.EchoPointComponent
applyStyle, getMouseCursor, getMouseCursorURI, getToolTipPopUp, getToolTipText, set, set, set, set, set, set, set, set, set, setEnabledAllChildren, setMouseCursor, setMouseCursorURI, setToolTipText, validate
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INCLUDE_INLINE

public static final int INCLUDE_INLINE
This includes JavaScript inline to where the component is placed

See Also:
Constant Field Values

INCLUDE_ONLOAD

public static final int INCLUDE_ONLOAD
This includes JavaScript in the onload event of the page

See Also:
Constant Field Values

INCLUDE_ONUNLOAD

public static final int INCLUDE_ONUNLOAD
This includes JavaScript in the unload event of the page

See Also:
Constant Field Values

INCLUDE_INHEAD

public static final int INCLUDE_INHEAD
This includes JavaScript in the HEAD section of the page

See Also:
Constant Field Values

SCRIPT_CHANGED_PROPERTY

public static final java.lang.String SCRIPT_CHANGED_PROPERTY
Property Names

See Also:
Constant Field Values

INCLUDE_TYPE_CHANGED_PROPERTY

public static final java.lang.String INCLUDE_TYPE_CHANGED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

JavaScriptInclude

public JavaScriptInclude()
Creates a JavaScriptInclude, with no script and an inline include type.


JavaScriptInclude

public JavaScriptInclude(java.lang.String script)
Creates a JavaScriptInclude, with no script and an INCLUDE_INLINE include type.


JavaScriptInclude

public JavaScriptInclude(java.lang.String script,
                         int includeType)
Creates a JavaScriptInclude, with the specified script and include type.

Method Detail

getScript

public java.lang.String getScript()
Returns the client side JavaScript.

Returns:
String

setScript

public void setScript(java.lang.String newValue)
Sets the client side scipt to be executed on the client.

Parameters:
newValue - String

getIncludeType

public int getIncludeType()
Returns the include type. This can be one of the following :

Returns:
int

setIncludeType

public void setIncludeType(int includeType)
Sets the include type to be use. This can be one of the following :

Parameters:
includeType - - the new include type

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0