public class StaticIdGenerator extends java.lang.Object implements IdGenerator, java.io.Serializable
To use this Id Generator, add system-config in zk.xml.
<system-config> <id-generator-class>org.zkoss.zk.ui.impl.StaticIdGenerator</id-generator-class> </system-config>
Constructor and Description |
---|
StaticIdGenerator() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
nextComponentUuid(Desktop desktop,
Component comp,
ComponentInfo compInfo)
Returns the next component UUID for the specified component,
or null to generate the default UUID.
|
java.lang.String |
nextDesktopId(Desktop desktop)
Returns the next desktop ID for the specified desktop,
or null to generate the default ID.
|
java.lang.String |
nextPageUuid(Page page)
Returns the next page UUID for the specified page,
or null to generate the default UUID.
|
public java.lang.String nextComponentUuid(Desktop desktop, Component comp, ComponentInfo compInfo)
IdGenerator
Default (if null is returned): UUID is generated by prefixing a portion of the desktop's ID with a number starting from 0.
Notice that UUID cannot be empty and can only have alphanumeric characters or underscore (i.e., a-z, A-Z, 0-9, and _).
This method is called when Component.getUuid()
is called at the first time. It is usually when
the component is attached to a page, unless the application
invokes Component.getUuid()
earlier.
nextComponentUuid
in interface IdGenerator
desktop
- the current desktop (never null)comp
- the component (never null)compInfo
- the information about the properties specified in the ZUML
document, null if the component is instantiated manually.public java.lang.String nextPageUuid(Page page)
IdGenerator
Default (if null is returned): UUID is generated by prefixing a portion of the desktop's ID with a number starting from 0.
Notice that UUID cannot be empty and can only have alphanumeric characters or underscore (i.e., a-z, A-Z, 0-9, and _). In additions, UUID for pages cannot be the same as UUID for components.
Also notice that the execution can be retrieved by use of
Executions.getCurrent()
.
nextPageUuid
in interface IdGenerator
public java.lang.String nextDesktopId(Desktop desktop)
IdGenerator
Default (if null is returned): ID is generated randomly. In other words, the desktop's ID, by default, is not deterministic. To have a deterministic value, you have to implement this method.
Notice that UUID cannot be empty and can only have alphanumeric characters or underscore (i.e., a-z, A-Z, 0-9, and _).
Also notice that we can retrieve the execution by use of
Desktop.getExecution()
, or Executions.getCurrent()
.
nextDesktopId
in interface IdGenerator
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.