[9150] | 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 | */
|
---|
| 37 | package org.greenstone.gatherer.gui;
|
---|
| 38 |
|
---|
| 39 | import java.awt.*;
|
---|
| 40 | import java.awt.event.*;
|
---|
| 41 | import java.io.*;
|
---|
| 42 | import java.util.ArrayList;
|
---|
| 43 | import javax.swing.*;
|
---|
| 44 | import javax.swing.event.*;
|
---|
| 45 |
|
---|
| 46 | import org.greenstone.gatherer.Gatherer;
|
---|
| 47 | import org.greenstone.gatherer.Dictionary;
|
---|
| 48 |
|
---|
| 49 | public class SimpleResultDialog
|
---|
[17131] | 50 | extends ModalDialog {
|
---|
[9150] | 51 |
|
---|
[17131] | 52 | private Dimension size = new Dimension(600,300);
|
---|
| 53 | private SimpleResultDialog self;
|
---|
[9150] | 54 |
|
---|
[17131] | 55 | public SimpleResultDialog(String title, String label, String results) {
|
---|
| 56 | super(Gatherer.g_man, title, true);
|
---|
| 57 | this.self = this;
|
---|
[18370] | 58 | this.setComponentOrientation(Dictionary.getOrientation());
|
---|
| 59 |
|
---|
[17131] | 60 | setUpGUI(label, results);
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /** If you are calling this from another dialog, and you want that dialog blocked while this is open, need to use this method, passing in the calling dialog as the parent */
|
---|
| 64 | public SimpleResultDialog(Dialog parent, String title, String label, String results) {
|
---|
| 65 |
|
---|
| 66 | super(parent, title, true);
|
---|
| 67 | this.self = this;
|
---|
| 68 |
|
---|
| 69 | setUpGUI(label, results);
|
---|
[32712] | 70 | TestingPreparation.setNamesRecursively(this);
|
---|
[17131] | 71 | }
|
---|
| 72 |
|
---|
| 73 | private void setUpGUI(String label, String results) {
|
---|
| 74 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
---|
| 75 | setSize(size);
|
---|
[9150] | 76 |
|
---|
[17131] | 77 | JPanel content_pane = (JPanel) getContentPane();
|
---|
[18370] | 78 | content_pane.setComponentOrientation(Dictionary.getOrientation());
|
---|
[17131] | 79 | JLabel result_label = new JLabel(label);
|
---|
[18370] | 80 | result_label.setComponentOrientation(Dictionary.getOrientation());
|
---|
[9150] | 81 |
|
---|
[17131] | 82 | JPanel button_pane = new JPanel();
|
---|
[18370] | 83 | button_pane.setComponentOrientation(Dictionary.getOrientation());
|
---|
[17131] | 84 | JButton close_button = new GLIButton(Dictionary.get("General.Close"));
|
---|
| 85 | close_button.addActionListener(new CloseButtonListener());
|
---|
[9150] | 86 |
|
---|
[17131] | 87 | JPanel output_pane = new JPanel();
|
---|
[18370] | 88 | output_pane.setComponentOrientation(Dictionary.getOrientation());
|
---|
[17131] | 89 | JLabel output_label = new JLabel(Dictionary.get("General.Review_Output"));
|
---|
[18370] | 90 | output_label.setComponentOrientation(Dictionary.getOrientation());
|
---|
| 91 |
|
---|
[17131] | 92 | JTextArea output_textarea = new JTextArea(results);
|
---|
[18370] | 93 | output_textarea.setComponentOrientation(Dictionary.getOrientation());
|
---|
[17131] | 94 | output_textarea.setCaretPosition(0);
|
---|
| 95 | output_textarea.setEditable(false);
|
---|
| 96 | output_textarea.setLineWrap(true);
|
---|
| 97 | output_textarea.setWrapStyleWord(true);
|
---|
[9150] | 98 |
|
---|
[17131] | 99 | button_pane.setLayout(new BorderLayout());
|
---|
[18370] | 100 | button_pane.add(close_button, BorderLayout.LINE_END);
|
---|
[9150] | 101 |
|
---|
[17131] | 102 | output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
|
---|
| 103 | output_pane.setLayout(new BorderLayout());
|
---|
| 104 | output_pane.add(output_label, BorderLayout.NORTH);
|
---|
| 105 | output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
|
---|
[9150] | 106 |
|
---|
[17131] | 107 | content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
|
---|
| 108 | content_pane.setLayout(new BorderLayout());
|
---|
| 109 | content_pane.add(result_label, BorderLayout.NORTH);
|
---|
| 110 | content_pane.add(output_pane, BorderLayout.CENTER);
|
---|
| 111 | content_pane.add(button_pane, BorderLayout.SOUTH);
|
---|
[9150] | 112 |
|
---|
[17131] | 113 | // Position
|
---|
| 114 | Rectangle frame_bounds = Gatherer.g_man.getBounds();
|
---|
| 115 | setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
|
---|
| 116 | //new SimpleResultDialog(Gatherer.g_man, title, label, results);
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 | private class CloseButtonListener
|
---|
| 121 | implements ActionListener {
|
---|
| 122 | public void actionPerformed(ActionEvent event) {
|
---|
| 123 | self.setVisible(false);
|
---|
[9150] | 124 | }
|
---|
[17131] | 125 | }
|
---|
[9150] | 126 | }
|
---|