source: trunk/gli/src/org/greenstone/gatherer/gui/DesignPane.java@ 7981

Last change on this file since 7981 was 7981, checked in by mdewsnip, 20 years ago

Removed some dead code.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 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;
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 DesignPane
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 DesignPane() {
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 // Retrieve the new config manager.
66 cdm = Gatherer.c_man.getCollection().cdm;
67 // Display it.
68 cdm.display(this);
69 }
70 else {
71 if(cdm != null) {
72 cdm.destroy();
73 cdm = null;
74 }
75 }
76 }
77 /** Called to cause the components to lay themselves out and be displayed.
78 */
79 public void display() {
80 // Layout
81 this.setLayout(new BorderLayout());
82 }
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 boolean canSave() {
101 return cdm.canSave();
102 }
103
104 public void loseFocus() {
105 if(cdm != null) {
106 cdm.save();
107 }
108 }
109
110 /** 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)
111 * @param mode the mode level as an int
112 */
113 public void modeChanged(int mode) {
114 cdm.modeChanged(mode);
115 }
116
117 public void saveConfiguration() {
118 if(cdm != null) {
119 cdm.save();
120 }
121 }
122}
Note: See TracBrowser for help on using the repository browser.