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

Last change on this file since 4659 was 4367, checked in by mdewsnip, 21 years ago

Fixed tabbing.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1package org.greenstone.gatherer.gui;
2/**
3 *#########################################################################
4 *
5 * A component of the Gatherer application, part of the Greenstone digital
6 * library suite from the New Zealand Digital Library Project at the
7 * University of Waikato, New Zealand.
8 *
9 * <BR><BR>
10 *
11 * Author: John Thompson, Greenstone Digital Library, University of Waikato
12 *
13 * <BR><BR>
14 *
15 * Copyright (C) 1999 New Zealand Digital Library Project
16 *
17 * <BR><BR>
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *
24 * <BR><BR>
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * <BR><BR>
32 *
33 * You should have received a copy of the GNU General Public License
34 * along with this program; if not, write to the Free Software
35 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36 *########################################################################
37 */
38import java.awt.*;
39import java.io.*;
40import java.util.*;
41import javax.swing.*;
42import org.greenstone.gatherer.Gatherer;
43import org.greenstone.gatherer.cdm.CollectionDesignManager;
44import org.greenstone.gatherer.msm.ElementWrapper;
45/** This serves as the Collection configuration pane and came in two flavors.<BR>
46 * The lower tech version has now been made redundant.<BR>
47 * 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.
48 * @author John Thompson, Greenstone Digital Library, University of Waikato
49 * @version 2.2
50 */
51public class GConfigPane
52 extends JPanel {
53 /** The collection manager is responsible for parsing in, and allowing the editing of, a single collections configuration file. */
54 private CollectionDesignManager cdm = null;
55 /** The constructor. */
56 public GConfigPane() {
57 }
58 /** This method is called whenever the state of the current collection
59 * changes.
60 * @param ready <i>true</i> if a collection is loaded and ready, <i>false</i> otherwise.
61 */
62 public void collectionChanged(boolean ready) {
63 ///atherer.println("CollectionChanged(" + ready + ")");
64 if(ready) {
65 String filename = Gatherer.c_man.getCollectionConfig();
66 if(cdm != null && cdm.getFilename().equals(filename)) {
67 return;
68 }
69 else {
70 if(cdm != null) {
71 cdm.destroy();
72 cdm = null;
73 }
74 // Create a new config manager.
75 cdm = new CollectionDesignManager();
76 // Parse the configuration file.
77 cdm.parse(filename);
78 // Display it.
79 cdm.display(this);
80 }
81 }
82 else {
83 if(cdm != null) {
84 cdm.destroy();
85 cdm = null;
86 }
87 }
88 }
89 /** Called to cause the components to lay themselves out and be displayed.
90 */
91 public void display() {
92 // Layout
93 this.setLayout(new BorderLayout());
94 }
95 public void gainFocus() {
96 cdm.gainFocus();
97 }
98 public ArrayList getIndexes() {
99 return cdm.getIndexes();
100 }
101
102 public ArrayList getLanguageCodes() {
103 return cdm.languages.getLanguageCodes();
104 }
105
106 public Rectangle setSelectedElement(ElementWrapper element) {
107 return cdm.setSelectedElement(element.getName());
108 }
109 public void saveConfiguration() {
110 if(cdm != null) {
111 cdm.save();
112 }
113 }
114}
Note: See TracBrowser for help on using the repository browser.