KickJava   Java API By Example, From Geeks To Geeks.

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


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.Map JavaDoc;
21
22 /**
23  * <p>
24  * This abstract class provides methods that are used to build maps of URL parameters
25  * containing current ahd future data grid state. These are useful for building
26  * anchors and other kinds of requests that when clicked / submitted can move to
27  * the next or previous page of data or change the state of sorts or filters for
28  * a data grid.
29  * </p>
30  * <p>
31  * Subclasses are free to implement the contents of the parameter map with whatever
32  * parameter key / values that make sense for a particular data grid. For example,
33  * some data grids may encode sort, filter, and paging information in the URL. Others
34  * may add information about row selection and not add sort / filter parameters. Be
35  * sure to check the documentation for a specific DataGridURLBuilder subclass to
36  * find out what specific parameters are available in the parameter maps.
37  * </p>
38  * <p>
39  * Parameter maps produced by methods on this class should contain key / value pairs
40  * where the key is of type <code>String</code> and the values are of type
41  * <code>String[]</code>. The parameter maps should also include all of the
42  * additional "current" URL parameters in order to maintain the "current" view
43  * state and modifying only state associated with a single data grid. Subclasses are
44  * free to change this behavior.
45  * </p>
46  */

47 public abstract class DataGridURLBuilder {
48
49     /**
50      * Get a {@link Map} containing the current state of the data grid.
51      * @return the parameter map
52      */

53     public abstract Map JavaDoc getQueryParams();
54
55     /**
56      * Get a parameter map that contains the grid's current state with a
57      * value that will set the current to the first page.
58      *
59      * @return the parameter map
60      */

61     public abstract Map JavaDoc getQueryParamsForFirstPage();
62
63     /**
64      * Get a parameter map that contains the grid's current state with a
65      * value that will set the current page to the previous page.
66      *
67      * @return the parameter map
68      */

69     public abstract Map JavaDoc getQueryParamsForPreviousPage();
70
71     /**
72      * Get a parameter map that contains the grid's current state with a
73      * value that will set the current page to the next page.
74      *
75      * @return the parameter map
76      */

77     public abstract Map JavaDoc getQueryParamsForNextPage();
78
79     /**
80      * Get a parameter map that contains the grid's current state with a
81      * value that will set the current page to the last page.
82      *
83      * @return the parameter map
84      */

85     public abstract Map JavaDoc getQueryParamsForLastPage();
86
87     /**
88      * Get a String array that contains the values which can be used to
89      * reach any page in the data grid.
90      *
91      * @return an array of the query parameter values for each page
92      */

93     public abstract String JavaDoc[] getPagerParamValues();
94
95     /**
96      * Get the String for the pager query parameter key.
97      *
98      * @return the query parameter key for accessing the current page from the URL
99      */

100     public abstract String JavaDoc getPagerRowQueryParamKey();
101
102     /**
103      * Get a parameter map that contains the grid's current state with the
104      * sort matching the given <code>sortExpression</code> switched to the
105      * next available sort direction.
106      *
107      * @param sortExpression the sort expression whose sort value to change
108      * @return the parameter map
109      */

110     public abstract Map JavaDoc buildSortQueryParamsMap(String JavaDoc sortExpression);
111 }
112
Popular Tags