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

Last change on this file since 7104 was 7103, checked in by kjdon, 20 years ago

added '-gli -language xx' to the exportcol.pl args

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