- Timestamp:
- 2006-10-06T14:58:12+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/IndexingManager.java
r12164 r13047 34 34 import org.greenstone.gatherer.Configuration; 35 35 import org.greenstone.gatherer.DebugStream; 36 import org.greenstone.gatherer.Dictionary; 36 37 import org.greenstone.gatherer.Gatherer; 37 38 import org.greenstone.gatherer.gui.DesignPaneHeader; … … 43 44 import org.greenstone.gatherer.util.JarTools; 44 45 import org.greenstone.gatherer.util.StaticStrings; 45 import org.w3c.dom.*; 46 47 46 48 /** This class is responsible for coordinating the IndexManager and LevelManager and BuildTypeManager into one panel 47 49 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 54 56 private BuildTypeManager build_type_manager = null; 55 57 58 private JCheckBox stem_checkbox = new JCheckBox(); 59 private JCheckBox casefold_checkbox = new JCheckBox(); 60 private JCheckBox accent_fold_checkbox = new JCheckBox(); 61 56 62 private String build_type = null; 57 63 58 64 private Control controls = null; 59 public IndexingManager() { 60 65 66 67 public IndexingManager() 68 { 61 69 build_type_manager = new BuildTypeManager(); 62 70 build_type = build_type_manager.getBuildType(); … … 67 75 index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGPPIndexes(), build_type); 68 76 } 69 70 77 } 71 78 … … 93 100 return index_manager.getIndexes(); 94 101 } 102 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 95 116 public ArrayList getLevels() { 96 117 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { … … 121 142 private class IndexingControl 122 143 extends JPanel 123 implements Control, BuildTypeManager.BuildTypeListener {124 125 JPanel build_type_panel = null;126 JPanel index _panel = null;144 implements Control, BuildTypeManager.BuildTypeListener 145 { 146 JPanel index_plus_options_panel = null; 147 JPanel indexing_options_panel = null; 127 148 JPanel level_panel = null; 128 149 JPanel main_index_pane = null; … … 134 155 JPanel header_pane = new DesignPaneHeader("CDM.GUI.Indexes", "searchindexes"); 135 156 136 build_type_panel = (JPanel)build_type_manager.getControls();137 index_panel = (JPanel)index_manager.getControls();157 JPanel build_type_panel = (JPanel)build_type_manager.getControls(); 158 JPanel index_panel = (JPanel)index_manager.getControls(); 138 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 } 139 168 140 169 main_index_pane = new JPanel(); 141 170 main_index_pane.setLayout(new BorderLayout()); 142 171 main_index_pane.add(build_type_panel, BorderLayout.NORTH); 143 main_index_pane.add(index_p anel, BorderLayout.CENTER);144 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {172 main_index_pane.add(index_plus_options_panel, BorderLayout.CENTER); 173 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 145 174 main_index_pane.add(level_panel, BorderLayout.SOUTH); 146 175 } … … 160 189 public void destroy() {} 161 190 162 public void buildTypeChanged(String new_build_type) { 191 public void buildTypeChanged(String new_build_type) 192 { 163 193 if (build_type.equals(new_build_type)) { 164 194 // shouldn't happen 165 195 return; 166 196 } 167 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 168 211 if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 169 // changing to mgpp/lucene212 // Changing to MGPP/Lucene 170 213 level_panel.setEnabled(true); 171 214 main_index_pane.add(level_panel, BorderLayout.SOUTH); 172 173 }else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {174 // changing to mg215 } 216 else if (new_build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) { 217 // Changing to MG 175 218 level_panel.setEnabled(false); 176 219 main_index_pane.remove(level_panel); 177 220 } 221 178 222 build_type = new_build_type; 179 223 } 180 } 181 224 225 226 private class IndexingOptionsControl 227 extends JPanel 228 { 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 MG 239 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 } 182 252 }
Note:
See TracChangeset
for help on using the changeset viewer.