01: /* IdGenerator.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Thu Jun 21 12:00:55 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zk.ui.sys;
20:
21: import org.zkoss.zk.ui.Desktop;
22: import org.zkoss.zk.ui.Page;
23: import org.zkoss.zk.ui.Component;
24:
25: /**
26: * Used to generate UUID of components and pages and ID of desktops.
27: *
28: * @author tomyeh
29: * @see Component#getUuid
30: * @see Page#getUuid
31: * @see Desktop#getId
32: * @since 2.4.1
33: */
34: public interface IdGenerator {
35: /** Returns the next component UUID for the specified component,
36: * or null to generate the default UUID.
37: *
38: * <p>This method is called when {@link Component#getUuid}
39: * is called at the first time. It is usually when
40: * the component is attached to a page, unless the application
41: * invokes {@link Component#getUuid} earlier.
42: *
43: * @param desktop the current desktop (never null)
44: * @param comp the component (never null)
45: * @return the next component UUID, or null to generate the
46: * default UUID.
47: */
48: public String nextComponentUuid(Desktop desktop, Component comp);
49:
50: /** Returns the next page UUID for the specified page,
51: * or null to generate the default UUID.
52: *
53: * <p>Note: we can retrieve the execution by use of
54: * {@link org.zkoss.zk.ui.Executions#getCurrent}.
55: *
56: * @return the next page UUID, or null to generate the
57: * default UUID.
58: */
59: public String nextPageUuid(Page page);
60:
61: /** Returns the next desktop ID for the specified desktop,
62: * or null to generate the default UUID.
63: *
64: * <p>Note: we can retrieve the execution by use of
65: * {@link Desktop#getExecution}, or {@link org.zkoss.zk.ui.Executions#getCurrent}.
66: *
67: * @return the next desktop UUID, or null to generate the
68: * default UUID.
69: */
70: public String nextDesktopId(Desktop desktop);
71: }
|