- Timestamp:
- 2010-08-11T21:28:34+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r20961 r22605 68 68 private JButton apply_button; 69 69 private JButton cancel_button; 70 private JButton chdir_button; 70 71 private JButton ok_button; 71 72 private JCheckBox show_file_size_checkbox; … … 92 93 private JTextField program_field; 93 94 private JTextField proxy_host_field; 95 private JTextField collect_dir_field; 96 94 97 private Preferences self; 95 98 … … 298 301 } 299 302 } 303 304 JPanel collect_dir_pane = new JPanel(); 305 collect_dir_pane.setComponentOrientation(Dictionary.getOrientation()); 306 collect_dir_pane.setPreferredSize(ROW_SIZE); 307 JLabel collect_dir_label = new JLabel(Dictionary.get("Preferences.Connection.CollectDirectory")); 308 collect_dir_label.setPreferredSize(LABEL_SIZE); 309 collect_dir_label.setComponentOrientation(Dictionary.getOrientation()); 310 collect_dir_field = new JTextField(Gatherer.getCollectDirectoryPath()); 311 //collect_dir_field = new JTextField(Configuration.getString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true)); 312 collect_dir_field.setCaretPosition(0); 313 collect_dir_field.setToolTipText(Dictionary.get("Preferences.Connection.CollectDirectory_Tooltip")); 314 collect_dir_field.setEditable(false); 315 JButton chdir_button = new GLIButton(Dictionary.get("General.CD"), Dictionary.get("General.CD_Tooltip")); 316 chdir_button.addActionListener(new ChangeDirListener()); 317 if(Gatherer.isGsdlRemote) { // disable changing directories for client GLI 318 chdir_button.setEnabled(false); 319 } 300 320 301 321 boolean currently_enabled = Configuration.get("general.use_proxy", true); … … 370 390 } 371 391 392 collect_dir_pane.setLayout(new BorderLayout()); 393 collect_dir_pane.add(collect_dir_label, BorderLayout.LINE_START); 394 collect_dir_pane.add(collect_dir_field, BorderLayout.CENTER); 395 collect_dir_pane.add(chdir_button, BorderLayout.LINE_END); 396 372 397 proxy_host_pane.setLayout(new BorderLayout()); 373 398 proxy_host_pane.add(proxy_host_label, BorderLayout.LINE_START); … … 389 414 connection_pane.add(servlet_pane); 390 415 } 416 connection_pane.add(collect_dir_pane); 417 391 418 connection_pane.add(use_proxy_checkbox); 392 419 connection_pane.add(proxy_host_pane); … … 731 758 } 732 759 760 private class ChangeDirListener implements ActionListener { 761 public void actionPerformed(ActionEvent event) { 762 JFileChooser chooser = new JFileChooser(collect_dir_field.getText()); 763 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 764 int returnVal = chooser.showOpenDialog(Preferences.this); 765 if(returnVal == JFileChooser.APPROVE_OPTION) { 766 collect_dir_field.setText(chooser.getSelectedFile().getAbsolutePath() + File.separator); 767 } // else collect_dir_field text remains as it is 768 } 769 } 733 770 734 771 private class OKButtonListener … … 826 863 Configuration.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem()); 827 864 } 865 866 // collect directory change 867 String newCollectPath = collect_dir_field.getText(); 868 if(!newCollectPath.endsWith(File.separator)) { 869 newCollectPath += File.separator; 870 } 871 Gatherer.collectDirectoryHasChanged(Gatherer.getCollectDirectoryPath(), newCollectPath); 872 // will tell the server that the collect directory has changed and that 873 // the workspace needs to be refreshed (Documents in Greenstone Collections) 874 828 875 829 876 Configuration.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
Note:
See TracChangeset
for help on using the changeset viewer.