Package org.zkoss.zk.ui.sys
Class ComponentsCtrl
java.lang.Object
org.zkoss.zk.ui.sys.ComponentsCtrl
Utilities for implementing components.
- Author:
- tomyeh
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidapplyForward(Component comp, String forward) Applies the forward condition to the specified component.static voidChecks if the given UUID is valid.static final StringencodeId(StringBuffer sb, int val) Returns an ID representing the specified number The ID consists of 0-9, a-z and _.static final ObjectReturns the current component infoComponentInfo, definition (ComponentDefinitionor null, which is used only byUiEngineto communicate withAbstractComponent.static final MethodgetEventMethod(Class<?> cls, String evtnm) Returns the method for handling the specified event, or null if not available.static final ComponentReturns the root parent when being called inComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)andComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)static final booleanisAutoUuid(String id) Returns whether an ID is generated automatically.static final booleanisReservedAttribute(String name) Returns if the attribute name is reserved.static Object[]parseEventExpression(Component comp, String evtexpr, Component defaultComp, boolean deferred) Pares the event expression.static final Collection<org.zkoss.json.JavaScriptValue>redraw(Collection<? extends Component> comps) An utilities to create an array of JavaScript objects (JavaScriptValue) that can be used to mount the specified widget at the clients.static final voidsetCurrentInfo(ComponentDefinition compdef) Sets the current component definition, which is used only byUiEngineto communicate withAbstractComponent.static voidsetCurrentInfo(ComponentInfo compInfo) Sets the current component definition, which is used only byUiEngineto communicate withAbstractComponent.static voidsetCurrentInfo(ShadowInfo compInfo) Sets the current shadow definition, which is used only byUiEngineto communicate withAbstractComponent.static final voidsetEventMethodCache(org.zkoss.util.Cache cache) Sets the cache that stores the information about event handler methods.static final voidsetRootParent(Component comp) Sets root parentstatic final StringReturns the automatically generate component's UUID/ID.
-
Field Details
-
DUMMY
Represents a dummy definition.
-
-
Constructor Details
-
ComponentsCtrl
public ComponentsCtrl()
-
-
Method Details
-
toAutoId
Returns the automatically generate component's UUID/ID. -
encodeId
Returns an ID representing the specified number The ID consists of 0-9, a-z and _.- Since:
- 5.0.5
-
isAutoUuid
Returns whether an ID is generated automatically. Note: true is returned if id is null. Also notice that this method doesn't check if a custom ID generator (IdGenerator) is assigned.- Since:
- 5.0.3
-
checkUuid
Checks if the given UUID is valid. UUID cannot be empty and can only have alphanumeric characters or underscore.- Throws:
UiException- if uuid is not valid.
-
isReservedAttribute
Returns if the attribute name is reserved. If name is null, false is returned.- Since:
- 3.0.0
-
getRootParent
Returns the root parent when being called inComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)andComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)- Since:
- 8.5.1
-
setRootParent
Sets root parentUsed only internally.
- Since:
- 8.5.1
-
getCurrentInfo
Returns the current component infoComponentInfo, definition (ComponentDefinitionor null, which is used only byUiEngineto communicate withAbstractComponent.- Since:
- 3.0.0
-
setCurrentInfo
Sets the current component definition, which is used only byUiEngineto communicate withAbstractComponent.Used only internally.
- Since:
- 3.0.0
-
setCurrentInfo
Sets the current component definition, which is used only byUiEngineto communicate withAbstractComponent.Used only internally.
- Since:
- 3.0.0
-
setCurrentInfo
Sets the current shadow definition, which is used only byUiEngineto communicate withAbstractComponent.Used only internally.
- Since:
- 8.0.0
-
parseEventExpression
public static Object[] parseEventExpression(Component comp, String evtexpr, Component defaultComp, boolean deferred) throws ComponentNotFoundException Pares the event expression.There are several formats for the event expression:
- onClick
- self.onClick
- id.onClick
- ../id1/id2.onClick
- ${elexpr}.onClick
- Parameters:
comp- the component that the event expression is referenced toevtexpr- 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
Applies the forward condition to the specified component.The basic format:
onEvent1=id1/id2.onEvent2,onEvent3=id3.onEvent4See
ComponentInfo.setForward(java.lang.String)for more information.- Since:
- 3.0.0
-
getEventMethod
Returns the method for handling the specified event, or null if not available. -
setEventMethodCache
public static final void setEventMethodCache(org.zkoss.util.Cache cache) Sets the cache that stores the information about event handler methods.Default:
FastReadCache. 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 Collection<org.zkoss.json.JavaScriptValue> redraw(Collection<? extends Component> comps) An utilities to create an array of JavaScript objects (JavaScriptValue) that can be used to mount the specified widget at the clients.- Since:
- 5.0.0
-