org.wings.script
Class JavaScriptListener

java.lang.Object
  extended by org.wings.script.JavaScriptListener
All Implemented Interfaces:
EventListener, ScriptListener
Direct Known Subclasses:
JavaScriptDOMListener

public class JavaScriptListener
extends Object
implements ScriptListener


Field Summary
static String JS_FORM_SUBMIT_SCRIPT
          Use this java script implementation to submit forms on button click
static JavaScriptListener JS_ON_CHANGE_SUBMIT_FORM
          Use i.e.
 
Fields inherited from interface org.wings.script.ScriptListener
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY
 
Constructor Summary
JavaScriptListener(String event, String code)
           
JavaScriptListener(String event, String code, SComponent[] components)
          The code is parsed and all occurrences of '{0..components.length}' are substituted with that component's id.
JavaScriptListener(String event, String code, String script)
           
JavaScriptListener(String event, String code, String script, SComponent[] components)
          The code is parsed and all occurrences of '{0..components.length}' are substituted with that component's id.
 
Method Summary
 boolean equals(Object obj)
           
 String getCode()
          Inline code which should be executed on occuration of this event
 SComponent[] getComponents()
           
 String getEvent()
          Event on which this script should be triggered.
 int getPriority()
          A numeric value which prioritzes the execution order of various script listeners listening on the same event.
 String getScript()
          Optional, additional script code which should be rendered externally (i.e.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JS_FORM_SUBMIT_SCRIPT

public static final String JS_FORM_SUBMIT_SCRIPT
Use this java script implementation to submit forms on button click

See Also:
Constant Field Values

JS_ON_CHANGE_SUBMIT_FORM

public static final JavaScriptListener JS_ON_CHANGE_SUBMIT_FORM
Use i.e. SComponent.addScriptListener(org.wings.script.ScriptListener) to add this scripts.

Constructor Detail

JavaScriptListener

public JavaScriptListener(String event,
                          String code)
Parameters:
event - one of 'onclick', 'onmouseover', ..
code - the code that is written as a value of the event attribute

JavaScriptListener

public JavaScriptListener(String event,
                          String code,
                          String script)
Parameters:
event - one of 'onclick', 'onmouseover', ..
code - the code that is written as a value of the event attribute
script - larger code block (java script functions), that is written to a combined script file, that is linked in the header

JavaScriptListener

public JavaScriptListener(String event,
                          String code,
                          SComponent[] components)
The code is parsed and all occurrences of '{0..components.length}' are substituted with that component's id. You can use this to address elements by id. This mechanism is highly dependant on the code, the plaf generates for a component.

Parameters:
event - one of 'onclick', 'onmouseover', ..
code - the code that is written as a value of the event attribute
components - the components whose ids are substituted into the code

JavaScriptListener

public JavaScriptListener(String event,
                          String code,
                          String script,
                          SComponent[] components)
The code is parsed and all occurrences of '{0..components.length}' are substituted with that component's id. You can use this to address elements by id. This mechanism is highly dependant on the code, the plaf generates for a component.

Parameters:
event - one of 'onclick', 'onmouseover', ..
code - the code that is written as a value of the event attribute
script - larger code block (java script functions), that is written to a separate script file, that is linked in the header
components - the components whose ids are substituted into the code
Method Detail

getEvent

public String getEvent()
Description copied from interface: ScriptListener
Event on which this script should be triggered.

Specified by:
getEvent in interface ScriptListener

getCode

public String getCode()
Description copied from interface: ScriptListener
Inline code which should be executed on occuration of this event

Specified by:
getCode in interface ScriptListener
Returns:
Inline Code

getScript

public String getScript()
Description copied from interface: ScriptListener
Optional, additional script code which should be rendered externally (i.e. external .JS file).

Specified by:
getScript in interface ScriptListener
Returns:
Optional scripting code, may be null

getComponents

public SComponent[] getComponents()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getPriority

public int getPriority()
Description copied from interface: ScriptListener
A numeric value which prioritzes the execution order of various script listeners listening on the same event.

Specified by:
getPriority in interface ScriptListener
Returns:
ScriptListener.DEFAULT_PRIORITY if you don't care. Lower values are executed later (low priority), higher values eraliert (higher priority).


wingS Swings ;-)