Source Code Cross Referenced for DefaultDataGridConfig.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » databinding » datagrid » runtime » config » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.databinding.datagrid.runtime.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.databinding.datagrid.runtime.config;
020:
021:        import java.util.List;
022:
023:        import javax.servlet.ServletRequest;
024:
025:        import org.apache.beehive.netui.databinding.datagrid.api.sort.Sort;
026:        import org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel;
027:        import org.apache.beehive.netui.databinding.datagrid.api.sort.SortStrategy;
028:        import org.apache.beehive.netui.databinding.datagrid.api.filter.FilterModel;
029:        import org.apache.beehive.netui.databinding.datagrid.api.filter.Filter;
030:        import org.apache.beehive.netui.databinding.datagrid.api.pager.PagerModel;
031:        import org.apache.beehive.netui.databinding.datagrid.api.rendering.PagerRenderer;
032:        import org.apache.beehive.netui.databinding.datagrid.api.rendering.StyleModel;
033:        import org.apache.beehive.netui.databinding.datagrid.api.DataGridConfig;
034:        import org.apache.beehive.netui.databinding.datagrid.api.DataGridResourceProvider;
035:        import org.apache.beehive.netui.databinding.datagrid.api.DataGridState;
036:        import org.apache.beehive.netui.databinding.datagrid.api.DataGridStateCodec;
037:        import org.apache.beehive.netui.databinding.datagrid.runtime.rendering.pager.PreviousNextPagerRenderer;
038:        import org.apache.beehive.netui.databinding.datagrid.runtime.model.style.DefaultStyleModel;
039:        import org.apache.beehive.netui.databinding.datagrid.runtime.model.style.EmptyStyleModel;
040:
041:        /**
042:         * <p>
043:         * Default implementation of the {@link DataGridConfig} base class.  This class is used to provide concrete
044:         * implementations of state containers and service providers for the data grid.
045:         * </p>
046:         */
047:        public class DefaultDataGridConfig extends DataGridConfig {
048:
049:            private static final String STYLE_POLICY_NAME_EMPTY = "empty";
050:            private static final String STYLE_POLICY_NAME_DEFAULT = "default";
051:            private static final String STYLE_PREFIX_DEFAULT = "datagrid";
052:
053:            private static final StyleModel DEFAULT_STYLE_POLICY = new DefaultStyleModel(
054:                    STYLE_PREFIX_DEFAULT);
055:            private static final StyleModel EMPTY_STYLE_POLICY = new EmptyStyleModel();
056:            private static final SortStrategy SORT_STRATEGY = new DefaultSortStrategy();
057:
058:            /**
059:             * Create a {@link DataGridState} object.  The default implementation returned is
060:             * {@link DataGridState}.
061:             * @return a data grid state implementation
062:             */
063:            public DataGridState createDataGridState() {
064:                return new DataGridState();
065:            }
066:
067:            /**
068:             * Create a {@link Sort} object.  The default implementation returned is {@link Sort}.
069:             * @return a sort
070:             */
071:            public Sort createSort() {
072:                return new Sort();
073:            }
074:
075:            /**
076:             * Create a {@link Filter} object.  The default implementation returned is {@link Filter}.
077:             * @return a filter
078:             */
079:            public Filter createFilter() {
080:                return new Filter();
081:            }
082:
083:            /**
084:             * Create a {@link SortModel} object.  The default implementation returned is {@link SortModel} with a
085:             * {@link SortStrategy} of {@link org.apache.beehive.netui.databinding.datagrid.runtime.config.DefaultSortStrategy}.
086:             * @param sorts the list of sorts for a data grid
087:             * @return a sort model
088:             */
089:            public SortModel createSortModel(List/*<Sort>*/sorts) {
090:                SortModel sortModel = new SortModel(sorts);
091:                sortModel.setSortStrategy(SORT_STRATEGY);
092:                return sortModel;
093:            }
094:
095:            /**
096:             * Create a {@link FilterModel} object.  The default implementation returned is {@link FilterModel}.
097:             * @param filters the list of filters for a data grid
098:             * @return a filter model
099:             */
100:            public FilterModel createFilterModel(List/*<Filter>*/filters) {
101:                return new FilterModel(filters);
102:            }
103:
104:            /**
105:             * Create a {@link PagerModel} object.  The default implementation returned is {@link PagerModel}.
106:             * @return a pager model
107:             */
108:            public PagerModel createPagerModel() {
109:                return new PagerModel();
110:            }
111:
112:            /**
113:             * Create a {@link DataGridStateCodec} for a grid with the given name for the given {@link ServletRequest}.
114:             * @param request the current request
115:             * @param gridName a data grid's name
116:             * @return the state encoder / decoder for a data grid's request state
117:             */
118:            public DataGridStateCodec createStateCodec(ServletRequest request,
119:                    String gridName) {
120:                DefaultDataGridStateCodec codec = new DefaultDataGridStateCodec(
121:                        this );
122:                codec.setServletRequest(request);
123:                codec.setGridName(gridName);
124:                return codec;
125:            }
126:
127:            /**
128:             * Get the default {@link PagerRenderer}.  The default pager renderer will display a pager with previous / next
129:             * page links via the implementation class {@link PreviousNextPagerRenderer}.
130:             * @return the pager renderer
131:             */
132:            public PagerRenderer getDefaultPagerRenderer() {
133:                return new PreviousNextPagerRenderer();
134:            }
135:
136:            /**
137:             * Get a {@link DataGridResourceProvider}.  The default implementation class is
138:             * {@link org.apache.beehive.netui.databinding.datagrid.runtime.config.DefaultDataGridResourceProvider}
139:             * and provides a basic implementation that reads messages from the default .properties file.
140:             * @return the resource provider
141:             */
142:            public DataGridResourceProvider getDefaultResourceProvider() {
143:                return new DefaultDataGridResourceProvider();
144:            }
145:
146:            /**
147:             * Get a {@link DataGridResourceProvider} for the given resource bundle path.  The default implementation
148:             * will set this resource bundle but does not enable message chaining.
149:             * @param resourceBundle a resource bundle specifically requested by a data grid
150:             * @return the resource provider
151:             */
152:            public DataGridResourceProvider getResourceProvider(
153:                    String resourceBundle) {
154:                DataGridResourceProvider resourceProvider = new DefaultDataGridResourceProvider();
155:                resourceProvider.setResourceBundlePath(resourceBundle);
156:                return resourceProvider;
157:            }
158:
159:            /**
160:             * Get a {@link StyleModel} given a model name and a style class prefix.  This class exposes two available
161:             * style names:
162:             * <table>
163:             * <tr><td>Name</td><td>Description</td><td>Implementation Class</td></tr>
164:             * <tr><td><code>empty</code></td>
165:             *     <td>Renders CSS style classes that are non-prefixed and generally empty.</td>
166:             *     <td>{@link EmptyStyleModel}</td>
167:             * </tr>
168:             * <tr><td><code>default</code></td>
169:             *     <td>Renders CSS style classes with names using a default prefix of <code>datagrid</code></td>
170:             *     <td>{@link DefaultStyleModel}</td>
171:             * </tr>
172:             * </table>
173:             * When using the <code>empty</code> style model, styles rendered on the &lt;table&gt; element will
174:             * be empty; the same style rendered wtih the <code>default</code> style model will render as
175:             * <code>class="datagrid"</code>.  If the style prefix "foo" is provided for the <code>default</code> style policy
176:             * the style name will be rendered as <code>class="foo"</code>.x
177:             * @param name the name of a {@link StyleModel} implementation to use
178:             * @param classPrefix the prefix for a style name
179:             * @return the style model
180:             */
181:            public StyleModel getStyleModel(String name, String classPrefix) {
182:                if (name == null || name.equals(STYLE_POLICY_NAME_DEFAULT)) {
183:                    if (classPrefix != null)
184:                        return new DefaultStyleModel(classPrefix);
185:                    else
186:                        return DEFAULT_STYLE_POLICY;
187:                } else if (name != null && name.equals(STYLE_POLICY_NAME_EMPTY))
188:                    return EMPTY_STYLE_POLICY;
189:                else
190:                    return DEFAULT_STYLE_POLICY;
191:            }
192:        }
w_ww._jav__a___2_s_.___com___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.