Source Code Cross Referenced for CGManager.java in  » Swing-Library » wings3 » org » wings » plaf » 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.plaf 
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:        package org.wings.plaf;
014:
015:        import org.apache.commons.logging.Log;
016:        import org.apache.commons.logging.LogFactory;
017:        import org.wings.SComponent;
018:        import org.wings.SIcon;
019:        import org.wings.SLayoutManager;
020:        import org.wings.session.Session;
021:        import org.wings.session.SessionManager;
022:        import org.wings.style.Style;
023:        import org.wings.style.StyleSheet;
024:
025:        import java.io.Serializable;
026:
027:        /**
028:         * The CGManager holds a reference to the current laf.
029:         * It delegates to a session related CGDefaults table, that is backed by
030:         * the laf's defaults.
031:         */
032:        public class CGManager implements  Serializable {
033:            private final transient static Log log = LogFactory
034:                    .getLog(CGManager.class);
035:
036:            private LookAndFeel lookAndFeel;
037:            private ResourceDefaults defaults = null;
038:
039:            /**
040:             * Get an Object from the defaults table.
041:             * If the there's no value associated to the <code>key</code>, the request
042:             * is delegated to the laf's defaults table.
043:             *
044:             * @param key the lookup key
045:             * @param clazz the class of the object in question
046:             */
047:            public Object getObject(String key, Class clazz) {
048:                return getDefaults().get(key, clazz);
049:            }
050:
051:            /**
052:             * Get a ComponentCG from the defaults table.
053:             * If the there's no value associated to the <code>target</code>'s cgClassID, the request
054:             * is delegated to the laf's defaults table.
055:             *
056:             * @param target the SComponent
057:             */
058:            public ComponentCG getCG(SComponent target) {
059:                return (ComponentCG) getDefaults().get(target.getClass(),
060:                        ComponentCG.class);
061:            }
062:
063:            /**
064:             * Get a ComponentCG from the defaults table.
065:             * If the there's no value associated to the <code>target</code>'s cgClassID, the request
066:             * is delegated to the laf's defaults table.
067:             *
068:             * @param targetClass the SComponent class
069:             */
070:            public ComponentCG getCG(Class targetClass) {
071:                return (ComponentCG) getDefaults().get(targetClass,
072:                        ComponentCG.class);
073:            }
074:
075:            /**
076:             * Get a ComponentCG from the defaults table.
077:             * If the there's no value associated to the <code>target</code>'s cgClassID, the request
078:             * is delegated to the laf's defaults table.
079:             *
080:             * @param cgClassID the cg class id
081:             */
082:            public ComponentCG getCG(String cgClassID) {
083:                return (ComponentCG) getDefaults().get(cgClassID,
084:                        ComponentCG.class);
085:            }
086:
087:            /**
088:             * Get a LayoutManagerCG from the defaults table.
089:             * If the there's no value associated to the <code>target</code>'s cgClassID, the request
090:             * is delegated to the laf's defaults table.
091:             *
092:             * @param target the SLayoutManager
093:             */
094:            public LayoutCG getCG(SLayoutManager target) {
095:                return (LayoutCG) getDefaults().get(target.getClass(),
096:                        LayoutCG.class);
097:            }
098:
099:            /**
100:             * Get a StyleSheet from the defaults table.
101:             * If the there's no value associated to the <code>key</code>, the request
102:             * is delegated to the laf's defaults table.
103:             *
104:             * @param key the lookup key
105:             */
106:            public StyleSheet getStyleSheet(String key) {
107:                return (StyleSheet) getDefaults().get(key, StyleSheet.class);
108:            }
109:
110:            /**
111:             * Get a Style from the defaults table.
112:             * If the there's no value associated to the <code>key</code>, the request
113:             * is delegated to the laf's defaults table.
114:             *
115:             * @param key the lookup key
116:             */
117:            public Style getStyle(String key) {
118:                return (Style) getDefaults().get(key, Style.class);
119:            }
120:
121:            /**
122:             * Get a Icon from the defaults table.
123:             * If the there's no value associated to the <code>key</code>, the request
124:             * is delegated to the laf's defaults table.
125:             *
126:             * @param key the lookup key
127:             */
128:            public SIcon getIcon(String key) {
129:                return (SIcon) getDefaults().get(key, SIcon.class);
130:            }
131:
132:            /**
133:             * Set the defaults table.
134:             *
135:             * @param defaults the defaults table
136:             */
137:            public void setDefaults(ResourceDefaults defaults) {
138:                this .defaults = defaults;
139:            }
140:
141:            /**
142:             * Return the defaults table.
143:             *
144:             * @return the defaults table
145:             */
146:            public ResourceDefaults getDefaults() {
147:                if (defaults == null) {
148:                    log.warn("defaults == null");
149:                }
150:                return defaults;
151:            }
152:
153:            /**
154:             * Returns the current default look and feel.
155:             *
156:             * @return the current default look and feel
157:             * @see #setLookAndFeel
158:             */
159:            public LookAndFeel getLookAndFeel() {
160:                return lookAndFeel;
161:            }
162:
163:            /**
164:             * Set the current default look and feel using a LookAndFeel object.
165:             *
166:             * @param newLookAndFeel the LookAndFeel object
167:             * @see #getLookAndFeel
168:             */
169:            public void setLookAndFeel(LookAndFeel newLookAndFeel) {
170:                lookAndFeel = newLookAndFeel;
171:
172:                if (newLookAndFeel != null) {
173:                    setDefaults(newLookAndFeel.createDefaults());
174:                    // have the session fire a propertyChangeEvent regarding the new lookAndFeel
175:                    Session session = SessionManager.getSession();
176:                    if (session != null) {
177:                        session.setProperty("lookAndFeel", ""
178:                                + newLookAndFeel.hashCode());
179:                    }
180:                } else {
181:                    log.warn("lookandfeel == null");
182:                    setDefaults(null);
183:                }
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.