1 | /**
|
---|
2 | *#########################################################################
|
---|
3 | *
|
---|
4 | * A component of the GAI 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: Chi-Yu Huang, 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.admin.gui;
|
---|
38 |
|
---|
39 | import java.awt.*;
|
---|
40 | import java.awt.event.*;
|
---|
41 | import java.io.*;
|
---|
42 | import java.net.*;
|
---|
43 | import javax.swing.*;
|
---|
44 | import javax.swing.event.*;
|
---|
45 |
|
---|
46 | import org.greenstone.admin.gui.ConfPane;
|
---|
47 |
|
---|
48 | import org.greenstone.core.Configuration;
|
---|
49 | import org.greenstone.core.DebugStream;
|
---|
50 |
|
---|
51 | /** This class provides the functionality to show a prompt to save changed file
|
---|
52 | * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
|
---|
53 | * @version 1.0
|
---|
54 | */
|
---|
55 | public class SaveChangePrompt
|
---|
56 | extends JDialog {
|
---|
57 |
|
---|
58 | /** A reference to ourself so any inner-classes can dispose of us. */
|
---|
59 | private SaveChangePrompt prompt = null;
|
---|
60 | private File file = null;
|
---|
61 |
|
---|
62 | //A flag showing the saving change status
|
---|
63 | private boolean current_change_saved = false;
|
---|
64 |
|
---|
65 | /** The size of the save prompt screen. */
|
---|
66 | static final Dimension SIZE = new Dimension(500, 500);
|
---|
67 |
|
---|
68 | // Constructor.
|
---|
69 | public SaveChangePrompt() {
|
---|
70 | super();
|
---|
71 | prompt = this;
|
---|
72 | }
|
---|
73 |
|
---|
74 | /** Destructor. */
|
---|
75 | public void destroy() {
|
---|
76 | prompt = null;
|
---|
77 | }
|
---|
78 |
|
---|
79 | /** This method causes the Save Change Confirmation Dialog to be displayed.
|
---|
80 | * returns true if it has save the change file that is currently open */
|
---|
81 | // public boolean display(File file) {
|
---|
82 | /*int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to save the change", "Save Confirmation", JOptionPane.YES_NO_OPTION);
|
---|
83 | if ( result == JOptionPane.YES_OPTION) {
|
---|
84 | ConfPane confPane = new ConfPane();
|
---|
85 | confPane.saveNewConfSetting();
|
---|
86 | confPane.writeConfFile(file);
|
---|
87 | current_change_saved = true;
|
---|
88 | } else if (result == JOptionPane.NO_OPTION) {
|
---|
89 | current_change_saved = false;
|
---|
90 | prompt.dispose();
|
---|
91 | }
|
---|
92 | resultPrompt(current_change_saved);
|
---|
93 | return current_change_saved;*/
|
---|
94 | //}
|
---|
95 |
|
---|
96 | /** Shows a save complete prompt.
|
---|
97 | * @param success A <strong>boolean</strong> indicating if the collection was successfully saved
|
---|
98 | */
|
---|
99 | public void resultPrompt(boolean success) {
|
---|
100 | if (success) {
|
---|
101 | JOptionPane.showMessageDialog(prompt,"The build property file has been saved.");
|
---|
102 | } else {
|
---|
103 | JOptionPane.showMessageDialog(prompt, "Cancel saving the change to build property file");
|
---|
104 | }
|
---|
105 | }
|
---|
106 |
|
---|
107 | /** Any implementation of ActionListener requires this method so that when an
|
---|
108 | **action is performed the appropriate effect can occur.*/
|
---|
109 | public void actionPerformed(ActionEvent event) {
|
---|
110 | }
|
---|
111 | }
|
---|