org.zkoss.zk.ui.sys
Interface IdGenerator


public interface IdGenerator

Used to generate UUID of components and pages and ID of desktops.

To create an ID generator that generates the same set of IDs from one test run to anther, you need only to implement nextDesktopId(org.zkoss.zk.ui.Desktop) to return a deterministic value. All other methods just return null to use the default.

Since:
2.4.1
Author:
tomyeh
See Also:
Component.getUuid(), Page.getUuid(), Desktop.getId()

Method Summary
 java.lang.String nextComponentUuid(Desktop desktop, Component comp)
          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.
 

Method Detail

nextComponentUuid

java.lang.String nextComponentUuid(Desktop desktop,
                                   Component comp)
Returns the next component UUID for the specified component, or null to generate the default UUID.

Default (if null is returned): UUID is generated by prefixing a portion of the desktop's ID with a number starting from 0.

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.

Parameters:
desktop - the current desktop (never null)
comp - the component (never null)
Returns:
the next component UUID, or null to generate the default UUID.
Note: don't return an UUID containing ':'.

nextPageUuid

java.lang.String nextPageUuid(Page page)
Returns the next page UUID for the specified page, or null to generate the default UUID.

Default (if null is returned): UUID is generated by prefixing a portion of the desktop's ID with a number starting from 0.

Note: we can retrieve the execution by use of Executions.getCurrent().

Returns:
the next page UUID, or null to generate the default UUID.

nextDesktopId

java.lang.String nextDesktopId(Desktop desktop)
Returns the next desktop ID for the specified desktop, or null to generate the default ID.

Default (if null is returned): ID is generated randomly. In other words, the desktop's ID, by default, is not deterministic. To have a deterministric value, you have to implement this method.

Note: we can retrieve the execution by use of Desktop.getExecution(), or Executions.getCurrent().

Returns:
the next desktop ID, or null to generate the default ID.


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