Source Code Cross Referenced for SwingletManager.java in  » Swing-Library » Swinglets » com » javelin » swinglets » 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 » Swinglets » com.javelin.swinglets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright Javelin Software, All rights reserved.
003:         */
004:
005:        package com.javelin.swinglets;
006:
007:        import java.awt.event.*;
008:        import java.io.*;
009:        import java.net.*;
010:        import java.util.*;
011:
012:        import javax.servlet.*;
013:        import javax.servlet.http.*;
014:
015:        //import com.javelin.security.*;
016:        import com.javelin.swinglets.event.*;
017:        import com.javelin.swinglets.plaf.*;
018:        import com.javelin.swinglets.theme.*;
019:
020:        /**
021:         * The SwingletManager manager Swinglet component. Every thread is allocated
022:         * a SwingletManager. 
023:         * <P>
024:         * Values can be stored in this object for the duration of the session.
025:         * <P>
026:         * SwingletManager is an abstract class. Specific Manager, such as the ServletManager
027:         * are used to manage Swinglets in different contexts.
028:         * 
029:         * @author 	Robin Sharp
030:         */
031:
032:        public abstract class SwingletManager {
033:            /**
034:             * Bind an value to the Swinglet Manager. 
035:             * @param name the key of the value. 
036:             * @param value the value. If this is null it is removed.
037:             */
038:            public abstract void putValue(String name, Object value);
039:
040:            /**
041:             * Get a value by name.
042:             */
043:            public abstract Object getValue(String name);
044:
045:            /**
046:             * Get an Enumeration of keys.
047:             */
048:            public abstract Enumeration getKeys();
049:
050:            /**
051:             * Get an Enumeration of keys.
052:             */
053:            public abstract Enumeration getValues();
054:
055:            /**
056:             * Get the SwingletManager associated with this session.
057:             * SwingletManagers are associated by thread. 
058:             */
059:            public static synchronized SwingletManager getSwingletManager() {
060:                return (SwingletManager) localSwingletManager.get();
061:            }
062:
063:            /**
064:             * Set the SwingletManager associated with this session. If this is
065:             * null it is removed. This must be set on entry into the session, and
066:             * set to null on exit from the session.  
067:             */
068:            public static synchronized void setSwingletManager(
069:                    SwingletManager swingletManager) {
070:                if (swingletManager == null) {
071:                    localSwingletManager.set(null);
072:                } else {
073:                    localSwingletManager.set(swingletManager);
074:                }
075:            }
076:
077:            /**
078:             * Get the browser profile.
079:             */
080:            public BrowserProfile getBrowserProfile() {
081:                return browserProfile;
082:            }
083:
084:            /**
085:             * Set the browser profile.
086:             */
087:            public void setBrowserProfile(BrowserProfile browserProfile) {
088:                this .browserProfile = browserProfile;
089:            }
090:
091:            /**
092:             * Get the browser look and feel policy. 
093:             * This defaults to the DefaultBrowserLookAndFeel
094:             */
095:            public BrowserLookAndFeel getBrowserLookAndFeel() {
096:                return browserLookAndFeel;
097:            }
098:
099:            /**
100:             * Set the browser look and feel.
101:             */
102:            public void setBrowserLookAndFeel(BrowserLookAndFeel blf) {
103:                this .browserLookAndFeel = blf;
104:            }
105:
106:            /**
107:             * Automatically set the look and feel based on the 
108:             * agent string. This is a helper method that will look
109:             * up the look and feel from the current browser look and
110:             * feel class.
111:             */
112:            public SLookAndFeel getDetectedLookAndFeel(String agent) {
113:                return getBrowserLookAndFeel().getLookAndFeel(
114:                        BrowserProfile.getProfile(agent, null));
115:            }
116:
117:            /**
118:             * Automatically set the look and feel based on the 
119:             * agent string, and mimeType. This is a helper method that 
120:             * will look up the look and feel from the current browser 
121:             * look and feel class.
122:             */
123:            public SLookAndFeel getDetectedLookAndFeel(String agent,
124:                    String mimeType) {
125:                return getBrowserLookAndFeel().getLookAndFeel(
126:                        BrowserProfile.getProfile(agent, mimeType));
127:            }
128:
129:            /**
130:             * Apply the detected look and feel to every SComponent
131:             * in the values list.
132:             */
133:            public void applyDetectedLookAndFeel(String agent) {
134:                Object object = null;
135:                SLookAndFeel detectedLookAndFeel = getDetectedLookAndFeel(agent);
136:                for (Enumeration e = getValues(); e.hasMoreElements();) {
137:                    object = e.nextElement();
138:                    if (object instanceof  SComponent) {
139:                        ((SComponent) object)
140:                                .setLookAndFeel(detectedLookAndFeel);
141:                    }
142:                }
143:            }
144:
145:            /**
146:             * Get the default Theme.
147:             */
148:            public static STheme getDefaultTheme() {
149:                return defaultTheme;
150:            }
151:
152:            /**
153:             * Set the default Theme.
154:             */
155:            public static void setDefaultTheme(STheme dt) {
156:                defaultTheme = dt;
157:            }
158:
159:            /**
160:             * Get the Theme for the session, This will get the default
161:             * values for colors and fonts if values are not set. 
162:             * <P>
163:             * If the theme is null a static DefaultTheme is returned.
164:             */
165:            public STheme getTheme() {
166:                if (theme == null) {
167:                    return defaultTheme;
168:                }
169:
170:                return theme;
171:            }
172:
173:            /**
174:             * Set the Theme for the session.
175:             */
176:            public void setTheme(STheme theme) {
177:                this .theme = theme;
178:            }
179:
180:            /**
181:             * Get the full url for the SwingletManager
182:             */
183:            public String getUrl() {
184:                if (url == null) {
185:                    return defaultUrl;
186:                }
187:
188:                return url;
189:            }
190:
191:            /**
192:             * Set the url SwingletManager.
193:             */
194:            public void setUrl(String url) {
195:                this .url = url;
196:            }
197:
198:            /**
199:             * Set the url SwingletManager.
200:             */
201:            public void setUrl(URL url) {
202:                this .url = url.toExternalForm();
203:            }
204:
205:            /**
206:             * Get the defult url for the SwingletManager
207:             */
208:            public static synchronized String getDefaultUrl() {
209:                return defaultUrl;
210:            }
211:
212:            /**
213:             * Set the Default url for the SwingletManager.
214:             */
215:            public static synchronized void setDefaultUrl(String url) {
216:                defaultUrl = url;
217:            }
218:
219:            /**
220:             * Get the PATH. If there is no real path get the default real path.
221:             */
222:            public String getRealPath() {
223:                if (realPath != null) {
224:                    return realPath;
225:                } else {
226:                    return defaultRealPath;
227:                }
228:            }
229:
230:            /**
231:             * Set the PATH . replace "\" with "/"
232:             */
233:            public void setRealPath(String rp) {
234:                realPath = rp.replace('\\', '/');
235:            }
236:
237:            /**
238:             * Get the Default PATH, for the current thread.
239:             * If the thread is null remove the path.
240:             */
241:            public static synchronized String getDefaultRealPath() {
242:                return defaultRealPath;
243:            }
244:
245:            /**
246:             * Set the Default PATH, for the current thread.
247:             * If the thread is null remove the path.
248:             */
249:            public static synchronized void setDefaultRealPath(String rp) {
250:                defaultRealPath = rp.replace('\\', '/');
251:            }
252:
253:            /**
254:             * Get the IMAGE PATH. If there is no image path get the default image path.
255:             */
256:            public String getImagePath() {
257:                if (imagePath != null) {
258:                    return imagePath;
259:                } else if (defaultImagePath != null) {
260:                    return defaultImagePath;
261:                } else {
262:                    return getRealPath();
263:                }
264:
265:            }
266:
267:            /**
268:             * Set the IMAGE PATH . replace "\" with "/"
269:             */
270:            public void setImagePath(String rp) {
271:                imagePath = rp.replace('\\', '/');
272:            }
273:
274:            /**
275:             * Get the Default IMAGE PATH, for the current thread.
276:             * If the thread is null remove the path.
277:             */
278:            public static synchronized String getDefaultImagePath() {
279:                return defaultImagePath;
280:            }
281:
282:            /**
283:             * Set the Default IMAGE PATH, for the current thread.
284:             * If the thread is null remove the path.
285:             */
286:            public static synchronized void setDefaultImagePath(String rp) {
287:                defaultImagePath = rp.replace('\\', '/');
288:            }
289:
290:            /**
291:             * Get the URL of the Servlet runner.
292:             */
293:            public static String getServletRunner() {
294:                return servletRunner;
295:            }
296:
297:            /**
298:             * Set the URL of the Servlet runner.
299:             */
300:            public static void setServletRunner(String sr) {
301:                servletRunner = sr;
302:            }
303:
304:            /**
305:             * Get the user for the SwingletManager
306:             */
307:            public String getRemoteUser() {
308:                return remoteUser;
309:            }
310:
311:            /**
312:             * Set the remoteuser SwingletManager
313:             */
314:            public void setRemoteUser(String remoteUser) {
315:                this .remoteUser = remoteUser;
316:            }
317:
318:            /**
319:             * Check whether the painting cached in a String. If the SComponent
320:             * is set to true then it will override this value.
321:             */
322:            public boolean isCached() {
323:                return cached;
324:            }
325:
326:            /**
327:             * Set whether the painting cached in a String. If the SComponent
328:             * is set to true then it will override this value.
329:             */
330:            public void setCached(boolean cached) {
331:                this .cached = cached;
332:            }
333:
334:            public abstract URL getResource(String resourceName)
335:                    throws MalformedURLException;
336:
337:            public abstract URL getImageResource(String imageName)
338:                    throws MalformedURLException;
339:
340:            // PRIVATE ///////////////////////////////////////////////////////
341:
342:            //Default values
343:            protected static String defaultImagePath;
344:            protected static String defaultRealPath = "";
345:            protected static String defaultUrl;
346:            protected static String servletRunner;
347:            protected static STheme defaultTheme = SDefaultTheme
348:                    .getDefaultTheme();
349:
350:            //PATH info
351:            protected String url;
352:            protected String imagePath;
353:            protected String realPath;
354:            protected String remoteUser;
355:            protected boolean cached;
356:
357:            protected STheme theme;
358:            protected BrowserProfile browserProfile;
359:            protected BrowserLookAndFeel browserLookAndFeel = new DefaultBrowserLookAndFeel();
360:
361:            protected static ThreadLocal localSwingletManager = new ThreadLocal();
362:
363:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.