Changeset 10793
- Timestamp:
- 2005-10-31T12:19:10+13:00 (19 years ago)
- Location:
- branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ConfPane.java
r9972 r10793 43 43 import java.util.List; 44 44 import java.util.ArrayList; 45 import java.util.Hashtable; 46 import java.util.Enumeration; 45 47 import java.lang.Object; 46 48 import javax.swing.*; … … 55 57 import org.greenstone.admin.GAIManager; 56 58 import org.greenstone.admin.gui.ThreadControl; 59 //import org.greenstone.admin.gui.ConfSettingTableModel; 60 import org.greenstone.admin.gui.SiteConfSetting; 57 61 import org.greenstone.core.Configuration; 58 62 import org.greenstone.core.Dictionary; … … 67 71 extends JPanel 68 72 implements ActionListener { 69 73 70 74 /* The pane to demonstrate Configuration information, including the build property file 71 75 * being monitored and their content, and control functions */ … … 73 77 74 78 protected JPanel main_contentPane = null; 79 public Hashtable conf_table; 75 80 76 81 /** The panel that contains a Conf_list */ … … 80 85 private JPanel confContent_pane = null; 81 86 private JScrollPane conf_table_pane = null; 82 87 83 88 /** The List showing all the Configuration files concerned. */ 84 89 private JList conf_list=null; 85 90 private JTree conf_tree = null; 86 87 /** The pane area into which the Configuration content is placed. */88 //private JScrollPane conf_content = null;89 91 90 92 /** The label at the top of the confList_pane. */ … … 94 96 95 97 // The control buttons used to manipulate Configuration Pane 96 protected JPanel outter_button_pane = null;97 protected JPanel outter_control_pane = null;98 98 protected JPanel inner_button_pane = null; 99 99 protected JPanel inner_control_pane = null; … … 109 109 private JButton shutdown_mysql_button = null; 110 110 private JButton restart_mysql_button = null; 111 111 112 112 private JButton save_button = null; 113 114 /** Buttons in outter button pane*/115 //private JButton reload_button = null;116 //private JButton delete_button = null;117 //private JButton exit_button = null;118 113 119 114 private JLabel conf_label = null; 120 115 private JLabel conf_setting_label = null; 121 private JTextField conf_field = null; 116 117 /* ConfPane empty AREA to show XML configuration file*/ 118 //private JTextArea conf_xml_area = null; 122 119 123 120 //control tomcat and mysql server running status … … 127 124 private String mysql_server; 128 125 private String mysql_port; 126 private String conf_pane_name; 127 129 128 private boolean tomcat_server_up = false; 130 129 private boolean mysql_server_up = false; 131 130 132 protected JTextArea text_area = null; 133 131 /** The scrollable area into which the configuration content is placed. */ 132 //private JScrollPane conf_xml_content = null; 133 134 public SiteConfSetting site_conf = null; 135 public SiteConfSetting interface_conf = null; 136 134 137 /** The various sizes for the screen layout*/ 135 138 static private Dimension MIN_SIZE = new Dimension( 90, 90); … … 137 140 static private Dimension CONTENT_SIZE = new Dimension (600,450); 138 141 static private Dimension TABLE_SIZE = new Dimension(500,200); 142 static private int MINIMUM_TABLE_HEADER_SIZE = 15; 139 143 140 144 private JTable conf_setting_table = null; 141 145 142 146 private int num_of_setting; 143 private int num_of_change = 0;144 147 145 148 //The details display in the table 149 int display_row_count = 5; 146 150 int rowLength = 20; 147 151 int colLength = 3; … … 152 156 private ArrayList conf_array; 153 157 154 // all the relevant details from the build.properties 155 private static boolean valueChanged =false; 156 157 ConfTableModel conf_table_model; 158 //Site configuration 159 public File site_conf_file = GAI.site_conf; 160 public File interface_conf_file = GAI.interface_conf; 161 public boolean project_conf_changed = false; 162 163 ConfSettingTableModel conf_table_model = null; 158 164 DefaultMutableTreeNode top = new DefaultMutableTreeNode("Configuration Files"); 159 160 165 //Constructor 161 166 public ConfPane() { 167 conf_table = new Hashtable(); 162 168 // create all the control button panes 163 169 inner_control_pane = new JPanel(); … … 165 171 tomcat_button_pane = new JPanel(); 166 172 mysql_button_pane = new JPanel(); 167 outter_control_pane = new JPanel(); 168 outter_button_pane = new JPanel(); 173 174 /*the class for showing the site configurations including 175 * siteConfig.xml and interfaceConfig.xml 176 */ 177 site_conf = new SiteConfSetting("siteConfig", site_conf_file); 178 interface_conf = new SiteConfSetting("interfaceConfig", interface_conf_file); 169 179 170 180 // Main Configuration Pane 171 181 main_conf_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); 172 173 // Main pane for Configuration Content Pane 182 // Main pane for Configuration Content Pane 174 183 main_contentPane = new JPanel(); 175 184 176 185 //Create a tree for a list Configuration files we are interested 177 DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Build"); 186 //DefaultMutableTreeNode child1 = new DefaultMutableTreeNode(); 187 DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Project Configuration"); 188 //Dictionary.get(child1,"Tree.ProjectConf"); 189 178 190 DefaultMutableTreeNode compile = new DefaultMutableTreeNode("Compile"); 179 191 DefaultMutableTreeNode tomcat = new DefaultMutableTreeNode("Tomcat"); 180 192 DefaultMutableTreeNode proxy = new DefaultMutableTreeNode("Proxy"); 181 DefaultMutableTreeNode mysql = new DefaultMutableTreeNode("My sql");193 DefaultMutableTreeNode mysql = new DefaultMutableTreeNode("MySQL"); 182 194 DefaultMutableTreeNode gsdl = new DefaultMutableTreeNode("GSDL"); 183 195 child1.add(compile); … … 187 199 child1.add(gsdl); 188 200 189 DefaultMutableTreeNode child2 = 190 new DefaultMutableTreeNode("Conf 2"); 191 DefaultMutableTreeNode child3 = 192 new DefaultMutableTreeNode("Conf 3"); 201 DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Site Configuration"); 202 //DefaultMutableTreeNode child2 = new DefaultMutableTreeNode(); 203 //Dictionary.registerText(child2,"Tree.SiteConf"); 204 DefaultMutableTreeNode siteConf = new DefaultMutableTreeNode("SiteConfig"); 205 DefaultMutableTreeNode interfaceConf = new DefaultMutableTreeNode("InterfaceConfig"); 206 child2.add(siteConf); 207 child2.add(interfaceConf); 208 209 //DefaultMutableTreeNode child3 = new DefaultMutableTreeNode("Conf 3"); 193 210 top.add(child1); 194 211 top.add(child2); 195 top.add(child3);212 //top.add(child3); 196 213 conf_tree = new JTree(top); 197 214 conf_tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); … … 206 223 ShutdownMysqlButtonListener smdbl = new ShutdownMysqlButtonListener(); 207 224 RestartMysqlButtonListener rmbl = new RestartMysqlButtonListener(); 208 209 //save button 210 SaveButtonListener sabl = new SaveButtonListener(); 211 212 //outter button_pane Buttons 213 //ReloadButtonListener rbl = new ReloadButtonListener(); 214 //DeleteButtonListener dbl = new DeleteButtonListener(); 215 //ExitButtonListener ebl = new ExitButtonListener(); 216 //ImageIcon reloadButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Refresh16.gif"); 217 //ImageIcon deleteButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Delete16.gif"); 218 //ImageIcon exitButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/exit16.gif"); 219 220 ImageIcon startupTomcatButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/redo16.gif"); 221 ImageIcon shutdownTomcatButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif"); 222 ImageIcon restartTomcatButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif"); 223 224 ImageIcon startupMysqlButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/redo16.gif"); 225 ImageIcon shutdownMysqlButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif"); 226 ImageIcon restartMysqlButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/stop16.gif"); 227 ImageIcon saveButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Save16.gif"); 228 229 startup_tomcat_button = new JButton("Startup Tomcat", startupTomcatButtonIcon); 225 226 ImageIcon startupTomcatButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/redo16.gif"); 227 ImageIcon shutdownTomcatButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/stop16.gif"); 228 ImageIcon restartTomcatButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/stop16.gif"); 229 230 ImageIcon startupMysqlButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/redo16.gif"); 231 ImageIcon shutdownMysqlButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/stop16.gif"); 232 ImageIcon restartMysqlButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/stop16.gif"); 233 ImageIcon saveButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/Save16.gif"); 234 235 startup_tomcat_button = new JButton(); 230 236 startup_tomcat_button.addActionListener(stbl); 231 237 startup_tomcat_button.setMnemonic(KeyEvent.VK_S); 232 startup_tomcat_button.setToolTipText("Click this button to startup the Tomcat server");233 238 startup_tomcat_button.setEnabled(false); 234 235 shutdown_tomcat_button = new JButton("Shutdown Tomcat", shutdownTomcatButtonIcon); 239 Dictionary.registerBoth(startup_tomcat_button,"ConfPane.Tomcat_Startup", "ConfPane.Tomcat_Startup_Tooltip"); 240 241 shutdown_tomcat_button = new JButton(); 236 242 shutdown_tomcat_button.addActionListener(stdbl); 237 243 shutdown_tomcat_button.setEnabled(false); 238 //shutdown_button.setMnemonic(KeyEvent.VK_h); 239 shutdown_tomcat_button.setToolTipText("Click this button to shutdown the Tomcat server"); 240 241 restart_tomcat_button = new JButton("Restart Tomcat",restartTomcatButtonIcon); 244 Dictionary.registerBoth(shutdown_tomcat_button,"ConfPane.Tomcat_Shutdown", "ConfPane.Tomcat_Shutdown_Tooltip"); 245 246 restart_tomcat_button = new JButton(); 242 247 restart_tomcat_button.addActionListener(rtbl); 243 248 restart_tomcat_button.setEnabled(false); 244 //shutdown_button.setMnemonic(KeyEvent.VK_h); 245 restart_tomcat_button.setToolTipText("Click this button to restart the Tomcat server(which will shutdown Tomcat server and restart it again"); 246 247 startup_mysql_button = new JButton("Startup MYSQL", startupMysqlButtonIcon); 249 Dictionary.registerBoth(restart_tomcat_button,"ConfPane.Tomcat_Restart", "ConfPane.Tomcat_Restart_Tooltip"); 250 251 startup_mysql_button = new JButton(); 248 252 startup_mysql_button.addActionListener(smbl); 249 253 startup_mysql_button.setMnemonic(KeyEvent.VK_S); 250 startup_mysql_button.setToolTipText("Click this button to startup the MYSQL server");251 254 startup_mysql_button.setEnabled(false); 252 253 shutdown_mysql_button = new JButton("Shutdown MYSQL", shutdownMysqlButtonIcon); 255 Dictionary.registerBoth(startup_mysql_button,"ConfPane.MySQL_Startup", "ConfPane.MySQL_Startup_Tooltip"); 256 257 shutdown_mysql_button = new JButton(); 254 258 shutdown_mysql_button.addActionListener(smdbl); 255 259 shutdown_mysql_button.setEnabled(false); 256 //shutdown_button.setMnemonic(KeyEvent.VK_h); 257 shutdown_mysql_button.setToolTipText("Click this button to shutdown the MYSQL server"); 258 259 restart_mysql_button = new JButton("Restart MYSQL",restartMysqlButtonIcon); 260 Dictionary.registerBoth(shutdown_mysql_button,"ConfPane.MySQL_Shutdown", "ConfPane.MySQL_Shutdown_Tooltip"); 261 262 restart_mysql_button = new JButton(); 260 263 restart_mysql_button.addActionListener(rmbl); 261 264 restart_mysql_button.setEnabled(false); 262 //shutdown_button.setMnemonic(KeyEvent.VK_h); 263 restart_tomcat_button.setToolTipText("Click this button to restart the MYSQL server(which will shutdown MYSQL server and restart it again"); 264 265 save_button = new JButton("Save Change", saveButtonIcon); 266 save_button.addActionListener(sabl); 267 //save_button.setMnemonic(KeyEvent.VK_a); 268 save_button.setEnabled(false); 269 save_button.setToolTipText("Click this button to save the change of build property file"); 270 271 /*reload_button = new JButton("Reload", reloadButtonIcon); 272 reload_button.addActionListener(rbl); 273 reload_button.setMnemonic(KeyEvent.VK_R); 274 reload_button.setToolTipText("Click this button to reload the build properties file");*/ 275 //Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip"); 276 277 /*delete_button = new JButton("Delete", deleteButtonIcon); 278 delete_button.addActionListener(dbl); 279 delete_button.setEnabled(false); 280 delete_button.setMnemonic(KeyEvent.VK_D); 281 delete_button.setToolTipText("Click this button to delete the Configuration file");*/ 282 //Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");*/ 283 284 /*exit_button = new JButton("Exit", exitButtonIcon); 285 exit_button.setToolTipText("Click this button to exit the viewing"); 286 exit_button.addActionListener(ebl); 287 exit_button.setEnabled(true); 288 exit_button.setMnemonic(KeyEvent.VK_E);*/ 289 290 //tomcat buttons 265 Dictionary.registerBoth(restart_mysql_button,"ConfPane.MySQL_Restart", "ConfPane.MySQL_Restart_Tooltip"); 266 267 //tomcat control buttons 291 268 stbl = null; 292 269 stdbl = null; 293 270 rtbl = null; 294 295 // restart mysql button271 272 //mysql control button 296 273 smbl = null; 297 274 smdbl = null; 298 275 rmbl = null; 299 300 //rbl = null;301 //dbl = null;302 //ebl = null;303 276 304 277 //read in build properties … … 308 281 /** Any implementation of ActionListener requires this method so that when an 309 282 **action is performed the appropriate effect can occur.*/ 310 311 283 public void actionPerformed(ActionEvent event) { 312 284 } 313 314 /** This method is callsed to actually layout the components.*/ 285 286 287 /** This method is called to actually layout the components.*/ 315 288 public void display() { 316 289 //Create Components. … … 318 291 //MouseListenerImpl mouse_listener = new MouseListenerImpl(); 319 292 //this.addKeyListener(key_listener); 320 321 // 293 294 //confList_Pane 322 295 confList_pane = new JPanel(); 323 296 confList_pane.setBorder(BorderFactory.createLoweredBevelBorder()); 324 297 confList_pane.setPreferredSize(LIST_SIZE); 325 298 confList_pane.setSize(LIST_SIZE); 326 confList_label = new JLabel("Configuration Files"); 299 confList_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false)); 300 confList_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false)); 301 302 confList_label = new JLabel(); 327 303 confList_label.setOpaque(true); 328 confList_label.setBackground(Configuration.getColor("coloring.workspace_ heading_background", false));329 confList_label.setForeground(Configuration.getColor("coloring.workspace_ heading_foreground", false));330 //Dictionary.registerText(logList_label, "Log.List");304 confList_label.setBackground(Configuration.getColor("coloring.workspace_selection_background", false)); 305 confList_label.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false)); 306 Dictionary.registerText(confList_label, "ConfPane.Conf_List"); 331 307 332 308 // confContent_Pane 333 309 confContent_pane = new JPanel(); 334 //confContent_pane.setBorder(BorderFactory.createLoweredBevelBorder());335 310 confContent_pane.setBorder(BorderFactory.createEmptyBorder(10,20,10,20)); 336 311 confContent_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false)); 337 312 confContent_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false)); 338 313 339 confContent_label = new JLabel( "Configuration Content");314 confContent_label = new JLabel(); 340 315 confContent_label.setOpaque(true); 341 confContent_label.setBackground(Configuration.getColor("coloring.workspace_ heading_background", false));342 confContent_label.setForeground(Configuration.getColor("coloring.workspace_ heading_foreground", false));343 //Dictionary.registerText(logContent_label, "Log.Content");344 345 conf_table_model = new Conf TableModel();316 confContent_label.setBackground(Configuration.getColor("coloring.workspace_selection_background", false)); 317 confContent_label.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false)); 318 Dictionary.registerText(confContent_label, "ConfPane.Conf_Content"); 319 320 conf_table_model = new ConfSettingTableModel(); 346 321 conf_setting_table = new JTable(conf_table_model){ 347 322 public String getToolTipText(MouseEvent e){ … … 352 327 int realColumnIndex = convertColumnIndexToModel(colIndex); 353 328 if (realColumnIndex == 0){ 354 tip = conf_display[rowIndex][ 0].toString();329 tip = conf_display[rowIndex][realColumnIndex].toString(); 355 330 } else { 356 331 tip = super.getToolTipText(e); … … 358 333 return tip; 359 334 } 335 public Component prepareRenderer (TableCellRenderer renderer, 336 int rowIndex, int colIndex){ 337 Component c = super.prepareRenderer(renderer, rowIndex, colIndex); 338 if (colIndex == 0) { 339 c.setBackground(Configuration.getColor("coloring.table_noneditable_background",false)); 340 } else { 341 c.setBackground(Configuration.getColor("coloring.table_editable_background",false)); 342 } 343 return c; 344 } 360 345 }; 361 346 347 //When the MySQL and TOMCAT servers are still running and detect double-clicking occuring (editing mode) 348 conf_setting_table.addMouseListener(new MouseAdapter(){ 349 public void mouseClicked(MouseEvent e){ 350 if (e.getClickCount() == 2){ 351 if (conf_pane_name.matches("MYSQL")){ 352 mysql_server_up = false; 353 mysql_server_up = checkMysqlServer(); 354 if (mysql_server_up) { 355 JOptionPane.showMessageDialog((Component) null,"MySQL is running, shutdown the MySQL server before making any changes"); 356 } 357 } 358 if (conf_pane_name.matches("TOMCAT")){ 359 tomcat_server_up = false; 360 tomcat_server_up = checkTomcatServer(); 361 if (tomcat_server_up) { 362 JOptionPane.showMessageDialog((Component) null,"TOMCAT is running, shutdown the TOMCAT server before making any changes"); 363 } 364 } 365 } 366 } 367 }); 368 conf_setting_table.addKeyListener(new KeyAdapter(){ 369 public void keyPressed(KeyEvent ke){ 370 if (ke.getKeyCode() == KeyEvent.VK_F2){ 371 if (conf_pane_name.matches("MYSQL")){ 372 mysql_server_up = checkMysqlServer(); 373 if (mysql_server_up) { 374 JOptionPane.showMessageDialog((Component) null,"MySQL is running, shutdown the MySQL server before making any changes"); 375 } 376 } 377 if (conf_pane_name.matches("TOMCAT")){ 378 tomcat_server_up = checkTomcatServer(); 379 if (tomcat_server_up) { 380 JOptionPane.showMessageDialog((Component) null,"TOMCAT is running, shutdown the TOMCAT server before making any changes"); 381 } 382 } 383 } 384 } 385 }); 386 362 387 //Set up tableHeader 363 JTableHeader header = conf_setting_table.getTableHeader(); 364 header.setFont(new Font("Arial", Font.BOLD, 14)); 365 388 JTableHeader table_header = conf_setting_table.getTableHeader(); 389 Dimension table_header_preferred_size = table_header.getPreferredSize(); 390 if (table_header_preferred_size.height < MINIMUM_TABLE_HEADER_SIZE) { 391 table_header_preferred_size.setSize(table_header_preferred_size.width, MINIMUM_TABLE_HEADER_SIZE); 392 table_header.setPreferredSize(table_header_preferred_size); 393 } 394 395 table_header.setFont(new Font("Arial", Font.BOLD, 13)); 366 396 conf_setting_table.setRowHeight(30); 367 397 conf_table_pane = new JScrollPane(conf_setting_table); 368 398 conf_table_pane.setVisible(false); 399 conf_table_pane.getViewport().setBackground(Configuration.getColor("coloring.collection_tree_background", false)); 400 369 401 // Layout Components 370 402 confList_pane.setLayout(new BorderLayout()); … … 372 404 confList_pane.add(conf_treeView, BorderLayout.CENTER); 373 405 confList_pane.add(confList_label, BorderLayout.NORTH); 374 375 406 confContent_pane.setLayout(new BorderLayout()); 376 407 confContent_pane.add(conf_table_pane, BorderLayout.CENTER); 377 408 409 inner_button_pane.setLayout(new GridLayout(1,2)); 378 410 inner_control_pane.setLayout (new BorderLayout()); 379 411 inner_control_pane.setBorder(BorderFactory.createEmptyBorder(5,10,5,10)); … … 382 414 inner_control_pane.add (inner_button_pane, BorderLayout.CENTER); 383 415 384 // Outter Button Layout385 //outter_button_pane.setLayout (new GridLayout(1,2));386 //outter_button_pane.add(reload_button);387 //outter_button_pane.add(delete_button);388 //outter_button_pane.add(exit_button);389 390 /*outter_control_pane.setLayout (new BorderLayout());391 outter_control_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));392 outter_control_pane.setPreferredSize(new Dimension(50,50));393 outter_control_pane.setSize(new Dimension(50,50));394 outter_control_pane.add (outter_button_pane, BorderLayout.CENTER);*/395 396 416 main_contentPane.setLayout (new BorderLayout()); 397 417 main_contentPane.add(confContent_label, BorderLayout.NORTH); … … 400 420 main_conf_pane.add(confList_pane, JSplitPane.LEFT); 401 421 main_conf_pane.add(main_contentPane, JSplitPane.RIGHT); 402 main_conf_pane.setDividerLocation(LIST_SIZE.width - 10); 422 main_conf_pane.setDividerLocation(LIST_SIZE.width - 10); 403 423 404 424 this.setLayout(new BorderLayout()); … … 406 426 } 407 427 408 /*private class ExitButtonListener409 implements ActionListener {410 // Exit the Adminstration tool411 public void actionPerformed(ActionEvent event) {412 if (valueChanged) {413 int result = JOptionPane.showConfirmDialog((Component) null, "The value of configuration has been changed,do you really want to exit?", "Exit Confirmation", JOptionPane.YES_NO_OPTION);414 if ( result == JOptionPane.YES_OPTION) {415 System.exit(1);416 } else if (result == JOptionPane.NO_OPTION) {417 JOptionPane.showMessageDialog((Component) null,"Press Save Change button to save the change!");418 }419 } else {420 System.exit(1);421 }422 }423 }*/424 425 428 private class StartupTomcatButtonListener 426 429 implements ActionListener { 427 430 public void actionPerformed(ActionEvent event) { 431 /*before startup Tomcat server, we want to make sure project and Site configuration 432 * files are saved*/ 433 if (project_conf_changed) { 434 saveProjectConf(GAI.build_file); 435 } 436 /*boolean site_conf_changed = site_conf.confChanged(); 437 boolean interface_conf_changed=interface_conf.confChanged(); 438 if (site_conf_changed) { 439 site_conf.saveFile(site_conf_file); 440 } 441 if (interface_conf_changed) { 442 interface_conf.saveFile(interface_conf_file); 443 }*/ 428 444 tomcat_server_up = checkTomcatServer(); 429 445 if (!tomcat_server_up) { 430 //ParsingProgress progressBar = new ParsingProgress("Startup Tomcat Server", "Starting up the Tomcat Server", 10);431 446 ThreadControl threadControl = new ThreadControl(); 432 447 Runnable startupTomcatThread = threadControl.new startupTomcatServer("start-tomcat"); 433 448 new Thread(startupTomcatThread).start(); 434 //if over two seconds435 // activae progress bar436 /*progressBar.dispose();437 progressBar.destroy();438 progressBar = null;*/439 449 threadControl.destroy(); 440 450 tomcat_server_up = true; 441 JOptionPane.showMessageDialog((Component) null,"T he Tomcat server has been Startup successfully!");451 JOptionPane.showMessageDialog((Component) null,"Tomcat server has been Startup successfully!"); 442 452 } else { 443 453 JOptionPane.showMessageDialog((Component) null,"Tomcat server is running"); … … 452 462 tomcat_server_up = checkTomcatServer(); 453 463 if (tomcat_server_up){ 454 int result = JOptionPane.showConfirmDialog((Component) null, "Are you sure that you want to shutdown the Tomcat server?", "Shutdown Confirmation", JOptionPane.YES_NO_OPTION); 455 if (result == JOptionPane.YES_OPTION) { 456 // ParsingProgress progressBar = new ParsingProgress("Shutdown Tomcat Server", "Shutting down the Tomcat Server", 10); 457 ThreadControl threadControl = new ThreadControl(); 458 Runnable shutdownTomcatThread = threadControl.new shutdownTomcatServer("stop-tomcat"); 459 new Thread(shutdownTomcatThread).start(); 460 /*progressBar.dispose(); 461 progressBar.destroy(); 462 progressBar = null;*/ 463 threadControl.destroy(); 464 tomcat_server_up = false; 465 JOptionPane.showMessageDialog((Component) null,"The Tomcat server has been Shutdown successfully !"); 466 } else if (result == JOptionPane.NO_OPTION) { 467 JOptionPane.showMessageDialog((Component) null,"Cancel to Shutdown the Tomcat server!"); 468 } 464 ThreadControl threadControl = new ThreadControl(); 465 Runnable shutdownTomcatThread = threadControl.new shutdownTomcatServer("stop-tomcat"); 466 new Thread(shutdownTomcatThread).start(); 467 threadControl.destroy(); 468 tomcat_server_up = false; 469 JOptionPane.showMessageDialog((Component) null, "Tomcat server has been shutted down !"); 469 470 } else { 470 JOptionPane.showMessageDialog((Component) null,"T he Tomcat server was not running!");471 JOptionPane.showMessageDialog((Component) null,"Tomcat server was not running!"); 471 472 } 472 473 changeTomcatButtonPane2(); … … 477 478 implements ActionListener { 478 479 public void actionPerformed(ActionEvent event) { 480 //before we restart Tomcat server, we want to make sure the conf_pane settings are saved 481 if (project_conf_changed) { 482 saveProjectConf(GAI.build_file); 483 } 484 /*boolean site_conf_changed = site_conf.confChanged(); 485 boolean interface_conf_changed=interface_conf.confChanged(); 486 if (site_conf_changed) { 487 site_conf.saveFile(site_conf_file); 488 } 489 if (interface_conf_changed) { 490 interface_conf.saveFile(interface_conf_file); 491 }*/ 479 492 tomcat_server_up = checkTomcatServer(); 480 493 if (tomcat_server_up) { 481 494 ThreadControl threadControl = new ThreadControl(); 482 495 Runnable restartTomcatThread = threadControl.new restartTomcatServer("restart-tomcat"); 483 new Thread(restartTomcatThread).start();496 new Thread(restartTomcatThread).start(); 484 497 threadControl.destroy(); 485 498 tomcat_server_up = true; 486 JOptionPane.showMessageDialog((Component) null,"T he Tomcat server has been Restarted successfully!");499 JOptionPane.showMessageDialog((Component) null,"Tomcat server has been Restarted successfully!"); 487 500 } else { 488 501 JOptionPane.showMessageDialog((Component) null,"Tomcat server was not running!"); … … 490 503 } 491 504 } 492 493 505 494 506 private class StartupMysqlButtonListener 495 507 implements ActionListener { 496 508 public void actionPerformed(ActionEvent event) { 509 //before we startup the MySQL server, we want to make sure the Conf_pane settings are saved 510 saveProjectConf(GAI.build_file); 497 511 mysql_server_up = checkMysqlServer(); 498 512 if (!mysql_server_up) { … … 501 515 new Thread(startupMysqlThread).start(); 502 516 threadControl.destroy(); 503 JOptionPane.showMessageDialog((Component) null,"The MYSQL server has been Startup successfully!");504 517 mysql_server_up = true; 518 JOptionPane.showMessageDialog((Component) null,"MYSQL server has been Startup successfully!"); 505 519 } else { 506 520 JOptionPane.showMessageDialog((Component) null,"MYSQL server has been running"); … … 515 529 mysql_server_up = checkMysqlServer(); 516 530 if (mysql_server_up){ 517 int result = JOptionPane.showConfirmDialog((Component) null, "Are you sure that you want to shutdown the MYSQL server?", "Shutdown Confirmation", JOptionPane.YES_NO_OPTION); 518 if (result == JOptionPane.YES_OPTION) { 519 ThreadControl threadControl = new ThreadControl(); 520 Runnable shutdownMysqlThread = threadControl.new shutdownMysqlServer("stop-mysql"); 521 new Thread(shutdownMysqlThread).start(); 522 threadControl.destroy(); 523 JOptionPane.showMessageDialog((Component) null,"The MYSQL server has been Shutdown successfully !"); 524 mysql_server_up = false; 525 } else if (result == JOptionPane.NO_OPTION) { 526 JOptionPane.showMessageDialog((Component) null,"Cancel to Shutdown the MYSQL server!"); 527 } 531 ThreadControl threadControl = new ThreadControl(); 532 Runnable shutdownMysqlThread = threadControl.new shutdownMysqlServer("stop-mysql"); 533 new Thread(shutdownMysqlThread).start(); 534 threadControl.destroy(); 535 JOptionPane.showMessageDialog((Component) null,"MYSQL server has been Shutdown successfully !"); 536 mysql_server_up = false; 528 537 } else { 529 JOptionPane.showMessageDialog((Component) null," TheMYSQL server was not running!");538 JOptionPane.showMessageDialog((Component) null,"MYSQL server was not running!"); 530 539 } 531 540 changeMysqlButtonPane2(); 532 541 } 533 542 } 534 543 535 544 private class RestartMysqlButtonListener 536 545 implements ActionListener { 537 546 public void actionPerformed(ActionEvent event) { 547 saveProjectConf(GAI.build_file); 538 548 mysql_server_up = checkMysqlServer(); 539 549 if (mysql_server_up) { … … 545 555 mysql_server_up = true; 546 556 } else { 547 JOptionPane.showMessageDialog((Component) null,"MYSQL server was not running, use startup button to start the MYSQL server!"); 548 } 549 } 550 } 551 552 private class SaveButtonListener 553 implements ActionListener { 554 public void actionPerformed(ActionEvent event) { 555 556 if (!valueChanged) { 557 JOptionPane.showMessageDialog((Component) null,"The configuration value has not been changed!"); 558 } else { 559 int result = JOptionPane.showConfirmDialog((Component) null, "Do you really want to save the change", "Save Confirmation", JOptionPane.YES_NO_OPTION); 560 if ( result == JOptionPane.YES_OPTION) { 561 saveNewConfSetting(); 562 writeConfFile(GAI.build_file); 563 valueChanged = false; 564 } else if (result == JOptionPane.NO_OPTION) { 565 valueChanged = true; 566 } 567 } 568 569 } 570 } 571 572 public void saveNewConfSetting(){ 573 String new_string; 574 for (int i=0; i < conf_display.length; i++){ 575 if (!conf_display[i][1].toString().matches("^\\s*$")){ 576 for (int j=0; j < conf_array.size(); j++){ 577 if (((String)conf_array.get(j)).startsWith(conf_display[i][1].toString().toLowerCase())){ 578 new_string = conf_display[i][1].toString()+"="+conf_display[i][2].toString(); 579 conf_array.set(j, new_string.toLowerCase()); 580 } 581 } 582 } 583 } 584 585 } 586 587 588 public void writeConfFile(File file){ 557 JOptionPane.showMessageDialog((Component) null,"MYSQL server was not running!"); 558 } 559 } 560 } 561 562 // Save the configuration file globally,when click File->Save or restart (or startup) Tomcat and MySQl server 563 public void saveProjectConf(File file){ 564 String new_string; 565 Enumeration keys = conf_table.keys(); 566 String key; 567 String value; 589 568 String filename = file.getPath(); 569 while (keys.hasMoreElements()) { 570 key = (String) keys.nextElement(); 571 value = (String) conf_table.get(key); 572 for (int j=0 ; j < conf_array.size(); j++){ 573 if (((String)conf_array.get(j)).startsWith(key.toLowerCase())){ 574 new_string = key+"="+value; 575 conf_array.set(j, new_string.toLowerCase()); 576 } 577 } 578 } 579 590 580 try { 591 581 BufferedWriter conf_out = new BufferedWriter(new FileWriter(filename)); … … 596 586 conf_out.close(); 597 587 getConfContent(); 588 project_conf_changed = false; 598 589 } catch (Exception e) { 599 590 e.printStackTrace(); … … 601 592 } 602 593 594 public boolean ProjectConfChanged() { 595 return project_conf_changed; 596 } 603 597 604 598 public void getConfContent(){ 605 System.err.println("GAI Build file:" + GAI.build_file);606 607 599 String filename = GAI.build_file.getPath(); 608 609 600 if (!GAI.build_file.exists()){ 610 601 JOptionPane.showMessageDialog((Component) null,"Build property file does not exist"); 611 //reload_button.setEnabled(false);612 602 } else { 613 readFile(filename); 614 } 615 save_button.setEnabled(true); 616 } 617 618 public void readFile (String filename) { 603 readProjectConf(filename); 604 } 605 } 606 607 /* Read build.properties file 608 * @param 609 */ 610 public void readProjectConf (String filename) { 619 611 String fileLine; 620 612 /*inside the array will store, the conf_setting[i][0]:Comment, 621 * conf_setting[i][1]:Para and conf_setting[i][2]:Value613 * conf_setting[i][1]:Para and conf_setting[i][2]:Value 622 614 * conf_array[] store all the details from the build.properties*/ 623 615 conf_array = new ArrayList(); … … 626 618 BufferedReader conf_in = new BufferedReader(new FileReader(filename)); 627 619 int i = 0; 628 int j = 0;629 620 while ((fileLine = conf_in.readLine()) != null) { 630 621 // This is an empty line … … 642 633 int end_index = fileLine.indexOf("="); 643 634 conf_setting[i][1] = fileLine.substring(0,end_index).toUpperCase(); 644 conf_setting[i][2] = fileLine.substring(end_index+1); 635 conf_setting[i][2] = fileLine.substring(end_index+1); 636 conf_table.put(conf_setting[i][1], conf_setting[i][2]); 645 637 i++; //calculat the number of settings 646 638 conf_array.add(fileLine); … … 650 642 } 651 643 num_of_setting = i; 644 for (int j=0; j<num_of_setting; j++){ 645 if (conf_setting[j][1].toString().matches("TOMCAT.SERVER")){ 646 tomcat_server = conf_setting[j][2].toString(); 647 } 648 if (conf_setting[j][1].toString().matches("TOMCAT.PORT")){ 649 tomcat_port = conf_setting[j][2].toString(); 650 } 651 if (conf_setting[j][1].toString().matches("MYSQL.ADMIN.USER")){ 652 mysql_adminuser = conf_setting[j][2].toString(); 653 } 654 if (conf_setting[j][1].toString().matches("MYSQL.SERVER")){ 655 mysql_server = conf_setting[j][2].toString(); 656 } 657 if (conf_setting[j][1].toString().matches("MYSQL.PORT")){ 658 mysql_port = conf_setting[j][2].toString(); 659 } 660 } 652 661 conf_in.close(); 653 662 } catch (Exception e) { … … 656 665 } 657 666 658 public void showConfSetting(String conf_param) { 659 clearTable(); 660 int j=0; 661 for (int i=0; i< num_of_setting; i++){ 662 if (conf_setting[i][1].toString().matches("^("+ conf_param +").+")) { 663 if (conf_setting[i][1].toString().matches("TOMCAT.SERVER")){ 664 tomcat_server = conf_setting[i][2].toString(); 665 } 666 if (conf_setting[i][1].toString().matches("TOMCAT.PORT")){ 667 tomcat_port = conf_setting[i][2].toString(); 668 } 669 if (conf_setting[i][1].toString().matches("MYSQL.ADMIN.USER")){ 670 mysql_adminuser = conf_setting[i][2].toString(); 671 } 672 if (conf_setting[i][1].toString().matches("MYSQL.SERVER")){ 673 mysql_server = conf_setting[i][2].toString(); 674 } 675 if (conf_setting[i][1].toString().matches("MYSQL.PORT")){ 676 mysql_port = conf_setting[i][2].toString(); 677 } 678 conf_display[j][0] = conf_setting[i][0]; 679 conf_display[j][1] = conf_setting[i][1]; 680 conf_display[j][2] = conf_setting[i][2]; 681 j++; 682 } 683 } 684 } 685 667 686 668 public void clearTable (){ 687 669 for (int i=0; i< rowLength; i++){ … … 709 691 } 710 692 } else { 711 System.err.println("E tiher tomcat server or tomcat port was not set properly");693 System.err.println("Either Tomcat server or Tomcat port was not set properly"); 712 694 } 713 695 } catch (Exception ex) { 696 tomcat_server_up = false; 714 697 System.err.println(ex.getMessage()); 715 698 } … … 723 706 String mysql_password = ""; 724 707 String mysql_url ="jdbc:mysql://"+mysql_server+":"+mysql_port+"/localsite_gs3mgdemo"; 725 System.err.println("what is Mysql_URL:" + mysql_url);708 //System.err.println("what is Mysql_URL:" + mysql_url); 726 709 Class.forName("com.mysql.jdbc.Driver").newInstance(); 727 710 conn = DriverManager.getConnection(mysql_url, mysql_userName, mysql_password); 728 System.err.println("MYSQL Server connection:" + conn);729 711 if (conn == null) { 730 //System.err.println("Connection is failed");731 712 mysql_server_up =false; 732 713 } else { … … 734 715 } 735 716 } catch (Exception e) { 717 mysql_server_up = false; 736 718 System.err.println("Cannot connect to database server"); 737 719 } 738 720 return mysql_server_up; 739 721 } 740 741 class ConfTableModel extends AbstractTableModel { 722 723 public class ConfSettingTableModel 724 extends AbstractTableModel 725 { 742 726 String[] columnNames = {"Configuration Parameter", 743 727 "Configuration Value"}; 744 728 745 729 public int getColumnCount(){ 746 747 } 748 730 return columnNames.length; 731 } 732 749 733 public int getRowCount() { 750 return conf_display.length;734 return display_row_count; 751 735 } 752 736 753 737 public String getColumnName(int col){ 738 754 739 return columnNames[col]; 755 740 } 756 741 757 742 public Object getValueAt(int row,int col){ 758 743 return conf_display[row][col+1]; … … 760 745 761 746 public boolean isCellEditable(int row, int col){ 762 if (col ==0){747 if (col==0){ 763 748 return false; 764 } else { 765 return true; 766 } 767 } 768 749 } else if (conf_display[row][col].toString().matches("MYSQL.+")){ 750 mysql_server_up = checkMysqlServer(); 751 if (mysql_server_up) { 752 return false; 753 } 754 } else if (conf_display[row][col].toString().matches("TOMCAT.+")){ 755 tomcat_server_up = checkTomcatServer(); 756 if (tomcat_server_up) { 757 return false; 758 } 759 } 760 return true; 761 } 762 769 763 public void setValueAt(Object value, int row, int col){ 764 if (!isCellEditable(row, col)) 765 return; 770 766 conf_display[row][col+1] = value; 767 project_conf_changed = true; 768 //System.err.println("**ConfDisplay:" + conf_display[row][col].toString()); 769 conf_table.put(conf_display[row][col].toString(), value); 771 770 fireTableCellUpdated(row,col+1); 772 valueChanged = true; 773 } 774 } 775 771 updateUI(); 772 } 773 } 774 775 public int showProjectConf(String conf_param) { 776 conf_table_pane.setVisible(true); 777 clearPrevConfPane(); 778 confContent_pane.add(conf_table_pane, BorderLayout.CENTER); 779 confContent_pane.revalidate(); 780 clearTable(); 781 int j=0; 782 int row_count = 0; 783 for (int i=0; i< num_of_setting; i++){ 784 if (conf_setting[i][1].toString().matches("^("+ conf_param +").+")) { 785 row_count = row_count +1; 786 conf_display[j][0] = conf_setting[i][0]; 787 conf_display[j][1] = conf_setting[i][1]; 788 conf_display[j][2] = conf_table.get(conf_setting[i][1]); 789 j++; 790 } 791 } 792 return row_count; 793 } 794 795 public void displaySiteConf(SiteConfSetting site_conf_tmp){ 796 clearPrevConfPane(); 797 confContent_pane.add(site_conf_tmp, BorderLayout.CENTER); 798 try { 799 site_conf_tmp.showText(); 800 site_conf_tmp.goTop(); 801 confContent_pane.revalidate(); 802 } catch (Exception e) { 803 e.printStackTrace(); 804 } 805 } 806 807 public void clearPrevConfPane() { 808 confContent_pane.remove(conf_table_pane); 809 confContent_pane.remove(site_conf); 810 confContent_pane.remove(interface_conf); 811 } 812 813 776 814 private class ConfTreeListener implements TreeSelectionListener{ 777 String conf_param;778 815 public void valueChanged (TreeSelectionEvent e){ 779 816 String option = conf_tree.getLastSelectedPathComponent().toString(); 817 conf_table_pane.setVisible(true); 780 818 if (option == "Compile"){ 781 if (valueChanged){ 782 JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change"); 819 conf_pane_name = "COMPILE"; 820 display_row_count = showProjectConf(conf_pane_name); 821 inner_button_pane.removeAll(); 822 inner_button_pane.setLayout(new GridLayout(1,3)); 823 } else if (option == "Tomcat"){ 824 conf_pane_name ="TOMCAT"; 825 display_row_count = showProjectConf(conf_pane_name); 826 //Setup Tomcat button control pane 827 inner_button_pane.removeAll(); 828 inner_button_pane.setLayout(new GridLayout(1,3)); 829 if (checkTomcatServer()) { 830 changeTomcatButtonPane1(); 783 831 } else { 784 conf_param = "COMPILE"; 785 //conf_tree.setToolTipText("The Configuration Setting for the Compilation "); 786 inner_button_pane.removeAll(); 787 inner_button_pane.setLayout(new GridLayout(1,3)); 788 inner_button_pane.add(save_button); 789 save_button.setEnabled(true); 790 showConfSetting(conf_param); 791 updateUI(); 792 } 793 } else if (option == "Tomcat"){ 794 if (valueChanged) { 795 JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change"); 832 changeTomcatButtonPane2(); 833 } 834 } else if (option =="Proxy"){ 835 conf_pane_name="PROXY"; 836 display_row_count = showProjectConf(conf_pane_name); 837 //Setup Proxy button control pane 838 inner_button_pane.removeAll(); 839 inner_button_pane.setLayout(new GridLayout(1,3)); 840 } else if (option == "MySQL"){ 841 conf_pane_name="MYSQL"; 842 display_row_count = showProjectConf(conf_pane_name); 843 // Setup MySQL button control pane 844 inner_button_pane.removeAll(); 845 inner_button_pane.setLayout(new GridLayout(1,3)); 846 if (checkMysqlServer()) { 847 changeMysqlButtonPane1(); 796 848 } else { 797 conf_param ="TOMCAT"; 798 showConfSetting(conf_param); 799 //Setup Tomcat button control pane 800 inner_button_pane.removeAll(); 801 inner_button_pane.setLayout(new GridLayout(1,3)); 802 if (checkTomcatServer()) { 803 changeTomcatButtonPane1(); 804 } else { 805 changeTomcatButtonPane2(); 806 } 807 updateUI(); 808 } 809 } else if (option =="Proxy"){ 810 if (valueChanged) { 811 JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change"); 812 } else { 813 conf_param="PROXY"; 814 showConfSetting(conf_param); 815 //conf_tree.setToolTipText("The Configuration Setting for the Proxy Server"); 816 inner_button_pane.removeAll(); 817 inner_button_pane.setLayout(new GridLayout(1,3)); 818 inner_button_pane.add(save_button); 819 save_button.setEnabled(true); 820 updateUI(); 821 } 822 } else if (option == "Mysql"){ 823 if (valueChanged) { 824 JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change"); 825 } else { 826 conf_param="MYSQL"; 827 showConfSetting(conf_param); 828 //conf_tree.setToolTipText("The Configuration Setting for the MYSQL Server"); 829 // Setup MySQL button control pane 830 inner_button_pane.removeAll(); 831 inner_button_pane.setLayout(new GridLayout(1,3)); 832 if (checkMysqlServer()) { 833 changeMysqlButtonPane1(); 834 } else { 835 changeMysqlButtonPane2(); 836 } 837 updateUI(); 849 changeMysqlButtonPane2(); 838 850 } 839 851 } else if (option == "GSDL"){ 840 if (valueChanged) { 841 JOptionPane.showMessageDialog((Component) null,"The configuration setting has been changed, please save the change"); 842 } else { 843 showConfSetting(conf_param); 844 //conf_tree.setToolTipText("The Configuration Setting for the GSDL"); 845 inner_button_pane.removeAll(); 846 inner_button_pane.setLayout(new GridLayout(1,3)); 847 inner_button_pane.add(save_button); 848 save_button.setEnabled(true); 849 conf_param ="GSDL"; 850 updateUI(); 851 } 852 } else if (option == "Conf 2"){ 853 //MysqlInstall mysql = 854 JOptionPane.showMessageDialog((Component) null,"This has not been defined yet!"); 855 } else if (option == "Conf 3") { 856 clearTable(); 857 JOptionPane.showMessageDialog((Component) null,"This has not been defined yet!"); 858 } 859 } 860 } 852 conf_pane_name ="GSDL"; 853 display_row_count = showProjectConf(conf_pane_name); 854 inner_button_pane.removeAll(); 855 } else if (option == "SiteConfig"){ 856 conf_pane_name = "SiteConfig"; 857 inner_button_pane.removeAll(); 858 displaySiteConf(site_conf); 859 } else if (option == "InterfaceConfig") { 860 conf_pane_name = "InterfaceConfig"; 861 inner_button_pane.removeAll(); 862 displaySiteConf(interface_conf); 863 } 864 updateUI(); 865 } 866 } 867 861 868 public void modeChanged (int mode){ 862 869 return; … … 869 876 public void changeTomcatButtonPane1 (){ 870 877 inner_button_pane.removeAll(); 871 inner_button_pane.setLayout(new GridLayout(1, 3));878 inner_button_pane.setLayout(new GridLayout(1,2)); 872 879 inner_button_pane.add(restart_tomcat_button); 873 880 inner_button_pane.add(shutdown_tomcat_button); 874 inner_button_pane.add(save_button);875 881 restart_tomcat_button.setEnabled (true); 876 882 shutdown_tomcat_button.setEnabled (true); 877 save_button.setEnabled (true);878 883 updateUI(); 879 884 } 880 885 public void changeTomcatButtonPane2 (){ 881 886 inner_button_pane.removeAll(); 882 inner_button_pane.setLayout(new GridLayout(1, 3));887 inner_button_pane.setLayout(new GridLayout(1,2)); 883 888 inner_button_pane.add(startup_tomcat_button); 884 889 inner_button_pane.add(shutdown_tomcat_button); 885 inner_button_pane.add(save_button);886 shutdown_tomcat_button.setEnabled (true);887 890 startup_tomcat_button.setEnabled (true); 888 s ave_button.setEnabled (true);891 shutdown_tomcat_button.setEnabled (false); 889 892 updateUI(); 890 893 } 891 894 public void changeMysqlButtonPane1 (){ 892 895 inner_button_pane.removeAll(); 893 inner_button_pane.setLayout(new GridLayout(1, 3));896 inner_button_pane.setLayout(new GridLayout(1,2)); 894 897 inner_button_pane.add(restart_mysql_button); 895 898 inner_button_pane.add(shutdown_mysql_button); 896 inner_button_pane.add(save_button);897 899 restart_mysql_button.setEnabled (true); 898 900 shutdown_mysql_button.setEnabled (true); 899 save_button.setEnabled (true);900 901 updateUI(); 901 902 } 902 903 public void changeMysqlButtonPane2 (){ 903 904 inner_button_pane.removeAll(); 904 inner_button_pane.setLayout(new GridLayout(1, 3));905 inner_button_pane.setLayout(new GridLayout(1,2)); 905 906 inner_button_pane.add(startup_mysql_button); 906 907 inner_button_pane.add(shutdown_mysql_button); 907 inner_button_pane.add(save_button);908 shutdown_mysql_button.setEnabled (true);909 908 startup_mysql_button.setEnabled (true); 910 s ave_button.setEnabled (true);909 shutdown_mysql_button.setEnabled (false); 911 910 updateUI(); 912 911 } 913 } 914 915 912 public void afterDisplay(){ 913 return; 914 } 915 } 916 -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/LogPane.java
r9972 r10793 46 46 import javax.swing.tree.*; 47 47 48 import org.greenstone.admin.GAIManager; 49 import org.greenstone.admin.GAI; 48 50 import org.greenstone.core.Configuration; 49 51 import org.greenstone.core.Dictionary; 50 52 import org.greenstone.core.util.Utility; 51 import org.greenstone.admin.GAIManager;52 import org.greenstone.admin.GAI;53 53 54 54 /** The Log pane is to view the status of relevant log files in GSIII … … 60 60 implements ActionListener { 61 61 62 // Main Pane63 //protected JSplitPane main_pane = null;64 65 62 /* The pane to demonstrate log information, including the log files being 66 63 *monitored and their content*/ … … 93 90 /** Buttons */ 94 91 private JButton reload_button = null; 95 private JButton delete_button = null; 96 private JButton exit_button = null; 92 private JButton clear_button = null; 97 93 98 94 /*The pane which contains the controls for log files */ … … 108 104 //Constructor 109 105 public LogPane() { 110 106 111 107 // create all the necessary panes 112 108 control_pane = new JPanel(); … … 134 130 // Buttons 135 131 ReloadButtonListener rbl = new ReloadButtonListener(); 136 DeleteButtonListener dbl = new DeleteButtonListener(); 137 //ExitButtonListener ebl = new ExitButtonListener(); 138 ImageIcon reloadButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Refresh16.gif"); 139 ImageIcon deleteButtonIcon = new ImageIcon(GAI.admin_path + "images/toolbarButtonGraphics/general/Delete16.gif"); 140 ImageIcon exitButtonIcon = new ImageIcon(GAI.admin_path + "images/exit16.gif"); 141 142 reload_button = new JButton("Reload", reloadButtonIcon); 132 ClearButtonListener dbl = new ClearButtonListener(); 133 ImageIcon reloadButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/Refresh16.gif"); 134 ImageIcon clearButtonIcon = new ImageIcon(GAI.images_path + "toolbarButtonGraphics/general/Delete16.gif"); 135 136 //reload_button = new JButton("Reload", reloadButtonIcon); 137 reload_button = new JButton(); 143 138 reload_button.addActionListener(rbl); 139 reload_button.setEnabled(false); 144 140 reload_button.setMnemonic(KeyEvent.VK_R); 145 reload_button.setToolTipText("Click this button to reload the log file"); 146 //Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip"); 147 148 delete_button = new JButton("Delete", deleteButtonIcon); 149 delete_button.addActionListener(dbl); 150 delete_button.setEnabled(false); 151 delete_button.setMnemonic(KeyEvent.VK_D); 152 delete_button.setToolTipText("Click this button to delete the log file"); 153 //Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");*/ 154 155 /*exit_button = new JButton("Exit", exitButtonIcon); 156 exit_button.setToolTipText("Click this button to exit the viewing"); 157 exit_button.addActionListener(ebl); 158 exit_button.setEnabled(true); 159 exit_button.setMnemonic(KeyEvent.VK_E);*/ 141 Dictionary.registerBoth(reload_button, "LogPane.Reload_Log", "LogPane.Reload_Log_Tooltip"); 142 143 clear_button = new JButton(); 144 clear_button.addActionListener(dbl); 145 clear_button.setEnabled(false); 146 clear_button.setMnemonic(KeyEvent.VK_C); 147 Dictionary.registerBoth(clear_button, "LogPane.Clear_Log", "LogPane.Clear_Log_Tooltip"); 160 148 161 149 rbl = null; 162 150 dbl = null; 163 //ebl = null;164 151 } 165 152 … … 181 168 logList_pane = new JPanel(); 182 169 logList_pane.setBorder(BorderFactory.createLoweredBevelBorder()); 183 logList_label = new JLabel( "Log Files");170 logList_label = new JLabel(); 184 171 logList_label.setOpaque(true); 185 172 logList_label.setBackground(Configuration.getColor("coloring.workspace_heading_background", false)); 186 173 logList_label.setForeground(Configuration.getColor("coloring.workspace_heading_foreground", false)); 187 //Dictionary.registerText(logList_label, "Log.List");174 Dictionary.registerText(logList_label, "LogPane.Log_List"); 188 175 189 176 // logContent_Pane … … 192 179 logContent_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background", false)); 193 180 logContent_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false)); 194 logContent_label = new JLabel( "Log Content");181 logContent_label = new JLabel(); 195 182 logContent_label.setOpaque(true); 196 logContent_label.setBackground(Configuration.getColor("coloring.workspace_ heading_background", false));197 logContent_label.setForeground(Configuration.getColor("coloring.workspace_ heading_foreground", false));198 //Dictionary.registerText(logContent_label, "Log.Content");183 logContent_label.setBackground(Configuration.getColor("coloring.workspace_selection_background", false)); 184 logContent_label.setForeground(Configuration.getColor("coloring.workspace_selection_foreground", false)); 185 Dictionary.registerText(logContent_label, "LogPane.Log_Content"); 199 186 200 187 // TEXTAREA Layout … … 204 191 button_pane.setLayout (new GridLayout(1,3)); 205 192 button_pane.add(reload_button); 206 button_pane.add(delete_button); 207 //button_pane.add(exit_button); 193 button_pane.add(clear_button); 208 194 209 195 control_pane.setLayout (new BorderLayout()); … … 251 237 repaint(); 252 238 }*/ 253 239 254 240 /** Implementation side-effect, not used in any way. 255 241 * @param event A <strong>FocusEvent</strong> containing details about the focus action performed. … … 257 243 /*public void focusLost(FocusEvent event) { 258 244 }*/ 259 245 260 246 /** Called to inform this control panel that it has just gained focus as an effect of the user clicking on its tab. 261 247 */ … … 273 259 workspace_filter.setEditable(mode > Configuration.LIBRARIAN_MODE); 274 260 }*/ 275 276 277 /** Refresh this pane, depending on what has just happened (refresh_reason). */278 /*public void refresh(int refresh_reason, boolean collection_loaded)279 {280 if (collection_loaded) {281 // Update collection label282 Dictionary.registerText(collection_label, "Collection.Collection");283 collection_label.setBackground(Configuration.getColor("coloring.collection_heading_background", false));284 collection_label.setForeground(Configuration.getColor("coloring.collection_heading_foreground", false));285 286 // Update collection tree287 if (refresh_reason == Gatherer.COLLECTION_OPENED) {288 collection_tree.setModel(Gatherer.c_man.getCollectionTreeModel());289 }290 // Update collection filter291 collection_filter.setBackground(Configuration.getColor("coloring.collection_heading_background", false));292 }293 else {294 // Update collection label295 String[] args = new String[1];296 args[0] = Dictionary.get("Collection.No_Collection");297 Dictionary.registerText(collection_label, "Collection.Collection", args);298 collection_label.setBackground(Color.lightGray);299 collection_label.setForeground(Color.black);300 301 // Update collection tree302 collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Error")));303 304 // Update collection filter305 collection_filter.setBackground(Color.lightGray);306 }307 308 // Enable or disable the controls309 workspace_tree.setEnabled(true);310 collection_tree.setEnabled(collection_loaded);311 collection_filter.setEnabled(collection_loaded);312 bin_button.setEnabled(collection_loaded);313 new_folder.setEnabled(collection_loaded);314 315 // Ensure that this collection tree view is synchronized with all others316 collection_tree_sync.add(collection_tree);317 }*/318 261 319 262 private class KeyListenerImpl … … 322 265 public void keyReleased(KeyEvent event) { 323 266 } 324 325 267 // we need to watch for left clicks on an unopened folder - should shift the focus to the 326 268 //parent folder. But because there is some other mysterious key listener that does opening and 327 269 //closing folders on right and left clicks, we must detect the situation before the other handler 328 270 //has done its job, and process it after.*/ 329 330 271 public void keyPressed(KeyEvent event) { 331 272 if (event.getKeyCode() == KeyEvent.VK_LEFT) { … … 343 284 *registered components, and start an external application if someone double clicks on a certain 344 285 *file record. */ 345 346 /*public void mouseReleased(MouseEvent e) {} 347 public void mouseExited(MouseEvent e) {} 286 public void mouseReleased(MouseEvent e) {} 287 public void mouseExited(MouseEvent e) {} 348 288 public void mousePressed(MouseEvent e) {} 349 public void mouseEntered(MouseEvent e) {} */289 public void mouseEntered(MouseEvent e) {} 350 290 351 291 } … … 359 299 // Remember that for lower thresholds the above doesn't work, so try this instead 360 300 reload_button.setEnabled(true); 361 delete_button.setEnabled(true);301 clear_button.setEnabled(true); 362 302 updateLogsContent(log_file.getPath()); 363 303 } 364 304 } 365 305 366 private class DeleteButtonListener306 private class ClearButtonListener 367 307 implements ActionListener { 368 308 public void actionPerformed(ActionEvent event) { 369 //log_file.370 309 if (!log_file.exists()){ 371 310 JOptionPane.showMessageDialog((Component) null,log_file.getPath() + " log file does not exist"); 372 311 return; 373 312 } else { 374 DeleteLogFilePrompt dfp = new DeleteLogFilePrompt();375 boolean file_ deleted = dfp.display(log_file);376 if (file_ deleted) {313 ClearLogFilePrompt cfp = new ClearLogFilePrompt(); 314 boolean file_cleared = cfp.display(log_file); 315 if (file_cleared) { 377 316 log_textarea.setText(""); 378 317 } 379 318 } 380 delete_button.setEnabled(true); 381 } 382 } 383 384 /* private class ExitButtonListener 385 implements ActionListener { 386 // Exit the Adminstration tool 387 public void actionPerformed(ActionEvent event) { 388 System.exit(1); 389 } 390 }*/ 391 319 clear_button.setEnabled(false); 320 } 321 } 322 392 323 public void updateLogsContent(String filename){ 393 324 if (!log_file.exists()){ 394 325 log_textarea.setText(""); 395 326 JOptionPane.showMessageDialog((Component) null, filename+" log file does not exist"); 396 delete_button.setEnabled(false);327 clear_button.setEnabled(false); 397 328 } else { 398 329 readFile(filename); … … 403 334 log_textarea.setText(""); 404 335 String fileLine; 405 int line_number = 0;406 336 try { 407 337 BufferedReader in = new BufferedReader(new FileReader(filename)); … … 409 339 log_textarea.append(fileLine); 410 340 log_textarea.append("\n"); 411 line_number =line_number + 1;412 341 } 413 342 } catch (Exception e) { … … 426 355 updateLogsContent(filename); 427 356 reload_button.setEnabled(true); 428 delete_button.setEnabled(true);357 clear_button.setEnabled(true); 429 358 } else if (log_list.getSelectedIndex () == 1) { 430 /*log_file = new File (GAI.gsdl3_path+"/ant_out.log");431 String filename = log_file.getPath();432 updateLogsContent(filename);433 delete_button.setEnabled(true);*/434 359 log_textarea.setText(""); 435 360 JOptionPane.showMessageDialog((Component) null,"This file has not been defined yet"); 436 delete_button.setEnabled(false);361 clear_button.setEnabled(false); 437 362 reload_button.setEnabled(false); 438 363 } else if (log_list.getSelectedIndex () == 2) { 439 364 log_textarea.setText(""); 440 365 JOptionPane.showMessageDialog((Component) null,"This file has not been defined yet"); 441 delete_button.setEnabled(false);366 clear_button.setEnabled(false); 442 367 reload_button.setEnabled(false); 443 368 } … … 448 373 return; 449 374 } 375 public void afterDisplay() { 376 return; 377 } 450 378 } -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/MenuBar.java
r9972 r10793 2 2 *######################################################################### 3 3 * 4 * A component of the G athererapplication, part of the Greenstone digital4 * A component of the GAI application, part of the Greenstone digital 5 5 * library suite from the New Zealand Digital Library Project at the 6 6 * University of Waikato, New Zealand. … … 43 43 44 44 import org.greenstone.admin.GAI; 45 import org.greenstone.core.Configuration; 46 import org.greenstone.core.Dictionary; 45 47 import org.greenstone.core.util.Utility; 46 48 … … 49 51 * @version 50 52 */ 51 52 53 public class MenuBar 53 54 extends JMenuBar { … … 58 59 private JMenu edit = null; 59 60 public JMenu help = null; 60 //public JMenuItem file_associations;61 61 // public JMenuItem file_cdimage = null; 62 62 // public JMenuItem file_close = null; 63 63 //public JMenuItem file_delete = null; 64 public JMenuItem file_exit = null; 65 // public JMenuItem file_exportas = null; 66 // public JMenuItem file_new = null; 67 //public JMenuItem file_open = null; 68 //public JMenuItem file_options = null; 69 // public JMenuItem file_save = null; 70 // public JMenuItem edit_copy; 71 //public JMenuItem edit_cut; 72 // public JMenuItem edit_paste; 64 public JMenuItem file_exit = null; 65 public JMenuItem file_save = null; 66 public JMenuItem help_general; 73 67 public JMenuItem help_conf; 74 68 public JMenuItem help_ext; 75 69 public JMenuItem help_monitor; 76 70 public JMenuItem help_log; 77 //public JMenuItem help_gather;78 //public JMenuItem help_enrich;79 //public JMenuItem help_design;80 //public JMenuItem help_create;81 71 public JMenuItem help_about; 82 72 83 //public static String imagePath = "/research/chi/gsdl3/src/java/org/greenstone/admin/images/";84 public static String imagePath = "/research/chi/gsdl3-test/gsdl3/src/java/org/greenstone/admin/images/";85 86 73 static public ImageIcon HELP_ICON = null; 87 74 88 75 // public MenuBar(MenuListener Menu_listener) 89 public MenuBar( )76 public MenuBar(MenuListener menu_listener) 90 77 { 91 HELP_ICON = new ImageIcon("images/help.gif"); 92 file = new JMenu("File"); 78 HELP_ICON = new ImageIcon(GAI.images_path +"help.gif"); 79 //file = new JMenu("File"); 80 file = new JMenu(); 93 81 file.setMnemonic(KeyEvent.VK_F); 94 //Dictionary.registerText(file, "Menu.File"); 95 96 /*file_associations = new JMenuItem(); 97 file_associations.addActionListener(Gatherer.g_man); 98 file_associations.setMnemonic(KeyEvent.VK_A); 99 Dictionary.registerText(file_associations, "Menu.File_Associations"); 100 101 file_cdimage = new JMenuItem(); 102 file_cdimage.addActionListener(Gatherer.g_man); 103 file_cdimage.setMnemonic(KeyEvent.VK_I); 104 Dictionary.registerText(file_cdimage, "Menu.File_CDimage"); 105 106 file_close = new JMenuItem(); 107 file_close.addActionListener(Gatherer.g_man); 108 file_close.setEnabled(false); 109 file_close.setMnemonic(KeyEvent.VK_C); 110 Dictionary.registerText(file_close, "Menu.File_Close"); 111 112 file_delete = new JMenuItem(); 113 file_delete.addActionListener(Gatherer.g_man); 114 file_delete.setMnemonic(KeyEvent.VK_D); 115 Dictionary.registerText(file_delete, "Menu.File_Delete");*/ 116 117 file_exit = new JMenuItem("Exit"); 82 Dictionary.registerText(file, "Menu.File"); 83 84 //file_save = new JMenuItem("Save"); 85 file_save = new JMenuItem(); 86 file_save.addActionListener(GAI.ga_man); 87 file_save.setMnemonic(KeyEvent.VK_S); 88 Dictionary.registerText(file_save, "Menu.File_Save"); 89 90 //file_exit = new JMenuItem("Exit"); 91 file_exit = new JMenuItem(); 118 92 file_exit.addActionListener(GAI.ga_man); 119 93 file_exit.setMnemonic(KeyEvent.VK_X); 120 //Dictionary.registerText(file_exit, "Menu.File_Exit"); 121 122 /*file_exportas = new JMenuItem(); 123 file_exportas.addActionListener(Gatherer.g_man); 124 file_exportas.setMnemonic(KeyEvent.VK_E); 125 Dictionary.registerText(file_exportas, "Menu.File_ExportAs");*/ 126 127 /*file_new = new JMenuItem(); 128 file_new.addActionListener(Gatherer.g_man); 129 file_new.setMnemonic(KeyEvent.VK_N); 130 Dictionary.registerText(file_new, "Menu.File_New"); 131 132 file_open = new JMenuItem(); 133 file_open.addActionListener(Gatherer.g_man); 134 file_open.setMnemonic(KeyEvent.VK_O); 135 Dictionary.registerText(file_open, "Menu.File_Open"); 136 137 file_options = new JMenuItem(); 138 file_options.addActionListener(Gatherer.g_man); 139 file_options.setMnemonic(KeyEvent.VK_P); 140 Dictionary.registerText(file_options, "Menu.File_Options"); 141 142 file_save = new JMenuItem(); 143 file_save.addActionListener(Gatherer.g_man); 144 file_save.setEnabled(false); 145 file_save.setMnemonic(KeyEvent.VK_S); 146 Dictionary.registerText(file_save, "Menu.File_Save");*/ 147 148 // Layout (file menu) 149 /*file.add(file_new); 150 file.add(file_open); 94 Dictionary.registerText(file_exit, "Menu.File_Exit"); 95 //Layout (File menu) 151 96 file.add(file_save); 152 file.add(file_close);*/153 97 file.add(new JSeparator()); 154 /*file.add(file_delete);155 file.add(file_exportas);156 file.add(file_cdimage);157 file.add(new JSeparator());158 file.add(file_associations);159 file.add(file_options);160 file.add(new JSeparator());*/161 98 file.add(file_exit); 162 99 163 100 // Edit menu 164 edit = new JMenu("Edit"); 101 //edit = new JMenu("Edit"); 102 edit = new JMenu(); 165 103 edit.setMnemonic(KeyEvent.VK_E); 166 //Dictionary.registerText(edit, "Menu.Edit");104 Dictionary.registerText(edit, "Menu.Edit"); 167 105 168 /*edit_cut = new JMenuItem();169 edit_cut.addActionListener(Gatherer.g_man);170 edit_cut.setMnemonic(KeyEvent.VK_X);171 Dictionary.registerText(edit_cut, "Menu.Edit_Cut");172 173 edit_copy = new JMenuItem();174 edit_copy.addActionListener(Gatherer.g_man);175 edit_copy.setMnemonic(KeyEvent.VK_C);176 Dictionary.registerText(edit_copy, "Menu.Edit_Copy");177 178 edit_paste = new JMenuItem();179 edit_paste.addActionListener(Gatherer.g_man);180 edit_paste.setMnemonic(KeyEvent.VK_V);181 Dictionary.registerText(edit_paste, "Menu.Edit_Paste");182 183 // Layout (edit menu)184 edit.add(edit_cut);185 edit.add(edit_copy);186 edit.add(edit_paste);*/187 188 106 // Help menu 189 help = new JMenu("Help"); 107 //help = new JMenu("Help"); 108 help = new JMenu(); 190 109 help.setMnemonic(KeyEvent.VK_H); 191 110 help.setIcon(HELP_ICON); 192 //Dictionary.setText(help, "Menu.Help"); 193 194 help_conf = new JMenuItem("Configuration"); 195 //help_log.addActionListener(Gatherer.g_man); 196 //Dictionary.registerText(help_general, "Source.General"); 197 198 help_ext = new JMenuItem("Ext"); 199 help_monitor = new JMenuItem("Monitor"); 200 help_log = new JMenuItem("Log"); 201 202 /*help_gather = new JMenuItem(Utility.BLANK_ICON); 203 help_gather.addActionListener(Gatherer.g_man); 204 Dictionary.registerText(help_gather, "GUI.Gather"); 205 206 help_enrich = new JMenuItem(Utility.BLANK_ICON); 207 help_enrich.addActionListener(Gatherer.g_man); 208 Dictionary.registerText(help_enrich, "GUI.Enrich"); 209 210 help_design = new JMenuItem(Utility.BLANK_ICON); 211 help_design.addActionListener(Gatherer.g_man); 212 Dictionary.registerText(help_design, "GUI.Design"); 213 214 help_create = new JMenuItem(Utility.BLANK_ICON); 215 help_create.addActionListener(Gatherer.g_man); 216 Dictionary.registerText(help_create, "GUI.Create");*/ 217 218 help_about = new JMenuItem("About"); 219 //help_about.addActionListener(Gatherer.g_man); 220 //Dictionary.registerText(help_about, "Menu.Help_About"); 221 111 Dictionary.setText(help, "Menu.Help"); 112 113 help_general = new JMenuItem(); 114 help_general.addActionListener(GAI.ga_man); 115 Dictionary.registerText(help_general,"Source.General"); 116 117 help_conf = new JMenuItem(); 118 help_conf.addActionListener(GAI.ga_man); 119 Dictionary.registerText(help_conf,"GAI.Configuration"); 120 121 help_ext = new JMenuItem(); 122 help_ext.addActionListener(GAI.ga_man); 123 Dictionary.registerText(help_ext,"GAI.Ext"); 124 125 help_monitor = new JMenuItem(); 126 help_monitor.addActionListener(GAI.ga_man); 127 Dictionary.registerText(help_monitor,"GAI.Monitor"); 128 129 help_log = new JMenuItem(); 130 help_log.addActionListener(GAI.ga_man); 131 Dictionary.registerText(help_log,"GAI.Log"); 132 133 help_about = new JMenuItem(); 134 help_about.addActionListener(GAI.ga_man); 135 Dictionary.registerText(help_about,"Menu.Help_About"); 136 137 222 138 // Layout (help menu) 223 help.add(help_conf); 224 help.add(help_ext); 225 help.add(help_monitor); 226 help.add(help_log); 139 help.add(help_general); 227 140 help.add(new JSeparator()); 228 229 /*if (Configuration.get("workflow.download", true)) { 230 help.add(help_download); 231 } 232 if (Configuration.get("workflow.gather", true)) { 233 help.add(help_gather); 234 } 235 if (Configuration.get("workflow.enrich", true)) { 236 help.add(help_enrich); 237 } 238 if (Configuration.get("workflow.design", true)) { 239 help.add(help_design); 240 } 241 if (Configuration.get("workflow.create", true)) { 242 help.add(help_create); 243 }*/ 141 if (Configuration.get("admin.conf", true)) { 142 help.add(help_conf); 143 } 144 if (Configuration.get("admin.ext", true)) { 145 help.add(help_ext); 146 } 147 if (Configuration.get("admin.monitor", true)) { 148 help.add(help_monitor); 149 } 150 if (Configuration.get("admin.log", true)) { 151 help.add(help_log); 152 } 244 153 245 154 help.add(new JSeparator()); -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/SaveChangePrompt.java
r9972 r10793 79 79 /** This method causes the Save Change Confirmation Dialog to be displayed. 80 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 85 86 87 88 } else if (result == JOptionPane.NO_OPTION) {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 89 current_change_saved = false; 90 90 prompt.dispose(); 91 }92 resultPrompt(current_change_saved);93 return current_change_saved;94 }91 } 92 resultPrompt(current_change_saved); 93 return current_change_saved;*/ 94 //} 95 95 96 96 /** Shows a save complete prompt. -
branches/ant-install-branch/gsdl3/src/java/org/greenstone/admin/gui/ThreadControl.java
r9972 r10793 45 45 46 46 import org.greenstone.admin.GAI; 47 import org.greenstone.admin.GAIManager; 47 48 import org.greenstone.admin.gui.LogPane; 48 49 import org.greenstone.core.ParsingProgress; … … 51 52 52 53 54 53 55 public class ThreadControl 54 56 extends Thread { 55 57 56 //boolean ant_success = false;58 private GAIManager gai_man; 57 59 58 60 public ThreadControl(){ … … 159 161 160 162 public void run() { 161 try { 163 try { 162 164 executeAntTarget(this.command_string); 163 165 } catch(Exception e) { … … 210 212 try { 211 213 executeAntTarget(this.command_string); 212 // ant_success;213 214 } catch(Exception e) { 214 215 System.out.println(e.getMessage()); … … 248 249 } 249 250 } 251 252 public class installGS3 253 implements Runnable { 254 private String command_string = null; 255 256 /* Install GSDL3 through ant program*/ 257 public installGS3(String command_string) { 258 this.command_string = command_string; 259 } 260 public void run() { 261 try { 262 263 executeAntTarget(this.command_string); 264 // ant_success; 265 } catch(Exception e) { 266 System.out.println(e.getMessage()); 267 } 268 } 269 } 270 250 271 251 272 public void destroy(){
Note:
See TracChangeset
for help on using the changeset viewer.