Source Code Cross Referenced for SUIManager.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:        /**
008:         * SUIManager is the manager for Look and Feels.
009:         * 
010:         * @author Robin Sharp
011:         */
012:
013:        import java.awt.*;
014:        import java.util.*;
015:        import java.io.*;
016:
017:        import javax.servlet.http.*;
018:
019:        import com.javelin.swinglets.plaf.*;
020:
021:        public class SUIManager {
022:            /**
023:             * Get the currently installed LAF's class names.
024:             */
025:            public synchronized static String[] getInstalledLookAndFeels() {
026:                return installedLAFNames;
027:            }
028:
029:            /**
030:             * Replaces the current array of installed LookAndFeelInfos class names.
031:             */
032:            public synchronized static void setInstalledLookAndFeels(
033:                    String[] classNames) {
034:                String[] newClassNames = new String[classNames.length];
035:                System.arraycopy(classNames, 0, newClassNames, 0,
036:                        classNames.length);
037:                installedLAFNames = newClassNames;
038:            }
039:
040:            /**
041:             * If the look and feel has not yet been set the cross platform look and
042:             * feel is installed.
043:             * <p>
044:             * @return The current default look and feel, or null.
045:             */
046:            public synchronized static SLookAndFeel getLookAndFeel() {
047:                if (lookAndFeel == null) {
048:                    //new Exception().printStackTrace();
049:                    setLookAndFeel(getCrossPlatformLookAndFeelClassName());
050:                }
051:
052:                return lookAndFeel;
053:            }
054:
055:            /**
056:             * Get a look and feel by name. This will try to create a look and feel by name.
057:             * This does not install the look and feel, as the default look and feel.
058:             * <p>
059:             * If the the class name is one of the installed look and feels then load 
060:             * the look and feel into a cache.
061:             */
062:            public synchronized static SLookAndFeel getLookAndFeel(
063:                    String className) {
064:                try {
065:                    int index = 0;
066:                    for (; index < installedLAFNames.length; index++) {
067:                        if (installedLAFNames[index].equals(className)) {
068:                            //Find the index of the class name
069:                            break;
070:                        }
071:                    }
072:
073:                    if (index >= installedLAFNames.length) {
074:                        //Return the look and feel but dont install it
075:                        return (SLookAndFeel) (Class.forName(className))
076:                                .newInstance();
077:                    }
078:
079:                    //If the laf has not yet been installed, then install it.
080:                    if (installedLAFs[index] == null) {
081:                        installedLAFs[index] = (SLookAndFeel) (Class
082:                                .forName(className)).newInstance();
083:                    }
084:
085:                    return installedLAFs[index];
086:                } catch (Exception e) {
087:                    e.printStackTrace();
088:                    return null;
089:                }
090:            }
091:
092:            /**
093:             * Adds the specified look and feel to the current array.
094:             */
095:            public synchronized static void installLookAndFeel(String className) {
096:                String[] classNames = installedLAFNames;
097:                String[] newClassNames = new String[classNames.length + 1];
098:                System.arraycopy(classNames, 0, newClassNames, 0,
099:                        classNames.length);
100:                newClassNames[classNames.length] = className;
101:
102:                SLookAndFeel[] lAFs = installedLAFs;
103:                SLookAndFeel[] newLAFS = new SLookAndFeel[lAFs.length + 1];
104:                System.arraycopy(lAFs, 0, newLAFS, 0, lAFs.length);
105:
106:                setInstalledLookAndFeels(newClassNames);
107:            }
108:
109:            /**
110:             * Set the current default look and feel using a LookAndFeel object.  
111:             */
112:            public synchronized static void setLookAndFeel(
113:                    SLookAndFeel newLookAndFeel) {
114:                lookAndFeel = newLookAndFeel;
115:            }
116:
117:            /**
118:             * Set the current default look and feel using a class name. If the
119:             * look an feel is one of the installed look and feels, put it in 
120:             * the cache.
121:             */
122:            public synchronized static void setLookAndFeel(String className) {
123:                try {
124:                    SLookAndFeel laf = getLookAndFeel(className);
125:                    if (laf != null) {
126:                        setLookAndFeel(laf);
127:                    }
128:                } catch (Exception e) {
129:                    e.printStackTrace();
130:                }
131:            }
132:
133:            /**
134:             * Returns the name of the LookAndFeel class that implements
135:             * the default cross platform look and feel.
136:             */
137:            public synchronized static String getCrossPlatformLookAndFeelClassName() {
138:                return "com.javelin.swinglets.plaf.html.HTMLLookAndFeel";
139:            }
140:
141:            // PRIVATE //////////////////////////////////////////////////////////////////////////////
142:
143:            protected static SLookAndFeel lookAndFeel;
144:            protected static String[] installedLAFNames = new String[] {
145:                    "com.javelin.swinglets.plaf.html.HTMLLookAndFeel",
146:                    "com.javelin.swinglets.plaf.javascript.JSLookAndFeel",
147:                    "com.javelin.swinglets.plaf.wml.WMLLookAndFeel",
148:                    "com.javelin.swinglets.plaf.jfc.JFCLookAndFeel" };
149:            protected static SLookAndFeel[] installedLAFs = new SLookAndFeel[installedLAFNames.length];
150:
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.