Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 *16 * $Header:$17 */18 package org.apache.beehive.netui.script.common;19 20 // java imports21 22 // internal imports23 24 // external imports25 26 /**27 * The IDataAccessProvider interface is implemented by objects28 * that need to provide their children with data and wish29 * to make it available to them with the <code>container</code>30 * binding context. Expression evaluation will process31 * 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, the43 * grandparent IDataAccessProvider may be referenced with the binding expression44 * <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 implemented49 * by repeating databound tags that iterate over a data set and render each item50 * in that data set. The item and iteration index are exposed through this51 * interface and can be bound to by tags inside of the repeating tag52 * that implements the IDataAccessProvider interface. This binding expression53 * should start with <code>container</code> and reference one of the properties above.54 * </p>55 */56 publicinterface IDataAccessProvider {57 58 /**59 * Get the current index in this iteration. This should be a60 * zero based integer that increments after each iteration.61 *62 * @return the current index of iteration or 063 */64 publicint 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 publicObject getCurrentItem();72 73 /**74 * Get the expression that references the data item to which the75 * IDataAccessProvider is bound.76 *77 * @return the expression referencing the data source or <code>null</code> if no78 * dataSource is set79 */80 publicString getDataSource();81 82 /**83 * Get a metadata object for the current item. This interface84 * is optional, and implementations of this interface are85 * provided by the IDataAccessProvider interface. See these86 * implementations for information about their support for87 * current item metadata.88 *89 * @return the current metadata or <code>null</code> if no metadata can be90 * found or metadata is not supported by a IDataAccessProvider implementation91 */92 publicObject getCurrentMetadata();93 94 /**95 * Get the parent IDataAccessProvider of a DataAccessProvider. A DataAccessProvider96 * 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 parent98 * providers. Implementations of this interface are left with having99 * to discover and export parents. The return value from this call100 * on an implementing Object can be <code>null</code>.101 *102 * @return the parent DataAccessProvider or <code>null</code> if this method103 * is not supported or the parent can not be found.104 */105 publicIDataAccessProvider getProviderParent();106 }107