source: trunk/gli/src/org/greenstone/gatherer/collection/ExportCollectionPrompt.java@ 8496

Last change on this file since 8496 was 8496, checked in by mdewsnip, 19 years ago

Started off fixing a bug where the loaded collection wasn't being ticked on in the cross-collection searching page. Ended up removing a ton of stuff from the CheckList class, some of which was duplicated code and buggy.

  • Property svn:keywords set to Author Date Id Revision
File size: 23.1 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.collection;
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.checklist.CheckList;
50import org.greenstone.gatherer.checklist.Entry;
51import org.greenstone.gatherer.gui.GLIButton;
52import org.greenstone.gatherer.gui.ModalDialog;
53import org.greenstone.gatherer.gui.SimpleMenuBar;
54import org.greenstone.gatherer.shell.GShell;
55import org.greenstone.gatherer.shell.GShellEvent;
56import org.greenstone.gatherer.shell.GShellListener;
57import org.greenstone.gatherer.util.ArrayTools;
58import org.greenstone.gatherer.util.GSDLSiteConfig;
59import org.greenstone.gatherer.util.StaticStrings;
60import org.greenstone.gatherer.util.Utility;
61
62/** This class provides the functionality to export 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.
63 Copied from DeleteCollectionPrompt
64 * @author John Thompson, Greenstone Digital Library, University of Waikato
65 * @version 2.3
66 */
67public class ExportCollectionPrompt
68 extends ModalDialog
69 implements GShellListener {
70
71 private OKButtonListener ok_button_listener;
72 private ArrayList all_collections = null;
73 private ArrayList selected_collections = null;
74 /** The list of collections to export */
75 private CheckList list = null;
76 /** The currently selected collection for deletion. */
77 private BasicCollectionConfiguration collection = null;
78 /** A reference to ourself so any inner-classes can dispose of us. */
79 private ExportCollectionPrompt prompt = null;
80 /** The close button, which exits the prompt without deleting anything. */
81 private JButton cancel_button = null;
82 /** The ok button which causes the selected collection to be deleted. */
83 private JButton ok_button = null;
84 /** The label above details. */
85 private JLabel details_label = null;
86 /** The label above the list. */
87 private JLabel list_label = null;
88 /** The text area used to display details about the collection selected. */
89 private JTextArea details_textarea = null;
90 /** The text area used to display instructions for the export */
91 private JTextArea instructions_textarea;
92 /** A string array used to pass arguments to the phrase retrieval method. */
93 private JTextField title_field = null;
94 private JLabel title_label = null;
95 private String args[] = null;
96 private String cd_title = null;
97 /** whether the exporting was successful or not */
98 private boolean successful = false;
99 /** whether we are trying to export or not */
100 private boolean exporting = false;
101 /** the error message if any */
102 private StringBuffer error_message = null;
103 /** The size of the export prompt screen. */
104 public static final Dimension SIZE = new Dimension(500, 500);
105
106 /** Constructor.
107 * @see org.greenstone.gatherer.collection.ExportCollectionPrompt.CancelButtonListener
108 * @see org.greenstone.gatherer.collection.ExportCollectionPrompt.CollectionListListener
109 * @see org.greenstone.gatherer.collection.ExportCollectionPrompt.OKButtonListener
110 */
111 public ExportCollectionPrompt() {
112 super(Gatherer.g_man, true);
113 cancel_button = new GLIButton();
114 cancel_button.setMnemonic(KeyEvent.VK_C);
115 Dictionary.setBoth(cancel_button, "General.Close", "General.Close_Tooltip");
116 details_textarea = new JTextArea();
117 details_textarea.setEditable(false);
118 details_textarea.setFont(Configuration.getFont("general.tooltip_font", false));
119 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
120 details_label = new JLabel();
121 Dictionary.setText(details_label, "DeleteCollectionPrompt.Collection_Details");
122
123 instructions_textarea = new JTextArea();
124 instructions_textarea.setCaretPosition(0);
125 instructions_textarea.setEditable(false);
126 instructions_textarea.setLineWrap(true);
127 instructions_textarea.setRows(4);
128 instructions_textarea.setWrapStyleWord(true);
129 Dictionary.registerText(instructions_textarea, "ExportCollectionPrompt.Instructions");
130
131 all_collections = new ArrayList();
132 list = new CheckList(true);
133 list_label = new JLabel();
134 Dictionary.setText(list_label, "DeleteCollectionPrompt.Collection_List");
135 ok_button = new GLIButton();
136 ok_button.setMnemonic(KeyEvent.VK_D);
137 Dictionary.setBoth(ok_button, "ExportCollectionPrompt.Export", "ExportCollectionPrompt.Export_Tooltip");
138
139 title_field = new JTextField();
140 Dictionary.setTooltip(title_field, "ExportCollectionPrompt.CD_Name_Tooltip");
141 title_label = new JLabel();
142 Dictionary.setText(title_label, "ExportCollectionPrompt.CD_Name");
143 scanForCollections();
144 list.setListData(all_collections);
145
146 prompt = this;
147 setSize(SIZE);
148 Dictionary.setText(this, "ExportCollectionPrompt.Title");
149
150 setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
151 cancel_button.addActionListener(new CancelButtonListener());
152 list.addListSelectionListener(new CollectionListListener());
153 list.clearSelection();
154 list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
155 ok_button_listener = new OKButtonListener();
156 ok_button.addActionListener(ok_button_listener);
157 ok_button.setEnabled(false);
158 //title.getDocument().addDocumentListener(new DocumentListener());
159 }
160
161 /** Destructor. */
162 public void destroy() {
163 all_collections.clear();
164 all_collections = null;
165 cancel_button = null;
166 details_textarea = null;
167 details_label = null;
168 list = null;
169 ok_button = null;
170 prompt = null;
171 if (selected_collections!=null) {
172 selected_collections.clear();
173 selected_collections = null;
174 }
175 title_field = null;
176 title_label = null;
177 }
178
179 /** This method causes the modal prompt to be displayed.
180 * returns true if it has exported the collections that are currently selected */
181 public boolean display() {
182 // Top pane
183 JPanel instructions_pane = new JPanel(new BorderLayout());
184 instructions_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0));
185 instructions_pane.add(new JScrollPane(instructions_textarea), BorderLayout.CENTER);
186
187 title_label.setBorder(BorderFactory.createEmptyBorder(0,5,0,15));
188
189 JPanel title_pane = new JPanel(new BorderLayout());
190 title_pane.add(title_label, BorderLayout.WEST);
191 title_pane.add(title_field, BorderLayout.CENTER);
192 instructions_pane.add(title_pane, BorderLayout.SOUTH);
193
194 // Central pane
195 JPanel list_pane = new JPanel(new BorderLayout());
196 list_pane.add(list_label, BorderLayout.NORTH);
197 list_pane.add(new JScrollPane(list), BorderLayout.CENTER);
198 list_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
199
200 JPanel details_pane = new JPanel(new BorderLayout());
201 details_pane.add(details_label, BorderLayout.NORTH);
202 details_pane.add(new JScrollPane(details_textarea), BorderLayout.CENTER);
203 details_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
204
205 JPanel central_pane = new JPanel(new GridLayout(2, 1));
206 central_pane.add(list_pane);
207 central_pane.add(details_pane);
208 central_pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
209
210 // Lower pane
211 JPanel button_pane = new JPanel(new GridLayout(1, 2));
212 button_pane.add(ok_button);
213 button_pane.add(cancel_button);
214 button_pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
215
216 JPanel lower_pane = new JPanel(new BorderLayout());
217 lower_pane.add(button_pane, BorderLayout.SOUTH);
218 lower_pane.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
219
220 // Final.
221 JPanel content_pane = (JPanel)this.getContentPane();
222 content_pane.setLayout(new BorderLayout());
223 content_pane.add(instructions_pane, BorderLayout.NORTH);
224 content_pane.add(central_pane, BorderLayout.CENTER);
225 content_pane.add(lower_pane, BorderLayout.SOUTH);
226
227 // Center and display.
228 Dimension screen_size = Configuration.screen_size;
229 this.setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
230 this.setVisible(true); // blocks until the dialog is killed
231 return true;
232
233 }
234
235
236 /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor.
237 * @see org.greenstone.gatherer.Configuration
238 * @see org.greenstone.gatherer.Gatherer
239 * @see org.greenstone.gatherer.collection.Collection
240 * @see org.greenstone.gatherer.gui.BuildOptions
241 * @see org.greenstone.gatherer.shell.GShell
242 * @see org.greenstone.gatherer.shell.GShellListener
243 * @see org.greenstone.gatherer.shell.GShellProgressMonitor
244 * @see org.greenstone.gatherer.util.Utility
245 */
246 public void exportCollections() {
247 DebugStream.println("ExportCollectionPrompt.exportCollection()");
248
249 int num_collections = selected_collections.size();
250 if (num_collections == 0) return;
251 cd_title = title_field.getText();
252 cd_title = cd_title.trim();
253 cd_title = cd_title.replaceAll("\"","");
254 int num_args = num_collections + 4;
255 boolean has_title = false;
256 if (!cd_title.equals("")) {
257 num_args += 2;
258 has_title = true;
259 }
260 String args[];
261 int next_arg = 0;
262 if(Utility.isWindows()) {
263 args = new String[num_args+2];
264 args[0] = Configuration.perl_path;
265 args[1] = "-S";
266 next_arg = 2;
267 } else {
268 args = new String[num_args];
269 }
270
271 args[next_arg] = Configuration.getScriptPath() + "exportcol.pl";
272 next_arg++;
273 args[next_arg] = "-gli"; next_arg++;
274 args[next_arg] = "-language"; next_arg++;
275 args[next_arg] = Configuration.getLanguage(); next_arg++;
276
277 if (has_title) {
278 args[next_arg] = "-cdname"; next_arg++;
279 args[next_arg] = cd_title; next_arg++;
280 }
281 for (int i=0; i<num_collections;i++,next_arg++) {
282 args[next_arg] = ((BasicCollectionConfiguration)selected_collections.get(i)).getShortName();
283 }
284
285 DebugStream.print("export command = ");
286 for (int i=0; i<args.length; i++) {
287 DebugStream.print(args[i]+" ");
288 }
289 DebugStream.println("");
290 GShell process = new GShell(args, GShell.EXPORT, 3, this, null, GShell.GSHELL_EXPORT);
291 process.start();
292 //process.run();
293 DebugStream.println("ExportCollectionPrompt.exportCollection().return");
294 }
295
296 /** Shows an export complete prompt.
297 * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
298 * @see org.greenstone.gatherer.collection.Collection
299 */
300 public void resultPrompt(boolean success, String extra) {
301 args = new String[2];
302 StringBuffer coll_names = new StringBuffer();
303 for (int i=0; i<selected_collections.size();i++) {
304 if (i>0) {
305 coll_names.append(", ");
306 }
307 BasicCollectionConfiguration complete_collection = (BasicCollectionConfiguration)selected_collections.get(i);
308 coll_names.append(complete_collection.getName() + StaticStrings.SPACE_CHARACTER + StaticStrings.OPEN_PARENTHESIS_CHARACTER + complete_collection.getShortName() + StaticStrings.CLOSE_PARENTHESIS_CHARACTER);
309 complete_collection = null;
310 }
311
312 args[0] = coll_names.toString();
313 args[1] = Configuration.gsdl_path+"tmp"+File.separator;
314 if(cd_title.equals("")) {
315 args[1] += "exported_collections";
316 } else {
317 args[1] += "exported_"+cd_title.replaceAll("\\s","");
318 }
319 ResultDialog result_dialog = new ResultDialog(success, extra, args);
320 result_dialog.setVisible(true); // Blocks
321 result_dialog.dispose();
322 result_dialog = null;
323 /*
324 if (success) {
325 JOptionPane.showMessageDialog(prompt,Dictionary.get("ExportCollectionPrompt.Successful_Export", args)+"\n\n"+Dictionary.get("ExportCollectionPrompt.Output")+"\n"+extra, Dictionary.get("ExportCollectionPrompt.Successful_Title"),JOptionPane.INFORMATION_MESSAGE);
326 }
327 else {
328 JOptionPane.showMessageDialog(prompt,Dictionary.get("ExportCollectionPrompt.Failed_Export", args)+"\n\n"+Dictionary.get("ExportCollectionPrompt.Output")+"\n"+extra, Dictionary.get("ExportCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE);
329 }
330 */
331 }
332
333 /** Method to scan the collect directory retrieving and reloading each collection it finds, while building the list of known collections.
334 * @see org.greenstone.gatherer.Configuration
335 * @see org.greenstone.gatherer.Gatherer
336 * @see org.greenstone.gatherer.util.ArrayTools
337 * @see org.greenstone.gatherer.util.Utility
338 */
339 private void scanForCollections() {
340 // Start at the collect dir.
341 File collect_directory;
342 if (Gatherer.GS3) {
343 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl3_path, Configuration.site_name));
344 } else {
345 collect_directory = new File(Utility.getCollectDir(Configuration.gsdl_path));
346 }
347 if(collect_directory.exists()) {
348 // Now for each child directory see if it contains a .col file and
349 // if so try to load it..
350 File collections[] = collect_directory.listFiles();
351 ArrayTools.sort(collections);
352 for(int i = 0; collections != null && i < collections.length; i++) {
353 if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
354 File config_file = new File(collections[i], Utility.CONFIG_FILE);
355 if (config_file.exists()) {
356 BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
357 all_collections.add(config);
358 config = null;
359 }
360 }
361 }
362 }
363 // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
364 }
365
366
367 /** All implementation of GShellListener must include this method so the listener can be informed of messages from the GShell.
368 * @param event A <strong>GShellEvent</strong> that contains, amoung other things, the message.
369 */
370 public synchronized void message(GShellEvent event) {
371 // Ignore the messages from RecPlug with 'show_progress' set (used for progress bars)
372 String message = event.getMessage();
373 if (message.startsWith("exportcol.pl>")) {
374 message = message.substring(13);
375 //DebugStream.println("message = "+event.getMessage());
376 error_message.append(message);
377 error_message.append("\n");
378 }
379 }
380
381 /** 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.
382 * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement.
383 */
384 public synchronized void processBegun(GShellEvent event) {
385 // We don't care.
386 }
387 /** All implementation of GShellListener must include this method so the listener can be informed when a GShell completes its task.
388 * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion.
389 */
390 public synchronized void processComplete(GShellEvent event) {
391 successful = false;
392 if(event.getStatus() == GShell.OK) {
393 if(event.getType() == GShell.EXPORT) {
394 successful = true;
395 }
396 }
397 ok_button_listener.processComplete();
398 }
399
400 /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
401 private class CancelButtonListener
402 implements ActionListener {
403 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
404 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
405 */
406 public void actionPerformed(ActionEvent event) {
407 prompt.dispose();
408 }
409 }
410
411 /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
412 */
413 private class CollectionListListener
414 implements ListSelectionListener {
415 /** Any implementation of ListSelectionListener must include this method so we can be informed when the list selection changes.
416 * @param event a <strong>ListSelectionEvent</strong> containing all the relevant information garnered from the event itself
417 */
418 public void valueChanged(ListSelectionEvent event) {
419 ok_button.setEnabled(false);
420 if(!list.isSelectionEmpty()) {
421 collection = (BasicCollectionConfiguration) ((Entry)list.getSelectedValue()).getObject();
422 args = new String[5];
423 args[0] = collection.getName();
424 args[1] = collection.getShortName();
425 args[2] = collection.getCreator();
426 args[3] = collection.getMaintainer();
427 args[4] = collection.getDescription();
428 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.Details", args);
429 details_textarea.setCaretPosition(0);
430 ok_button.setEnabled(true);
431 }
432 else {
433 Dictionary.setText(details_textarea, "DeleteCollectionPrompt.No_Collection");
434 ok_button.setEnabled(false);
435 }
436 }
437 }
438
439 /** The OK button listener implementation. */
440 private class OKButtonListener
441 implements ActionListener {
442 private Component glass_pane;
443 private MouseListener mouse_blocker_listener;
444 private ProgressDialog progress_dialog;
445
446 /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
447 * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
448 * @see org.greenstone.gatherer.Configuration
449 * @see org.greenstone.gatherer.Gatherer
450 * @see org.greenstone.gatherer.util.Utility
451 */
452 public void actionPerformed(ActionEvent event) {
453 ///ystem.err.println("OK Clicked");
454 // Make sure there are some colls specified
455 selected_collections = list.getSelected();
456 error_message = new StringBuffer();
457
458 // Set the cursor to hourglass
459 glass_pane = getGlassPane();
460 mouse_blocker_listener = new MouseAdapter() {};
461 glass_pane.addMouseListener(mouse_blocker_listener);
462 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
463 glass_pane.setVisible(true);
464
465 // Export the selected collection.
466 ///ystem.err.println("Export collections");
467 exportCollections();
468
469 // Show progress dialog
470 ///ystem.err.println("Showing progress dialog");
471 progress_dialog = new ProgressDialog();
472 progress_dialog.setVisible(true);
473 }
474
475 public void processComplete() {
476 ///ystem.err.println("Process complete");
477 // Dispose of progress dialog
478 progress_dialog.setVisible(false);
479 progress_dialog.dispose();
480 progress_dialog = null;
481
482 // unset the cursor
483 glass_pane.setVisible(false);
484 glass_pane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
485 glass_pane.removeMouseListener(mouse_blocker_listener);
486 glass_pane = null;
487 mouse_blocker_listener= null;
488
489 if (successful) {
490 resultPrompt(true, error_message.toString());
491 } else {
492 resultPrompt(false, error_message.toString());
493 }
494 error_message = null;
495 }
496
497 private class ProgressDialog
498 extends ModalDialog {
499
500 private Dimension size = new Dimension(400,65);
501
502 public ProgressDialog() {
503 super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Title"), true);
504 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
505 setSize(size);
506 JPanel content_pane = (JPanel) getContentPane();
507 JLabel progress_label = new JLabel();
508 Dictionary.setText(progress_label, "ExportCollectionPrompt.Progress_Label");
509 JProgressBar progress_bar = new JProgressBar();
510 progress_bar.setIndeterminate(true);
511 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
512 content_pane.setLayout(new BorderLayout());
513 content_pane.add(progress_label, BorderLayout.NORTH);
514 content_pane.add(progress_bar, BorderLayout.CENTER);
515 // Position
516 Rectangle frame_bounds = Gatherer.g_man.getBounds();
517 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
518 }
519 }
520 }
521
522 private class ResultDialog
523 extends ModalDialog {
524
525 private Dimension size = new Dimension(600,300);
526 private ResultDialog self;
527
528 public ResultDialog(boolean success, String extra, String [] args) {
529 super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Successful_Title"), true);
530
531 this.self = this;
532
533 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
534 setSize(size);
535
536 JPanel content_pane = (JPanel) getContentPane();
537 JLabel result_label = new JLabel();
538 if(success) {
539 Dictionary.registerText(result_label, "ExportCollectionPrompt.Successful_Export", args);
540 }
541 else {
542 Dictionary.registerText(result_label, "ExportCollectionPrompt.Failed_Export", args);
543 }
544
545 JPanel button_pane = new JPanel();
546 JButton close_button = new GLIButton("Close");
547 close_button.setMnemonic(KeyEvent.VK_C);
548 close_button.addActionListener(new CloseButtonListener());
549
550 JPanel output_pane = new JPanel();
551 JLabel output_label = new JLabel();
552 Dictionary.registerText(output_label, "ExportCollectionPrompt.Output");
553
554 JTextArea output_textarea = new JTextArea(extra);
555 output_textarea.setCaretPosition(0);
556 output_textarea.setEditable(false);
557 output_textarea.setLineWrap(true);
558 output_textarea.setWrapStyleWord(true);
559
560 button_pane.setLayout(new BorderLayout());
561 button_pane.add(close_button, BorderLayout.EAST);
562
563 output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
564 output_pane.setLayout(new BorderLayout());
565 output_pane.add(output_label, BorderLayout.NORTH);
566 output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
567
568 content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
569 content_pane.setLayout(new BorderLayout());
570 content_pane.add(result_label, BorderLayout.NORTH);
571 content_pane.add(output_pane, BorderLayout.CENTER);
572 content_pane.add(button_pane, BorderLayout.SOUTH);
573
574 // Position
575 Rectangle frame_bounds = Gatherer.g_man.getBounds();
576 setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
577 }
578
579 private class CloseButtonListener
580 implements ActionListener {
581 public void actionPerformed(ActionEvent event) {
582 self.setVisible(false);
583 }
584 }
585 }
586}
587
588
589
590
Note: See TracBrowser for help on using the repository browser.