Source Code Cross Referenced for TestApplet.java in  » J2EE » Sofia » com » salmonllc » examples » example16 » 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 » J2EE » Sofia » com.salmonllc.examples.example16 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //The Salmon Open Framework for Internet Applications (SOFIA)
002:        //Copyright (C) 1999 - 2002, Salmon LLC
003:        //
004:        //This program is free software; you can redistribute it and/or
005:        //modify it under the terms of the GNU General Public License version 2
006:        //as published by the Free Software Foundation;
007:        //
008:        //This program is distributed in the hope that it will be useful,
009:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
010:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011:        //GNU General Public License for more details.
012:        //
013:        //You should have received a copy of the GNU General Public License
014:        //along with this program; if not, write to the Free Software
015:        //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
016:        //
017:        //For more information please visit http://www.salmonllc.com
018:        package com.salmonllc.examples.example16;
019:
020:        import com.salmonllc.swing.SComponentHelper;
021:        import com.salmonllc.swing.STextField;
022:        import com.salmonllc.personalization.SkinManager;
023:        import com.salmonllc.personalization.ProxySkinManager;
024:        import com.salmonllc.personalization.Skin;
025:
026:        import javax.swing.*;
027:        import javax.swing.table.TableColumnModel;
028:        import java.awt.*;
029:
030:        /*
031:         * This applet will get embedded in the CustomizeSwingSkin.jsp page and provide a visual representation of the changes to the skin as they are made
032:         */
033:
034:        public class TestApplet extends JApplet {
035:
036:            public void init() {
037:                //figure out the url for the server from the code base for the applet
038:                String serverURL = null;
039:                String codeBase = getCodeBase().toString();
040:                if (codeBase != null) {
041:                    int pos = codeBase.indexOf("/Jsp/");
042:                    if (pos != -1)
043:                        serverURL = codeBase.substring(0, pos);
044:                }
045:                //if we are running from the ide, the codebase isn't the server URL so use a parm from the applet parms instead
046:                if (serverURL == null) {
047:                    codeBase = getParameter("codeBase");
048:                    if (codeBase != null)
049:                        serverURL = codeBase;
050:                }
051:
052:                //if we use a salmon applet tag, it will have a parm with the session id. We can pass it back to the server so our proxy datastores come from the same session as the rest of the web app does
053:                String sessionId = getParameter("servletSessionID");
054:
055:                //set up the screen
056:                JPanel main = new JPanel();
057:                Box layout = Box.createVerticalBox();
058:                main.add(layout);
059:                getContentPane().add(main);
060:
061:                JLabel l = new JLabel("Sample View");
062:                l.setAlignmentX(Component.CENTER_ALIGNMENT);
063:                layout.add(l);
064:                layout.add(Box.createVerticalStrut(10));
065:                Box buttonBar = Box.createHorizontalBox();
066:                buttonBar.add(new JButton("Enabled"));
067:                JButton dis = new JButton("Disabled");
068:                dis.setEnabled(false);
069:                buttonBar.add(dis);
070:                layout.add(buttonBar);
071:
072:                layout.add(Box.createVerticalStrut(10));
073:                Box textBar = Box.createHorizontalBox();
074:                STextField enaT = new STextField();
075:                enaT.setText("Enabled");
076:                textBar.add(enaT);
077:                JTextField disT = new JTextField("Disabled");
078:                disT.setEnabled(false);
079:                textBar.add(disT);
080:                layout.add(textBar);
081:
082:                layout.add(Box.createVerticalStrut(10));
083:                JPanel tabPanel = new JPanel(new GridLayout(1, 1));
084:                String tabData[][] = new String[20][2];
085:                for (int i = 0; i < 20; i++) {
086:                    tabData[i][0] = "Sample Column 1 ";
087:                    tabData[i][1] = "Sample Column 2 ";
088:                }
089:                String caps[] = { "Sample Caption 1", "Sample Caption 2" };
090:                JTable tab = new JTable(tabData, caps);
091:                tab.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
092:                tabPanel.setPreferredSize(new Dimension(getBounds().width,
093:                        getBounds().height - 100));
094:                tabPanel.add(new JScrollPane(tab));
095:                TableColumnModel mod = tab.getColumnModel();
096:                mod.getColumn(0).setPreferredWidth(getBounds().width / 2 + 20);
097:                mod.getColumn(1).setPreferredWidth(getBounds().width / 2 + 20);
098:                mod.getSelectionModel().setSelectionMode(
099:                        ListSelectionModel.SINGLE_SELECTION);
100:                tab.changeSelection(0, -1, false, false);
101:
102:                layout.add(tabPanel);
103:
104:                //Now set the look and feel to the default one for the application from a special "TEMP" skin that is set by the editor
105:                SkinManager man = new ProxySkinManager(serverURL
106:                        + "/PersonalizationServer", sessionId);
107:                Skin sk = new Skin();
108:                man.load("TEMP", sk);
109:                SComponentHelper.applySkin(sk, main);
110:            }
111:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.