Source Code Cross Referenced for CSSProperty.java in  » Swing-Library » wings3 » org » wings » style » 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 » Swing Library » wings3 » org.wings.style 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2005 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:
014:        package org.wings.style;
015:
016:        import java.io.Serializable;
017:        import java.util.*;
018:
019:        /**
020:         * A CSS attribute is a property on any abritriary HTML element which can be set via CSS.
021:         *
022:         * You use CSS selectors ({@link Selector}) to define <b>which</b> elements you want to modify and define
023:         * with CSS properties {@link CSSProperty} <b>what</b> visual property you want to modify.
024:         *
025:         * <p>Please refer to <a href="http://www.w3.org/TR/REC-CSS2/selector.html">http://www.w3.org/TR/REC-CSS2/selector.html</a> 
026:         * for details
027:         *
028:         * @author bschmid
029:         */
030:        public class CSSProperty implements  Serializable {
031:
032:            // intern() Pool for CSS Properties if resolved via valueOf() method
033:            private final static Hashtable<String, CSSProperty> INSTANCE_POOL = new Hashtable<String, CSSProperty>(
034:                    100);
035:
036:            /* These CSSProperty Constants are the complete CSS2 standard for visual
037:             * media as in the CSS2 spec at http://www.w3.org/TR/REC-CSS2/propidx.html
038:             */
039:
040:            public final static CSSProperty BACKGROUND = new CSSProperty(
041:                    "background").intern();
042:
043:            public final static CSSProperty BACKGROUND_ATTACHMENT = new CSSProperty(
044:                    "background-attachment").intern();
045:
046:            public final static CSSProperty BACKGROUND_COLOR = new CSSProperty(
047:                    "background-color").intern();
048:
049:            public final static CSSProperty BACKGROUND_IMAGE = new CSSProperty(
050:                    "background-image").intern();
051:
052:            public final static CSSProperty BACKGROUND_POSITION = new CSSProperty(
053:                    "background-position").intern();
054:
055:            public final static CSSProperty BACKGROUND_REPEAT = new CSSProperty(
056:                    "background-repeat").intern();
057:
058:            public final static CSSProperty BORDER = new CSSProperty("border")
059:                    .intern();
060:
061:            public final static CSSProperty BORDER_BOTTOM = new CSSProperty(
062:                    "border-bottom").intern();
063:
064:            public final static CSSProperty BORDER_BOTTOM_COLOR = new CSSProperty(
065:                    "border-bottom-color").intern();
066:
067:            public final static CSSProperty BORDER_BOTTOM_STYLE = new CSSProperty(
068:                    "border-bottom-style").intern();
069:
070:            public final static CSSProperty BORDER_BOTTOM_WIDTH = new CSSProperty(
071:                    "border-bottom-width").intern();
072:
073:            public final static CSSProperty BORDER_COLLAPSE = new CSSProperty(
074:                    "border-collapse").intern();
075:
076:            public final static CSSProperty BORDER_COLOR = new CSSProperty(
077:                    "border-color").intern();
078:
079:            public final static CSSProperty BORDER_LEFT = new CSSProperty(
080:                    "border-left").intern();
081:
082:            public final static CSSProperty BORDER_LEFT_COLOR = new CSSProperty(
083:                    "border-left-color").intern();
084:
085:            public final static CSSProperty BORDER_LEFT_STYLE = new CSSProperty(
086:                    "border-left-style").intern();
087:
088:            public final static CSSProperty BORDER_LEFT_WIDTH = new CSSProperty(
089:                    "border-left-width").intern();
090:
091:            public final static CSSProperty BORDER_RIGHT = new CSSProperty(
092:                    "border-right").intern();
093:
094:            public final static CSSProperty BORDER_RIGHT_COLOR = new CSSProperty(
095:                    "border-right-color").intern();
096:
097:            public final static CSSProperty BORDER_RIGHT_STYLE = new CSSProperty(
098:                    "border-right-style").intern();
099:
100:            public final static CSSProperty BORDER_RIGHT_WIDTH = new CSSProperty(
101:                    "border-right-width").intern();
102:
103:            public final static CSSProperty BORDER_SPACING = new CSSProperty(
104:                    "border-spacing").intern();
105:
106:            public final static CSSProperty BORDER_STYLE = new CSSProperty(
107:                    "border-style").intern();
108:
109:            public final static CSSProperty BORDER_TOP = new CSSProperty(
110:                    "border-top").intern();
111:
112:            public final static CSSProperty BORDER_TOP_COLOR = new CSSProperty(
113:                    "border-top-color").intern();
114:
115:            public final static CSSProperty BORDER_TOP_STYLE = new CSSProperty(
116:                    "border-top-style").intern();
117:
118:            public final static CSSProperty BORDER_TOP_WIDTH = new CSSProperty(
119:                    "border-top-width").intern();
120:
121:            public final static CSSProperty BORDER_WIDTH = new CSSProperty(
122:                    "border-width").intern();
123:
124:            public final static CSSProperty BOTTOM = new CSSProperty("bottom")
125:                    .intern();
126:
127:            public final static CSSProperty CAPTION_SIDE = new CSSProperty(
128:                    "caption-side").intern();
129:
130:            public final static CSSProperty CLEAR = new CSSProperty("clear")
131:                    .intern();
132:
133:            public final static CSSProperty COLOR = new CSSProperty("color")
134:                    .intern();
135:
136:            /* This is just used for :before and :after pseudo elements. We don't have those
137:             * public final static CSSProperty CONTENT = new CSSProperty("content");
138:             */
139:
140:            public final static CSSProperty COUNTER_INCREMENT = new CSSProperty(
141:                    "counter-increment").intern();
142:
143:            public final static CSSProperty COUNTER_RESET = new CSSProperty(
144:                    "counter-reset").intern();
145:
146:            public final static CSSProperty CURSOR = new CSSProperty("cursor")
147:                    .intern();
148:
149:            public final static CSSProperty DIRECTION = new CSSProperty(
150:                    "direction").intern();
151:
152:            public final static CSSProperty DISPLAY = new CSSProperty("display")
153:                    .intern();
154:
155:            public final static CSSProperty EMPTY_CELLS = new CSSProperty(
156:                    "empty-cells").intern();
157:
158:            public final static CSSProperty FLOAT = new CSSProperty("float")
159:                    .intern();
160:
161:            public final static CSSProperty FONT = new CSSProperty("font")
162:                    .intern();
163:
164:            public final static CSSProperty FONT_FAMILY = new CSSProperty(
165:                    "font-family").intern();
166:
167:            public final static CSSProperty FONT_SIZE = new CSSProperty(
168:                    "font-size").intern();
169:
170:            public final static CSSProperty FONT_SIZE_ADJUST = new CSSProperty(
171:                    "font-size-adjust").intern();
172:
173:            public final static CSSProperty FONT_STRETCH = new CSSProperty(
174:                    "font-stretch").intern();
175:
176:            public final static CSSProperty FONT_STYLE = new CSSProperty(
177:                    "font-style").intern();
178:
179:            public final static CSSProperty FONT_VARIANT = new CSSProperty(
180:                    "font-variant").intern();
181:
182:            public final static CSSProperty FONT_WEIGHT = new CSSProperty(
183:                    "font-weight").intern();
184:
185:            public final static CSSProperty HEIGHT = new CSSProperty("height")
186:                    .intern();
187:
188:            public final static CSSProperty LEFT = new CSSProperty("left")
189:                    .intern();
190:
191:            public final static CSSProperty LETTER_SPACING = new CSSProperty(
192:                    "letter-spacing").intern();
193:
194:            public final static CSSProperty LINE_HEIGHT = new CSSProperty(
195:                    "line-height").intern();
196:
197:            public final static CSSProperty LIST_STYLE = new CSSProperty(
198:                    "list-style").intern();
199:
200:            public final static CSSProperty LIST_STYLE_IMAGE = new CSSProperty(
201:                    "list-style-image").intern();
202:
203:            public final static CSSProperty LIST_STYLE_POSITION = new CSSProperty(
204:                    "list-style-position").intern();
205:
206:            public final static CSSProperty LIST_STYLE_TYPE = new CSSProperty(
207:                    "list-style-type").intern();
208:
209:            public final static CSSProperty MARGIN = new CSSProperty("margin")
210:                    .intern();
211:
212:            public final static CSSProperty MARGIN_TOP = new CSSProperty(
213:                    "margin-top").intern();
214:
215:            public final static CSSProperty MARGIN_BOTTOM = new CSSProperty(
216:                    "margin-bottom").intern();
217:
218:            public final static CSSProperty MARGIN_LEFT = new CSSProperty(
219:                    "margin-left").intern();
220:
221:            public final static CSSProperty MARGIN_RIGHT = new CSSProperty(
222:                    "margin-right").intern();
223:
224:            // only for paged output mediums, we don't need it at the moment
225:            //public final static CSSProperty MARKS = new CSSProperty("marks");
226:
227:            public final static CSSProperty MAX_HEIGHT = new CSSProperty(
228:                    "max-height").intern();
229:
230:            public final static CSSProperty MAX_WIDTH = new CSSProperty(
231:                    "max-width").intern();
232:
233:            public final static CSSProperty MIN_HEIGHT = new CSSProperty(
234:                    "min-height").intern();
235:
236:            public final static CSSProperty MIN_WIDTH = new CSSProperty(
237:                    "min-width").intern();
238:
239:            // only for paged output mediums, we don't need it at the moment
240:            //public final static CSSProperty ORPHANS = new CSSProperty("orphans");
241:
242:            public final static CSSProperty OUTLINE = new CSSProperty("outline")
243:                    .intern();
244:
245:            public final static CSSProperty OUTLINE_COLOR = new CSSProperty(
246:                    "outline-color").intern();
247:
248:            public final static CSSProperty OUTLINE_STYLE = new CSSProperty(
249:                    "outline-style").intern();
250:
251:            public final static CSSProperty OUTLINE_WIDTH = new CSSProperty(
252:                    "outline-width").intern();
253:
254:            public final static CSSProperty OVERFLOW = new CSSProperty(
255:                    "overflow").intern();
256:
257:            public final static CSSProperty PADDING = new CSSProperty("padding")
258:                    .intern();
259:
260:            public final static CSSProperty PADDING_BOTTOM = new CSSProperty(
261:                    "padding-bottom").intern();
262:
263:            public final static CSSProperty PADDING_LEFT = new CSSProperty(
264:                    "padding-left").intern();
265:
266:            public final static CSSProperty PADDING_RIGHT = new CSSProperty(
267:                    "padding-right").intern();
268:
269:            public final static CSSProperty PADDING_TOP = new CSSProperty(
270:                    "padding-top").intern();
271:
272:            // only for paged output mediums, we don't need it at the moment
273:            /*
274:             public final static CSSProperty PAGE = new CSSProperty("page");
275:
276:             public final static CSSProperty PAGE_BREAK_AFTER = new CSSProperty("page-break-after");
277:
278:             public final static CSSProperty PAGE_BREAK_BEFORE = new CSSProperty("page-break-before");
279:
280:             public final static CSSProperty PAGE_BREAK_INSIDE = new CSSProperty("page-break-inside");
281:             */
282:
283:            public final static CSSProperty POSITION = new CSSProperty(
284:                    "position").intern();
285:
286:            public final static CSSProperty QUOTES = new CSSProperty("quotes")
287:                    .intern();
288:
289:            public final static CSSProperty RIGHT = new CSSProperty("right")
290:                    .intern();
291:
292:            // only for paged output mediums, we don't need it at the moment
293:            //public final static CSSProperty SIZE = new CSSProperty("size");
294:
295:            public final static CSSProperty TABLE_LAYOUT = new CSSProperty(
296:                    "table-layout").intern();
297:
298:            public final static CSSProperty TEXT_ALIGN = new CSSProperty(
299:                    "text-align").intern();
300:
301:            public final static CSSProperty TEXT_DECORATION = new CSSProperty(
302:                    "text-decoration").intern();
303:
304:            public final static CSSProperty TEXT_INDENT = new CSSProperty(
305:                    "text-indent").intern();
306:
307:            public final static CSSProperty TEXT_SHADOW = new CSSProperty(
308:                    "text-shadow").intern();
309:
310:            public final static CSSProperty TEXT_TRANSFORM = new CSSProperty(
311:                    "text-transform").intern();
312:
313:            public final static CSSProperty TOP = new CSSProperty("top")
314:                    .intern();
315:
316:            public final static CSSProperty UNICODE_BIDI = new CSSProperty(
317:                    "unicode-bidi").intern();
318:
319:            public final static CSSProperty VERTICAL_ALIGN = new CSSProperty(
320:                    "vertical-align").intern();
321:
322:            public final static CSSProperty VISIBILITY = new CSSProperty(
323:                    "visibility").intern();
324:
325:            public final static CSSProperty WHITE_SPACE = new CSSProperty(
326:                    "white-space").intern();
327:
328:            // only for paged output mediums, we don't need it at the moment
329:            //public final static CSSProperty WIDOWS = new CSSProperty("widows");
330:
331:            public final static CSSProperty WIDTH = new CSSProperty("width")
332:                    .intern();
333:
334:            public final static CSSProperty WORD_SPACING = new CSSProperty(
335:                    "word-spacing").intern();
336:
337:            public final static CSSProperty Z_INDEX = new CSSProperty("z-index")
338:                    .intern();
339:
340:            /**
341:             * List of CSS properties which may not be applied to SComponents but their borders.
342:             */
343:            public static final Set<CSSProperty> BORDER_PROPERTIES = Collections
344:                    .unmodifiableSet(new HashSet<CSSProperty>(Arrays.asList(
345:                            CSSProperty.BORDER,
346:                            //CSSProperty.BORDER_COLLAPSE,
347:                            CSSProperty.BORDER_COLOR,
348:                            //CSSProperty.BORDER_SPACING,
349:                            CSSProperty.BORDER_STYLE, CSSProperty.BORDER_WIDTH,
350:                            CSSProperty.BORDER_BOTTOM,
351:                            CSSProperty.BORDER_BOTTOM_COLOR,
352:                            CSSProperty.BORDER_BOTTOM_STYLE,
353:                            CSSProperty.BORDER_BOTTOM_WIDTH,
354:                            CSSProperty.BORDER_LEFT,
355:                            CSSProperty.BORDER_LEFT_COLOR,
356:                            CSSProperty.BORDER_LEFT_STYLE,
357:                            CSSProperty.BORDER_LEFT_WIDTH,
358:                            CSSProperty.BORDER_RIGHT,
359:                            CSSProperty.BORDER_RIGHT_COLOR,
360:                            CSSProperty.BORDER_RIGHT_STYLE,
361:                            CSSProperty.BORDER_RIGHT_WIDTH,
362:                            CSSProperty.BORDER_TOP,
363:                            CSSProperty.BORDER_TOP_COLOR,
364:                            CSSProperty.BORDER_TOP_STYLE,
365:                            CSSProperty.BORDER_TOP_WIDTH, CSSProperty.PADDING,
366:                            CSSProperty.PADDING_TOP, CSSProperty.PADDING_RIGHT,
367:                            CSSProperty.PADDING_BOTTOM,
368:                            CSSProperty.PADDING_LEFT)));
369:
370:            private final String name;
371:
372:            public CSSProperty(String cssAttributeName) {
373:                // CSS properties are CASE INSENSITIVE!
374:                this .name = cssAttributeName.toLowerCase();
375:            }
376:
377:            /**
378:             * Retrieve the CSS property with the given attribute name.
379:             * @param cssPropertyName The css attribute name.
380:             * @return A pooled CSS instance if this is a known css property or new instance.
381:             */
382:            public static CSSProperty valueOf(String cssPropertyName) {
383:                CSSProperty instance = INSTANCE_POOL.get(cssPropertyName);
384:                if (instance != null) {
385:                    return instance;
386:                } else {
387:                    return new CSSProperty(cssPropertyName);
388:                }
389:            }
390:
391:            /**
392:             * @return The CSS attribute name.
393:             */
394:            public String getName() {
395:                return name;
396:            }
397:
398:            /**
399:             * When the intern method is invoked, if the pool already contains a
400:             * property equal to this <code>CSSProperty</code> object as determined by
401:             * the {@link #equals(Object)} method, then the object from the pool is
402:             * returned. Otherwise, this <code>CSSProperty</code> object is added to the
403:             * pool and a reference to this <code>CSSProperty</code> object is returned.
404:
405:             * @param property The CSS Property too pool.
406:             * @return A pooled object instance.
407:             */
408:            public CSSProperty intern() {
409:                if (INSTANCE_POOL.containsKey(name)) {
410:                    return INSTANCE_POOL.get(name);
411:                } else {
412:                    INSTANCE_POOL.put(name, this );
413:                    return this ;
414:                }
415:            }
416:
417:            @Override
418:            public boolean equals(Object o) {
419:                if (this  == o)
420:                    return true;
421:                if (!(o instanceof  CSSProperty))
422:                    return false;
423:                final CSSProperty cssProperty = (CSSProperty) o;
424:
425:                // CSS properties are CASE INSENSITIVE! Enfored in constructor
426:                // return (name.equalsIgnoreCase(cssProperty.name));
427:                return (name.equals(cssProperty.name));
428:            }
429:
430:            @Override
431:            public int hashCode() {
432:                return name.hashCode();
433:            }
434:
435:            @Override
436:            public String toString() {
437:                return getName();
438:            }
439:
440:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.