Source Code Cross Referenced for DataGridResourceProvider.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » databinding » datagrid » api » 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.api 
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.api;
020:
021:        import java.util.Locale;
022:        import java.util.ResourceBundle;
023:        import java.text.MessageFormat;
024:
025:        /**
026:         * <p>
027:         * This abstract class provides an abstraction used for obtaining messages and strings used
028:         * during data grid rendering.
029:         * </p>
030:         */
031:        public abstract class DataGridResourceProvider {
032:
033:            private boolean _enableChaining = false;
034:            private String _resourceBundlePath = null;
035:            private Locale _locale = null;
036:
037:            /**
038:             * Abstract method used to obtain a message {@link String} given a <code>key</code>
039:             *
040:             * @param key the key used to lookup a {@link String}
041:             * @return the returned String if a message is found matching the key
042:             */
043:            public abstract String getMessage(String key);
044:
045:            /**
046:             * Abstract method used to format a pattern given a pattern / message key and an array of
047:             * arguments.
048:             *
049:             * @param key the key to use when looking up a message to format
050:             * @param args the arguments to use when formatting a message
051:             * @return the formatted message if a message is found matching the key
052:             */
053:            public abstract String formatMessage(String key, Object[] args);
054:
055:            /**
056:             * Accessor for determining if implementations are chaining enabled.  When chaining
057:             * is enabled, subclasses must use any nested DataGridResourceProvider instances to
058:             * lookup messages.  When chaining is enabled, the default messages for the data grid
059:             * will be returned.  When chaining is disabled, implementations are free to
060:             * hide message keys.
061:             *
062:             * @return <code>true</code> if chaining is enabled; <code>false</code> otherwise
063:             */
064:            public boolean isEnableChaining() {
065:                return _enableChaining;
066:            }
067:
068:            /**
069:             * Setter for enabling or disabling chaining
070:             *
071:             * @param enableChaining the new chaining enabled value
072:             */
073:            public void setEnableChaining(boolean enableChaining) {
074:                _enableChaining = enableChaining;
075:            }
076:
077:            /**
078:             * Set the {@link Locale} in which a message {@link String} should be looked up.
079:             *
080:             * @param locale the {@link Locale} to use
081:             */
082:            public void setLocale(Locale locale) {
083:                _locale = locale;
084:            }
085:
086:            /**
087:             * Accessor for obtaining the {@link Locale} used when looking up messages.
088:             *
089:             * @return the {@link Locale} used for message lookup or <code>null</code> if no {@link Locale} was set
090:             */
091:            public Locale getLocale() {
092:                return _locale;
093:            }
094:
095:            /**
096:             * Set the path used for creating a {@link ResourceBundle} object.
097:             *
098:             * @param resourceBundlePath the path to a resource bundle
099:             */
100:            public void setResourceBundlePath(String resourceBundlePath) {
101:                _resourceBundlePath = resourceBundlePath;
102:            }
103:
104:            /**
105:             * Accessor for obtaining the path to the resource bundle used by a DataGridResourceProvider
106:             * implementation.
107:             *
108:             * @return the path to the {@link ResourceBundle}
109:             */
110:            public String getResourceBundlePath() {
111:                return _resourceBundlePath;
112:            }
113:
114:            protected ResourceBundle createResourceBundle(String path) {
115:                ResourceBundle rb = ResourceBundle.getBundle(path, getLocale(),
116:                        Thread.currentThread().getContextClassLoader());
117:                return rb;
118:            }
119:
120:            /**
121:             * Internal convenience method that is used to format a message given a pattern
122:             * and a set of arguments.
123:             *
124:             * @param pattern the pattern to format
125:             * @param args the arguments to use when formatting
126:             * @return the formatted string
127:             */
128:            protected String internalFormatMessage(String pattern, Object[] args) {
129:                /* todo: perf -- could the MessageFormat objects be cached? */
130:                MessageFormat format = new MessageFormat(pattern);
131:                String msg = format.format(args).toString();
132:                return msg;
133:            }
134:        }
w___w__w___._j__a_v_a_2__s___.c__om__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.