Ignore:
Timestamp:
2010-08-11T21:28:34+12:00 (14 years ago)
Author:
ak19
Message:

Ticket #152: Allowing different paths to collect dir so that GLI can work with collect dirs on pen drives. NONE OF THESE CHANGES ARE FOR Client-GLI AS YET. 1. Preferences (Connection tab), Open and New Collection dialogs allow one to change the current collect directory containing the collections to select from. 2. New Collection dialog allows one to base a new collection on an existing collection in a collect dir other than the current collect dir. 3. Collections in the Documents in Greenstone Collections Workspace Tree Node now have two additional rightclick options: to move and copy these collections to another location.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java

    r20961 r22605  
    6868    private JButton apply_button;
    6969    private JButton cancel_button;
     70    private JButton chdir_button;
    7071    private JButton ok_button;
    7172    private JCheckBox show_file_size_checkbox;
     
    9293    private JTextField program_field;
    9394    private JTextField proxy_host_field;
     95    private JTextField collect_dir_field;
     96
    9497    private Preferences self;
    9598
     
    298301        }
    299302    }
     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    }
    300320   
    301321    boolean currently_enabled = Configuration.get("general.use_proxy", true);
     
    370390    }
    371391
     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
    372397    proxy_host_pane.setLayout(new BorderLayout());
    373398    proxy_host_pane.add(proxy_host_label, BorderLayout.LINE_START);
     
    389414        connection_pane.add(servlet_pane);
    390415    }
     416    connection_pane.add(collect_dir_pane);
     417
    391418    connection_pane.add(use_proxy_checkbox);
    392419    connection_pane.add(proxy_host_pane);
     
    731758    }
    732759
     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    }
    733770
    734771    private class OKButtonListener
     
    826863        Configuration.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem());
    827864        }
     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
    828875       
    829876        Configuration.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
Note: See TracChangeset for help on using the changeset viewer.