|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zk.ui.Components
public class Components
Utilities to access Component
.
Field Summary | |
---|---|
static org.zkoss.zk.ui.Components.Exec |
EXECUTION_PROXY
Execution Proxy |
static org.zkoss.zk.ui.Components.RequestScope |
REQUEST_SCOPE_PROXY
Request Scope Proxy |
Constructor Summary | |
---|---|
protected |
Components()
|
Method Summary | |
---|---|
static void |
addForwards(Component comp,
java.lang.Object controller)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
addForwards(Component comp,
java.lang.Object controller,
char separator)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static java.lang.String |
componentToPath(Component comp,
Component ref)
Converts a component to a path (relevant to another component). |
static Page |
getCurrentPage(Component comp)
Returns the page of the give component, or the current page if the component is null or it doesn't belong to any page. |
static ComponentDefinition |
getDefinitionByDeviceType(java.lang.String deviceType,
java.lang.Class cls)
Returns the component definition of the specified class in all language of the specified device, or null if not found |
static java.lang.Object |
getImplicit(Component comp,
java.lang.String name)
Returns the implicit object of the specified name, or null if not found. |
static java.lang.Object |
getImplicit(Page page,
Component comp,
java.lang.String name)
Returns the implicit object of the specified name, or null if not found. |
static java.lang.Object |
getImplicit(Page page,
java.lang.String name)
Returns the implicit object of the specified name, or null if not found. |
static java.util.Collection<java.lang.String> |
getImplicitNames()
Returns a readonly collection of the names of the implicit objects. |
static IdSpace |
getParentIdSpace(IdSpace idspace)
Returns the parent of the ID space, or null if not found. |
static Component |
getRoot(Component comp)
Returns the root component of the specified one. |
static int |
getScope(java.lang.String scope)
Converts a string to an integer that can be used to access Component.getAttribute(String, int) |
static java.util.Collection<Component> |
getVisibleChildren(Component comp)
Returns a collection of visible children. |
static boolean |
isAncestor(Component node1,
Component node2)
Tests whether node1 is an ancestor of node 2. |
static boolean |
isImplicit(java.lang.String id)
Returns whether the given id is an implicit ZK object id. |
static boolean |
isRealVisible(Component comp)
Returns whether this component is real visible (all its parents are visible). |
static Component |
pathToComponent(java.lang.String path,
Component ref)
Converts a path, generated by componentToPath(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component) , to
a component. |
static void |
removeAllChildren(Component comp)
Removes all children of the specified component. |
static void |
replace(Component oldc,
Component newc)
Replaces a component with another. |
static void |
replaceChildren(Component parent,
java.util.Collection<Component> newChildren)
Replaces all children of the specified component. |
static java.lang.String |
scopeToString(int scope)
Converts an integer to the string representing the scope. |
static void |
sort(java.util.List<? extends Component> list,
java.util.Comparator<? super Component> cpr)
Sorts the components in the list. |
static void |
sort(java.util.List<? extends Component> list,
int from,
int to,
java.util.Comparator<? super Component> cpr)
Sorts the components in the list. |
static void |
wireController(Component comp,
java.lang.Object controller)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireController(Component comp,
java.lang.Object controller,
char separator)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireController(Component comp,
java.lang.Object controller,
char separator,
boolean ignoreZScript,
boolean ignoreXel)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireFellows(IdSpace idspace,
java.lang.Object controller)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireFellows(IdSpace idspace,
java.lang.Object controller,
char separator)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireFellows(IdSpace idspace,
java.lang.Object controller,
char separator,
boolean ignoreZScript,
boolean ignoreXel)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireImplicit(Component comp,
java.lang.Object controller)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireVariables(Component comp,
java.lang.Object controller)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireVariables(Component comp,
java.lang.Object controller,
char separator)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireVariables(Component comp,
java.lang.Object controller,
char separator,
boolean ignoreZScript,
boolean ignoreXel)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireVariables(Page page,
java.lang.Object controller)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireVariables(Page page,
java.lang.Object controller,
char separator)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
static void |
wireVariables(Page page,
java.lang.Object controller,
char separator,
boolean ignoreZScript,
boolean ignoreXel)
Deprecated. As of release 6.0.0, replaced with ConventionWires . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.zkoss.zk.ui.Components.Exec EXECUTION_PROXY
public static final org.zkoss.zk.ui.Components.RequestScope REQUEST_SCOPE_PROXY
Constructor Detail |
---|
protected Components()
Method Detail |
---|
public static IdSpace getParentIdSpace(IdSpace idspace)
public static void sort(java.util.List<? extends Component> list, java.util.Comparator<? super Component> cpr)
Note: you cannot use Collections.sort(java.util.List
to sort
Component.getChildren()
because Collections.sort might cause
some replicated item in the list.
sort(List, int, int, Comparator)
public static void replace(Component oldc, Component newc)
oldc
- the component to remove.newc
- the component to add
java.lang.IllegalArgumentException
- if oldc's parent and page are
both null.public static void replaceChildren(Component parent, java.util.Collection<Component> newChildren)
parent.getChildren().clear();
parent.getChildren().addAll(newChildren);
public static void sort(java.util.List<? extends Component> list, int from, int to, java.util.Comparator<? super Component> cpr)
list
- the list to be sortedfrom
- the index of the first element (inclusive) to be sortedto
- the index of the last element (exclusive) to be sortedcpr
- the comparator to determine the order of the list.public static Component getRoot(Component comp)
comp
, if it is already
a root component (or it is null).
public static boolean isAncestor(Component node1, Component node2)
public static void removeAllChildren(Component comp)
comp.getChildren().clear()
.
public static final ComponentDefinition getDefinitionByDeviceType(java.lang.String deviceType, java.lang.Class cls)
deviceType
- the device type (Device
),
such as ajax. It cannot be null.cls
- the implementation class of the component.public static boolean isRealVisible(Component comp)
Note: true is returned if comp is null.
In other words, it can be used to examine parent's real visibility
even if it is a root component,
such as Components.isRealVisible(getParent())
.
Component.isVisible()
public static java.util.Collection<Component> getVisibleChildren(Component comp)
The performance of the returned collection's size() is NO GOOD.
public static final int getScope(java.lang.String scope)
Component.getAttribute(String, int)
public static final java.lang.String scopeToString(int scope)
scope
- one of Component.COMPONENT_SCOPE
,
Component.SPACE_SCOPE
, Component.PAGE_SCOPE
,
Component.DESKTOP_SCOPE
, Component.SESSION_SCOPE
,
Component.REQUEST_SCOPE
, and Component.APPLICATION_SCOPE
.public static final java.lang.String componentToPath(Component comp, Component ref)
Rather, it is better to store the path related, and then restore
it back to a component by calling pathToComponent(java.lang.String, org.zkoss.zk.ui.Component)
.
comp
- the component to be converted to path. It cannot be null.ref
- the component used to generated the path from.
It cannot be null.
pathToComponent(java.lang.String, org.zkoss.zk.ui.Component)
to convert it back.
java.lang.UnsupportedOperationException
- if we cannot find a path
to the component to write.public static final Component pathToComponent(java.lang.String path, Component ref)
componentToPath(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
, to
a component.
ref
- the component used to generated the path from.
It cannot be null. It is the same as the one when calling
componentToPath(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
.public static final void wireFellows(IdSpace idspace, java.lang.Object controller)
ConventionWires
.
public static final void wireFellows(IdSpace idspace, java.lang.Object controller, char separator)
ConventionWires
.
public static final void wireFellows(IdSpace idspace, java.lang.Object controller, char separator, boolean ignoreZScript, boolean ignoreXel)
ConventionWires
.
public static final void wireVariables(Component comp, java.lang.Object controller)
ConventionWires
.
public static final void wireVariables(Component comp, java.lang.Object controller, char separator)
ConventionWires
.
public static final void wireVariables(Component comp, java.lang.Object controller, char separator, boolean ignoreZScript, boolean ignoreXel)
ConventionWires
.
public static final void wireVariables(Page page, java.lang.Object controller)
ConventionWires
.
public static final void wireVariables(Page page, java.lang.Object controller, char separator)
ConventionWires
.
public static final void wireVariables(Page page, java.lang.Object controller, char separator, boolean ignoreZScript, boolean ignoreXel)
ConventionWires
.
public static final void wireController(Component comp, java.lang.Object controller)
ConventionWires
.
public static final void wireController(Component comp, java.lang.Object controller, char separator)
ConventionWires
.
public static final void wireController(Component comp, java.lang.Object controller, char separator, boolean ignoreZScript, boolean ignoreXel)
ConventionWires
.
public static final void wireImplicit(Component comp, java.lang.Object controller)
ConventionWires
.
public static void addForwards(Component comp, java.lang.Object controller)
ConventionWires
.
public static void addForwards(Component comp, java.lang.Object controller, char separator)
ConventionWires
.
public static boolean isImplicit(java.lang.String id)
id
- Component id
public static java.util.Collection<java.lang.String> getImplicitNames()
public static java.lang.Object getImplicit(Page page, Component comp, java.lang.String name)
Notice that it does check for the current scope
(Scopes.getCurrent(org.zkoss.zk.ui.Page)
).
Rather, Scopes.getImplicit(java.lang.String, java.lang.Object)
depends on this method.
page
- the page. If page is null and comp is not,
comp.getPage() is assumedScopes.getImplicit(java.lang.String, java.lang.Object)
public static java.lang.Object getImplicit(Component comp, java.lang.String name)
It is the same as getImplicit(null, comp, name).
public static java.lang.Object getImplicit(Page page, java.lang.String name)
It is the same as getImplicit(page, null, name).
public static Page getCurrentPage(Component comp)
ExecutionCtrl.getCurrentPage()
or the current execution. This method returns null if no execution
or no current page at all.
comp
- the component to retrieve the page. Ignored if null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |