Changeset 5102


Ignore:
Timestamp:
2003-08-06T17:32:28+12:00 (21 years ago)
Author:
mdewsnip
Message:

Added auto-completion (when the Enter key is pressed) - a requirement that I wasn't aware of when revising the code...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/valuetree/GValueTree.java

    r4803 r5102  
    9393    value.setPreferredSize(new Dimension(413, 24));
    9494    value.getDocument().addDocumentListener(new DocumentListenerImpl());
     95    value.addActionListener(new MetadataFieldListener());
    9596
    9697    JPanel button_pane = new JPanel();
     
    217218    public void valueChanged(TreeSelectionEvent event)
    218219    {
    219     if(tree.getSelectionCount() != 0 && !ignore_tree_selection_event) {
     220    if (tree.getSelectionCount() != 0 && !ignore_tree_selection_event) {
    220221        TreePath path = tree.getSelectionPath();
    221222        GValueNode node = (GValueNode) path.getLastPathComponent();
     
    245246
    246247    private String get(String key, String args[]) {
    247     if(key.indexOf('.') == -1) {
     248    if (key.indexOf('.') == -1) {
    248249        key = "MetaEdit." + key;
    249250    }
     
    312313
    313314
     315    private class MetadataFieldListener
     316    implements ActionListener {
     317    /** Gives notification of the Enter key being pressed on the text field */
     318    public void actionPerformed(ActionEvent e) {
     319        if (tree.getSelectionCount() != 0 && !value.getText().equals("")) {
     320        TreePath path = tree.getSelectionPath();
     321        GValueNode node = (GValueNode) path.getLastPathComponent();
     322        value.setText(Utility.stripNL(node.getFullPath()));
     323        }
     324    }
     325    }
     326
     327
    314328    private class DocumentListenerImpl
    315329    implements DocumentListener {
Note: See TracChangeset for help on using the changeset viewer.