source: gli/branches/rtl-gli/src/org/greenstone/gatherer/cdm/IndexOptionList.java@ 18368

Last change on this file since 18368 was 13059, checked in by kjdon, 18 years ago

Level and LevelManager replaced by IndexOption, IndexOptionList and IndexOptionManager, which are more general. IndexOptionManager now handles levels and stem options. IndexOption is just one of the options (eg document, or stem). IndexOptionList is one of the lines in the config file, eg 'levels document section' or 'indexoptions stsem casefold'. INdexOptionManager keeps an IndexOptionList for each option type it knows about, and produces controls for each one.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 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: Katherine Don, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 2006 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 org.w3c.dom.Element;
30import org.greenstone.gatherer.util.StaticStrings;
31
32/** A DOMProxyListModel thatholds options for indexoptions. For example, levels and stem options */
33public class IndexOptionList
34 extends DOMProxyListModel {
35
36 /** A reference to ourselves so our inner methods have access. */
37 private DOMProxyListModel options_model = null;
38
39 public IndexOptionList(Element options) {
40 super(options, StaticStrings.INDEXOPTION_ELEMENT, new IndexOption());
41
42 options_model = this;
43 }
44
45 public void addOption(String name) {
46 if (getOption(name) == null) {
47 add(new IndexOption(name));
48 }
49 }
50
51
52 public IndexOption getOption(String name) {
53 int options_model_size = options_model.getSize();
54 for(int i = 0; i < options_model_size; i++) {
55 IndexOption option = (IndexOption) options_model.getElementAt(i);
56 if(option.getName().equals(name)) {
57 return option;
58 }
59 }
60 return null;
61 }
62
63 public void removeOption(String name) {
64 IndexOption option_elem = null;
65 if ((option_elem = getOption(name)) != null) {
66 options_model.remove(option_elem);
67 }
68 }
69
70
71}
72
Note: See TracBrowser for help on using the repository browser.