Source Code Cross Referenced for guiJCGridClient.java in  » Net » JCGrid » org » homedns » dade » jcgrid » cmd » mandel » 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 » Net » JCGrid » org.homedns.dade.jcgrid.cmd.mandel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         Copyright (C) 2004 David Bucciarelli (davibu@interfree.it)
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
006:         as published by the Free Software Foundation; either version 2
007:         of the License, or (at your option) any later version.
008:
009:         This program is distributed in the hope that it will be useful,
010:         but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:         GNU General Public License for more details.
013:
014:         You should have received a copy of the GNU General Public License
015:         along with this program; if not, write to the Free Software
016:         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:         */
018:
019:        package org.homedns.dade.jcgrid.cmd.mandel;
020:
021:        import java.io.*;
022:        import java.awt.*;
023:        import java.awt.image.*;
024:        import javax.swing.*;
025:
026:        import org.apache.log4j.*;
027:
028:        import org.homedns.dade.jcgrid.*;
029:        import org.homedns.dade.jcgrid.cmd.*;
030:        import org.homedns.dade.jcgrid.client.*;
031:        import org.homedns.dade.jcgrid.worker.*;
032:        import org.homedns.dade.jcgrid.worker.impl.mandel.*;
033:        import org.homedns.dade.jcgrid.admin.*;
034:        import org.homedns.dade.jcgrid.gui.*;
035:
036:        public class guiJCGridClient extends javax.swing.JFrame {
037:            private final static String className = guiJCGridClient.class
038:                    .getName();
039:            private static Logger log = Logger.getLogger(className);
040:            private static Logger logDetail = Logger.getLogger("DETAIL."
041:                    + className);
042:
043:            private static final long serialVersionUID = 1L;
044:
045:            private guiMandelRenderingPannel pPic;
046:            private guiRenderingSetting pSet;
047:            private guiJCGridAdminStatus pServerStatus;
048:            private guiMandelWorkerPannel pWorker;
049:            private guiJCGridAbout pAbout;
050:
051:            private GridNodeClientConfig clientConfig;
052:            private GridNodeWorkerConfig workerConfig;
053:            private GridNodeAdminConfig adminConfig;
054:
055:            /** Creates new form guiJCGridClient */
056:            public guiJCGridClient() {
057:                pSet = null;
058:                pServerStatus = null;
059:                pAbout = null;
060:
061:                initComponents();
062:
063:                clientConfig = new GridNodeClientConfig();
064:                clientConfig.autoSessioName();
065:                adminConfig = new GridNodeAdminConfig();
066:                adminConfig.autoSessioName();
067:                workerConfig = new GridNodeWorkerConfig();
068:                workerConfig.autoSessioName();
069:
070:                // Share the same config
071:
072:                GridConfig gc = clientConfig.getGridConfig();
073:                gc.setServerAddress(MandelConfig.MANDELGRID_SERVER);
074:                gc.setServerClientPort(MandelConfig.MANDELGRID_CLIENT_PORT);
075:                gc.setServerWorkerPort(MandelConfig.MANDELGRID_WORKER_PORT);
076:                gc.setServerAdminPort(MandelConfig.MANDELGRID_ADMIN_PORT);
077:                gc.setUseCompression(MandelConfig.MANDELGRID_USE_COMPRESSION);
078:                gc.setUseVFS(false);
079:
080:                adminConfig.setGridConfig(gc);
081:                workerConfig.setGridConfig(gc);
082:
083:                // Rendering pannel
084:
085:                pPic = new guiMandelRenderingPannel();
086:                GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
087:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
088:                gridBagConstraints.weightx = 1.0;
089:                gridBagConstraints.weighty = 1.0;
090:                this .getContentPane().add(pPic, gridBagConstraints);
091:
092:                // Rendering settings pannel
093:
094:                pSet = new guiRenderingSetting(clientConfig, this , false, pPic);
095:                pSet.setVisible(true);
096:
097:                // Worker pannel
098:
099:                pWorker = new guiMandelWorkerPannel(workerConfig, this , false);
100:                pWorker.setVisible(true);
101:            }
102:
103:            /** This method is called from within the constructor to
104:             * initialize the form.
105:             * WARNING: Do NOT modify this code. The content of this method is
106:             * always regenerated by the Form Editor.
107:             */
108:            private void initComponents() {//GEN-BEGIN:initComponents
109:                mBar = new javax.swing.JMenuBar();
110:                mFile = new javax.swing.JMenu();
111:                mSaveImageAs = new javax.swing.JMenuItem();
112:                mSepa2 = new javax.swing.JSeparator();
113:                mAbout = new javax.swing.JMenuItem();
114:                mSepa3 = new javax.swing.JSeparator();
115:                mExit = new javax.swing.JMenuItem();
116:                mEdit = new javax.swing.JMenu();
117:                mResetView = new javax.swing.JMenuItem();
118:                mAdmin = new javax.swing.JMenu();
119:                mStatus = new javax.swing.JMenuItem();
120:
121:                getContentPane().setLayout(new java.awt.GridBagLayout());
122:
123:                setTitle("JCGrid Mandel Client");
124:                setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
125:                addWindowListener(new java.awt.event.WindowAdapter() {
126:                    public void windowClosing(java.awt.event.WindowEvent evt) {
127:                        exitForm(evt);
128:                    }
129:                });
130:
131:                mFile.setText("File");
132:                mSaveImageAs.setText("Save image as...");
133:                mSaveImageAs.setMnemonic('s');
134:                mSaveImageAs
135:                        .addActionListener(new java.awt.event.ActionListener() {
136:                            public void actionPerformed(
137:                                    java.awt.event.ActionEvent evt) {
138:                                mSaveImageAsActionPerformed(evt);
139:                            }
140:                        });
141:
142:                mFile.add(mSaveImageAs);
143:
144:                mFile.add(mSepa2);
145:
146:                mAbout.setText("About");
147:                mAbout.setMnemonic('a');
148:                mAbout.addActionListener(new java.awt.event.ActionListener() {
149:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
150:                        mAboutActionPerformed(evt);
151:                    }
152:                });
153:
154:                mFile.add(mAbout);
155:
156:                mFile.add(mSepa3);
157:
158:                mExit.setText("Exit");
159:                mExit.setMnemonic('e');
160:                mExit.addActionListener(new java.awt.event.ActionListener() {
161:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
162:                        mExitActionPerformed(evt);
163:                    }
164:                });
165:
166:                mFile.add(mExit);
167:
168:                mBar.add(mFile);
169:
170:                mEdit.setText("Edit");
171:                mResetView.setText("Reset view");
172:                mResetView.setMnemonic('r');
173:                mResetView
174:                        .addActionListener(new java.awt.event.ActionListener() {
175:                            public void actionPerformed(
176:                                    java.awt.event.ActionEvent evt) {
177:                                mResetViewActionPerformed(evt);
178:                            }
179:                        });
180:
181:                mEdit.add(mResetView);
182:
183:                mBar.add(mEdit);
184:
185:                mAdmin.setText("Admin.");
186:                mStatus.setText("Server status");
187:                mStatus.setMnemonic('s');
188:                mStatus.addActionListener(new java.awt.event.ActionListener() {
189:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
190:                        mStatusActionPerformed(evt);
191:                    }
192:                });
193:
194:                mAdmin.add(mStatus);
195:
196:                mBar.add(mAdmin);
197:
198:                setJMenuBar(mBar);
199:
200:                setBounds(0, 0, 400, 300);
201:            }//GEN-END:initComponents
202:
203:            private void mAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mAboutActionPerformed
204:                if ((pAbout == null) || (!pAbout.isVisible())) {
205:                    pAbout = new guiJCGridAbout(this , false);
206:                    pAbout.setVisible(true);
207:                }
208:            }//GEN-LAST:event_mAboutActionPerformed
209:
210:            private void mResetViewActionPerformed(
211:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mResetViewActionPerformed
212:                if (pSet != null)
213:                    pSet.startRendering();
214:            }//GEN-LAST:event_mResetViewActionPerformed
215:
216:            private void mStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mStatusActionPerformed
217:                if ((pServerStatus != null) && (pServerStatus.isVisible()))
218:                    pServerStatus.refreshInfo(adminConfig);
219:                else {
220:                    try {
221:                        pServerStatus = new guiJCGridAdminStatus(adminConfig,
222:                                this , false);
223:                        pServerStatus.setVisible(true);
224:                    } catch (Exception ex) {
225:                        log.warn(
226:                                "Error while opening the Admin. Status dialog",
227:                                ex);
228:
229:                        JOptionPane.showMessageDialog(this ,
230:                                "Error while opening the Admin. Status dialog",
231:                                "Admin error", JOptionPane.ERROR_MESSAGE);
232:                    }
233:                }
234:            }//GEN-LAST:event_mStatusActionPerformed
235:
236:            private void mExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mExitActionPerformed
237:                this .exitForm(null);
238:            }//GEN-LAST:event_mExitActionPerformed
239:
240:            private void mSaveImageAsActionPerformed(
241:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mSaveImageAsActionPerformed
242:                JFileChooser chooser = new JFileChooser();
243:                chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
244:                chooser.setCurrentDirectory(new File(System
245:                        .getProperty("user.dir")));
246:
247:                int res = chooser.showSaveDialog(this );
248:
249:                if (res == JFileChooser.APPROVE_OPTION)
250:                    pPic.saveImage(chooser.getSelectedFile().getAbsolutePath());
251:            }//GEN-LAST:event_mSaveImageAsActionPerformed
252:
253:            /** Exit the Application */
254:            private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
255:                System.exit(0);
256:            }//GEN-LAST:event_exitForm
257:
258:            /**
259:             * @param args the command line arguments
260:             */
261:            public static void main(String args[]) {
262:                try {
263:                    // Setup log4j
264:
265:                    MainCmd.setUpLog4J("gui-client", false);
266:
267:                    new guiJCGridClient().setVisible(true);
268:                } catch (Exception ex) {
269:                    log.warn("Error", ex);
270:                    System.exit(0);
271:                }
272:            }
273:
274:            // Variables declaration - do not modify//GEN-BEGIN:variables
275:            private javax.swing.JMenuItem mAbout;
276:            private javax.swing.JMenu mAdmin;
277:            private javax.swing.JMenuBar mBar;
278:            private javax.swing.JMenu mEdit;
279:            private javax.swing.JMenuItem mExit;
280:            private javax.swing.JMenu mFile;
281:            private javax.swing.JMenuItem mResetView;
282:            private javax.swing.JMenuItem mSaveImageAs;
283:            private javax.swing.JSeparator mSepa2;
284:            private javax.swing.JSeparator mSepa3;
285:            private javax.swing.JMenuItem mStatus;
286:            // End of variables declaration//GEN-END:variables
287:
288:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.