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