|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.scripting.Namespaces
public class Namespaces
Namespace relevant utilities.
| Constructor Summary | |
|---|---|
Namespaces()
|
|
| Method Summary | |
|---|---|
static void |
afterInterpret()
Used with beforeInterpret(org.zkoss.zk.ui.Component) to clean up implicit
variables. |
static void |
afterInterpret(java.util.Map backup,
Namespace ns,
boolean popNS)
Deprecated. As of release 3.6.1, it is replaced with afterInterpret(). |
static void |
backupVariable(java.util.Map backup,
Namespace ns,
java.lang.String name)
Deprecated. As of release 3.6.1, it is replaced with setImplicit(java.lang.String, java.lang.Object). |
static Namespace |
beforeInterpret(Component comp)
Prepares implicit variable before calling Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.scripting.Namespace). |
static Namespace |
beforeInterpret(java.util.Map backup,
Component comp,
boolean pushNS)
Deprecated. As of release 3.6.1, it is replaced with beforeInterpret(Component). |
static Namespace |
beforeInterpret(java.util.Map backup,
Page page,
boolean pushNS)
Deprecated. As of release 3.6.1, it is replaced with beforeInterpret(Page). |
static Namespace |
beforeInterpret(Page page)
Prepares builtin variable before calling Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.scripting.Namespace) or a method that might be
implemented with zscript. |
static Namespace |
getCurrent(Page page)
Returns the current namespace. |
static java.lang.Object |
getImplicit(java.lang.String name,
java.lang.Object defValue)
Returns the implict object. |
static void |
setImplicit(java.lang.String name,
java.lang.Object value)
Sets an implicit object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Namespaces()
| Method Detail |
|---|
public static final Namespace beforeInterpret(Component comp)
Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.scripting.Namespace).
Typical use:
final Namespace ns = Namespaces.beforeInterpret(comp);
try {
Namespaces.setImplicit("some", value);
page.interpret(zslang, zscript, ns); //it will push ns as the current namespace
} finally {
Namespaces.afterInterpret();
}
Another example:
Namespaces.beforeInterpret(comp);
try {
constr.validate(comp); //if constr might be an instance of a class implemented in zscript
} finally {
Namespaces.afterInterpret();
}
If you need to set some implicit variables, you can invoke
setImplicit(java.lang.String, java.lang.Object) between beforeInterpret(org.zkoss.zk.ui.Component)
and afterInterpret().
comp - the component, never null.
public static final Namespace beforeInterpret(Page page)
Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.scripting.Namespace) or a method that might be
implemented with zscript.
page - the page, never null.
beforeInterpret(Component)public static final void afterInterpret()
beforeInterpret(org.zkoss.zk.ui.Component) to clean up implicit
variables.
public static void setImplicit(java.lang.String name,
java.lang.Object value)
beforeInterpret(org.zkoss.zk.ui.Component) and
afterInterpret().
public static java.lang.Object getImplicit(java.lang.String name,
java.lang.Object defValue)
name - the variable to retrievedefValue - the default vale that is used if the implicit
object is not defined.
public static final Namespace beforeInterpret(java.util.Map backup,
Component comp,
boolean pushNS)
beforeInterpret(Component).
public static final Namespace beforeInterpret(java.util.Map backup,
Page page,
boolean pushNS)
beforeInterpret(Page).
public static final void afterInterpret(java.util.Map backup,
Namespace ns,
boolean popNS)
afterInterpret().
public static final void backupVariable(java.util.Map backup,
Namespace ns,
java.lang.String name)
setImplicit(java.lang.String, java.lang.Object).
public static final Namespace getCurrent(Page page)
Event.getTarget().
Otherwise, the namespace of the page specified is assumed.
This method is used only to implement Interpreter.
You rarely need to access it other than implementing an interpreter.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||