KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.servlet.ServletRequest JavaDoc;
21
22 /**
23  * <p>
24  * This abstract base class acts as a service that exposes state information to a
25  * data grid.
26  * </p>
27  * <p>
28  * Implementations of the DataGridStateCodec should be request scoped and are not
29  * meant to be serialized. Implementations can hold references to the {@link ServletRequest}.
30  * In order to maintain a data grid's state across a request in a Java object,
31  * the {@link DataGridState} object should be used.
32  * </p>
33  */

34 public abstract class DataGridStateCodec {
35
36     private ServletRequest JavaDoc _request;
37     private String JavaDoc _gridName;
38
39     /**
40      * Set the {@link ServletRequest}. The ServletRequest can be used by implementations to
41      * discover information contained in request URL or searched for request attributes.
42      *
43      * @param request the current request
44      */

45     public void setServletRequest(ServletRequest JavaDoc request) {
46         _request = request;
47     }
48
49     /**
50      * Get the current servlet request with which this DataGridStateCodec is associated.
51      *
52      * @return the {@link ServletRequest}
53      */

54     public ServletRequest JavaDoc getServletRequest() {
55         return _request;
56     }
57
58     /**
59      * Set the data grid name with which this DataGridStateCodec is associated.
60      *
61      * @param gridName the data grid's name
62      */

63     public void setGridName(String JavaDoc gridName) {
64         _gridName = gridName;
65     }
66
67     /**
68      * Get the data grid name with which this DataGridStateCodec is associated.
69      *
70      * @return the data grid's name
71      */

72     public String JavaDoc getGridName() {
73         return _gridName;
74     }
75
76     /**
77      * Get the {@link DataGridState} for a data grid. This object contains the state
78      * which the data grid will use during rendering.
79      *
80      * @return the current {@link DataGridState} object
81      */

82     public abstract DataGridState getDataGridState();
83
84     /**
85      * Set the @{link DataGridState} object. This allows a client to apply a prior
86      * {@link DataGridState} object in order to explicitly set the data grid's state
87      * to a previously create set of objects.
88      *
89      * @param state the new {@link DataGridState}
90      */

91     public abstract void setDataGridState(DataGridState state);
92
93     /**
94      * Get a {@link DataGridURLBuilder} which can build be used to build URLs for
95      * a data grid's current state.
96      *
97      * @return the {@link DataGridURLBuilder} for the data grid's state
98      */

99     public abstract DataGridURLBuilder getDataGridURLBuilder();
100 }
101
Popular Tags