Source Code Cross Referenced for StyleModel.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » databinding » datagrid » api » rendering » 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.rendering 
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.rendering;
020:
021:        import org.apache.beehive.netui.util.internal.InternalStringBuilder;
022:
023:        import java.util.List;
024:
025:        /**
026:         * <p>
027:         * JavaBean base class that creates HTML style class names used to render various HTML elements in the data grid.
028:         * </p>
029:         */
030:        public abstract class StyleModel {
031:
032:            private static final String DELIM = "-";
033:            private static final String SPACE = " ";
034:            private static final String EMPTY = "";
035:
036:            private String _stylePrefix = null;
037:
038:            /**
039:             * Default constructor.
040:             */
041:            public StyleModel() {
042:            }
043:
044:            /**
045:             * Constructor that takes a style prefix string.  If a style prefix is provided, StyleModel subclasses
046:             * should use this as a prefix to any style names that are produced.
047:             *
048:             * @param stylePrefix the prefix to use for styles
049:             */
050:            public StyleModel(String stylePrefix) {
051:                _stylePrefix = stylePrefix;
052:            }
053:
054:            /**
055:             * Set the style prefix.
056:             * @param stylePrefix the style prefix
057:             */
058:            public void setStylePrefix(String stylePrefix) {
059:                _stylePrefix = stylePrefix;
060:            }
061:
062:            /**
063:             * Get the style prefix
064:             * @return the style prefix
065:             */
066:            public String getStylePrefix() {
067:                return _stylePrefix;
068:            }
069:
070:            /**
071:             * Get the style class for an HTML table tag.
072:             * @return the style class
073:             */
074:            public abstract String getTableClass();
075:
076:            /**
077:             * Get the style class for an HTML caption tag.
078:             * @return the style class
079:             */
080:            public abstract String getCaptionClass();
081:
082:            /**
083:             * Get the style class for an HTML thead tag.
084:             * @return the style class
085:             */
086:            public abstract String getTableHeadClass();
087:
088:            /**
089:             * Get the style class for an HTML tfoot tag.
090:             * @return the style class
091:             */
092:            public abstract String getTableFootClass();
093:
094:            /**
095:             * Get the style class for an HTML tr tag rendered in the grid's header.
096:             * @return the style class
097:             */
098:            public abstract String getHeaderRowClass();
099:
100:            /**
101:             * Get the style class for an HTML tr tag rendered in the grid's footer.
102:             * @return the style class
103:             */
104:            public abstract String getFooterRowClass();
105:
106:            /**
107:             * Get the style class for an HTML tr tag rendered in a grid row.  This style class will be used on
108:             * even numbered rows.
109:             * @return the style class
110:             */
111:            public abstract String getRowClass();
112:
113:            /**
114:             * Get the style class for an HTML tr tag rendered in a grid row.  This style class will be used on
115:             * odd numbered rows.
116:             * @return the style class
117:             */
118:            public abstract String getAltRowClass();
119:
120:            /**
121:             * Get the style class for an HTML td tag rendered for a grid cell.
122:             * @return the style class
123:             */
124:            public abstract String getDataCellClass();
125:
126:            /**
127:             * Get the style class for an HTML th tag rendered for a grid's header cell.
128:             * @return the style class
129:             */
130:            public abstract String getHeaderCellClass();
131:
132:            /**
133:             * Get the style class for an HTML th tag for a grid's header cell whose data is sorted.
134:             * @return the style class
135:             */
136:            public abstract String getHeaderCellSortedClass();
137:
138:            /**
139:             * Get the style class for an HTML th tag for a grid's header cell that is sortable.
140:             * @return the style class
141:             */
142:            public abstract String getHeaderCellSortableClass();
143:
144:            /**
145:             * Get the style class for an HTML th tag for a grid's header cell that is filtered.
146:             * @return the style class
147:             */
148:            public abstract String getHeaderCellFilteredClass();
149:
150:            /**
151:             * Get the style class for an HTML td tag for a grid cell that is sorted.
152:             * @return the style class
153:             */
154:            public abstract String getDataCellSortedClass();
155:
156:            /**
157:             * Get the style class for an HTML td tag for a grid cell that is filtered.
158:             * @return the style class
159:             */
160:            public abstract String getDataCellFilteredClass();
161:
162:            /**
163:             * Build the value of the HTML style class attribute from the {@link List} of style classes.  The style classes
164:             * are converted into a string in their list order.  For example, a list with contents:
165:             * <pre>
166:             *  foo,bar,baz
167:             * </pre>
168:             * will be convereted into a style class whose value is <code>foo,bar,baz</code>
169:             *
170:             * @param styleClasses the classes to render into a style class value
171:             * @return the string style class or an empty string if no style classes are provided
172:             */
173:            public String buildStyleClassValue(List/*<String>*/styleClasses) {
174:                if (styleClasses == null)
175:                    return EMPTY;
176:
177:                boolean styleWritten = false;
178:                InternalStringBuilder buf = new InternalStringBuilder();
179:                for (int i = 0; i < styleClasses.size(); i++) {
180:                    if (styleWritten)
181:                        buf.append(SPACE);
182:
183:                    if (styleClasses.get(i) != null) {
184:                        buf.append(styleClasses.get(i));
185:                        styleWritten = true;
186:                    }
187:                }
188:
189:                if (!styleWritten)
190:                    return null;
191:                else
192:                    return buf.toString();
193:            }
194:
195:            /**
196:             * Given a base style class name, this method adds a style prefix to produce a complete style class.
197:             * @param baseStyle the core style class name
198:             * @return the style class
199:             */
200:            protected String buildStyleClass(String baseStyle) {
201:                if (_stylePrefix != null)
202:                    return prefix(baseStyle);
203:                else
204:                    return baseStyle;
205:            }
206:
207:            /* @todo: perf - could cache the style names once they've been produced */
208:            /**
209:             * Utility method to concatenate the given style class name and the style prefix.
210:             * @param style the core style name
211:             * @return the style class
212:             */
213:            private final String prefix(String style) {
214:                InternalStringBuilder sb = new InternalStringBuilder(16);
215:                sb.append(_stylePrefix);
216:                if (style != null) {
217:                    sb.append(DELIM);
218:                    sb.append(style);
219:                }
220:                return sb.toString();
221:            }
222:        }
w_ww__.___j___a___v___a__2__s___.__c___o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.