KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > databinding > datagrid > api > DataGridConfig


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.databinding.datagrid.api;
19
20 import java.util.List JavaDoc;
21 import javax.servlet.ServletRequest JavaDoc;
22
23 import org.apache.beehive.netui.databinding.datagrid.api.sort.Sort;
24 import org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel;
25 import org.apache.beehive.netui.databinding.datagrid.api.filter.FilterModel;
26 import org.apache.beehive.netui.databinding.datagrid.api.filter.Filter;
27 import org.apache.beehive.netui.databinding.datagrid.api.pager.PagerModel;
28 import org.apache.beehive.netui.databinding.datagrid.api.rendering.PagerRenderer;
29 import org.apache.beehive.netui.databinding.datagrid.api.rendering.StyleModel;
30
31 /**
32  * <p>
33  * Abstract class used by the data grid to create model objects used for state
34  * management and rendering. This abstraction exists in order to allow the data grid's
35  * implementation to be configurable. Various data grid implementation classes are exposed
36  * here including sorting, filtering, and paging. In addition, classes such as the
37  * {@link PagerRenderer} and {@link StyleModel} are created by subclasses in order to provide
38  * a data grid specific implementation of pager UI or style support.
39  * </p>
40  * <p>
41  * By default, DataGridConfig implementations are not thread safe, but custom implementations are
42  * free to store instance state as long as the DataGridConfig object lifetimes are managed
43  * in user code.
44  * </p>
45  * <p>
46  * A specific DataGridConfig object can be created and passed to a data grid via the
47  * data grid's
48  * {@link org.apache.beehive.netui.tags.databinding.datagrid.DataGrid#setDataGridConfig(DataGridConfig)}
49  * method.
50  * </p>
51  */

52 public abstract class DataGridConfig
53     implements java.io.Serializable JavaDoc {
54
55     /**
56      * <p>
57      * Create a {@link DataGridState} instance that will be used to store the state for a data grid. This
58      * method will be called only when a DataGridState object needs to be manufactured by a data grid tag.
59      * </p>
60      *
61      * @return the {@link DataGridState} object for a data grid.
62      */

63     public abstract DataGridState createDataGridState();
64
65     /**
66      * <p>
67      * Create a concrete {@link Sort} implementation for a data grid. When the sort state of a data grid
68      * is created, this {@link Sort} instance will contain a single sort.
69      * </p>
70      * @return a {@link Sort} instance
71      */

72     public abstract Sort createSort();
73
74     /**
75      * <p>
76      * Create a {@link SortModel} instance used to store the {@link Sort} state for a data grid.
77      * </p>
78      * @param sorts the current {@link List} of sorts for a data grid
79      * @return the {@link SortModel}
80      */

81     public abstract SortModel createSortModel(List JavaDoc/*<Sort>*/ sorts);
82
83     /**
84      * <p>
85      * Create a concrete {@link org.apache.beehive.netui.databinding.datagrid.api.filter.Filter} implementation for a data grid. When the filter state of a data grid
86      * is created, this {@link org.apache.beehive.netui.databinding.datagrid.api.filter.Filter} instance will contain a single filter.
87      * </p>
88      * @return a {@link org.apache.beehive.netui.databinding.datagrid.api.filter.Filter} instance
89      */

90     public abstract Filter createFilter();
91
92     /**
93      * <p>
94      * Create a {@link FilterModel} instance used to store the {@link Filter} state for a data grid.
95      * </p>
96      * @param filters the current {@link List} of filters for a data grid
97      * @return a {@link FilterModel}
98      */

99     public abstract FilterModel createFilterModel(List JavaDoc/*<Filter>*/ filters);
100
101     /**
102      * <p>
103      * Create a {@link PagerModel} instance used to store the current paging state for a data grid.
104      * </p>
105      * @return a {@link PagerModel}
106      */

107     public abstract PagerModel createPagerModel();
108
109     /**
110      * <p>
111      * Create a {@link DataGridStateCodec} instance used to obtain services for handling data grid state.
112      * </p>
113      * @param request the current {@link ServletRequest}
114      * @param gridName the name of a data grid whose {@link DataGridStateCodec} to obtain
115      * @return a {@link DataGridStateCodec}
116      */

117     public abstract DataGridStateCodec createStateCodec(ServletRequest JavaDoc request, String JavaDoc gridName);
118
119     /**
120      * <p>
121      * Create the default {@link DataGridResourceProvider}. A resource provider is an implementation of
122      * the {@link DataGridResourceProvider} which is used during data grid rendering to obtain strings
123      * for messages, paths, etc. The default resource provider simply exposes the default data grid
124      * messages stored in the properties file located at:
125      * <pre>
126      * org.apache.beehive.netui.databinding.datagrid.runtime.util.data-grid-default.properties
127      * </pre>
128      * </p>
129      * @return a {@link DataGridResourceProvider}
130      */

131     public abstract DataGridResourceProvider getDefaultResourceProvider();
132
133     /**
134      * <p>
135      * Create a DataGridConfig-specific implementation of a {@link DataGridResourceProvider}. The DataGridConfig
136      * instance should use the provided resource bundle path to create a {@link DataGridResourceProvider} which
137      * will expose those messages into the data grid for rendering.
138      * </p>
139      * @param resourceBundle the resource bundle to use for grid messages
140      * @return a {@link DataGridResourceProvider}
141      */

142     public abstract DataGridResourceProvider getResourceProvider(String JavaDoc resourceBundle);
143
144     /**
145      * <p>
146      * Create a {@link StyleModel} used by a data grid to render styles onto various HTML markup elements
147      * generated by a data grid.
148      * </p>
149      * @param name the name of a style type to support. This name can vary by {@link DataGridConfig} implementation
150      * subclasses may use this value to configure the type of {@link StyleModel} returned to the caller.
151      * @param classPrefix an optional prefix to use when generating style class names
152      * @return the {@link StyleModel}
153      */

154     public abstract StyleModel getStyleModel(String JavaDoc name, String JavaDoc classPrefix);
155
156     /**
157      * <p>
158      * Create a concrete {@link PagerRenderer} implementation that will be used to render the pager
159      * in the absence of an alternate pager renderer.
160      * </p>
161      * @return the default {@link PagerRenderer} used to render a paging user interface
162      */

163     public abstract PagerRenderer getDefaultPagerRenderer();
164 }
165
Popular Tags