source: branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/GAIFirstSettingFrame.java@ 10798

Last change on this file since 10798 was 9968, checked in by chi, 19 years ago

The intial version of GAI tools.

  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
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 * Date: 03.2005
12 *
13 * <BR><BR>
14 *
15 * Copyright (C) 1999 New Zealand Digital Library Project
16 *
17 * <BR><BR>
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *
24 * <BR><BR>
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * <BR><BR>
32 *
33 * You should have received a copy of the GNU General Public License
34 * along with this program; if not, write to the Free Software
35 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36 *########################################################################
37 */
38/* This program is intended to confirm the initial user's setting about
39 * the Tomcat server and MySQL server they would like to run GSDL3 with
40 */
41package org.greenstone.admin;
42
43import java.awt.*;
44import java.awt.event.*;
45import java.io.*;
46import java.lang.Object;
47import javax.swing.*;
48import javax.swing.event.*;
49import javax.swing.tree.*;
50
51import org.greenstone.core.Configuration;
52import org.greenstone.core.Dictionary;
53import org.greenstone.core.ParsingProgress;
54import org.greenstone.admin.gui.SetServerPane;
55import org.greenstone.admin.GAI;
56
57/** The initial setting pane is to request the user to input the preferred
58 * Tomcat and Mysql server,they would like to run GSDL3 with
59 * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
60 * @version
61 */
62public class GAIFirstSettingFrame
63 extends JFrame
64 implements ActionListener {
65
66 public static Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
67
68 /* This pane is to inform the user to set up the tomcat and mysql server
69 * if they are the first time run GAI, if the user doen't want to set up
70 * the installation will be based on the gsdl3 default value*/
71 protected JScrollPane setting_message_pane = null;
72 protected JPanel first_setting_pane = null;
73 protected JPanel main_pane = null;
74 protected JTextArea first_setting_message = null;
75 protected JButton fset_yes_button = null;
76 protected JButton fset_no_button = null;
77 protected JPanel button_pane = null;
78 protected JPanel control_pane = null;
79
80 public boolean setting_confirm = false;
81
82 /** The various sizes for the screen layout*/
83 static private Dimension MIN_SIZE = new Dimension( 90, 90);
84 static private Dimension LIST_SIZE = new Dimension(200, 450);
85 static private Dimension DIALOG_SIZE = new Dimension (400,300);
86 static private Dimension TABLE_SIZE = new Dimension(500,200);
87 static final Dimension SIZE = new Dimension(400,75);
88
89 //Constructor
90 public GAIFirstSettingFrame() {
91 super();
92
93 this.setDefaultCloseOperation(EXIT_ON_CLOSE);
94 this.setSize(DIALOG_SIZE);
95 this.setTitle("First time setting Tomcat/MYSQL Server");
96
97 // create all the control button panes
98 button_pane = new JPanel();
99
100 //First time running button
101 FirstSetYesButtonListener fsybl = new FirstSetYesButtonListener();
102 FirstSetNoButtonListener fsnbl = new FirstSetNoButtonListener();
103
104 // ImagesIcon for the buttons
105 ImageIcon setYesButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Refresh16.gif");
106 ImageIcon setNoButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/exit16.gif");
107
108 fset_yes_button = new JButton("Yes", setYesButtonIcon);
109 fset_yes_button.addActionListener(fsybl);
110 fset_yes_button.setMnemonic(KeyEvent.VK_S);
111 fset_yes_button.setToolTipText("Click this button to Set up the Tomcat/MYSQL server");
112 fset_yes_button.setEnabled(false);
113 //Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
114 fset_no_button = new JButton("No", setNoButtonIcon);
115 fset_no_button.addActionListener(fsnbl);
116 fset_no_button.setEnabled(false);
117 fset_no_button.setMnemonic(KeyEvent.VK_N);
118 fset_no_button.setToolTipText("Click this button to skip the First time Tomcat/MYSQL server setting");
119 //Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
120
121 //First time running setting buttons
122 fsybl = null;
123 fsnbl = null;
124 display();
125 }
126
127 /** Any implementation of ActionListener requires this method so that when an
128 **action is performed the appropriate effect can occur.*/
129 public void actionPerformed(ActionEvent event) {
130 }
131
132 /** This method is callsed to actually layout the components.*/
133 public void display() {
134 //KeyListenerImpl key_listener = new KeyListenerImpl();
135 //MouseListenerImpl mouse_listener = new MouseListenerImpl();
136 //this.addKeyListener(key_listener);
137
138 first_setting_message = new JTextArea();
139 first_setting_message.setEditable(false);
140 first_setting_message.setLineWrap(true);
141
142 first_setting_message.setText("If you are about the first time to run GAI, you can set up " +
143 "your own TOMCAT/MYSQL server. Otherwise, your GSDL3 " +
144 "will be installed with the TOMCAT/MYSQL setting come " +
145 "with the package. You may change the setting later on.");
146
147 first_setting_message.setFont(new Font("Arial", Font.BOLD, 14));
148
149 setting_message_pane = new JScrollPane(first_setting_message);
150
151 // The pane to store setting_message_pane
152 first_setting_pane = new JPanel();
153 first_setting_pane.setBorder(BorderFactory.createEmptyBorder(5,5,20,5));
154 first_setting_pane.setLayout (new BorderLayout());
155 first_setting_pane.add(setting_message_pane, BorderLayout.CENTER);
156
157 // Button Control Layout
158 fset_yes_button.setEnabled(true);
159 fset_no_button.setEnabled(true);
160
161 button_pane.setLayout (new GridLayout(1,2));
162 button_pane.add(fset_yes_button);
163 button_pane.add(fset_no_button);
164
165 control_pane = new JPanel();
166 control_pane.setBorder(BorderFactory.createLoweredBevelBorder());
167 control_pane.setLayout(new BorderLayout());
168 control_pane.add(new JLabel("Do you want to set up your own running Tomcat/Mysql Servers?"), BorderLayout.CENTER);
169 control_pane.add(button_pane, BorderLayout.SOUTH);
170
171 main_pane = (JPanel) getContentPane();
172 //main_pane.setBorder(BorderFactory.createLoweredBevelBorder());
173 main_pane.setLayout (new BorderLayout());
174 main_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
175 main_pane.add(first_setting_pane,BorderLayout.CENTER);
176 main_pane.add(control_pane, BorderLayout.SOUTH);
177 main_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false));
178 main_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false));
179
180 // Center and display
181 Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
182 setLocation((screen_size.width - SIZE.width) / 2,
183 (screen_size.height - SIZE.height) / 2);
184 setVisible(true);
185 }
186
187 public boolean checkSettingConfirm(){
188 return setting_confirm;
189 }
190
191 public void destroy() {
192 }
193
194 /** This class serves as the listener for actions on the build button.*/
195 private class FirstSetYesButtonListener
196 implements ActionListener {
197 /** If you want to give up the change you have made to the build properties
198 * file before you save the change, This button is to reload the log file
199 * whenever user want to */
200 public void actionPerformed(ActionEvent event) {
201 SetServerPane set_server_pane = new SetServerPane ();
202 set_server_pane.display();
203 //disable the GAIFirstSettingFrame
204 setVisible (false);
205 setting_confirm = true;
206 }
207 }
208 private class FirstSetNoButtonListener
209 implements ActionListener {
210 // Exit the Adminstration tool
211 public void actionPerformed(ActionEvent event) {
212 setting_confirm = false;
213 setVisible (false);
214 //return setting_confirm;
215 if (!setting_confirm) {
216 GAIManager gai = new GAIManager(screen_size);
217 }
218 }
219 }
220}
221
222
Note: See TracBrowser for help on using the repository browser.