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

Last change on this file since 6318 was 5589, checked in by mdewsnip, 21 years ago

Nearly finished adding tooltips (and thank goodness for that).

  • 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 */
37package org.greenstone.gatherer.msm;
38
39import java.util.*;
40import javax.swing.DefaultComboBoxModel;
41import org.greenstone.gatherer.msm.MetadataSetManager;
42import org.greenstone.gatherer.msm.MSMEvent;
43import org.greenstone.gatherer.msm.MSMListener;
44import org.w3c.dom.*;
45
46/** A combobox model that contains information from an array of NodeLists. */
47public class MetadataComboBoxModel
48 extends DefaultComboBoxModel
49 implements MSMListener {
50 private MetadataSetManager msm = null;
51 /** Constructor.
52 * @param nodelists The <strong>NodeList[]</strong> this model is proxied to.
53 */
54 public MetadataComboBoxModel(MetadataSetManager msm) {
55 super();
56 this.msm = msm;
57 init();
58 }
59 /** Called whenever a metadata element is changed.
60 * @param event A <strong>MSMEvent</strong> containing pertinent information about the event.
61 */
62 public void elementChanged(MSMEvent event) {
63 init();
64 }
65 /** Called whenever a metadata value is changed.
66 * @param event A <strong>MSMEvent</strong> containing pertinent information about the event.
67 */
68 public void metadataChanged(MSMEvent event) {
69 // Don't care.
70 }
71 /** Called whenever a metadata set is changed.
72 * @param event A <strong>MSMEvent</strong> containing pertinent information about the event.
73 */
74 public void setChanged(MSMEvent event) {
75 init();
76 }
77 /** Called whenever the value tree of a certain element is significantly changed.
78 * @param event A <strong>MSMEvent</strong> containing information about the event.
79 */
80 public void valueChanged(MSMEvent event) {
81 // Don't care.
82 }
83 private void init() {
84 removeAllElements();
85 Vector elements = msm.getElements();
86 Collections.sort(elements);
87 for(int k = 0; k < elements.size(); k++) {
88 addElement(elements.get(k));
89 }
90 }
91}
Note: See TracBrowser for help on using the repository browser.