1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.trinidad.model;
20
21 /**
22 * Identifies a collection that is indexed by rowKeys.
23 * Data is accessed by setting a rowKey, and then accessing
24 * {@link #getRowData}.
25 */
26 public interface RowKeyIndex
27 {
28 /**
29 * Gets the number of values in this collection
30 * @return -1 if the number of values is not known.
31 */
32 public int getRowCount();
33
34 /**
35 * Gets the index of the current value.
36 * The current value is returned by calling {link #getRowData}
37 * @return the zero-based index of the current value, or -1 if there
38 * is no current value
39 */
40 public int getRowIndex();
41
42 /**
43 * Sets up a value at a particular index to be the current value.
44 * The current value is returned by calling {link #getRowData}
45 * @param rowIndex the zero-based index of the value to make current.
46 * Use -1 to clear the current value
47 */
48 public void setRowIndex(int rowIndex);
49
50 /**
51 * Gets the rowKey of the current value.
52 * The current value is returned by calling {link #getRowData}
53 * @return the rowKey of the current value, or null if there
54 * is no current value
55 */
56 public Object getRowKey();
57
58 /**
59 * Sets up a value at a particular rowKey to be the current value.
60 * The current value is returned by calling {link #getRowData}
61 * @param rowKey the rowKey of the value to make current.
62 * Use null to clear the current value
63 */
64 public void setRowKey(Object rowKey);
65
66 /**
67 * Checks to make sure a value exists for the current index or rowKey.
68 * This is useful if the number of values in this collection is not known
69 * (See {@link #getRowCount}).
70 * @see #getRowKey
71 * @see #getRowIndex
72 * @return true if a value exists; false otherwise.
73 */
74 public boolean isRowAvailable();
75
76 /**
77 * Gets the current value identified by the current index or rowKey.
78 * @see #getRowKey
79 * @see #getRowIndex
80 * @return null if the current value has been cleared.
81 */
82 public Object getRowData();
83
84 /**
85 * Checks to make sure a value exists for the given index.
86 * @param rowIndex the index of the row to check.
87 * @return true if a value exists; false otherwise.
88 */
89 public boolean isRowAvailable(int rowIndex);
90
91 /**
92 * Gets the row value at the given index.
93 * @param rowIndex the index of the row to get data from.
94 * @return null if the current value has been cleared.
95 */
96 public Object getRowData(int rowIndex);
97
98 }