Source Code Cross Referenced for ProgressDialog.java in  » J2EE » jag » com » finalist » jaggenerator » 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 » jag » com.finalist.jaggenerator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // ProgressDialog
002:        // $Id: ProgressDialog.java,v 1.1 2003/12/09 10:21:45 oconnor_m Exp $
003:        //
004:        // Copyright (C) 2002-2003 Axel Wernicke <axel.wernicke@gmx.de>
005:        //
006:        // This program is free software; you can redistribute it and/or modify
007:        // it under the terms of the GNU General Public License as published by
008:        // the Free Software Foundation; either version 2 of the License, or
009:        // (at your option) any later version.
010:        //
011:        // This program is distributed in the hope that it will be useful,
012:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
013:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:        // GNU General Public License for more details.
015:        //
016:        // You should have received a copy of the GNU General Public License
017:        // along with this program; if not, write to the Free Software
018:        // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:
020:        package com.finalist.jaggenerator;
021:
022:        /**
023:         * ProgressDialog provides a progress bar within a dialog window and a cancel button to abort the action.
024:         *
025:         * @author  axel wernicke
026:         */
027:        public class ProgressDialog extends javax.swing.JDialog {
028:            /** The myPod action worker thre3ad this dialog is attached to */
029:            private Thread worker = null;
030:
031:            /**
032:             * Creates new form ProgressDialog.  The dialogue will not be visible untl {@link #startThread} is called.
033:             *
034:             * @param parent frame for the dialog
035:             * @param modal create dialog (a-) synchronously
036:             */
037:            public ProgressDialog(java.awt.Frame parent, boolean modal) {
038:                super (parent, modal);
039:            }
040:
041:            /**
042:             * Starts up the thread that does the actual work being monitored.
043:             *
044:             * @param worker thread the dialog is attached to
045:             */
046:            public void startThread(final Thread worker) {
047:                this .worker = worker;
048:                initComponents();
049:                totalProgressBar.setIndeterminate(true);
050:                pack();
051:                setLocationRelativeTo(getParent());
052:                worker.start();
053:                //      //create a waiter thread: waits until task is finished, then closes dialogue.
054:                //      new Thread("ProgressDialog.startThread") {
055:                //         public void run() {
056:                //            try {
057:                //               worker.join();
058:                //            } catch (InterruptedException e) {
059:                //               //no action
060:                //            }
061:                //            setVisible(false);
062:                //            dispose();
063:                //            JagGenerator.logToConsole("2222222222222222222222222");
064:                //
065:                //         }
066:                //      }.start();
067:
068:                setVisible(true);
069:                JagGenerator.logToConsole("33333333333333333333333");
070:
071:            }
072:
073:            /** This method is called from within the constructor to
074:             * initialize the form.
075:             * WARNING: Do NOT modify this code. The content of this method is
076:             * always regenerated by the Form Editor.
077:             */
078:            private void initComponents()//GEN-BEGIN:initComponents
079:            {
080:                java.awt.GridBagConstraints gridBagConstraints;
081:
082:                statusLabel = new javax.swing.JLabel();
083:                statusContentLabel = new javax.swing.JLabel();
084:                totalProgressBar = new javax.swing.JProgressBar();
085:                clipLabel = new javax.swing.JLabel();
086:                clipContentLabel = new javax.swing.JLabel();
087:                canelButton = new javax.swing.JButton();
088:
089:                getContentPane().setLayout(new java.awt.GridBagLayout());
090:
091:                setTitle("progress...");
092:                setName("progressDialog");
093:                setResizable(false);
094:                addWindowListener(new java.awt.event.WindowAdapter() {
095:                    public void windowClosing(java.awt.event.WindowEvent evt) {
096:                        closeDialog(evt);
097:                    }
098:                });
099:
100:                statusLabel.setForeground(new java.awt.Color(102, 102, 153));
101:                statusLabel.setText("status:");
102:                gridBagConstraints = new java.awt.GridBagConstraints();
103:                gridBagConstraints.gridx = 0;
104:                gridBagConstraints.gridy = 0;
105:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
106:                gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
107:                getContentPane().add(statusLabel, gridBagConstraints);
108:
109:                statusContentLabel.setFont(new java.awt.Font("Dialog", 1, 10));
110:                statusContentLabel.setMaximumSize(new java.awt.Dimension(250,
111:                        14));
112:                statusContentLabel.setMinimumSize(new java.awt.Dimension(200,
113:                        14));
114:                statusContentLabel.setPreferredSize(new java.awt.Dimension(200,
115:                        14));
116:                gridBagConstraints = new java.awt.GridBagConstraints();
117:                gridBagConstraints.gridx = 1;
118:                gridBagConstraints.gridy = 0;
119:                gridBagConstraints.gridwidth = 2;
120:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
121:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
122:                gridBagConstraints.weightx = 0.1;
123:                gridBagConstraints.insets = new java.awt.Insets(12, 11, 0, 12);
124:                getContentPane().add(statusContentLabel, gridBagConstraints);
125:
126:                gridBagConstraints = new java.awt.GridBagConstraints();
127:                gridBagConstraints.gridx = 0;
128:                gridBagConstraints.gridy = 1;
129:                gridBagConstraints.gridwidth = 3;
130:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
131:                gridBagConstraints.insets = new java.awt.Insets(11, 17, 0, 17);
132:                getContentPane().add(totalProgressBar, gridBagConstraints);
133:
134:                clipLabel.setForeground(new java.awt.Color(102, 102, 153));
135:                clipLabel.setText("clip:");
136:                gridBagConstraints = new java.awt.GridBagConstraints();
137:                gridBagConstraints.gridx = 0;
138:                gridBagConstraints.gridy = 2;
139:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
140:                gridBagConstraints.insets = new java.awt.Insets(11, 12, 0, 0);
141:                getContentPane().add(clipLabel, gridBagConstraints);
142:
143:                clipContentLabel.setFont(new java.awt.Font("Dialog", 1, 10));
144:                clipContentLabel
145:                        .setMaximumSize(new java.awt.Dimension(250, 14));
146:                clipContentLabel
147:                        .setMinimumSize(new java.awt.Dimension(250, 14));
148:                clipContentLabel.setPreferredSize(new java.awt.Dimension(250,
149:                        14));
150:                gridBagConstraints = new java.awt.GridBagConstraints();
151:                gridBagConstraints.gridx = 1;
152:                gridBagConstraints.gridy = 2;
153:                gridBagConstraints.gridwidth = 2;
154:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
155:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
156:                gridBagConstraints.insets = new java.awt.Insets(11, 11, 0, 12);
157:                getContentPane().add(clipContentLabel, gridBagConstraints);
158:
159:                canelButton.setText("cancel");
160:                canelButton
161:                        .addActionListener(new java.awt.event.ActionListener() {
162:                            public void actionPerformed(
163:                                    java.awt.event.ActionEvent evt) {
164:                                canelButtonActionPerformed(evt);
165:                            }
166:                        });
167:
168:                gridBagConstraints = new java.awt.GridBagConstraints();
169:                gridBagConstraints.gridx = 0;
170:                gridBagConstraints.gridy = 6;
171:                gridBagConstraints.gridwidth = 3;
172:                gridBagConstraints.insets = new java.awt.Insets(17, 12, 12, 12);
173:                getContentPane().add(canelButton, gridBagConstraints);
174:
175:                pack();
176:            }//GEN-END:initComponents
177:
178:            /** Cancels the action and closes the dialog
179:             * @param evt that triggered the action
180:             */
181:            private void canelButtonActionPerformed(
182:                    java.awt.event.ActionEvent evt)//GEN-FIRST:event_canelButtonActionPerformed
183:            {//GEN-HEADEREND:event_canelButtonActionPerformed
184:                if (worker != null) {
185:                    worker.interrupt();
186:                } else {
187:                    setVisible(false);
188:                    dispose();
189:                }
190:
191:            }//GEN-LAST:event_canelButtonActionPerformed
192:
193:            /** Cancels the action and closes the dialog
194:             * @param evt that triggered the action
195:             */
196:            private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
197:                if (worker != null) {
198:                    worker.interrupt();
199:                } else {
200:                    setVisible(false);
201:                    dispose();
202:                }
203:
204:            }//GEN-LAST:event_closeDialog
205:
206:            /** Sets the status text
207:             * @param text to set
208:             */
209:            public void setStatusText(String text) {
210:                if (statusContentLabel != null) {
211:                    this .statusContentLabel.setText(text);
212:                }
213:            }
214:
215:            /** Sets the clip text
216:             * @param text to set
217:             */
218:            public void setClipText(String text) {
219:                this .clipContentLabel.setText(text);
220:            }
221:
222:            /** Sets the minimum value of the progress bar
223:             * @param value to set
224:             */
225:            public void setProgressMin(int value) {
226:                this .totalProgressBar.setMinimum(value);
227:            }
228:
229:            /** Sets the progress max value
230:             * @param value to set
231:             */
232:            public void setProgressMax(int value) {
233:                this .totalProgressBar.setMaximum(value);
234:            }
235:
236:            /** Sets the progress bounds
237:             * @param min value to set
238:             * @param max value to set
239:             */
240:            public void setProgressBounds(int min, int max) {
241:                this .totalProgressBar.setMinimum(min);
242:                this .totalProgressBar.setMaximum(max);
243:            }
244:
245:            /** Sets the value of the progress bar
246:             * @param value to set
247:             */
248:            public void setProgressValue(int value) {
249:                this .totalProgressBar.setValue(value);
250:            }
251:
252:            /** Gets the value of the progress bar
253:             * @return progress value
254:             */
255:            public int getProgressValue() {
256:                return this .totalProgressBar.getValue();
257:            }
258:
259:            /** Sets the progress bars indeterminate status.
260:             * @param value to set
261:             */
262:            public void setProgressIndeterminate(boolean value) {
263:                this .totalProgressBar.setIndeterminate(value);
264:            }
265:
266:            /** Interrupts the worker thread (action) that dialog is attached to */
267:            public void interrupt() {
268:                this .worker.interrupt();
269:            }
270:
271:            // Variables declaration - do not modify//GEN-BEGIN:variables
272:            private javax.swing.JButton canelButton;
273:            private javax.swing.JLabel clipContentLabel;
274:            private javax.swing.JLabel clipLabel;
275:            private javax.swing.JLabel statusContentLabel;
276:            private javax.swing.JLabel statusLabel;
277:            private javax.swing.JProgressBar totalProgressBar;
278:            // End of variables declaration//GEN-END:variables
279:
280:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.