Changeset 8386


Ignore:
Timestamp:
2004-10-20T13:40:02+13:00 (20 years ago)
Author:
kjdon
Message:

added a edit set button which just pops up a message teling the user about GEMS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/MetadataSetView.java

    r8313 r8386  
    124124    extends JPanel
    125125    implements Control {
    126     /** Opens the MEM and systematically performs as if the add set button were clicked. */
     126    /** Adds a new set to the collection*/
    127127    private JButton add_button;
    128     /** Opens the MEM and systematically performs as if the remove set button were clicked. */
     128    /** Will eventually launch GEMS for editing the selected set, for now just gives a message */
     129    private JButton edit_button;
     130    /** REmoves a set from the collection */
    129131    private JButton remove_button;
    130132    /** The label denoting the element list. */
     
    201203        add_button.setMnemonic(KeyEvent.VK_A);
    202204        Dictionary.registerBoth(add_button, "CDM.MetadataSetManager.Add", "CDM.MetadataSetManager.Add_Tooltip");
     205        edit_button = new GLIButton();
     206        edit_button.setEnabled(false);
     207        edit_button.setMnemonic(KeyEvent.VK_E);
     208        Dictionary.registerBoth(edit_button, "CDM.MetadataSetManager.Edit", "CDM.MetadataSetManager.Edit_Tooltip");
     209       
    203210        remove_button = new GLIButton();
    204211        remove_button.setEnabled(false);
     
    209216        // Add listeners
    210217        add_button.addActionListener(new AddButtonListener());
     218        edit_button.addActionListener(new EditButtonListener());
    211219        remove_button.addActionListener(new RemoveButtonListener());
    212220        set_list.addListSelectionListener(list_listener);
     
    233241        button_pane.setLayout(new GridLayout(1,3,0,0));
    234242        button_pane.add(add_button);
     243        button_pane.add(edit_button);
    235244        button_pane.add(remove_button);
    236245
     
    258267        list_listener.valueChanged(new ListSelectionEvent(set_list, 0, 0, true));
    259268        }
     269        if (!set_list.isSelectionEmpty()) {
     270        edit_button.setEnabled(true);
     271        remove_button.setEnabled(true);
     272        } else {
     273        edit_button.setEnabled(false);
     274        remove_button.setEnabled(false);
     275        }
     276       
    260277    }
    261278
     
    289306
    290307
     308    /** Listens for clicks on the edit button. */
     309    private class EditButtonListener
     310        implements ActionListener {
     311
     312        /** Called when the edit button is clicked.
     313         * @param event an ActionEvent containing information about the mouse click
     314         */
     315        public void actionPerformed(ActionEvent event)
     316        {
     317        // do a pop up message
     318        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.MetadataSetManager.Edit_Message"), Dictionary.get("CDM.MetadataSetManager.Edit_Message_Title"), JOptionPane.INFORMATION_MESSAGE);
     319
     320        }
     321    }
     322
     323
    291324    private class MetadataSetListCellRenderer
    292325        implements ListCellRenderer
     
    323356            element_list.setListData(new Vector(metadata_set.getMetadataSetElements()));
    324357            remove_button.setEnabled(true);
     358            edit_button.setEnabled(true);
    325359
    326360            // Finally check the directionality and scroll as necessary
     
    335369        else {
    336370            remove_button.setEnabled(false);
     371            edit_button.setEnabled(false);
    337372        }
    338373        }
Note: See TracChangeset for help on using the changeset viewer.