01: /*
02: * Copyright 2007 MyGWT.
03: *
04: * Licensed under the MyGWT License, Version 1.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://mygwt.net/license
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package net.mygwt.ui.client.data;
17:
18: import java.util.HashMap;
19: import java.util.Map;
20:
21: import com.google.gwt.user.client.rpc.IsSerializable;
22:
23: /**
24: * Contains configuration data for a data load operations.
25: */
26: public class LoadConfig implements IsSerializable {
27:
28: /**
29: * start specifies the current cursor.
30: */
31: public int start;
32:
33: /**
34: * limit specifies the number of records being requested.
35: */
36: public int limit;
37:
38: /**
39: * sortField specifies the field to sort by.
40: */
41: public String sortField;
42:
43: /**
44: * sortDir specifies the requested sort direction.
45: */
46: public int sortDir;
47:
48: /**
49: * dataMap contains application specific load properties
50: *
51: * @gwt.typeArgs <java.lang.String,com.google.gwt.user.client.rpc.IsSerializable>
52: */
53: protected Map dataMap;
54:
55: /**
56: * Returns the application specific load property for the given name, or
57: * <code>null</code> if it has not been set.
58: *
59: * @param key the name of the property
60: * @return the value or <code>null</code> if it has not been set
61: */
62: public Object getData(String key) {
63: if (dataMap == null)
64: return null;
65: return dataMap.get(key);
66: }
67:
68: /**
69: * Sets the application specific load property with the given name.
70: *
71: * @param key the name of the property
72: * @param config the new value for the property
73: */
74: public void setData(String key, Object config) {
75: if (dataMap == null)
76: dataMap = new HashMap();
77: dataMap.put(key, config);
78: }
79:
80: public String toString() {
81: StringBuffer sb = new StringBuffer();
82: sb.append("start=" + start);
83: sb.append("&limit=" + limit);
84: sb.append("&sortField=" + sortField);
85: sb.append("&sortDir=" + sortDir);
86: return sb.toString();
87: }
88:
89: }
|