source: gli/trunk/src/org/greenstone/gatherer/cdm/IndexingManager.java@ 18412

Last change on this file since 18412 was 18412, checked in by kjdon, 15 years ago

more modifications for RTL GLI, thanks to Amin Hedjazi

  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * Author: John Thompson, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 1999 New Zealand Digital Library Project
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *########################################################################
26 */
27package org.greenstone.gatherer.cdm;
28
29import java.awt.*;
30import java.awt.event.*;
31import java.util.*;
32import javax.swing.*;
33import javax.swing.event.*;
34import org.greenstone.gatherer.Configuration;
35import org.greenstone.gatherer.DebugStream;
36import org.greenstone.gatherer.Dictionary;
37import org.greenstone.gatherer.Gatherer;
38import org.greenstone.gatherer.gui.DesignPaneHeader;
39import org.greenstone.gatherer.gui.GComboBox;
40import org.greenstone.gatherer.gui.GLIButton;
41import org.greenstone.gatherer.metadata.MetadataElement;
42import org.greenstone.gatherer.metadata.MetadataSetManager;
43import org.greenstone.gatherer.util.CheckList;
44import org.greenstone.gatherer.util.JarTools;
45import org.greenstone.gatherer.util.StaticStrings;
46
47
48/** This class is responsible for coordinating the IndexManager and IndexOptionManager (controls levels, stem options etc) and BuildTypeManager into one panel
49 * @author John Thompson, Greenstone Digital Library, University of Waikato
50 * @version 2.3
51 */
52public class IndexingManager {
53
54 private IndexOptionManager option_manager = null;
55 private IndexManager index_manager = null;
56 private BuildTypeManager build_type_manager = null;
57
58
59 private String build_type = null;
60
61 private Control controls = null;
62
63
64 public IndexingManager()
65 {
66 build_type_manager = new BuildTypeManager();
67 build_type = build_type_manager.getBuildType();
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);
71 } else {
72 index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGPPIndexes(), build_type);
73 }
74 }
75
76 public boolean isMGPP() {
77 return build_type_manager.isMGPP();
78 }
79
80 public boolean isLucene() {
81 return build_type_manager.isLucene();
82 }
83
84 public boolean isMG() {
85 return build_type_manager.isMG();
86 }
87
88 public int getNumLevels() {
89 return option_manager.getNumLevels();
90 }
91
92 public int getNumIndexes() {
93 return index_manager.getSize();
94 }
95
96 public ArrayList getIndexes() {
97 return index_manager.getIndexes();
98 }
99
100 public ArrayList getLevels() {
101 if (!build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
102 return option_manager.getLevels();
103 }
104 return null;
105 }
106
107 public Control getControls() {
108 if (controls == null) {
109 controls = new IndexingControl();
110 }
111 return controls;
112 }
113
114 public void destroy() {
115
116 }
117
118 /** Called when the detail mode has changed which in turn may cause several design elements to be available/hidden
119 * @param mode the new mode as an int
120 */
121 public void modeChanged(int mode) {
122
123 }
124
125
126 private class IndexingControl
127 extends JPanel
128 implements Control, BuildTypeManager.BuildTypeListener
129 {
130 JPanel main_index_pane = null;
131 JPanel index_options_panel = null;
132
133 public IndexingControl() {
134 super();
135 this.setComponentOrientation(Dictionary.getOrientation());
136 // Creation
137 JPanel header_pane = new DesignPaneHeader("CDM.GUI.Indexes", "searchindexes");
138
139 JPanel build_type_panel = (JPanel)build_type_manager.getControls();
140 JPanel index_panel = (JPanel)index_manager.getControls();
141 index_options_panel = (JPanel)option_manager.getControls();
142
143
144 main_index_pane = new JPanel();
145 main_index_pane.setLayout(new BorderLayout());
146 main_index_pane.add(build_type_panel, BorderLayout.NORTH);
147 main_index_pane.add(index_panel, BorderLayout.CENTER);
148 main_index_pane.add(index_options_panel, BorderLayout.SOUTH);
149 main_index_pane.setComponentOrientation(Dictionary.getOrientation());
150
151 setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
152 setLayout(new BorderLayout());
153 add(header_pane, BorderLayout.NORTH);
154 add(main_index_pane, BorderLayout.CENTER);
155
156 build_type_manager.addBuildTypeListener(this);
157 build_type_manager.addBuildTypeListener(index_manager);
158 build_type_manager.addBuildTypeListener(option_manager);
159 }
160
161 public void loseFocus() {}
162 public void gainFocus() {}
163 public void destroy() {}
164
165 public void buildTypeChanged(String new_build_type)
166 {
167 if (build_type.equals(new_build_type)) {
168 // shouldn't happen
169 return;
170 }
171 build_type = new_build_type;
172 }
173
174 }
175}
Note: See TracBrowser for help on using the repository browser.