org.zkoss.zk.ui.sys
Class ComponentsCtrl

java.lang.Object
  extended by org.zkoss.zk.ui.sys.ComponentsCtrl

public class ComponentsCtrl
extends java.lang.Object

Utilities for implementing components.

Author:
tomyeh

Field Summary
static java.lang.String ANONYMOUS_ID
          The anonymous UUID.
static ComponentDefinition DUMMY
          Represents a dummy definition.
 
Constructor Summary
ComponentsCtrl()
           
 
Method Summary
static void applyForward(Component comp, java.lang.String forward)
          Applies the forward condition to the specified component.
static java.lang.Object getCurrentInfo()
          Returns the current component info ComponentInfo, definition (ComponentDefinition or null, which is used only by UiEngine to communicate with AbstractComponent.
static java.lang.reflect.Method getEventMethod(java.lang.Class cls, java.lang.String evtnm)
          Returns the method for handling the specified event, or null if not available.
static boolean isAutoId(java.lang.String id)
          Returns whether an ID is generated automatically.
static boolean isReservedAttribute(java.lang.String name)
          Returns if the attribute name is reserved.
static boolean isUuid(java.lang.String id)
          Returns whether an ID is a valid UUID.
static java.lang.String parseClientScript(Component comp, java.lang.String script)
          Deprecated. As of release 5.0.0, use the script component instead.
static java.lang.Object[] parseEventExpression(Component comp, java.lang.String evtexpr, Component defaultComp, boolean deferred)
          Pares the event expression.
static java.util.Collection redraw(java.util.Collection comps)
          An utilities to create an array of JavaScript codes that can be used to mount the specified widget at the clients.
static void setCurrentInfo(ComponentDefinition compdef)
          Sets the current component definition, which is used only by UiEngine to communicate with AbstractComponent.
static void setCurrentInfo(ComponentInfo compInfo)
          Sets the current component definition, which is used only by UiEngine to communicate with AbstractComponent.
static void setEventMethodCache(Cache cache)
          Sets the cache that stores the information about event handler methods.
static java.lang.String toAutoId(java.lang.String prefix, int id)
          Returns the automatically generate component's UUID/ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANONYMOUS_ID

public static final java.lang.String ANONYMOUS_ID
The anonymous UUID. Used only internally.

See Also:
Constant Field Values

DUMMY

public static final ComponentDefinition DUMMY
Represents a dummy definition.

Constructor Detail

ComponentsCtrl

public ComponentsCtrl()
Method Detail

toAutoId

public static final java.lang.String toAutoId(java.lang.String prefix,
                                              int id)
Returns the automatically generate component's UUID/ID.


isAutoId

public static final boolean isAutoId(java.lang.String id)
Returns whether an ID is generated automatically. Note: true is returned if id is null.


isUuid

public static final boolean isUuid(java.lang.String id)
Returns whether an ID is a valid UUID. Note: true is returned if id is null.


isReservedAttribute

public static final boolean isReservedAttribute(java.lang.String name)
Returns if the attribute name is reserved. If name is null, false is returned.

Since:
3.0.0

getCurrentInfo

public static final java.lang.Object getCurrentInfo()
Returns the current component info ComponentInfo, definition (ComponentDefinition or null, which is used only by UiEngine to communicate with AbstractComponent.

Since:
3.0.0

setCurrentInfo

public static final void setCurrentInfo(ComponentDefinition compdef)
Sets the current component definition, which is used only by UiEngine to communicate with AbstractComponent.

Used only internally.

Since:
3.0.0

setCurrentInfo

public static void setCurrentInfo(ComponentInfo compInfo)
Sets the current component definition, which is used only by UiEngine to communicate with AbstractComponent.

Used only internally.

Since:
3.0.0

parseEventExpression

public static java.lang.Object[] parseEventExpression(Component comp,
                                                      java.lang.String evtexpr,
                                                      Component defaultComp,
                                                      boolean deferred)
                                               throws ComponentNotFoundException
Pares the event expression.

There are several formats for the event expression:

Parameters:
comp - the component that the event expression is referenced to
evtexpr - the event expression.
defaultComp - the default component which is used when evtexpr doesn't specify the component.
deferred - whether to defer the conversion of the path to a component. If true and EL not specified or evaluated to a string, it returns the path directly rather than converting it to a component.
Returns:
a two element array. The first element is the component if deferred is false or EL is evaluated to a component, or a path, otherwise. The second component is the event name.
Throws:
ComponentNotFoundException
Since:
3.0.0

applyForward

public static final void applyForward(Component comp,
                                      java.lang.String forward)
Applies the forward condition to the specified component.

The basic format:
onEvent1=id1/id2.onEvent2,onEvent3=id3.onEvent4

See ComponentInfo.setForward(java.lang.String) for more information.

Since:
3.0.0

parseClientScript

public static java.lang.String parseClientScript(Component comp,
                                                 java.lang.String script)
Deprecated. As of release 5.0.0, use the script component instead.


getEventMethod

public static final java.lang.reflect.Method getEventMethod(java.lang.Class cls,
                                                            java.lang.String evtnm)
Returns the method for handling the specified event, or null if not available.


setEventMethodCache

public static final void setEventMethodCache(Cache cache)
Sets the cache that stores the information about event handler methods.

Default: MultiCache. In additions, the number of caches is default to 97 and can be changed by use of the org.zkoss.zk.ui.eventMethods.cache.number property. The maximal allowed size of each cache, if GC, is default to 30 and can be changed by use of the org.zkoss.zk.ui.eventMethods.cache.maxSize property.

Parameters:
cache - the cache. It cannot be null. It must be thread safe. Once assigned, the caller shall not access it again.
Since:
3.0.0

redraw

public static final java.util.Collection redraw(java.util.Collection comps)
An utilities to create an array of JavaScript codes that can be used to mount the specified widget at the clients.

Since:
5.0.0


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