source: trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java@ 12730

Last change on this file since 12730 was 12730, checked in by kjdon, 18 years ago

added menu bar of changed where help text is opened at

  • Property svn:keywords set to Author Date Id Revision
File size: 24.3 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer.gui;
38
39import java.awt.*;
40import java.awt.event.*;
41import java.io.*;
42import java.util.ArrayList;
43import javax.swing.*;
44import javax.swing.event.*;
45import org.greenstone.gatherer.Configuration;
46import org.greenstone.gatherer.DebugStream;
47import org.greenstone.gatherer.Dictionary;
48import org.greenstone.gatherer.Gatherer;
49import org.greenstone.gatherer.LocalGreenstone;
50import org.greenstone.gatherer.collection.BasicCollectionConfiguration;
51import org.greenstone.gatherer.collection.CollectionManager;
52import org.greenstone.gatherer.shell.GShell;
53import org.greenstone.gatherer.shell.GShellEvent;
54import org.greenstone.gatherer.shell.GShellListener;
55import org.greenstone.gatherer.util.ArrayTools;
56import org.greenstone.gatherer.util.CheckList;
57import org.greenstone.gatherer.util.CheckListEntry;
58import org.greenstone.gatherer.util.StaticStrings;
59import org.greenstone.gatherer.util.Utility;
60
61/** This class provides the functionality to write a CD-ROM/DVD image of current collections from the GSDLHOME/collect/ directory to CDROM. The user chooses the collection from a list, where each entry also displays details about itself, confirms the delete of a collection by checking a checkbox then presses the ok button to actually delete the collection.
62 Copied from DeleteCollectionPrompt
63 * @author John Thompson, Greenstone Digital Library, University of Waikato
64 * @version 2.3
65 */
66public class WriteCDImagePrompt
67 extends ModalDialog
68 implements GShellListener {
69
70 private OKButtonListener ok_button_listener;
71 private ArrayList all_collections = null;
72 private ArrayList selected_collections = null;
73 /** The list of collections to include in exported cd-rom/dvd image */
74 private CheckList list = null;
75 /** The currently selected collection for deletion. */
76 private BasicCollectionConfiguration collection = null;
77 /** A reference to ourself so any inner-classes can dispose of us. */
78 private WriteCDImagePrompt prompt = null;
79 /** The close button, which exits the prompt without deleting anything. */
80 private JButton cancel_button = null;
81 /** The ok button which causes the selected collection to be deleted. */
82 private JButton ok_button = null;
83 /** The label above details. */
84 private JLabel details_label = null;
85 /** The label above the list. */
86 private JLabel list_label = null;
87 /** The text area used to display details about the collection selected. */
88 private JTextArea details_textarea = null;
89 /** The text area used to display instructions for the cd-rom/dvd export */
90 private JTextArea instructions_textarea;
91
92 /** The radio button for switching on the noinstall option */
93 private JRadioButton noinstall_button = null;
94 private JRadioButton install_button = null;
95 private JTextField title_field = null;
96 private JTextField estimated_size_field = null;
97 private JLabel title_label = null;
98 private JLabel estimated_size_label = null;
99 /** A string array used to pass arguments to the exportcol.pl script */
100 private String args[] = null;
101 private String cd_title = null;
102 /** whether the exporting was successful or not */
103 private boolean successful = false;
104 /** whether we are trying to export or not */
105 private boolean exporting = false;
106 /** the error message if any */
107 private StringBuffer error_message = null;
108 /** This is the size of the exported stuff on its own without collections. */
109 private long total_exported_size = 14000000;
110 /** The size of the export prompt screen. */
111 public static final Dimension SIZE = new Dimension(500, 500);
112
113 /** Constructor.
114 * @see org.greenstone.gatherer.collection.WriteCDImagePrompt.CancelButtonListener
115 * @see org.greenstone.gatherer.collection.WriteCDImagePrompt.CollectionListListener
116 * @see org.greenstone.gatherer.collection.WriteCDImagePrompt.OKButtonListener
117 */
118 public WriteCDImagePrompt() {
119 super(Gatherer.g_man, true);
120 cancel_button = new GLIButton(Dictionary.get("General.Close"), Dictionary.get("General.Close_Tooltip"));
121
122 details_textarea = new JTextArea(Dictionary.get("DeleteCollectionPrompt.No_Collection"));
123 details_textarea.setEditable(false);
124
125 details_label = new JLabel(Dictionary.get("DeleteCollectionPrompt.Collection_Details"));
126
127 instructions_textarea = new JTextArea(Dictionary.get("WriteCDImagePrompt.Instructions"));
128 instructions_textarea.setCaretPosition(0);
129 instructions_textarea.setEditable(false);
130 instructions_textarea.setLineWrap(true);
131 instructions_textarea.setRows(4);
132 instructions_textarea.setWrapStyleWord(true);
133
134 all_collections = new ArrayList();
135 list = new CheckList(true);
136 list_label = new JLabel(Dictionary.get("DeleteCollectionPrompt.Collection_List"));
137
138 ok_button = new GLIButton(Dictionary.get("WriteCDImagePrompt.Export"), Dictionary.get("WriteCDImagePrompt.Export_Tooltip"));
139
140 title_field = new JTextField();
141 // Dictionary.setTooltip(title_field, "WriteCDImagePrompt.CD_Name_Tooltip");
142 title_label = new JLabel(Dictionary.get("WriteCDImagePrompt.CD_Name"));
143
144
145 estimated_size_field = new JTextField();
146 estimated_size_field.setEditable(false);
147
148 // work out the size of the images directory - could be large if they
149 // have the classic interface pack installed
150 total_exported_size += getFileSize(new File(LocalGreenstone.getDirectoryPath()+File.separator+"images"));
151 estimated_size_field.setText(Utility.formatFileLength(total_exported_size));
152 estimated_size_field.setBackground(Configuration.getColor("coloring.collection_tree_background", false));
153 estimated_size_label = new JLabel(Dictionary.get("WriteCDImagePrompt.Size_Label"));
154
155 scanForCollections();
156 list.setListData(all_collections);
157
158 prompt = this;
159 setSize(SIZE);
160 setTitle(Dictionary.get("WriteCDImagePrompt.Export"));
161
162 setJMenuBar(new SimpleMenuBar("exportingcollections"));
163 cancel_button.addActionListener(new CancelButtonListener());
164 list.addListSelectionListener(new CollectionListListener());
165 list.clearSelection();
166 list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
167 ok_button_listener = new OKButtonListener();
168 ok_button.addActionListener(ok_button_listener);
169 ok_button.setEnabled(false);
170 //title.getDocument().addDocumentListener(new DocumentListener());
171
172 noinstall_button = new JRadioButton(Dictionary.get("WriteCDImagePrompt.NoInstall"));
173 noinstall_button.setToolTipText(Dictionary.get("WriteCDImagePrompt.NoInstall_Tooltip"));
174
175
176 install_button = new JRadioButton(Dictionary.get("WriteCDImagePrompt.Install"));
177 install_button.setToolTipText(Dictionary.get("WriteCDImagePrompt.Install_Tooltip"));
178
179
180
181 }
182
183 /** Destructor. */
184 public void destroy() {
185 all_collections.clear();
186 all_collections = null;
187 cancel_button = null;
188 details_textarea = null;
189 details_label = null;
190 list = null;
191 ok_button = null;
192 prompt = null;
193 if (selected_collections!=null) {
194 selected_collections.clear();
195 selected_collections = null;
196 }
197 title_field = null;
198 title_label = null;
199 }
200
201 /** This method causes the modal prompt to be displayed.
202 * returns true if it has exported the collections that are currently selected */
203 public boolean display() {
204
205 // Radio buttons
206 ButtonGroup radio_group = new ButtonGroup();
207 radio_group.add(install_button);
208 install_button.setSelected(true);
209 radio_group.add(noinstall_button);
210
211 // Top pane
212 JPanel instructions_pane = new JPanel(new BorderLayout());
213 instructions_pane.setBorder(BorderFactory.createEmptyBorder(5,5,0,5));
214 instructions_pane.add(new JScrollPane(instructions_textarea), BorderLayout.CENTER);
215
216 title_label.setBorder(BorderFactory.createEmptyBorder(0,5,0,15));
217
218 JPanel title_pane = new JPanel(new BorderLayout());
219 title_pane.add(title_label, BorderLayout.WEST);
220 title_pane.add(title_field, BorderLayout.CENTER);
221 title_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
222
223 JPanel radio_pane = new JPanel(new GridLayout(2,1));
224 install_button.setBackground(Configuration.getColor("coloring.collection_heading_background", true));
225 noinstall_button.setBackground(Configuration.getColor("coloring.collection_heading_background", true));
226 radio_pane.add(install_button);
227 radio_pane.add(noinstall_button);
228
229
230 JPanel options_pane = new JPanel(new BorderLayout());
231 options_pane.add(title_pane, BorderLayout.NORTH);
232 options_pane.add(radio_pane, BorderLayout.CENTER);
233 instructions_pane.add(options_pane, BorderLayout.SOUTH);
234
235 // Central pane
236 JPanel list_pane = new JPanel(new BorderLayout());
237 list_pane.add(list_label, BorderLayout.NORTH);
238 list_pane.add(new JScrollPane(list), BorderLayout.CENTER);
239 list_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
240
241 JPanel details_pane = new JPanel(new BorderLayout());
242 details_pane.add(details_label, BorderLayout.NORTH);
243 details_pane.add(new JScrollPane(details_textarea), BorderLayout.CENTER);
244 details_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
245
246 JPanel central_pane = new JPanel(new GridLayout(2, 1));
247 central_pane.add(list_pane);
248 central_pane.add(details_pane);
249 central_pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
250
251 // Lower pane
252 JPanel estimated_size_pane = new JPanel(new BorderLayout());
253 estimated_size_pane.add(estimated_size_label, BorderLayout.WEST);
254 estimated_size_pane.add(estimated_size_field, BorderLayout.CENTER);
255 estimated_size_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
256
257 JPanel button_pane = new JPanel(new GridLayout(1, 2));
258 button_pane.add(ok_button);
259 button_pane.add(cancel_button);
260 button_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
261
262 JPanel lower_pane = new JPanel(new BorderLayout());
263 lower_pane.add(estimated_size_pane, BorderLayout.NORTH);
264 lower_pane.add(button_pane, BorderLayout.SOUTH);
265 lower_pane.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
266
267 // Final.
268 JPanel content_pane = (JPanel)this.getContentPane();
269 content_pane.setLayout(new BorderLayout());
270 content_pane.add(instructions_pane, BorderLayout.NORTH);
271 content_pane.add(central_pane, BorderLayout.CENTER);
272 content_pane.add(lower_pane, BorderLayout.SOUTH);
273
274 // Center and display.
275 Dimension screen_size = Configuration.screen_size;
276 this.setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
277 this.setVisible(true); // blocks until the dialog is killed
278 return true;
279
280 }
281
282
283 protected long getFileSize(File file)
284 {
285 long file_size = 0;
286
287 // Directory case
288 if (file.isDirectory()) {
289 File files[] = file.listFiles();
290 for (int i = 0; i < files.length; i++) {
291 file_size += getFileSize(files[i]);
292 }
293 }
294 // File case
295 else {
296 file_size = file.length();
297 }
298
299 return file_size;
300 }
301
302 /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor.
303 * @see org.greenstone.gatherer.Configuration
304 * @see org.greenstone.gatherer.Gatherer
305 * @see org.greenstone.gatherer.collection.Collection
306 * @see org.greenstone.gatherer.gui.BuildOptions
307 * @see org.greenstone.gatherer.shell.GShell
308 * @see org.greenstone.gatherer.shell.GShellListener
309 * @see org.greenstone.gatherer.shell.GShellProgressMonitor
310 * @see org.greenstone.gatherer.util.Utility
311 */
312 public void writeCDImageCollections()
313 {
314 DebugStream.println("WriteCDImagePrompt.writeCDImageCollections()");
315
316 int num_collections = selected_collections.size();
317 if (num_collections == 0) return;
318 cd_title = title_field.getText();
319 cd_title = cd_title.trim();
320 cd_title = cd_title.replaceAll("\"","");
321
322 // Generate the exportcol.pl command
323 ArrayList command_parts_list = new ArrayList();
324 if (Utility.isWindows() && (!Gatherer.isGsdlRemote)) {
325 command_parts_list.add(Configuration.perl_path);
326 command_parts_list.add("-S");
327 }
328 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "exportcol.pl");
329
330 command_parts_list.add("-gli");
331 command_parts_list.add("-language");
332 command_parts_list.add(Configuration.getLanguage());
333
334 if (cd_title.equals("")) {
335 command_parts_list.add("-cdname");
336 command_parts_list.add("Greenstone Collections");
337
338 command_parts_list.add("-cddir");
339 command_parts_list.add("exported_collections");
340 }
341 else {
342 command_parts_list.add("-cdname");
343 command_parts_list.add(cd_title);
344
345 String cd_dir = "exported_"+cd_title.replaceAll("\\s","");
346 command_parts_list.add("-cddir");
347 command_parts_list.add(cd_dir);
348 }
349
350 if (noinstall_button.isSelected()) {
351 command_parts_list.add("-noinstall");
352 }
353
354 for (int i = 0; i < num_collections; i++) {
355 command_parts_list.add(((BasicCollectionConfiguration) selected_collections.get(i)).getShortName());
356 }
357
358 DebugStream.print("export command = ");
359 for (int i = 0; i < command_parts_list.size(); i++) {
360 DebugStream.print(command_parts_list.get(i) + " ");
361 }
362 DebugStream.println("");
363 // Run the exportcol.pl command
364 String[] command_parts = (String[]) command_parts_list.toArray(new String[0]);
365 GShell process = new GShell(command_parts, GShell.CDIMAGE, 3, this, null, GShell.GSHELL_CDIMAGE);
366 process.start();
367 //process.run();
368 DebugStream.println("WriteCDImagePrompt.writeCDImageCollections().return");
369
370 }
371
372 /** Shows an export complete prompt.
373 * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
374 * @see org.greenstone.gatherer.collection.Collection
375 */
376 public void resultPrompt(boolean success, String extra) {
377 args = new String[2];
378 StringBuffer coll_names = new StringBuffer();
379 for (int i=0; i<selected_collections.size();i++) {
380 if (i>0) {
381 coll_names.append(", ");
382 }
383 BasicCollectionConfiguration complete_collection = (BasicCollectionConfiguration)selected_collections.get(i);
384 coll_names.append(complete_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + complete_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER);
385 complete_collection = null;
386 }
387
388 args[0] = coll_names.toString();
389 args[1] = LocalGreenstone.getTmpDirectoryPath();
390 if(cd_title.equals("")) {
391 args[1] += "exported_collections";
392 } else {
393 args[1] += "exported_"+cd_title.replaceAll("\\s","");
394 }
395 String title;
396 String label;
397 if (success) {
398 title = Dictionary.get("WriteCDImagePrompt.Successful_Title");
399 label = Dictionary.get("WriteCDImagePrompt.Successful_Export", args);
400 } else {
401 title = Dictionary.get("WriteCDImagePrompt.Failed_Title");
402 label = Dictionary.get("WriteCDImagePrompt.Failed_Export", args);
403 }
404 SimpleResultDialog result_dialog = new SimpleResultDialog(title, label, extra);
405 result_dialog.setVisible(true); // Blocks
406 result_dialog.dispose();
407 result_dialog = null;
408 }
409
410 /** Method to scan the collect directory retrieving and reloading each collection it finds, while building the list of known collections.
411 * @see org.greenstone.gatherer.Configuration
412 * @see org.greenstone.gatherer.Gatherer
413 * @see org.greenstone.gatherer.util.ArrayTools
414 * @see org.greenstone.gatherer.util.Utility
415 */
416 private void scanForCollections() {
417 // Start at the collect dir.
418 File collect_directory = new File(Gatherer.getCollectDirectoryPath());
419 if (collect_directory.exists()) {
420 // Now for each child directory see if it contains a .col file and
421 // if so try to load it..
422 File collections[] = collect_directory.listFiles();
423 ArrayTools.sort(collections);
424 for(int i = 0; collections != null && i < collections.length; i++) {
425 if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
426 File config_file = new File(collections[i], Utility.CONFIG_FILE);
427 if (config_file.exists()) {
428 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
429 all_collections.add(config);
430 config = null;
431 }
432 }
433 }
434 }
435 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
436 }
437
438
439 /** All implementation of GShellListener must include this method so the listener can be informed of messages from the GShell.
440 * @param event A <strong>GShellEvent</strong> that contains, amoung other things, the message.
441 */
442 public synchronized void message(GShellEvent event) {
443 // Ignore the messages from RecPlug with 'show_progress' set (used for progress bars)
444 String message = event.getMessage();
445 if (message.startsWith("exportcol.pl>")) {
446 message = message.substring(13);
447 //DebugStream.println("message = "+event.getMessage());
448 error_message.append(message);
449 error_message.append("\n");
450 }
451 }
452
453 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell begins its task. Implementation side-effect, not actually used.
454 * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement.
455 */
456 public synchronized void processBegun(GShellEvent event) {
457 // We don't care.
458 }
459 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell completes its task.
460 * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion.
461 */
462 public synchronized void processComplete(GShellEvent event) {
463 successful = false;
464 if(event.getStatus() == GShell.OK) {
465 if(event.getType() == GShell.CDIMAGE) {
466 successful = true;
467 }
468 }
469 ok_button_listener.processComplete();
470 }
471
472 /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
473 private class CancelButtonListener
474 implements ActionListener {
475 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
476 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
477 */
478 public void actionPerformed(ActionEvent event) {
479 prompt.dispose();
480 }
481 }
482
483 /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
484 */
485 private class CollectionListListener
486 implements ListSelectionListener
487 {
488 /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
489 * @param event a <strong>ListSelectionEvent</strong> containing all the relevant information garnered from the event itself
490 */
491 public void valueChanged(ListSelectionEvent event)
492 {
493 // Wait for things to settle down a bit
494 if (event.getValueIsAdjusting()) {
495 return;
496 }
497
498 // Can only export when something is ticked
499 ok_button.setEnabled(!list.isNothingTicked());
500
501 if (list.isSelectionEmpty()) {
502 // This only happens when the dialog is first entered
503 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.No_Collection"));
504 return;
505 }
506
507 collection = (BasicCollectionConfiguration) ((CheckListEntry) list.getSelectedValue()).getObject();
508 args = new String[3];
509 args[0] = collection.getCreator();
510 args[1] = collection.getMaintainer();
511 args[2] = collection.getDescription();
512 details_textarea.setText(Dictionary.get("DeleteCollectionPrompt.Details", args));
513 details_textarea.setCaretPosition(0);
514
515 // Find the size of the "etc", "images" and "index" directories of the collection
516 String collection_directory_path = CollectionManager.getCollectionDirectoryPath(collection.getShortName());
517 File etc_directory = new File(collection_directory_path + "etc");
518 File images_directory = new File(collection_directory_path + "images");
519 File index_directory = new File(collection_directory_path + "index");
520 long collection_size_built = getFileSize(etc_directory) + getFileSize(images_directory) + getFileSize(index_directory);
521
522 // Add/subtract it from the total, depending on whether the collection has just been ticked/unticked
523 if (((CheckListEntry) list.getSelectedValue()).isSelected()) {
524 total_exported_size += collection_size_built;
525 }
526 else {
527 total_exported_size -= collection_size_built;
528 }
529
530 // Update the size field
531 estimated_size_field.setText(Utility.formatFileLength(total_exported_size));
532 }
533 }
534
535
536 /** The OK button listener implementation. */
537 private class OKButtonListener
538 implements ActionListener {
539 private Component glass_pane;
540 private MouseListener mouse_blocker_listener;
541 private ProgressDialog progress_dialog;
542
543 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
544 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
545 * @see org.greenstone.gatherer.Configuration
546 * @see org.greenstone.gatherer.Gatherer
547 * @see org.greenstone.gatherer.util.Utility
548 */
549 public void actionPerformed(ActionEvent event) {
550 ///ystem.err.println("OK Clicked");
551 // Make sure there are some colls specified
552 selected_collections = list.getTicked();
553 error_message = new StringBuffer();
554
555 // Set the cursor to hourglass
556 glass_pane = getGlassPane();
557 mouse_blocker_listener = new MouseAdapter() {};
558 glass_pane.addMouseListener(mouse_blocker_listener);
559 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
560 glass_pane.setVisible(true);
561
562 // Export the selected collection.
563 ///ystem.err.println("Write CD-ROM/DVD image for named collections");
564 writeCDImageCollections();
565
566 // Show progress dialog
567 ///ystem.err.println("Showing progress dialog");
568 progress_dialog = new ProgressDialog();
569 progress_dialog.setVisible(true);
570 }
571
572 public void processComplete() {
573 ///ystem.err.println("Process complete");
574 // Dispose of progress dialog
575 progress_dialog.setVisible(false);
576 progress_dialog.dispose();
577 progress_dialog = null;
578
579 // unset the cursor
580 glass_pane.setVisible(false);
581 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
582 glass_pane.removeMouseListener(mouse_blocker_listener);
583 glass_pane = null;
584 mouse_blocker_listener= null;
585
586 if (successful) {
587 resultPrompt(true, error_message.toString());
588 } else {
589 resultPrompt(false, error_message.toString());
590 }
591 error_message = null;
592 }
593
594 private class ProgressDialog
595 extends ModalDialog {
596
597 private Dimension size = new Dimension(400,65);
598
599 public ProgressDialog() {
600 super(Gatherer.g_man, Dictionary.get("WriteCDImagePrompt.Title"), true);
601 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
602 setSize(size);
603 JPanel content_pane = (JPanel) getContentPane();
604 JLabel progress_label = new JLabel(Dictionary.get("WriteCDImagePrompt.Progress_Label"));
605
606 JProgressBar progress_bar = new JProgressBar();
607 progress_bar.setIndeterminate(true);
608 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
609 content_pane.setLayout(new BorderLayout());
610 content_pane.add(progress_label, BorderLayout.NORTH);
611 content_pane.add(progress_bar, BorderLayout.CENTER);
612 // Position
613 Rectangle frame_bounds = Gatherer.g_man.getBounds();
614 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
615 }
616 }
617 }
618}
Note: See TracBrowser for help on using the repository browser.