- Timestamp:
- 2022-05-09T09:51:09+12:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/cdm/IndexingManager.java
r18611 r36153 53 53 54 54 private IndexOptionManager option_manager = null; 55 private IndexManager index_manager = null;55 private SearchIndexManager index_manager = null; 56 56 private BuildTypeManager build_type_manager = null; 57 57 private SortFieldManager sortfield_manager = null; 58 private FacetManager facet_manager = null; 58 59 59 60 private String build_type = null; 60 61 61 62 private Control controls = null; 62 63 63 64 64 public IndexingManager() … … 67 67 build_type = build_type_manager.getBuildType(); 68 68 option_manager = new IndexOptionManager(build_type); 69 if ( build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {70 index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGIndexes(), build_type);69 if (isMG()) { 70 index_manager = new SearchIndexManager(CollectionDesignManager.collect_config.getMGIndexes(), build_type); 71 71 } else { 72 index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGPPIndexes(), build_type); 73 } 74 } 75 72 index_manager = new SearchIndexManager(CollectionDesignManager.collect_config.getMGPPIndexes(), build_type); 73 } 74 // we always create the managers, but only display the controls if we 75 // are Lucene/SOLR 76 sortfield_manager = new SortFieldManager(CollectionDesignManager.collect_config.getSorts(), build_type); 77 facet_manager = new FacetManager(CollectionDesignManager.collect_config.getFacets(), build_type); 78 79 } 76 80 public boolean isMGPP() { 77 81 return build_type_manager.isMGPP(); … … 84 88 public boolean isMG() { 85 89 return build_type_manager.isMG(); 90 } 91 92 public boolean isSOLR() { 93 return build_type_manager.isSOLR(); 86 94 } 87 95 … … 130 138 JPanel main_index_pane = null; 131 139 JPanel index_options_panel = null; 140 141 JPanel index_sort_facet_panel = null; 142 // these get added/removed depending on indexer in use 143 private JPanel sortfield_panel = null; 144 private JPanel facet_panel = null; 132 145 133 146 public IndexingControl() { … … 138 151 139 152 JPanel build_type_panel = (JPanel)build_type_manager.getControls(); 140 JPanel index_panel = (JPanel)index_manager.getControls();141 153 index_options_panel = (JPanel)option_manager.getControls(); 142 143 154 155 index_sort_facet_panel = new JPanel(); 156 157 index_sort_facet_panel.setLayout(new GridLayout(0,1)); 158 JPanel index_panel = (JPanel)index_manager.getControls(); 159 index_sort_facet_panel.add(index_panel); 160 if (isLucene() || isSOLR() ) { 161 sortfield_panel = (JPanel)sortfield_manager.getControls(); 162 index_sort_facet_panel.add(sortfield_panel); 163 } 164 if (isSOLR()) { 165 facet_panel = (JPanel)facet_manager.getControls(); 166 index_sort_facet_panel.add(facet_panel); 167 } 144 168 main_index_pane = new JPanel(); 145 169 main_index_pane.setLayout(new BorderLayout()); 146 170 main_index_pane.add(build_type_panel, BorderLayout.NORTH); 147 main_index_pane.add(index_ panel, BorderLayout.CENTER);171 main_index_pane.add(index_sort_facet_panel, BorderLayout.CENTER); 148 172 main_index_pane.add(index_options_panel, BorderLayout.SOUTH); 149 173 main_index_pane.setComponentOrientation(Dictionary.getOrientation()); … … 156 180 build_type_manager.addBuildTypeListener(this); 157 181 build_type_manager.addBuildTypeListener(index_manager); 182 build_type_manager.addBuildTypeListener(sortfield_manager); 183 build_type_manager.addBuildTypeListener(facet_manager); 158 184 build_type_manager.addBuildTypeListener(option_manager); 159 185 } … … 169 195 return; 170 196 } 197 if (hasSorts(new_build_type) && !hasSorts(build_type)) { 198 sortfield_panel = (JPanel)sortfield_manager.getControls(); 199 index_sort_facet_panel.add(sortfield_panel); 200 // add sort panel 201 } 202 if (hasSorts(build_type) && ! hasSorts(new_build_type)) { 203 // remove sort panel 204 index_sort_facet_panel.remove(sortfield_panel); 205 } 206 if (hasFacets(new_build_type) && ! hasFacets(build_type)) { 207 // add facet 208 facet_panel = (JPanel)facet_manager.getControls(); 209 index_sort_facet_panel.add(facet_panel); 210 } 211 if (hasFacets(build_type) && ! hasFacets(new_build_type)) { 212 // remove facet pane 213 index_sort_facet_panel.remove(facet_panel); 214 } 171 215 build_type = new_build_type; 172 216 } 173 217 218 private boolean hasSorts(String build_type) { 219 return build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE) || build_type.equals(BuildTypeManager.BUILD_TYPE_SOLR); 220 } 221 private boolean hasFacets(String build_type) { 222 return build_type.equals(BuildTypeManager.BUILD_TYPE_SOLR); 223 224 } 225 174 226 } 175 227 }
Note:
See TracChangeset
for help on using the changeset viewer.