Changeset 12122


Ignore:
Timestamp:
2006-07-10T15:02:22+12:00 (18 years ago)
Author:
kjdon
Message:

Changed text handling to use Dictionary.get rather than Dictionary.setText or Dictionary.registerBoth etc. also removed mnemonics cos they suck for other languages. also changed mg new index add all button to select all

File:
1 edited

Legend:

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

    r12087 r12122  
    443443        JPanel assigned_indexes_pane = new JPanel();
    444444       
    445         JLabel index_label = new JLabel();
    446         Dictionary.registerText(index_label, "CDM.IndexManager.Indexes");
     445        JLabel index_label = new JLabel(Dictionary.get("CDM.IndexManager.Indexes"));
    447446        index_list = new JList(index_model);
    448447        index_list.setCellRenderer(new IndexListRenderer());
     
    451450
    452451        JPanel movement_pane = new JPanel();
    453         move_up_button = new GLIButton("", JarTools.getImage("arrow-up.gif"));
     452        move_up_button = new GLIButton(Dictionary.get("CDM.Move.Move_Up"), JarTools.getImage("arrow-up.gif"), Dictionary.get("CDM.Move.Move_Up_Tooltip"));
    454453        move_up_button.setEnabled(false);
    455         move_up_button.setMnemonic(KeyEvent.VK_U);
    456         Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
    457 
    458         move_down_button = new GLIButton("", JarTools.getImage("arrow-down.gif"));
     454       
     455        move_down_button = new GLIButton(Dictionary.get("CDM.Move.Move_Down"), JarTools.getImage("arrow-down.gif"), Dictionary.get("CDM.Move.Move_Down_Tooltip"));
    459456        move_down_button.setEnabled(false);
    460         move_down_button.setMnemonic(KeyEvent.VK_D);
    461         Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
    462        
    463         set_default_button = new GLIButton();
     457               
     458        set_default_button = new GLIButton(Dictionary.get("CDM.IndexManager.Set_Default"), Dictionary.get("CDM.IndexManager.Set_Default_Tooltip"));
    464459        set_default_button.setEnabled(false);
    465         set_default_button.setMnemonic(KeyEvent.VK_S);
    466         Dictionary.registerBoth(set_default_button, "CDM.IndexManager.Set_Default", "CDM.IndexManager.Set_Default_Tooltip");
    467 
     460       
    468461        JPanel button_pane = new JPanel();
    469         new_button = new GLIButton();
     462        new_button = new GLIButton(Dictionary.get("CDM.IndexManager.New_Index"), Dictionary.get("CDM.IndexManager.New_Index_Tooltip"));
    470463        new_button.setEnabled(true);
    471         new_button.setMnemonic(KeyEvent.VK_A);
    472         Dictionary.registerBoth(new_button, "CDM.IndexManager.New_Index", "CDM.IndexManager.New_Index_Tooltip");
    473         edit_button = new GLIButton();
     464       
     465        edit_button = new GLIButton(Dictionary.get("CDM.IndexManager.Edit_Index"), Dictionary.get("CDM.IndexManager.Edit_Index_Tooltip"));
    474466        edit_button.setEnabled(false);
    475         edit_button.setMnemonic(KeyEvent.VK_A);
    476         Dictionary.registerBoth(edit_button, "CDM.IndexManager.Edit_Index", "CDM.IndexManager.Edit_Index_Tooltip");
    477         remove_button = new GLIButton();
     467       
     468        remove_button = new GLIButton(Dictionary.get("CDM.IndexManager.Remove_Index"), Dictionary.get("CDM.IndexManager.Remove_Index_Tooltip"));
    478469        remove_button.setEnabled(false);
    479         remove_button.setMnemonic(KeyEvent.VK_R);
    480         Dictionary.registerBoth(remove_button, "CDM.IndexManager.Remove_Index", "CDM.IndexManager.Remove_Index_Tooltip");
    481      
     470             
    482471        // Listeners
    483472        new_button.addActionListener(new NewIndexListener());
     
    656645
    657646        private JButton add_button;
     647        private JButton add_all_button;
     648        private JButton select_all_button;
    658649        private JButton replace_button;
    659         private JButton add_all_button;
    660650        private JButton cancel_button;
    661651
     
    696686        JPanel main_index_pane = new JPanel();
    697687
    698         JLabel source_label = new JLabel();
    699         Dictionary.registerText(source_label, "CDM.IndexManager.Source");
     688        JLabel source_label = new JLabel(Dictionary.get("CDM.IndexManager.Source"));
    700689        source_list = new CheckList(false);
    701690        source_list.setListData(new_data);
    702         Dictionary.registerTooltip(source_list, "CDM.IndexManager.Source_Tooltip");
     691        source_list.setToolTipText(Dictionary.get("CDM.IndexManager.Source_Tooltip"));
    703692        source_list.addListSelectionListener(new SourceListListener());
    704693
    705694        JPanel button_pane = new JPanel();
     695        // three buttons for new index, or replace mg index, two buttons otherwise
     696        if (existing_index == null || !mgpp_enabled) {
     697            button_pane.setLayout(new GridLayout(1,3,5,0));
     698        } else {
     699            button_pane.setLayout(new GridLayout(1,2,5,0));
     700        }
     701
    706702        if (existing_index != null) {
    707             button_pane.setLayout(new GridLayout(1,2,5,0));
    708             replace_button = new GLIButton();
     703            replace_button = new GLIButton(Dictionary.get("CDM.IndexManager.Replace_Index"), Dictionary.get("CDM.IndexManager.Replace_Index_Tooltip"));
    709704            replace_button.setEnabled(false);
    710             Dictionary.registerBoth(replace_button, "CDM.IndexManager.Replace_Index", "CDM.IndexManager.Replace_Index_Tooltip");
     705            replace_button.addActionListener(new ReplaceIndexListener());
    711706            button_pane.add(replace_button);
    712             replace_button.addActionListener(new ReplaceIndexListener());
    713707        } else {
    714             button_pane.setLayout(new GridLayout(1,3,5,0));
    715             add_button = new GLIButton();
     708            add_button = new GLIButton(Dictionary.get("CDM.IndexManager.Add_Index"), Dictionary.get("CDM.IndexManager.Add_Index_Tooltip"));
    716709            add_button.setEnabled(false);
    717             add_button.setMnemonic(KeyEvent.VK_A);
    718             Dictionary.registerBoth(add_button, "CDM.IndexManager.Add_Index", "CDM.IndexManager.Add_Index_Tooltip");
    719710            add_button.addActionListener(new AddIndexListener());
    720 
    721        
    722             add_all_button = new GLIButton();
     711            button_pane.add(add_button);
     712        }
     713       
     714        if (!mgpp_enabled) {
     715            select_all_button = new GLIButton(Dictionary.get("CDM.IndexManager.Select_All"), Dictionary.get("CDM.IndexManager.Select_All_Tooltip"));
     716            select_all_button.setEnabled(true);
     717            select_all_button.addActionListener(new SelectAllActionListener());
     718            button_pane.add(select_all_button);
     719        } else if (existing_index == null) {
     720            // mgpp, and new index
     721            add_all_button = new GLIButton(Dictionary.get("CDM.IndexManager.Add_All"), Dictionary.get("CDM.IndexManager.Add_All_Tooltip"));
    723722            add_all_button.setEnabled(true);
    724             add_all_button.setMnemonic(KeyEvent.VK_L);
    725             Dictionary.registerBoth(add_all_button, "CDM.IndexManager.Add_All", "CDM.IndexManager.Add_All_Tooltip");
    726723            add_all_button.addActionListener(new AddAllIndexActionListener());     
    727             button_pane.add(add_button);
    728724            button_pane.add(add_all_button);
    729 
    730         }
    731         cancel_button = new GLIButton();
     725           
     726        }
     727        // always have a cancel button
     728        cancel_button = new GLIButton(Dictionary.get("General.Cancel"), Dictionary.get("General.Cancel"));
    732729        cancel_button.setEnabled(true);
    733         Dictionary.registerBoth(cancel_button, "General.Cancel", "General.Cancel");
    734730        cancel_button.addActionListener(new ActionListener() {
    735731            public void actionPerformed(ActionEvent event) {
     
    755751        if (!mgpp_enabled) {
    756752
    757             level_label = new JLabel();
    758             Dictionary.registerText(level_label, "CDM.IndexManager.Level");
     753            level_label = new JLabel(Dictionary.get("CDM.IndexManager.Level"));
    759754            level_combobox = new JComboBox();
    760755            level_combobox.setPreferredSize(FIELD_SIZE);
     
    763758            level_combobox.addItem(CollectionConfiguration.SECTION_STR);//Dictionary.get("CDM.IndexManager.Section"));
    764759            level_combobox.setEditable(false);
    765             Dictionary.registerTooltip(level_combobox, "CDM.IndexManager.Level_Tooltip");
     760            level_combobox.setToolTipText(Dictionary.get("CDM.IndexManager.Level_Tooltip"));
    766761            labels_pane.add(level_label, BorderLayout.SOUTH);
    767762            boxes_pane.add(level_combobox, BorderLayout.SOUTH);
     
    770765            allfields_pane = new JPanel();
    771766            allfields_box = new JCheckBox();
    772             JLabel allfields_label = new JLabel();
    773             Dictionary.registerText(allfields_label, "CDM.IndexManager.Allfields_Index");
     767            JLabel allfields_label = new JLabel(Dictionary.get("CDM.IndexManager.Allfields_Index"));
    774768            allfields_pane.setLayout(new BorderLayout());
    775769            allfields_pane.add(allfields_box, BorderLayout.WEST);
     
    850844        }
    851845
    852         /** add all sources as indexes. for MG, this adds them in one combined
    853         index, for MGPP this adds them as individual indexes (fields) */
     846        /** add all sources as separate indexes (fields).  */
    854847        private class AddAllIndexActionListener
    855848        implements ActionListener {
     
    857850        public void actionPerformed(ActionEvent event) {
    858851            ArrayList all_sources = source_list.getAll();
    859             if (!mgpp_enabled) {
    860             Index index = new Index(level_combobox.getSelectedIndex(), all_sources);
    861             if (!index_model.contains(index)) {
    862                 CollectionMeta metadatum = new CollectionMeta(CollectionConfiguration.STOP_CHARACTER + index.getID());
    863                 metadatum.setValue("all fields"); // need a good name
    864                 addIndex(index, metadatum);
    865             }
    866             all_sources = null;
    867             index = null;
    868             return;
    869             }
    870        
    871852            ArrayList new_sources = new ArrayList();
    872853            for(int i = 0; i < all_sources.size(); i++) {
     
    899880        }
    900881   
     882        private class SelectAllActionListener
     883        implements ActionListener {
     884
     885        public void actionPerformed(ActionEvent event) {
     886            source_list.setAllTicked();
     887        }
     888        }
     889
    901890        private class SourceListListener
    902891        implements ListSelectionListener {
Note: See TracChangeset for help on using the changeset viewer.