/** *######################################################################### * * A component of the Gatherer application, part of the Greenstone digital * library suite from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * Author: John Thompson, Greenstone Digital Library, University of Waikato * * Copyright (C) 1999 New Zealand Digital Library Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *######################################################################## */ package org.greenstone.gatherer.cdm; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.regex.*; import javax.swing.*; import javax.swing.filechooser.*; import javax.swing.event.*; import javax.swing.tree.*; import org.greenstone.gatherer.Configuration; import org.greenstone.gatherer.DebugStream; import org.greenstone.gatherer.Dictionary; import org.greenstone.gatherer.Gatherer; import org.greenstone.gatherer.gui.DesignPaneHeader; import org.greenstone.gatherer.gui.EmailField; import org.greenstone.gatherer.gui.GLIButton; import org.greenstone.gatherer.gui.NewCollectionDetailsPrompt; import org.greenstone.gatherer.gui.OpenCollectionDialog; import org.greenstone.gatherer.gui.WarningDialog; import org.greenstone.gatherer.remote.RemoteGreenstoneServer; import org.greenstone.gatherer.util.StaticStrings; /** This class is responsible for generating the necessary GUI components. It does this by calling the getEditControls() method of the appropriate class (i.e. IndexManager for index related edits). It also is in charge of correctly adding (and removing) listeners, using phrases from the Dictionary rather than the text keys inserted in the component classes, and several other aspects of the design page, including the config file section tree. * @author John Thompson, Greenstone Digital Library, University of Waikato * @version 2.3d */ public class GeneralManager extends JPanel { /** The available subscreens. */ static final private String CONTENTS[] = { "CDM.GUI.General", "CDM.GUI.Plugins", "CDM.GUI.SearchTypes", "CDM.GUI.Indexes", "CDM.GUI.Subcollections", "CDM.GUI.SuperCollection", "CDM.GUI.Classifiers", "CDM.GUI.Formats", "CDM.GUI.Translation", "CDM.GUI.MetadataSets" }; /** The preferred size of the contents tree. */ static final private Dimension TREE_SIZE = new Dimension(200, 500); /** The controls used to modify the general options. */ private Control controls; /** The panel apon which is rendered the currently selected section screen. */ private Control view = null; /** A tree to serve as a 'table of contents' for this design tool. We decided on a tree rather than a list, as it allows us to break sections into subsections if they become to complicated. */ private DesignTree tree; /** Constructor. */ public GeneralManager() { super(); DebugStream.println("GeneralManager: Main GUI components created."); // Assignments this.controls = new GeneralControl(); // Creation JPanel tree_pane = new JPanel(); //JLabel title = new JLabel(); //Dictionary.registerText(title, "CDM.GUI.Design_Topics"); tree = new DesignTree(); view = controls; // Connect tree.addTreeSelectionListener(new TreeListener()); // Layout tree_pane.setLayout(new BorderLayout()); tree_pane.setPreferredSize(TREE_SIZE); //tree_pane.add(title, BorderLayout.NORTH); tree_pane.add(new JScrollPane(tree), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); setLayout(new BorderLayout()); add(tree_pane, BorderLayout.WEST); add((JPanel)view, BorderLayout.CENTER); } public boolean canSave() { return (controls == null || ((GeneralControl)controls).canSave()); } /** Destructor. */ public void destroy() { controls.destroy(); controls = null; tree = null; view = null; } /** Called whenever the detail mode changes to ensure the contents tree is at an appropriate level (ie with Partitions disabled in lower levels) * Written 1543-07-01-2004, and made obsolete by a new list of requirements 1611-07-01-2004. *sigh* * @param mode the mode level as an int */ /* public void modeChanged(int mode) { tree.resetModel(mode); } */ /** Force the display to show a certain pane of controls. * @param type a String giving the name of the information manager or view we wish to display */ public void setSelectedView(String type) { tree.setSelectedView(type); } /** Refresh the values on our controls that could be stale due to changes in other components. */ public void gainFocus() { if (view != null) { view.gainFocus(); } } /** Saves the state of the controls in the current view. */ public void loseFocus() { if (view != null) { view.loseFocus(); } } /** This class is resposible for generating the controls for the editing of general options. * @return the Control for editing the general options */ private Control getControls() { return controls; } /** This class represents the visual component of the general options stored in the CollectionDesignManager. */ private class GeneralControl extends JPanel implements Control { private boolean has_been_warned = false; private boolean ready = false; private CollectionMeta collection_extra_collectionmeta; private CollectionMeta collection_name_collectionmeta; private CollectionMeta creator_collectionmeta; private CollectionMeta icon_collection_collectionmeta; private CollectionMeta icon_collection_small_collectionmeta; private CollectionMeta maintainer_collectionmeta; private CollectionMeta public_collectionmeta; /** The creators email. */ private EmailField creator_emailfield; /** The maintainers email. */ private EmailField maintainer_emailfield; /** Button to browse for the collection about page icon. */ private JButton browse_about_icon_button; /** Button to browse for the collection home page icon. */ private JButton browse_home_icon_button; /** The checkbox controlling public access to the collection. */ private JCheckBox public_checkbox; private JLabel creator_label; private JLabel description_label; private JLabel icon_label; private JLabel maintainer_label; private JLabel name_label; private JLabel small_icon_label; /** The text field used to edit the file name of the collections icon. */ private JTextField icon_textfield; /** The text field used to edit the collections title. */ private JTextField name_textfield; /** The text field used to edit the file name of the collections small icon. */ private JTextField small_icon_textfield; /** A text area used to modify the collection description. */ private JTextArea description_textarea; /** Constructor. */ public GeneralControl() { super(); // Retrieve some of the model elements, those we know aren't language dependant public_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getPublic()); // Creation JPanel header_panel = new DesignPaneHeader("CDM.GUI.General", "generalsettings"); JPanel all_details_panel = new JPanel(); JPanel details_panel = new JPanel(); JPanel fields_panel = new JPanel(); creator_label = new JLabel(); Dictionary.registerText(creator_label, "CDM.General.Email.Creator"); creator_emailfield = new EmailField(Configuration.getColor("coloring.error_background", false)); Dictionary.registerTooltip(creator_emailfield, "CDM.General.Email.Creator_Tooltip"); maintainer_label = new JLabel(); Dictionary.registerText(maintainer_label, "CDM.General.Email.Maintainer"); maintainer_emailfield = new EmailField(Configuration.getColor("coloring.error_background", false)); Dictionary.registerTooltip(maintainer_emailfield, "CDM.General.Email.Maintainer_Tooltip"); name_label = new JLabel(); Dictionary.registerText(name_label, "CDM.General.Collection_Name"); name_textfield = new JTextField("CDM.General.Collection_Name"); Dictionary.registerTooltip(name_textfield, "CDM.General.Collection_Name_Tooltip"); JLabel short_name_label = new JLabel(); Dictionary.registerText(short_name_label, "NewCollectionPrompt.Collection_Name"); JTextField short_name_textfield = new JTextField(Gatherer.c_man.getCollection().getName()); short_name_textfield.setEditable(false); short_name_textfield.setBackground(Configuration.getColor("coloring.collection_tree_background", false)); JPanel icon_panel = new JPanel(); icon_label = new JLabel(); Dictionary.registerText(icon_label, "CDM.General.Icon_Collection"); icon_textfield = new JTextField("CDM.General.Icon_Collection"); Dictionary.registerTooltip(icon_textfield, "CDM.General.Icon_Collection_Tooltip"); browse_about_icon_button = new GLIButton(); browse_about_icon_button.setMnemonic(KeyEvent.VK_A); Dictionary.registerText(browse_about_icon_button, "General.Browse"); JPanel small_icon_panel = new JPanel(); small_icon_label = new JLabel("CDM.General.Icon_Collection_Small"); Dictionary.registerText(small_icon_label, "CDM.General.Icon_Collection_Small"); small_icon_textfield = new JTextField("CDM.General.Icon_Collection_Small"); Dictionary.registerTooltip(small_icon_textfield, "CDM.General.Icon_Collection_Small_Tooltip"); browse_home_icon_button = new GLIButton(); browse_home_icon_button.setMnemonic(KeyEvent.VK_A); Dictionary.registerText(browse_home_icon_button, "General.Browse"); // public JPanel box_panel = new JPanel(); public_checkbox = new JCheckBox("", public_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); Dictionary.registerText(public_checkbox, "CDM.General.Access"); JPanel description_panel = new JPanel(); description_label = new JLabel(); Dictionary.registerText(description_label, "CDM.General.Collection_Extra"); description_textarea = new JTextArea(); description_textarea.setBackground(Configuration.getColor("coloring.editable_background", false)); Dictionary.registerTooltip(description_textarea, "CDM.General.Collection_Extra_Tooltip"); // Connection BrowseListener browse_listener = new BrowseListener(StaticStrings.IMAGES_PATH_RELATIVE_TO_GSDL_PREFIX); browse_about_icon_button.addActionListener(browse_listener); browse_home_icon_button.addActionListener(browse_listener); browse_listener = null; public_checkbox.addActionListener(CollectionDesignManager.change_listener); public_checkbox.addActionListener(CollectionDesignManager.buildcol_change_listener); creator_emailfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); creator_emailfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); description_textarea.getDocument().addDocumentListener(CollectionDesignManager.change_listener); description_textarea.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); maintainer_emailfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); maintainer_emailfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); name_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); name_textfield.getDocument().addDocumentListener(new CollectionTitleUpdater()); name_textfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); small_icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.change_listener); small_icon_textfield.getDocument().addDocumentListener(CollectionDesignManager.buildcol_change_listener); //Note: unfortunately just loading the General Design panel fires the buildcol_change_listener (even if nothing is changed). // Layout fields_panel.setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); fields_panel.setLayout(new BorderLayout(5,2)); JPanel fields_label_panel = new JPanel(); fields_label_panel.setLayout(new GridLayout(6,1)); JPanel fields_box_panel = new JPanel(); fields_box_panel.setLayout(new GridLayout(6,1)); // creator fields_label_panel.add(creator_label); fields_box_panel.add(creator_emailfield); // maintainer fields_label_panel.add(maintainer_label); fields_box_panel.add(maintainer_emailfield); // title fields_label_panel.add(name_label); fields_box_panel.add(name_textfield); // collection short name fields_label_panel.add(short_name_label); fields_box_panel.add(short_name_textfield); // icon fields_label_panel.add(icon_label); fields_box_panel.add(icon_panel); // small icon fields_label_panel.add(small_icon_label); fields_box_panel.add(small_icon_panel); fields_panel.add(fields_label_panel, BorderLayout.WEST); fields_panel.add(fields_box_panel, BorderLayout.CENTER); icon_panel.setLayout(new BorderLayout()); icon_panel.add(icon_textfield, BorderLayout.CENTER); icon_panel.add(browse_about_icon_button, BorderLayout.EAST); small_icon_panel.setLayout(new BorderLayout()); small_icon_panel.add(small_icon_textfield, BorderLayout.CENTER); small_icon_panel.add(browse_home_icon_button, BorderLayout.EAST); box_panel.setLayout(new GridLayout(1,1,5,2)); box_panel.add(public_checkbox); description_panel.setLayout(new BorderLayout()); description_panel.add(description_label, BorderLayout.NORTH); description_panel.add(new JScrollPane(description_textarea), BorderLayout.CENTER); details_panel.setLayout(new BorderLayout()); details_panel.add(fields_panel, BorderLayout.NORTH); details_panel.add(box_panel, BorderLayout.CENTER); all_details_panel.setLayout(new BorderLayout()); all_details_panel.add(details_panel, BorderLayout.NORTH); all_details_panel.add(description_panel, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); setLayout(new BorderLayout()); add(header_panel, BorderLayout.NORTH); add(all_details_panel, BorderLayout.CENTER); } /** Destructor. */ public void destroy() { } /** Called to refresh the components. */ public void gainFocus() { // Retrieve all of the elements that are dependant on default language. collection_extra_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_COLLECTIONEXTRA_STR); collection_name_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_COLLECTIONNAME_STR); creator_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getCreator()); icon_collection_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTION_STR); icon_collection_small_collectionmeta = CollectionDesignManager.collectionmeta_manager.getMetadatum(CollectionConfiguration.COLLECTIONMETADATA_ICONCOLLECTIONSMALL_STR); maintainer_collectionmeta = new CollectionMeta(CollectionDesignManager.collect_config.getMaintainer()); // Make sure the components are up to date creator_emailfield.setText(creator_collectionmeta.getValue(CollectionMeta.TEXT)); creator_emailfield.setCaretPosition(0); description_textarea.setText(collection_extra_collectionmeta.getValue(CollectionMeta.TEXT)); description_textarea.setCaretPosition(0); icon_textfield.setText(icon_collection_collectionmeta.getValue(CollectionMeta.TEXT)); icon_textfield.setCaretPosition(0); maintainer_emailfield.setText(maintainer_collectionmeta.getValue(CollectionMeta.TEXT)); maintainer_emailfield.setCaretPosition(0); name_textfield.setText(collection_name_collectionmeta.getValue(CollectionMeta.TEXT)); name_textfield.setCaretPosition(0); small_icon_textfield.setText(icon_collection_small_collectionmeta.getValue(CollectionMeta.TEXT)); small_icon_textfield.setCaretPosition(0); public_checkbox.setSelected(public_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR)); ready = true; } public boolean canSave() { boolean title_clash_warning = true; // Oh, and if the collection title is already in use warn them about it String title = name_textfield.getText(); // I just happen to have a handy method in the new details prompt to detect this very thing if(NewCollectionDetailsPrompt.titleClashes(title, CollectionDesignManager.collect_config.getFile())) { // Determine if the user wants to be warned about this WarningDialog dialog = new WarningDialog("warning.TitleClashes", "TitleClashes.Title", Dictionary.get("TitleClashes.Message"), null, true); if(dialog.display() == JOptionPane.OK_OPTION) { // If they have said yes, then carry on with the assignement collection_name_collectionmeta.setValue(title); has_been_warned = true; } // Otherwise we don't assign anything. In fact we have to restore the frame title back to its original value else { title_clash_warning = false; String collection_title = collection_name_collectionmeta.getValue(CollectionMeta.TEXT); String collection_name = Gatherer.c_man.getCollection().getName(); Gatherer.g_man.setTitle(collection_title, collection_name); collection_name = null; collection_title = null; } dialog.dispose(); dialog = null; } // No clash, no worries. else if(collection_name_collectionmeta != null) { collection_name_collectionmeta.setValue(title); } return title_clash_warning; } /** Called to store the current value of the components. */ public void loseFocus() { // String values. Have to test if this component has actually ever recieved focus anyway. if(ready) { // Boolean values public_collectionmeta.setValue((public_checkbox.isSelected() ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR)); String creator_email_str = creator_emailfield.getText(); creator_collectionmeta.setValue(creator_email_str); // If the email is currently empty, store this email if(Configuration.getEmail() == null) { Configuration.setEmail(creator_email_str); // Store the email address in the configuration } collection_extra_collectionmeta.setValue(description_textarea.getText()); icon_collection_collectionmeta.setValue(icon_textfield.getText()); maintainer_collectionmeta.setValue(maintainer_emailfield.getText()); icon_collection_small_collectionmeta.setValue(small_icon_textfield.getText()); // Oh, and if the collection title is already in use warn them about it String title = name_textfield.getText(); // I just happen to have a handy method in the new details prompt to detect this very thing if(!has_been_warned && NewCollectionDetailsPrompt.titleClashes(title, CollectionDesignManager.collect_config.getFile())) { // Determine if the user wants to be warned about this WarningDialog dialog = new WarningDialog("warning.TitleClashes", "TitleClashes.Title", Dictionary.get("TitleClashes.Message"), null, true); if(dialog.display() == JOptionPane.OK_OPTION) { // If they have said yes, then carry on with the assignement collection_name_collectionmeta.setValue(title); } // Otherwise we don't assign anything. In fact we have to restore the frame title back to its original value else { String collection_title = collection_name_collectionmeta.getValue(CollectionMeta.TEXT); String collection_name = Gatherer.c_man.getCollection().getName(); Gatherer.g_man.setTitle(collection_title, collection_name); collection_name = null; collection_title = null; } dialog.dispose(); dialog = null; } // No clash, no worries. else { collection_name_collectionmeta.setValue(title); } title = null; ready = false; has_been_warned = false; } } /** Listens for a click on either browse button, and when detected opens a file browser window initially pointed at the images folder of the collection. Once a user has selected a path, does it's best to construct the best address to the resource, such as _httpcollection_/images/about.gif */ private class BrowseListener implements ActionListener { private String prefix; public BrowseListener(String prefix_raw) { this.prefix = prefix_raw.replaceAll(StaticStrings.COLNAME_PATTERN, Gatherer.c_man.getCollection().getName()); } public void actionPerformed(ActionEvent event) { // Open an almost standard file browser to the images folder of the current collection File images_folder = new File(Gatherer.c_man.getCollectionImagesDirectoryPath()); // If images isn't already there, create it if(!images_folder.exists()) { images_folder.mkdirs(); } JFileChooser file_chooser = new JFileChooser(images_folder); file_chooser.setAcceptAllFileFilterUsed(false); file_chooser.setDialogTitle(Dictionary.get("CDM.General.Browser_Title")); file_chooser.setFileFilter(new ImageFilter()); file_chooser.setSize(400,300); OpenCollectionDialog.disableRename(file_chooser); int value = file_chooser.showOpenDialog(Gatherer.g_man); // If the user hasn't cancelled, retrieve the file path selected if(value == JFileChooser.APPROVE_OPTION) { // If the file isn't in the images folder, then ask the user if they want to copy it there File file = file_chooser.getSelectedFile(); if(!file.getParentFile().equals(images_folder)) { if(true) { //JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("CDM.General.Copy_Image"), Dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // Copy the file try { File collection_image_file = new File(images_folder, file.getName()); Gatherer.f_man.getQueue().copyFile(file, collection_image_file, null); // If we're using a remote Greenstone server, upload the image if (Gatherer.isGsdlRemote) { RemoteGreenstoneServer.uploadCollectionFile(Gatherer.c_man.getCollection().getName(), collection_image_file); } } catch(Exception exception) { DebugStream.printStackTrace(exception); // Show warning JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CDM.General.Image_Copy_Failed"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); // Nothing else we can do. return; } } else { // Nothing we can safely do return; } } // Create the path starting _httpcollection_/images/ String path = prefix + file.getName(); if(event.getSource() == browse_about_icon_button) { icon_textfield.setText(path); } else { small_icon_textfield.setText(path); } path = null; } } /** ImageFilter.java is a 1.4 example used by FileChooserDemo2.java. */ private class ImageFilter extends javax.swing.filechooser.FileFilter { private Pattern pattern = null; public ImageFilter() { pattern = Pattern.compile(".*\\.(gif|png|jpe?g)"); } // Accept all directories and all .col files public boolean accept(File f) { String filename = f.getName().toLowerCase(); Matcher matcher = pattern.matcher(filename); return f.isDirectory() || matcher.matches(); } // The description of this filter public String getDescription() { return Dictionary.get("CDM.General.Image_Filter"); } } } private class CollectionTitleUpdater implements DocumentListener { /** Gives notification that an attribute or set of attributes changed. */ public void changedUpdate(DocumentEvent e) { setTitle(); } /** Gives notification that there was an insert into the document. */ public void insertUpdate(DocumentEvent e) { setTitle(); } /** Gives notification that a portion of the document has been removed. */ public void removeUpdate(DocumentEvent e) { setTitle(); } private void setTitle() { // Set the title String collection_title = name_textfield.getText(); String collection_name = Gatherer.c_man.getCollection().getName(); Gatherer.g_man.setTitle(collection_title, collection_name); collection_title = null; collection_name = null; } } } /** This tree provides a 'table of contents' for the various components of the design process (collection configuration in more technical terms). */ private class DesignTree extends JTree { private DesignNode root = null; /** Constructor. Automatically generates all of the nodes, in the order of CONTENTS. */ public DesignTree() { super(); resetModel(Configuration.getMode()); expandRow(0); setRootVisible(false); setSelectionRow(0); } /** Reset the model used by the design page contents tree. This is necessary to hide the partitions entry when in lower detail modes * @param mode the current detail mode as an int */ public void resetModel(int mode) { root = new DesignNode("CDM.GUI.Root"); // Now add the design categories. for(int i = 0; i < CONTENTS.length; i++) { root.add(new DesignNode(CONTENTS[i])); } this.setModel(new DefaultTreeModel(root)); updateUI(); } /** Set the current view to the one specified. * @param type the name of the desired view as a String */ public void setSelectedView(String type) { type = Dictionary.get(type); for(int i = 0; i < root.getChildCount(); i++) { DesignNode child = (DesignNode) root.getChildAt(i); if(child.toString().equals(type)) { TreePath path = new TreePath(child.getPath()); setSelectionPath(path); } } } } /** A tree node that retains a reference to one of the possible design sub-views relating to the different sub-managers. */ private class DesignNode extends DefaultMutableTreeNode { /** Constructor. * @param object The Object assigned to this node. */ public DesignNode(String object) { super(object); } /** Retrieve a textual representation of the object. * @return a String */ public String toString() { // return Dictionary.get("CDM.GUI." + (String)getUserObject()); return Dictionary.get((String) getUserObject()); } } /** Listens for selection changes in the 'contents' tree, and switches to the appropriate view. */ private class TreeListener implements TreeSelectionListener { /** Called whenever the selection changes, we must update the view so it matches the node selected. * @param event A TreeSelectionEvent containing more information about the tree selection. * @see org.greenstone.gatherer.cdm.ClassifierManager * @see org.greenstone.gatherer.cdm.CollectionDesignManager * @see org.greenstone.gatherer.cdm.CollectionMetaManager * @see org.greenstone.gatherer.cdm.FormatManager * @see org.greenstone.gatherer.cdm.LanguageManager * @see org.greenstone.gatherer.cdm.MetadataSetView * @see org.greenstone.gatherer.cdm.SubcollectionManager * @see org.greenstone.gatherer.cdm.TranslationView * @see org.greenstone.gatherer.cdm.PlugInManager */ public void valueChanged(TreeSelectionEvent event) { if(!tree.isSelectionEmpty()) { TreePath path = tree.getSelectionPath(); DesignNode node = (DesignNode)path.getLastPathComponent(); String type = (String)node.getUserObject(); // Wait begins Gatherer.g_man.wait(true); // Save information in current view view.loseFocus(); remove((JPanel)view); // Change panes. if(type == CONTENTS[0]) { view = getControls(); } else if(type == CONTENTS[1]) { view = CollectionDesignManager.plugin_manager.getControls(); } else if(type == CONTENTS[2]) { view = CollectionDesignManager.searchtype_manager.getControls(); } else if(type == CONTENTS[3]) { view = CollectionDesignManager.index_manager.getControls(); } else if(type == CONTENTS[4]) { view = CollectionDesignManager.subcollection_manager.getControls(); } else if(type == CONTENTS[5]) { view = CollectionDesignManager.supercollection_manager.getControls(); } else if(type == CONTENTS[6]) { view = CollectionDesignManager.classifier_manager.getControls(); } else if(type == CONTENTS[7]) { view = CollectionDesignManager.format_manager.getControls(); } else if(type == CONTENTS[8]) { view = CollectionDesignManager.translation_view.getControls(); } else if(type == CONTENTS[9]) { view = CollectionDesignManager.metadataset_view.getControls(); } add((JPanel)view, BorderLayout.CENTER); // Update information on visible pane view.gainFocus(); repaint(); // Wait ends Gatherer.g_man.wait(false); } } } }