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

Last change on this file since 6540 was 6389, checked in by jmt12, 20 years ago

Introduced the idea of detail modes - these have an effect on several parts of the gui, such as disabling or hiding all regular expression based controls, simplifying the output from perl scripts and (having been given yet another new last minute feature to implement) displays a completely different create pane. Mode is stored in the config.xml and is changable via the Preferences controls

  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 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
85 public void gainFocus() {
86 if(cdm == null && Gatherer.c_man.ready()) {
87 // Retrieve the new config manager.
88 cdm = Gatherer.c_man.getCollection().cdm;
89 // Display it.
90 cdm.display(this);
91 }
92 if(cdm != null) {
93 cdm.gainFocus();
94 }
95 }
96
97 public ArrayList getLanguageCodes() {
98 return cdm.language_manager.getLanguageCodes();
99 }
100
101 public void loseFocus() {
102 if(cdm != null) {
103 cdm.save();
104 }
105 }
106
107 /** Called whenever the detail mode changes to ensure the filters are at an appropriate level (ie only editable by those that understand regular expression matching)
108 * @param mode the mode level as an int
109 */
110 public void modeChanged(int mode) {
111 cdm.modeChanged(mode);
112 }
113
114 public Rectangle setSelectedElement(ElementWrapper element) {
115 return cdm.setSelectedElement(element.getName());
116 }
117
118 public void saveConfiguration() {
119 if(cdm != null) {
120 cdm.save();
121 }
122 }
123}
Note: See TracBrowser for help on using the repository browser.