Changeset 12122
- Timestamp:
- 2006-07-10T15:02:22+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java
r12087 r12122 443 443 JPanel assigned_indexes_pane = new JPanel(); 444 444 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")); 447 446 index_list = new JList(index_model); 448 447 index_list.setCellRenderer(new IndexListRenderer()); … … 451 450 452 451 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")); 454 453 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")); 459 456 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")); 464 459 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 468 461 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")); 470 463 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")); 474 466 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")); 478 469 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 482 471 // Listeners 483 472 new_button.addActionListener(new NewIndexListener()); … … 656 645 657 646 private JButton add_button; 647 private JButton add_all_button; 648 private JButton select_all_button; 658 649 private JButton replace_button; 659 private JButton add_all_button;660 650 private JButton cancel_button; 661 651 … … 696 686 JPanel main_index_pane = new JPanel(); 697 687 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")); 700 689 source_list = new CheckList(false); 701 690 source_list.setListData(new_data); 702 Dictionary.registerTooltip(source_list, "CDM.IndexManager.Source_Tooltip");691 source_list.setToolTipText(Dictionary.get("CDM.IndexManager.Source_Tooltip")); 703 692 source_list.addListSelectionListener(new SourceListListener()); 704 693 705 694 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 706 702 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")); 709 704 replace_button.setEnabled(false); 710 Dictionary.registerBoth(replace_button, "CDM.IndexManager.Replace_Index", "CDM.IndexManager.Replace_Index_Tooltip");705 replace_button.addActionListener(new ReplaceIndexListener()); 711 706 button_pane.add(replace_button); 712 replace_button.addActionListener(new ReplaceIndexListener());713 707 } 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")); 716 709 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");719 710 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")); 723 722 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");726 723 add_all_button.addActionListener(new AddAllIndexActionListener()); 727 button_pane.add(add_button);728 724 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")); 732 729 cancel_button.setEnabled(true); 733 Dictionary.registerBoth(cancel_button, "General.Cancel", "General.Cancel");734 730 cancel_button.addActionListener(new ActionListener() { 735 731 public void actionPerformed(ActionEvent event) { … … 755 751 if (!mgpp_enabled) { 756 752 757 level_label = new JLabel(); 758 Dictionary.registerText(level_label, "CDM.IndexManager.Level"); 753 level_label = new JLabel(Dictionary.get("CDM.IndexManager.Level")); 759 754 level_combobox = new JComboBox(); 760 755 level_combobox.setPreferredSize(FIELD_SIZE); … … 763 758 level_combobox.addItem(CollectionConfiguration.SECTION_STR);//Dictionary.get("CDM.IndexManager.Section")); 764 759 level_combobox.setEditable(false); 765 Dictionary.registerTooltip(level_combobox, "CDM.IndexManager.Level_Tooltip");760 level_combobox.setToolTipText(Dictionary.get("CDM.IndexManager.Level_Tooltip")); 766 761 labels_pane.add(level_label, BorderLayout.SOUTH); 767 762 boxes_pane.add(level_combobox, BorderLayout.SOUTH); … … 770 765 allfields_pane = new JPanel(); 771 766 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")); 774 768 allfields_pane.setLayout(new BorderLayout()); 775 769 allfields_pane.add(allfields_box, BorderLayout.WEST); … … 850 844 } 851 845 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). */ 854 847 private class AddAllIndexActionListener 855 848 implements ActionListener { … … 857 850 public void actionPerformed(ActionEvent event) { 858 851 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 name864 addIndex(index, metadatum);865 }866 all_sources = null;867 index = null;868 return;869 }870 871 852 ArrayList new_sources = new ArrayList(); 872 853 for(int i = 0; i < all_sources.size(); i++) { … … 899 880 } 900 881 882 private class SelectAllActionListener 883 implements ActionListener { 884 885 public void actionPerformed(ActionEvent event) { 886 source_list.setAllTicked(); 887 } 888 } 889 901 890 private class SourceListListener 902 891 implements ListSelectionListener {
Note:
See TracChangeset
for help on using the changeset viewer.