source: trunk/gli/src/org/greenstone/gatherer/msm/MetadataComboBoxModel.java@ 4538

Last change on this file since 4538 was 4365, checked in by mdewsnip, 21 years ago

Fixed tabbing.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 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 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37
38
39
40
41
42
43package org.greenstone.gatherer.msm;
44
45import java.util.Collections;
46import java.util.Vector;
47import javax.swing.DefaultComboBoxModel;
48import org.greenstone.gatherer.msm.MetadataSetManager;
49import org.greenstone.gatherer.msm.MSMEvent;
50import org.greenstone.gatherer.msm.MSMListener;
51import org.w3c.dom.Element;
52import org.w3c.dom.NodeList;
53/** A combobox model that contains information from an array of NodeLists. */
54public class MetadataComboBoxModel
55 extends DefaultComboBoxModel
56 implements MSMListener {
57 private MetadataSetManager msm = null;
58 /** Constructor.
59 * @param nodelists The <strong>NodeList[]</strong> this model is proxied to.
60 */
61 public MetadataComboBoxModel(MetadataSetManager msm) {
62 super();
63 this.msm = msm;
64 init();
65 }
66 /** Called whenever a metadata element is changed.
67 * @param event A <strong>MSMEvent</strong> containing pertinent information about the event.
68 */
69 public void elementChanged(MSMEvent event) {
70 init();
71 }
72 /** Called whenever a metadata value is changed.
73 * @param event A <strong>MSMEvent</strong> containing pertinent information about the event.
74 */
75 public void metadataChanged(MSMEvent event) {
76 // Don't care.
77 }
78 /** Called whenever a metadata set is changed.
79 * @param event A <strong>MSMEvent</strong> containing pertinent information about the event.
80 */
81 public void setChanged(MSMEvent event) {
82 init();
83 }
84 /** Called whenever the value tree of a certain element is significantly changed.
85 * @param event A <strong>MSMEvent</strong> containing information about the event.
86 */
87 public void valueChanged(MSMEvent event) {
88 // Don't care.
89 }
90 private void init() {
91 removeAllElements();
92 Vector elements = msm.getElements();
93 Collections.sort(elements);
94 for(int k = 0; k < elements.size(); k++) {
95 addElement(elements.get(k));
96 }
97 }
98}
Note: See TracBrowser for help on using the repository browser.