Changeset 13058
- Timestamp:
- 2006-10-09T16:58:36+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/IndexingManager.java
r13047 r13058 46 46 47 47 48 /** This class is responsible for coordinating the IndexManager and LevelManagerand BuildTypeManager into one panel48 /** This class is responsible for coordinating the IndexManager and IndexOptionManager (controls levels, stem options etc) and BuildTypeManager into one panel 49 49 * @author John Thompson, Greenstone Digital Library, University of Waikato 50 50 * @version 2.3 … … 52 52 public class IndexingManager { 53 53 54 private LevelManager level_manager = null;54 private IndexOptionManager option_manager = null; 55 55 private IndexManager index_manager = null; 56 56 private BuildTypeManager build_type_manager = null; 57 57 58 private JCheckBox stem_checkbox = new JCheckBox();59 private JCheckBox casefold_checkbox = new JCheckBox();60 private JCheckBox accent_fold_checkbox = new JCheckBox();61 58 62 59 private String build_type = null; … … 69 66 build_type_manager = new BuildTypeManager(); 70 67 build_type = build_type_manager.getBuildType(); 71 level_manager = new LevelManager(CollectionDesignManager.collect_config.getLevels(), build_type);68 option_manager = new IndexOptionManager(build_type); 72 69 if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 73 70 index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGIndexes(), build_type); … … 90 87 91 88 public int getNumLevels() { 92 return level_manager.getSize();89 return option_manager.getNumLevels(); 93 90 } 94 91 … … 101 98 } 102 99 103 public String getIndexingOptionsString()104 {105 if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) {106 return "";107 }108 109 String indexing_options_string = "";110 indexing_options_string += (stem_checkbox.isSelected() ? "stem " : "");111 indexing_options_string += (casefold_checkbox.isSelected() ? "casefold " : "");112 indexing_options_string += (accent_fold_checkbox.isSelected() ? "accentfold " : "");113 return indexing_options_string;114 }115 116 100 public ArrayList getLevels() { 117 101 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 118 return level_manager.getLevels();102 return option_manager.getLevels(); 119 103 } 120 104 return null; … … 144 128 implements Control, BuildTypeManager.BuildTypeListener 145 129 { 146 JPanel index_plus_options_panel = null;147 JPanel indexing_options_panel = null;148 JPanel level_panel = null;149 130 JPanel main_index_pane = null; 131 JPanel index_options_panel = null; 150 132 151 133 public IndexingControl() { … … 157 139 JPanel build_type_panel = (JPanel)build_type_manager.getControls(); 158 140 JPanel index_panel = (JPanel)index_manager.getControls(); 159 level_panel = (JPanel)level_manager.getControls(); 160 161 index_plus_options_panel = new JPanel(); 162 index_plus_options_panel.setLayout(new BorderLayout()); 163 index_plus_options_panel.add(index_panel, BorderLayout.CENTER); 164 indexing_options_panel = new IndexingOptionsControl(); 165 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) { 166 index_plus_options_panel.add(indexing_options_panel, BorderLayout.SOUTH); 167 } 141 index_options_panel = (JPanel)option_manager.getControls(); 168 142 169 143 main_index_pane = new JPanel(); 170 144 main_index_pane.setLayout(new BorderLayout()); 171 145 main_index_pane.add(build_type_panel, BorderLayout.NORTH); 172 main_index_pane.add(index_plus_options_panel, BorderLayout.CENTER); 173 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 174 main_index_pane.add(level_panel, BorderLayout.SOUTH); 175 } 146 main_index_pane.add(index_panel, BorderLayout.CENTER); 147 main_index_pane.add(index_options_panel, BorderLayout.SOUTH); 176 148 177 149 setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); … … 182 154 build_type_manager.addBuildTypeListener(this); 183 155 build_type_manager.addBuildTypeListener(index_manager); 184 build_type_manager.addBuildTypeListener( level_manager);156 build_type_manager.addBuildTypeListener(option_manager); 185 157 } 186 158 … … 195 167 return; 196 168 } 197 198 // Show/hide the indexing options panel 199 if (build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) { 200 // Changing to MG/MGPP 201 index_plus_options_panel.add(indexing_options_panel, BorderLayout.SOUTH); 202 } 203 else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE)) { 204 // Changing to Lucene 205 index_plus_options_panel.remove(indexing_options_panel); 206 } 207 // Accent-folding is currently not available for MG 208 accent_fold_checkbox.setEnabled(!new_build_type.equals(BuildTypeManager.BUILD_TYPE_MG)); 209 210 // Show/hide the levels panel 211 if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 212 // Changing to MGPP/Lucene 213 level_panel.setEnabled(true); 214 main_index_pane.add(level_panel, BorderLayout.SOUTH); 215 } 216 else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 217 // Changing to MG 218 level_panel.setEnabled(false); 219 main_index_pane.remove(level_panel); 220 } 221 222 build_type = new_build_type; 169 build_type = new_build_type; 223 170 } 224 171 225 226 private class IndexingOptionsControl227 extends JPanel228 {229 public IndexingOptionsControl()230 {231 setLayout(new BorderLayout(10,10));232 setBorder(BorderFactory.createEmptyBorder(5,5,5,5));233 234 stem_checkbox.setText(Dictionary.get("CDM.IndexingManager.Stem"));235 casefold_checkbox.setText(Dictionary.get("CDM.IndexingManager.Casefold"));236 accent_fold_checkbox.setText(Dictionary.get("CDM.IndexingManager.Accent_fold"));237 238 // Accent-folding is currently not available for MG239 accent_fold_checkbox.setEnabled(!build_type.equals(BuildTypeManager.BUILD_TYPE_MG));240 241 JPanel checkbox_panel = new JPanel();242 checkbox_panel.setLayout(new GridLayout(1, 3));243 checkbox_panel.add(stem_checkbox);244 checkbox_panel.add(casefold_checkbox);245 checkbox_panel.add(accent_fold_checkbox);246 247 add(new JLabel(Dictionary.get("CDM.IndexingManager.Options")), BorderLayout.WEST);248 add(checkbox_panel, BorderLayout.CENTER);249 }250 }251 172 } 252 173 }
Note:
See TracChangeset
for help on using the changeset viewer.