|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.impl.SimpleScope
public class SimpleScope
A simple implementation of Scope.
It supports ScopeListener, but it doesn't support
the concept of parent scope.
Thus, the deriving class can override
getAttribute(String,boolean),
hasAttribute(String,boolean),
and invoke notifyParentChanged(org.zkoss.zk.ui.ext.Scope) if the parent is changed.
Not thread safe.
| Constructor Summary | |
|---|---|
SimpleScope(Scope owner)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addScopeListener(ScopeListener listener)
Adds a listener to listen whether this scope is changed. |
SimpleScope |
clone(Scope owner)
Clones this scope. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the custom attribute associated with this object (scope). |
java.lang.Object |
getAttribute(java.lang.String name,
boolean recurse)
The same as getAttribute(name). |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Returns all custom attributes associated with this object (scope). |
java.util.List<ScopeListener> |
getListeners()
Returns a ist of all scope listners (never null). |
boolean |
hasAttribute(java.lang.String name)
Returns if a custom attribute is associated with this object (scope). |
boolean |
hasAttribute(java.lang.String name,
boolean recurse)
The same as hasAttribute(name). |
void |
notifyIdSpaceChanged(IdSpace newIdSpace)
Invokes ScopeListener.idSpaceChanged(org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.IdSpace) for registered
listeners. |
void |
notifyParentChanged(Scope newparent)
Invokes ScopeListener.parentChanged(org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.ext.Scope) for registered
listeners. |
java.lang.Object |
removeAttribute(java.lang.String name)
Removes the attribute from the current scope if any. |
java.lang.Object |
removeAttribute(java.lang.String name,
boolean recurse)
The same as removeAttribute(name). |
boolean |
removeScopeListener(ScopeListener listener)
Removes a change listener from this scope. |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets (aka., associates) the value for a custom attribute with this object (scope). |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value,
boolean recurse)
The same as setAttribute(name, value). |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleScope(Scope owner)
owner - the real scope that an user can access.
If this object is the scope that an user accesses directly, pass null| Method Detail |
|---|
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Scope
getAttributes in interface Scopepublic java.lang.Object getAttribute(java.lang.String name)
Scope
getAttribute in interface Scopepublic boolean hasAttribute(java.lang.String name)
ScopeNotice that null is a valid value, so you can
tell if an attribute is assoicated by examining the return value
of Scope.getAttribute(java.lang.String).
hasAttribute in interface Scope
public java.lang.Object setAttribute(java.lang.String name,
java.lang.Object value)
Scope
setAttribute in interface Scopepublic java.lang.Object removeAttribute(java.lang.String name)
Scope
removeAttribute in interface Scope
public java.lang.Object getAttribute(java.lang.String name,
boolean recurse)
getAttribute in interface Scoperecurse - whether to search its ancestor scope.
If true and the current scope doen't define the attribute,
it searches up its ancestor to see
any of them has defined the specified attribute.
public boolean hasAttribute(java.lang.String name,
boolean recurse)
hasAttribute in interface Scoperecurse - whether to search its ancestor scope.
If true and the current scope doen't define the attribute,
it searches up its ancestor to see
any of them has defined the specified attribute.
public java.lang.Object setAttribute(java.lang.String name,
java.lang.Object value,
boolean recurse)
setAttribute in interface Scoperecurse - whether to look up the parent scope for the
existence of the attribute.Scope.setAttribute(String,Object).
public java.lang.Object removeAttribute(java.lang.String name,
boolean recurse)
removeAttribute in interface Scoperecurse - whether to look up the parent scope for the
existence of the attribute.Scope.removeAttribute(String).public boolean addScopeListener(ScopeListener listener)
Scope
addScopeListener in interface Scopepublic boolean removeScopeListener(ScopeListener listener)
Scope
removeScopeListener in interface Scopepublic void notifyParentChanged(Scope newparent)
ScopeListener.parentChanged(org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.ext.Scope) for registered
listeners.
addScopeListener(org.zkoss.zk.ui.ext.ScopeListener)public void notifyIdSpaceChanged(IdSpace newIdSpace)
ScopeListener.idSpaceChanged(org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.IdSpace) for registered
listeners.
addScopeListener(org.zkoss.zk.ui.ext.ScopeListener)public java.util.List<ScopeListener> getListeners()
public SimpleScope clone(Scope owner)
owner - the owner of the cloned scope.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||