source: main/trunk/greenstone3/src/java/org/greenstone/admin/GAIFirstSettingFrame.java@ 21918

Last change on this file since 21918 was 10953, checked in by kjdon, 18 years ago

fixed up some paths. still needs more tidying...

  • Property svn:keywords set to Author Date Id Revision
File size: 7.8 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.ParsingProgress;
52import org.greenstone.admin.gui.SetServerPane;
53import org.greenstone.admin.GAI;
54
55/** The initial setting pane is to request the user to input the preferred
56 * Tomcat and Mysql server,they would like to run GSDL3 with
57 * @author Chi-Yu Huang, Greenstone Digital Library, University of Waikato
58 * @version
59 */
60public class GAIFirstSettingFrame
61 extends JFrame
62 implements ActionListener {
63
64 public static Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
65
66 /* This pane is to inform the user to set up the tomcat and mysql server
67 * if they are the first time run GAI, if the user doen't want to set up
68 * the installation will be based on the gsdl3 default value*/
69 protected JScrollPane setting_message_pane = null;
70 protected JPanel first_setting_pane = null;
71 protected JPanel main_pane = null;
72 protected JTextArea first_setting_message = null;
73 protected JButton fset_yes_button = null;
74 protected JButton fset_no_button = null;
75 protected JPanel button_pane = null;
76 protected JPanel control_pane = null;
77
78 public boolean setting_confirm = false;
79
80 /** The various sizes for the screen layout*/
81 static private Dimension MIN_SIZE = new Dimension( 90, 90);
82 static private Dimension LIST_SIZE = new Dimension(200, 450);
83 static private Dimension DIALOG_SIZE = new Dimension (400,300);
84 static private Dimension TABLE_SIZE = new Dimension(500,200);
85 static final Dimension SIZE = new Dimension(400,75);
86
87 //Constructor
88 public GAIFirstSettingFrame() {
89 super();
90
91 this.setDefaultCloseOperation(EXIT_ON_CLOSE);
92 this.setSize(DIALOG_SIZE);
93 this.setTitle("First time setting Tomcat/MYSQL Server");
94
95 // create all the control button panes
96 button_pane = new JPanel();
97
98 //First time running button
99 FirstSetYesButtonListener fsybl = new FirstSetYesButtonListener();
100 FirstSetNoButtonListener fsnbl = new FirstSetNoButtonListener();
101
102 // ImagesIcon for the buttons
103 ImageIcon setYesButtonIcon = new ImageIcon(GAI.images_path + "refresh.gif");
104 ImageIcon setNoButtonIcon = new ImageIcon(GAI.images_path + "exit.gif");
105
106 fset_yes_button = new JButton("Yes", setYesButtonIcon);
107 fset_yes_button.addActionListener(fsybl);
108 fset_yes_button.setMnemonic(KeyEvent.VK_S);
109 fset_yes_button.setToolTipText("Click this button to Set up the Tomcat/MYSQL server");
110 fset_yes_button.setEnabled(false);
111 fset_no_button = new JButton("No", setNoButtonIcon);
112 fset_no_button.addActionListener(fsnbl);
113 fset_no_button.setEnabled(false);
114 fset_no_button.setMnemonic(KeyEvent.VK_N);
115 fset_no_button.setToolTipText("Click this button to skip the First time Tomcat/MYSQL server setting");
116
117 //First time running setting buttons
118 fsybl = null;
119 fsnbl = null;
120 display();
121 }
122
123 /** Any implementation of ActionListener requires this method so that when an
124 **action is performed the appropriate effect can occur.*/
125 public void actionPerformed(ActionEvent event) {
126 }
127
128 /** This method is callsed to actually layout the components.*/
129 public void display() {
130 //KeyListenerImpl key_listener = new KeyListenerImpl();
131 //MouseListenerImpl mouse_listener = new MouseListenerImpl();
132 //this.addKeyListener(key_listener);
133
134 first_setting_message = new JTextArea();
135 first_setting_message.setEditable(false);
136 first_setting_message.setLineWrap(true);
137
138 first_setting_message.setText("If you are about the first time to run GAI, you can set up " +
139 "your own TOMCAT/MYSQL server. Otherwise, your GSDL3 " +
140 "will be installed with the TOMCAT/MYSQL setting come " +
141 "with the package. You may change the setting later on.");
142
143 first_setting_message.setFont(new Font("Arial", Font.BOLD, 14));
144
145 setting_message_pane = new JScrollPane(first_setting_message);
146
147 // The pane to store setting_message_pane
148 first_setting_pane = new JPanel();
149 first_setting_pane.setBorder(BorderFactory.createEmptyBorder(5,5,20,5));
150 first_setting_pane.setLayout (new BorderLayout());
151 first_setting_pane.add(setting_message_pane, BorderLayout.CENTER);
152
153 // Button Control Layout
154 fset_yes_button.setEnabled(true);
155 fset_no_button.setEnabled(true);
156
157 button_pane.setLayout (new GridLayout(1,2));
158 button_pane.add(fset_yes_button);
159 button_pane.add(fset_no_button);
160
161 control_pane = new JPanel();
162 control_pane.setBorder(BorderFactory.createLoweredBevelBorder());
163 control_pane.setLayout(new BorderLayout());
164 control_pane.add(new JLabel("Do you want to set up your own running Tomcat/Mysql Servers?"), BorderLayout.CENTER);
165 control_pane.add(button_pane, BorderLayout.SOUTH);
166
167 main_pane = (JPanel) getContentPane();
168 //main_pane.setBorder(BorderFactory.createLoweredBevelBorder());
169 main_pane.setLayout (new BorderLayout());
170 main_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
171 main_pane.add(first_setting_pane,BorderLayout.CENTER);
172 main_pane.add(control_pane, BorderLayout.SOUTH);
173 main_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background"));
174 main_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground"));
175
176 // Center and display
177 Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
178 setLocation((screen_size.width - SIZE.width) / 2,
179 (screen_size.height - SIZE.height) / 2);
180 setVisible(true);
181 }
182
183 public boolean checkSettingConfirm(){
184 return setting_confirm;
185 }
186
187 public void destroy() {
188 }
189
190 /** This class serves as the listener for actions on the build button.*/
191 private class FirstSetYesButtonListener
192 implements ActionListener {
193 /** If you want to give up the change you have made to the build properties
194 * file before you save the change, This button is to reload the log file
195 * whenever user want to */
196 public void actionPerformed(ActionEvent event) {
197 SetServerPane set_server_pane = new SetServerPane ();
198 set_server_pane.display();
199 //disable the GAIFirstSettingFrame
200 setVisible (false);
201 setting_confirm = true;
202 }
203 }
204 private class FirstSetNoButtonListener
205 implements ActionListener {
206 // Exit the Adminstration tool
207 public void actionPerformed(ActionEvent event) {
208 setting_confirm = false;
209 setVisible (false);
210 //return setting_confirm;
211 if (!setting_confirm) {
212 GAIManager gai = new GAIManager(screen_size);
213 }
214 }
215 }
216}
217
218
Note: See TracBrowser for help on using the repository browser.