org.zkoss.zk.scripting
Interface Namespace


Deprecated. As of release 5.0, replaced with Scope.

To represent the name space for storing variables. There are two ways to declare variables: by zscirpt, or by Component.setVariable(java.lang.String, java.lang.Object, boolean)/ Page.setVariable(java.lang.String, java.lang.Object).

Each ID space (IdSpace has an independent name space to store varaibles. It is a mimic concept of ID space to work with zscript.

public interface Namespace

Author:
tomyeh
See Also:
Interpreter

Method Summary
 boolean addChangeListener(NamespaceChangeListener listener)
          Deprecated.  
 boolean containsVariable(java.lang.String name, boolean local)
          Deprecated. Returns whether the specified variable is defined.
 Component getOwner()
          Deprecated. Returns the component that owns this namespace, or null if it is owned by a page, or not owned by any one.
 Page getOwnerPage()
          Deprecated. Returns the page that owns this namespace, or null if not owned by any page.
 Namespace getParent()
          Deprecated. Returns the parent name space, or null if this is topmost.
 java.lang.Object getVariable(java.lang.String name, boolean local)
          Deprecated. Returns the variable of the specified name, or null if not defined or the value is null.
 java.util.Set getVariableNames()
          Deprecated. Returns a set of variable names stored in this name space.
 boolean removeChangeListener(NamespaceChangeListener listener)
          Deprecated.  
 void setParent(Namespace parent)
          Deprecated. Sets the parent name space.
 void setVariable(java.lang.String name, java.lang.Object value, boolean local)
          Deprecated. Sets the variable of the specified name.
 void unsetVariable(java.lang.String name, boolean local)
          Deprecated. Unsets a variable from the current ID space.
 

Method Detail

getOwner

Component getOwner()
Deprecated. 
Returns the component that owns this namespace, or null if it is owned by a page, or not owned by any one.

Since:
3.0.1

getOwnerPage

Page getOwnerPage()
Deprecated. 
Returns the page that owns this namespace, or null if not owned by any page.

Since:
3.0.1

getVariableNames

java.util.Set getVariableNames()
Deprecated. 
Returns a set of variable names stored in this name space.

Note: it doesn't include the parent's varaibles.


containsVariable

boolean containsVariable(java.lang.String name,
                         boolean local)
Deprecated. 
Returns whether the specified variable is defined.

Parameters:
local - whether not to search its ancestor. If false and the current ID space doen't define the variable, it searches up its ancestor (via getParent()) to see any of them has defined the specified variable.

getVariable

java.lang.Object getVariable(java.lang.String name,
                             boolean local)
Deprecated. 
Returns the variable of the specified name, or null if not defined or the value is null.

Parameters:
local - whether not to search its ancestor. If false and the current ID space doen't define the variable, it searches up its ancestor (via getParent()) to see any of them has defined the specified variable.

setVariable

void setVariable(java.lang.String name,
                 java.lang.Object value,
                 boolean local)
Deprecated. 
Sets the variable of the specified name.

Parameters:
local - whether not to set the variable to this name space directly. If false, it searches whether the variable is defined in any of its ancestor (via getParent()). If local = false and the ancestor is found, the value is stored to the ancestor instead of this.
Throws:
UiException - if failed.

unsetVariable

void unsetVariable(java.lang.String name,
                   boolean local)
Deprecated. 
Unsets a variable from the current ID space.

Unlike setVariable(java.lang.String, java.lang.Object, boolean), this method removed only the variable defined in the ID space cotnaining this component.


getParent

Namespace getParent()
Deprecated. 
Returns the parent name space, or null if this is topmost.


setParent

void setParent(Namespace parent)
Deprecated. 
Sets the parent name space.


addChangeListener

boolean addChangeListener(NamespaceChangeListener listener)
Deprecated. 

Adds a change listener to listen whether this namespace is changed. The listener is called when a variable is added, removed, or the parent is changed.

Returns:
wether the resolver is added successfully. Note: if the resolver was added before, it won't be added again and this method returns false.

removeChangeListener

boolean removeChangeListener(NamespaceChangeListener listener)
Deprecated. 

Removes a change listener from this namespace.

Returns:
false if resolved is not added before.


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo