source: trunk/gli/src/org/greenstone/gatherer/gui/GConfigPane.java@ 5590

Last change on this file since 5590 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.5 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.gui;
38
39import java.awt.*;
40import java.io.*;
41import java.util.*;
42import javax.swing.*;
43import org.greenstone.gatherer.Gatherer;
44import org.greenstone.gatherer.cdm.CollectionDesignManager;
45import org.greenstone.gatherer.msm.ElementWrapper;
46/** This serves as the Collection configuration pane and came in two flavors.<BR>
47 * The lower tech version has now been made redundant.<BR>
48 * The higher tech, and finally implemented, version uses a tree to allow a user to navigate through the various regions of the config file and further allows them to interactively design and modify such gsdl elements as classifiers and plugins.
49 * @author John Thompson, Greenstone Digital Library, University of Waikato
50 * @version 2.2
51 */
52public class GConfigPane
53 extends JPanel {
54 /** The collection manager is responsible for parsing in, and allowing the editing of, a single collections configuration file. */
55 private CollectionDesignManager cdm = null;
56 /** The constructor. */
57 public GConfigPane() {
58 }
59 /** This method is called whenever the state of the current collection
60 * changes.
61 * @param ready <i>true</i> if a collection is loaded and ready, <i>false</i> otherwise.
62 */
63 public void collectionChanged(boolean ready) {
64 ///atherer.println("CollectionChanged(" + ready + ")");
65 if(ready) {
66 // Retrieve the new config manager.
67 cdm = Gatherer.c_man.getCollection().cdm;
68 // Display it.
69 cdm.display(this);
70 }
71 else {
72 if(cdm != null) {
73 cdm.destroy();
74 cdm = null;
75 }
76 }
77 }
78 /** Called to cause the components to lay themselves out and be displayed.
79 */
80 public void display() {
81 // Layout
82 this.setLayout(new BorderLayout());
83 }
84 public void gainFocus() {
85 if(cdm == null && Gatherer.c_man.ready()) {
86 // Retrieve the new config manager.
87 cdm = Gatherer.c_man.getCollection().cdm;
88 // Display it.
89 cdm.display(this);
90 }
91 if(cdm != null) {
92 cdm.gainFocus();
93 }
94 }
95
96 public ArrayList getLanguageCodes() {
97 return cdm.language_manager.getLanguageCodes();
98 }
99
100 public Rectangle setSelectedElement(ElementWrapper element) {
101 return cdm.setSelectedElement(element.getName());
102 }
103 public void saveConfiguration() {
104 if(cdm != null) {
105 cdm.save();
106 }
107 }
108}
Note: See TracBrowser for help on using the repository browser.