Skip to content

Commit

Permalink
2858441: Merge attributes of ID space and component for space owner
Browse files Browse the repository at this point in the history
2855804: EL/zscript read attributes directly, and deprecate Namespace


git-svn-id: https://svn.potix.com/svn/zk1/branches/5.0@12404 dd50bd9b-9913-0410-b9ba-e07a3075be86
  • Loading branch information
tomyeh committed Sep 14, 2009
1 parent 4f19845 commit 7cde4a6
Show file tree
Hide file tree
Showing 46 changed files with 1,681 additions and 1,002 deletions.
6 changes: 6 additions & 0 deletions build
Expand Up @@ -403,6 +403,11 @@ function invoke_ant
if [ "$tgtver" = "" ] ; then
tgtver=1.4
fi
deprecation=$(grep '^deprecation=' version)
deprecation=${deprecation#deprecation=}
if [ "$deprecation" = "" ] ; then
deprecation=on
fi

this_dflag=$dflag
dflagtmp=$(grep '^debug=' version)
Expand Down Expand Up @@ -447,6 +452,7 @@ function invoke_ant
-Dear.libs="$ear_libs" \
-Dproject.name="$pronm" -Dproject.version="$prjver" \
-Dsource.version="$srcver" -Dtarget.version="$tgtver" \
-Ddeprecation="$deprecation" \
-Dhaltonerror=$haltonerror -Dout.dir=$outdir \
-Ddebug=$this_dflag -Doptimize=$this_oflag ${nojc} \
-Dshare.javadoc.dir="$javadocdir" \
Expand Down
2 changes: 1 addition & 1 deletion zk/format
@@ -1,2 +1,2 @@
jar
time=archive/metainfo/zk/build
time=archive/metainfo/zk/build
66 changes: 34 additions & 32 deletions zk/src/org/zkoss/zk/scripting/HierachicalAware.java
Expand Up @@ -19,16 +19,17 @@
package org.zkoss.zk.scripting;

import org.zkoss.xel.Function;
import org.zkoss.zk.ui.ext.Scope;

/**
* An extra interface implemented by an interpreter ({@link Interpreter})
* if it supports the hierachical scopes.
*
* <p>By supporting the hierachical scopes we mean the interpreter
* associates one interpreter-dependent scope with each ZK's
* {@link Namespace}. And, variables, classes and methods defined
* {@link org.zkoss.zk.ui.IdSpace}. And, variables, classes and methods defined
* in zscript are then stored in an individual scope depending on
* the namespace when calling {@link Interpreter#interpret}.
* the scope when calling {@link Interpreter#interpret}.
*
* <p>On the other hand, if the interpreter doesn't support the hierachical
* scopes, it maintains only one global scope and all variables, classes
Expand All @@ -39,72 +40,73 @@
*/
public interface HierachicalAware {
/** Tests whether a variable defined in this interpreter.
* Note: it doesn't search the namespace ({@link Namespace}).
* Note: it doesn't search the scope ({@link Scope}).
*
* <p>It is similar to {@link Interpreter#containsVariable}, except
* it uses the specified namespace as a reference to identify the
* it uses the specified scope as a reference to identify the
* correct scope for searching the variable.
*
* @param ns the namespace used as a reference to identify the
* @param scope the scope used as a reference to identify the
* correct scope for searching the variable.
* Note: this method doesn't look for any variable stored in ns.
* @since 2.4.0
* Note: this method doesn't look for any variable stored in scope.
* @since 5.0.0
*/
public boolean containsVariable(Namespace ns, String name);
public boolean containsVariable(Scope scope, String name);
/** Returns the value of a variable defined in this interpreter's
* scope identified by the specified namespace.
* Note: it doesn't search the specified namespace ({@link Namespace}).
* scope identified by the specified scope.
* Note: it doesn't search the specified scope ({@link Scope}).
*
* <p>It is similar to {@link Interpreter#getVariable}, except
* it uses the specified namespace as a reference to identify the
* it uses the specified scope as a reference to identify the
* correct scope for searching the variable.
*
* @param ns the namespace used as a reference to identify the
* @param scope the scope used as a reference to identify the
* correct scope for searching the variable.
* Note: this method doesn't look for any variable stored in ns.
* Note: this method doesn't look for any variable stored in scope.
* @since 5.0.0
*/
public Object getVariable(Namespace ns, String name);
public Object getVariable(Scope scope, String name);
/** Sets the value of a variable to this interpreter's scope
* identified by the specified namespace.
* identified by the specified scope.
*
* <p>It is similar to {@link Interpreter#setVariable}, except
* it uses the specified namespace as a reference to identify the
* it uses the specified scope as a reference to identify the
* correct scope for storing the variable.
*
* @param ns the namespace used as a reference to identify the
* @param scope the scope used as a reference to identify the
* correct scope for searching the variable.
* Note: this method doesn't look for any variable stored in ns.
* @since 2.4.0
* Note: this method doesn't look for any variable stored in scope.
* @since 5.0.0
*/
public void setVariable(Namespace ns, String name, Object value);
public void setVariable(Scope scope, String name, Object value);
/** Removes the value of a variable defined in the interpreter's
* scope identified by the specified namespace.
* scope identified by the specified scope.
*
* <p>It is similar to {@link Interpreter#unsetVariable}, except
* it uses the specified namespace as a reference to identify the
* it uses the specified scope as a reference to identify the
* correct scope for removing the variable.
*
* @param ns the namespace used as a reference to identify the
* @param scope the scope used as a reference to identify the
* correct scope for searching the variable.
* Note: this method doesn't look for any variable stored in ns.
* @since 2.4.0
* Note: this method doesn't look for any variable stored in scope.
* @since 5.0.0
*/
public void unsetVariable(Namespace ns, String name);
public void unsetVariable(Scope scope, String name);

/** Returns the method of the specified name defined in
* this interpreter's scope identified by the specified namespace,
* this interpreter's scope identified by the specified scope,
* or null if not defined.
*
* <p>It is similar to {@link Interpreter#getFunction}, except
* it uses the specified namespace as a reference to identify the
* it uses the specified scope as a reference to identify the
* correct scope for searching the variable.
*
* @param ns the namespace used as a reference to identify the
* @param scope the scope used as a reference to identify the
* correct scope for searching the method.
* Note: this method doesn't look for any variable stored in ns.
* Note: this method doesn't look for any variable stored in scope.
* @param argTypes the list of argument (aka., parameter) types.
* If null, Class[0] is assumed.
* @since 3.0.0
* @since 5.0.0
*/
public Function getFunction(Namespace ns, String name, Class[] argTypes);
public Function getFunction(Scope scope, String name, Class[] argTypes);
}
28 changes: 17 additions & 11 deletions zk/src/org/zkoss/zk/scripting/Interpreter.java
Expand Up @@ -20,6 +20,7 @@

import org.zkoss.xel.Function;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.ext.Scope;

/**
* Represents an interpter that can interpret the scripting codes.
Expand Down Expand Up @@ -55,25 +56,30 @@ public interface Interpreter {
*/
public Object getNativeInterpreter();

/** Evaluates the script against the specified namespace.
/** @deprecated As of release 5.0.0, replaced with {@link #interpret(String, Scope}}
* <p>Evaluates the script against the specified namespace.
*/
public void interpret(String script, Namespace ns);
/** Evaluates the script against the specified scope.
*
* <p>Implementation Note:
* <ol>
* <li>The implementation has to concatenate
* the string returned by
* {@link org.zkoss.zk.ui.metainfo.LanguageDefinition#getEachTimeScript}
* if not null.</li>
* <li>The implementation must use {@link Namespaces#getCurrent}
* to retrieve the current namesace if the ns argument is null.
* <li>The implementation must use {@link Scopes#getCurrent}
* to retrieve the current namesace if the comp argument is null.
*
* @param ns the namspace. If null, the current namespace is assumed.
* The current namespace is {@link Namespaces#getCurrent}, which
* is the event target's namespace, if the thread is processing an event.
* @param scope the scope as the context to interpret the script.
* If null, the current scope is assumed.
* The current scope is {@link Scopes#getCurrent}, which
* is the event target's scope, if the thread is processing an event.
* The event target is {@link org.zkoss.zk.ui.event.Event#getTarget}.
* Otherwise, the current namespace is the owner page's namespace
* ({@link #getOwner}.
* Otherwise, the current scope is the owner page ({@link #getOwner}.
* @since 5.0.0
*/
public void interpret(String script, Namespace ns);
public void interpret(String script, Scope scope);

/** Returns the class defined in this interpreter, or null if not found.
*/
Expand All @@ -88,13 +94,13 @@ public interface Interpreter {
public Function getFunction(String name, Class[] argTypes);

/** Tests whether the variable is defined in this interpreter.
* Note: it doesn't search the namespace ({@link Namespace}).
* Note: it doesn't search the attributes ({@link Scope}).
*
* @since 2.4.0
*/
public boolean containsVariable(String name);
/** Returns the value of a variable defined in this interpreter.
* Note: it doesn't search the namespace ({@link Namespace}).
* Note: it doesn't search the scope ({@link Scope}).
*/
public Object getVariable(String name);
/** Sets the value of a variable to this interpreter, as if
Expand Down
4 changes: 3 additions & 1 deletion zk/src/org/zkoss/zk/scripting/Namespace.java
Expand Up @@ -23,7 +23,9 @@
import org.zkoss.zk.ui.Component;

/**
* To represent the name space for storing variables.
* @deprecated As of release 5.0, replaced with {@link org.zkoss.zk.ui.ext.Scope}.
*
* <p>To represent the name space for storing variables.
* There are two ways to declare variables: by zscirpt, or by
* {@link org.zkoss.zk.ui.Component#setVariable}/
* {@link org.zkoss.zk.ui.Page#setVariable}.
Expand Down
10 changes: 7 additions & 3 deletions zk/src/org/zkoss/zk/scripting/NamespaceActivationListener.java
Expand Up @@ -15,7 +15,11 @@
package org.zkoss.zk.scripting;

/**
* Used to notify an object stored in a namespace, when the namespace
* @deprecated As of release 5.0.0, use
* {@link org.zkoss.zk.ui.util.ComponentActivationListener}
* or {@link org.zkoss.zk.ui.util.PageActivationListener} instead.
*
* <p>Used to notify a variable stored in a namespace, when the namespace
* is going to be deactivated or has been activated.
*
* <p>When a namespace is going to be deactivate, it checks every
Expand All @@ -28,11 +32,11 @@
* @since 3.6.2
*/
public interface NamespaceActivationListener {
/** Called when a session has just been activated
/** Called when a namespace has just been activated
* (and its value has been deserialized).
*/
public void didActivate(Namespace ns);
/** Called when a session is about to be passivated
/** Called when a namespace is about to be passivated
* (and then serialize its value).
*/
public void willPassivate(Namespace ns);
Expand Down
10 changes: 7 additions & 3 deletions zk/src/org/zkoss/zk/scripting/NamespaceChangeListener.java
Expand Up @@ -18,8 +18,10 @@
*/
package org.zkoss.zk.scripting;

/**
* A listener used to listen whether {@link Namespace} is changed.
/** @deprecated, As of release 5.0.0, the concept of namespace is
* deprecated.
*
* <p>A listener used to listen whether {@link Namespace} is changed.
*
* <p>To add a listener to the namespace, invoke
* {@link Namespace#addChangeListener}.
Expand All @@ -35,7 +37,9 @@ public interface NamespaceChangeListener {
/** Called when a variable is removed from {@link Namespace}.
*/
public void onRemove(String name);
/** Called when the parent is changed.
/** @deprecated As of release 5.0.0, the concept of namespace is
* deprecated.
* <p>Called when the parent is changed.
*
* @param newparent the new parent.
*/
Expand Down

0 comments on commit 7cde4a6

Please sign in to comment.