KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > script > common > IDataAccessProvider


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.script.common;
19
20 // java imports
21

22 // internal imports
23

24 // external imports
25

26 /**
27  * The IDataAccessProvider interface is implemented by objects
28  * that need to provide their children with data and wish
29  * to make it available to them with the <code>container</code>
30  * binding context. Expression evaluation will process
31  * all <code>container</code> context references against this interface;
32  * several read-only properties are exposed:
33  * <table cellpadding="2" cellspacing="0" border="1">
34  * <tr><th>Method</th><th>NetUI Data Binding Expression</th><th>Required</th></tr>
35  * <tr><td>getCurrentIndex()</td><td><code>container.index</code></td><td>Yes</td></tr>
36  * <tr><td>getCurrentItem()</td><td><code>container.item</code></td><td>Yes</td></tr>
37  * <tr><td>getCurrentMetadata()</td><td><code>container.metadata</code></td><td>No</td></tr>
38  * <tr><td>getDataSource()</td><td><code>container.dataSource</code></td><td>Yes</td></tr>
39  * <tr><td>getProviderParent()</td><td><code>container.container</code></td><td>Yes</td></tr>
40  * </table>
41  * <p/>
42  * In cases where a IDataAccessProvider contains another IDataAccessProvider, the
43  * grandparent IDataAccessProvider may be referenced with the binding expression
44  * <code>container.container</code>. For example, the item, with the property firstName,
45  * may be accessed with the expression <code>container.container.item.firstName</code>.
46  * </p>
47  * <p/>
48  * The general use of the IDataAccessProvider is as an interface that is implemented
49  * by repeating databound tags that iterate over a data set and render each item
50  * in that data set. The item and iteration index are exposed through this
51  * interface and can be bound to by tags inside of the repeating tag
52  * that implements the IDataAccessProvider interface. This binding expression
53  * should start with <code>container</code> and reference one of the properties above.
54  * </p>
55  */

56 public interface IDataAccessProvider {
57
58     /**
59      * Get the current index in this iteration. This should be a
60      * zero based integer that increments after each iteration.
61      *
62      * @return the current index of iteration or 0
63      */

64     public int getCurrentIndex();
65
66     /**
67      * Get the current data item in this IDataAccessProvider.
68      *
69      * @return the current data item or <code>null</code>
70      */

71     public Object JavaDoc getCurrentItem();
72
73     /**
74      * Get the expression that references the data item to which the
75      * IDataAccessProvider is bound.
76      *
77      * @return the expression referencing the data source or <code>null</code> if no
78      * dataSource is set
79      */

80     public String JavaDoc getDataSource();
81
82     /**
83      * Get a metadata object for the current item. This interface
84      * is optional, and implementations of this interface are
85      * provided by the IDataAccessProvider interface. See these
86      * implementations for information about their support for
87      * current item metadata.
88      *
89      * @return the current metadata or <code>null</code> if no metadata can be
90      * found or metadata is not supported by a IDataAccessProvider implementation
91      */

92     public Object JavaDoc getCurrentMetadata();
93
94     /**
95      * Get the parent IDataAccessProvider of a DataAccessProvider. A DataAccessProvider
96      * implementation may be able to nest DataAccessProviders. In this case,
97      * it can be useful to be able to also nest access to data from parent
98      * providers. Implementations of this interface are left with having
99      * to discover and export parents. The return value from this call
100      * on an implementing Object can be <code>null</code>.
101      *
102      * @return the parent DataAccessProvider or <code>null</code> if this method
103      * is not supported or the parent can not be found.
104      */

105     public IDataAccessProvider getProviderParent();
106 }
107
Popular Tags