Class JsScope
- java.lang.Object
-
- org.wicketstuff.wiquery.core.javascript.JsScope
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
JsScopeEvent
public abstract class JsScope extends java.lang.Object implements java.io.Serializable$Id: JsScope.java 1714 2011-09-22 20:38:30Z hielke.hoeve $JsScopeare used to define anonymous JavaScript functions. For example, let's take theeachstatement:new JsQuery().$(".foo").each(new JsScope() { public void execute(JsScopeContext scopeContext) { scopeContext.self().chain("css", "border", "1px solid red"); } });You can either pass arguments to the JsScope (like in JavaScript functions) (see constructor args).
- Since:
- 0.7
- Author:
- Lionel Armanet
- See Also:
JsStatement,JsScopeContext, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidexecute(JsScopeContext scopeContext)Executes theJsScope.static JsScopequickScope(java.lang.CharSequence javascriptCode)Creates a defaultJsScopeto execute the given statement.static JsScopequickScope(JsStatement jsStatement)Creates a defaultJsScopeto execute the given statement.java.lang.CharSequencerender()Renders the scope.
-
-
-
Constructor Detail
-
JsScope
public JsScope(java.lang.String... scopeParameters)
Constructs a newJsScopeinstance with the given args. This is the equivalent of the JavaScript statement:function(arg1, arg2, arg3) {- Parameters:
scopeParameters-
-
-
Method Detail
-
quickScope
public static JsScope quickScope(java.lang.CharSequence javascriptCode)
Creates a defaultJsScopeto execute the given statement.- Parameters:
javascriptCode- the JavaScript statement to execute with the scope.- Returns:
- the created
JsScope.
-
quickScope
public static JsScope quickScope(JsStatement jsStatement)
Creates a defaultJsScopeto execute the given statement.- Parameters:
jsStatement- the JavaScript statement to execute with the scope.- Returns:
- the created
JsScope.
-
execute
protected abstract void execute(JsScopeContext scopeContext)
Executes theJsScope.- Parameters:
scopeContext- the given scope.
-
render
public java.lang.CharSequence render()
Renders the scope.
-
-