|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odlabs.wiquery.core.javascript.JsStatement
public class JsStatement
$Id$
A JsStatement
defines a whole executable JavaScript statement. The generator
eases "jQuery oriented" code, but you can still use another JavaScript coding style
with the append(CharSequence)
method.
To get a valid instance and to ease JavaScript and Wicket integration, you should use
the JsQuery
class (example below). This class will initialize a
JsStatement
and contribute to a WebPage
.
The JavaScript generating by a JsStatement is jQuery oriented. Example of generated string:
$(".aClassName").each(function() {alert('foo');});
To generate the script above, you can write this:
new JsQuery().$().each(JsScope.quickScope("alert('foo')"));
Any JsStatement
should be returned by a JsQuery
within the
$
methods.
JsQuery
,
JsScope
,
Serialized FormConstructor Summary | |
---|---|
JsStatement()
Creates a new JsStatement . |
Method Summary | |
---|---|
JsStatement |
$()
Appends the jQuery's $ function to the current JsStatement . |
JsStatement |
$(org.apache.wicket.Component context)
Same method as $(Component, String) with an empty selector. |
JsStatement |
$(org.apache.wicket.Component context,
String selector)
Appends the jQuery's $ function to the current JsStatement . |
JsStatement |
addClass(String className)
Binds the addClass statement. |
JsStatement |
after(CharSequence html)
Binds the after statement. |
JsStatement |
append(CharSequence charSequence)
Appends the given CharSequence to this statement. |
JsStatement |
attr(String key,
JsScope computedValue)
Binds the attr statement. |
JsStatement |
attr(String key,
String value)
Binds the attr statement. |
JsStatement |
before(CharSequence html)
Binds the before statement. |
JsStatement |
chain(ChainableStatement chainableStatement)
Chains a function call to this JsStatement . |
JsStatement |
chain(CharSequence statementLabel,
CharSequence... statementArgs)
Chains a function call to this JsStatement . |
JsStatement |
css(Options options)
Binds the css statement. |
JsStatement |
css(String name,
String value)
Binds the css statement. |
JsStatement |
document()
Appends $(document) to the statement. |
JsStatement |
each(JsScope scope)
Appends the each jQuery statement. |
StringBuilder |
getStatement()
|
JsStatement |
html(CharSequence htmlContents)
Binds the html statement. |
JsStatement |
insertAfter(String expression)
Binds the insertAfter statement. |
JsStatement |
insertBefore(String expression)
Binds the insertBefore statement. |
JsStatement |
ready(JsScope scope)
Appends the ready jQuery statement. |
JsStatement |
removeAttr(String key)
Binds the removeAttr statement. |
JsStatement |
removeClass(String className)
Binds the removeClass statement. |
CharSequence |
render()
Renders this statement. |
CharSequence |
render(boolean semicolon)
Renders this statement. |
JsStatement |
self()
Appends the this keyword to this statement. |
JsStatement |
toggleClass(String className)
Binds the toggleClass statement. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsStatement()
JsStatement
.
Method Detail |
---|
public JsStatement $()
$
function to the current JsStatement
.
So, we can call some special jquery fonction, like $.browser
...
JsStatement
this instance.public JsStatement $(org.apache.wicket.Component context)
$(Component, String)
with an empty selector.
JsStatement
this instance.public JsStatement $(org.apache.wicket.Component context, String selector)
$
function to the current JsStatement
. If
context is not null, the generated JavaScript code will be:
$("#component.getMarkupId selector")
$("selector")
JsStatement
this instance.public JsStatement addClass(String className)
addClass
statement.
public JsStatement after(CharSequence html)
after
statement.
public JsStatement append(CharSequence charSequence)
CharSequence
to this statement.
JsStatement
this instance.public JsStatement attr(String key, JsScope computedValue)
attr
statement.
public JsStatement attr(String key, String value)
attr
statement.
public JsStatement before(CharSequence html)
before
statement.
public JsStatement chain(ChainableStatement chainableStatement)
JsStatement
. The function call is wrapped in
a ChainableStatement. (eases JavaScript integration).
JsStatement
this instance.chain(CharSequence, CharSequence...).
public JsStatement chain(CharSequence statementLabel, CharSequence... statementArgs)
JsStatement
. This will append
statementLabel(statementArgs) to this JsStatement
.
statementLabel
- the statement label to append.statementArgs
- the statement args.
JsStatement
this instance.public JsStatement css(Options options)
css
statement.
public JsStatement css(String name, String value)
css
statement.
public JsStatement document()
JsStatement
this instance.public JsStatement each(JsScope scope)
scope
- the JsScope
to execute within every matched element.public StringBuilder getStatement()
public JsStatement html(CharSequence htmlContents)
html
statement.
public JsStatement insertAfter(String expression)
insertAfter
statement.
public JsStatement insertBefore(String expression)
insertBefore
statement.
public JsStatement ready(JsScope scope)
scope
- the JsScope
to execute when jQuery is ready.
public JsStatement removeAttr(String key)
removeAttr
statement.
public JsStatement removeClass(String className)
removeClass
statement.
public CharSequence render()
CharSequence
.public CharSequence render(boolean semicolon)
semicolon
- If true, a semicolon is automatically added
CharSequence
.public JsStatement self()
this
keyword to this statement.
JsStatement
this instance.public JsStatement toggleClass(String className)
toggleClass
statement.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |