Source Code Cross Referenced for DiscRack.java in  » J2EE » enhydra » discRack » 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 » enhydra » discRack 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package discRack;
002:
003:        import com.lutris.appserver.server.sql.*;
004:        import com.lutris.util.*;
005:        import org.enhydra.dods.*;
006:
007:        import discRack.actions.*;
008:        import discRack.presentation.*;
009:        import discRack.presentation.delements.*;
010:
011:        import javax.swing.*;
012:        import java.util.*;
013:        import java.awt.*;
014:        import java.awt.event.*;
015:        import java.net.*;
016:        import java.io.*;
017:
018:        //import org.apache.log4j.Logger;
019:        //import org.apache.log4j.xml.DOMConfigurator;
020:
021:        /**
022:         * The main class of DiscRack application.
023:         *
024:         * @author Sasa Bojanic
025:         * @version 1.0
026:         */
027:        public class DiscRack extends JPanel {
028:            // Application Title and other stuff. From resource file.
029:            private static final String appTitle = "DiscRack";
030:            // Application Icon. From resource file.
031:            private static ImageIcon appIcon;
032:
033:            /**
034:             * Checks if java version is >= 1.4, sets application title and icon, as
035:             * well as logo icon.
036:             */
037:            static {
038:                try {
039:                    String vers = System.getProperty("java.version");
040:                    if (vers.compareTo("1.") < 0) {
041:                        System.out
042:                                .println("!!!WARNING: JaWE must be run with a "
043:                                        + "1.4 or higher version VM!!!");
044:                    }
045:
046:                    // Icon
047:                    URL url = ResourceManager.getResource("Icon");
048:                    if (url != null)
049:                        appIcon = new ImageIcon(url);
050:
051:                    try {
052:                        //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
053:                        UIManager.setLookAndFeel(UIManager
054:                                .getSystemLookAndFeelClassName());
055:                    } catch (Exception exc) {
056:                        System.err.println("Error loading L&F: " + exc);
057:                    }
058:                } catch (Throwable t) {
059:                    System.err.println("uncaught exception: " + t);
060:                    t.printStackTrace();
061:                }
062:            }
063:
064:            // The frame of application
065:            protected JFrame myFrame;
066:
067:            protected Hashtable commands;
068:            protected JMenuBar menubar;
069:            protected JToolBar toolbar;
070:            /**
071:             * Actions defined by the WorkflowAdmin class
072:             */
073:            protected Action[] defaultActions;
074:
075:            private JScrollPane helperJSP = new JScrollPane();
076:            private JPanel centralPanel = new JPanel();
077:
078:            //************************** CONSTRUCTOR ***********************
079:            /** Creates instance of main application class. */
080:            public DiscRack() {
081:                super (true);
082:
083:                setBorder(BorderFactory.createEtchedBorder());
084:                setLayout(new BorderLayout());
085:
086:                commands = new Hashtable();
087:                // Actions defined by the ProcessEditor class
088:                createActions();
089:                Action[] actions = getActions();
090:                for (int i = 0; i < actions.length; i++) {
091:                    Action a = actions[i];
092:                    commands.put(a.getValue(Action.NAME), a);
093:                }
094:
095:                menubar = BarFactory.createMenubar("menubar", commands);
096:                // adding menubar to the main panel
097:                add(menubar, BorderLayout.NORTH);
098:                // adding center component
099:                JPanel helperPanel = new JPanel();
100:                helperPanel.setLayout(new BorderLayout());
101:
102:                toolbar = (JToolBar) BarFactory.createToolbar("toolbar",
103:                        commands);
104:                helperPanel.add(toolbar, BorderLayout.NORTH);
105:                helperJSP.setViewportView(centralPanel);
106:                helperPanel.add(helperJSP, BorderLayout.CENTER);
107:                //add(centralPanel,BorderLayout.CENTER);
108:                add(helperPanel, BorderLayout.CENTER);
109:
110:                myFrame = new JFrame();
111:                myFrame.setBackground(Color.lightGray);
112:                myFrame.getContentPane().setLayout(new BorderLayout());
113:                myFrame.getContentPane().add(this , BorderLayout.CENTER);
114:                myFrame
115:                        .setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
116:                myFrame.addWindowListener(new AppCloser());
117:                myFrame.pack();
118:                Dimension screenSize = Toolkit.getDefaultToolkit()
119:                        .getScreenSize();
120:                int xSize = 950, ySize = 600;
121:                int xMinus, yMinus;
122:                if (screenSize.width > xSize) {
123:                    xMinus = screenSize.width - xSize;
124:                } else {
125:                    xMinus = 0;
126:                }
127:                if (screenSize.height > ySize) {
128:                    yMinus = screenSize.height - ySize;
129:                } else {
130:                    yMinus = 0;
131:                }
132:
133:                myFrame.setBounds(xMinus / 2, yMinus / 2, screenSize.width
134:                        - xMinus, screenSize.height - yMinus);
135:
136:                if (appIcon != null)
137:                    myFrame.setIconImage(appIcon.getImage());
138:                setTitleUser(null);
139:
140:                getAction("Logout").setEnabled(false);
141:                myFrame.show();
142:                getAction("Login").actionPerformed(null);
143:
144:            }
145:
146:            //************************* END OF WORKLISTHANDLER CONSTRUCTOR *****************
147:
148:            public void setTitleUser(String user) {
149:                if (user == null) {
150:                    user = "no logged user";
151:                }
152:                myFrame.setTitle(appTitle + " - " + user);
153:            }
154:
155:            //************** APPCLOSER CLASS FOR CLOSING APPLICATION WINDOW ***************
156:            /**
157:             * To shutdown when run as an application.
158:             */
159:            protected final class AppCloser extends WindowAdapter {
160:                public void windowClosing(WindowEvent e) {
161:                    getAction("Exit").actionPerformed(null);
162:                }
163:            }
164:
165:            //**** END OF CREATING APPLICATION CLOSER COMPONENT FOR APPLICATION WINDOW ****
166:
167:            // ************************* GETTING ACTION STUFF *****************************
168:            protected void createActions() {
169:                defaultActions = new Action[] {
170:                        new discRack.actions.Exit(this ),
171:                        new discRack.actions.Login(this ),
172:                        new discRack.actions.Logout(this ),
173:                        new discRack.actions.Register(this ), };
174:            }
175:
176:            /**
177:             * Fetch the list of actions supported by this app.
178:             */
179:            public Action[] getActions() {
180:                return defaultActions;
181:            }
182:
183:            /**
184:             * Method to get action corresponding to the given string.
185:             * @param cmd String representation of editor's action.
186:             * @return action specified by the string cmd.
187:             **/
188:            public Action getAction(String cmd) {
189:                return (Action) commands.get(cmd);
190:            }
191:
192:            // ********************* END OF GETTING ACTION STUFF **************************
193:
194:            //*********************** END OF EXIT ACTION CLASS *************************
195:
196:            public JFrame getFrame() {
197:                return myFrame;
198:            }
199:
200:            public String getAppTitle() {
201:                return appTitle;
202:            }
203:
204:            public void setCentralPanel(JPanel p) {
205:                centralPanel = p;
206:                helperJSP.setViewportView(centralPanel);
207:            }
208:
209:            public static void main(String[] args) {
210:                try {
211:                    String userDir = System.getProperty("user.dir");
212:                    DODS.startup(userDir + File.separator + "discRack.conf");
213:                } catch (Exception ex) {
214:                    ex.printStackTrace();
215:                    System.exit(0);
216:                }
217:                DiscRack dr = new DiscRack();
218:            }
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.