source: trunk/gli/src/org/greenstone/gatherer/cdm/GUI.java@ 4580

Last change on this file since 4580 was 4494, checked in by jmt12, 21 years ago

2030098: Fixed translation manager and separated the Languages from the possible text fragment Translations.

  • Property svn:keywords set to Author Date Id Revision
File size: 25.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 * Author: John Thompson, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 1999 New Zealand Digital Library Project
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *########################################################################
26 */
27package org.greenstone.gatherer.cdm;
28
29import java.awt.*;
30import java.awt.event.*;
31import javax.swing.*;
32import javax.swing.event.*;
33import javax.swing.text.JTextComponent;
34import javax.swing.tree.*;
35import org.greenstone.gatherer.Gatherer;
36import org.greenstone.gatherer.cdm.CollectionDesignManager;
37import org.greenstone.gatherer.cdm.CollectionMeta;
38import org.greenstone.gatherer.util.EmailAddress;
39import org.greenstone.gatherer.util.Utility;
40/** 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 <strong>Dictionary</strong> rather than the text keys inserted in the component classes, and several other aspects of the design page, including the config file section tree.
41* @author John Thompson, Greenstone Digital Library, University of Waikato
42* @version 2.3
43*/
44public class GUI
45 extends JPanel {
46 /** A flag used to tell whether we should initialize the divider location. */
47 private boolean init = true;
48 /** A reference to the collection manager, as it is here that all of the other data members and managers reside. */
49 private CollectionDesignManager manager = null;
50 /** The controls used to modify the general options. */
51 private Control controls = null;
52 /** 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. */
53 private DesignTree tree = null;
54 /** A reference to the Gatherer. */
55 private Gatherer gatherer = null;
56 /** The title located just above the content tree. */
57 private JLabel title = null;
58 /** The panel containing both the title and the tree. */
59 private JPanel tree_pane = null;
60 /** The panel apon which is rendered the currently selected section screen. */
61 private JPanel view = null;
62 /** A split pane in which the contents menu and context controls sit. */
63 //private JSplitPane center_pane;
64 /** The available subscreens. */
65 static final public String CONTENTS[] = {"General", "Plugins", "Indexes", "Subcollections", "Classifiers", "Formats", "SuperCollection", "Translation", "MetadataSets"};
66 /** The preferred size of the collection design module screen real-estate. */
67 static final private Dimension SIZE = new Dimension(760, 500);
68 static final private Dimension TREE_SIZE = new Dimension(200, 500);
69 /** Constructor.
70 * @see DesignTree
71 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
72 */
73 public GUI(Gatherer gatherer, CollectionDesignManager manager) {
74 super();
75 // Assignments
76 this.gatherer = gatherer;
77 this.manager = manager;
78 // Creation
79 //center_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
80 this.title = new JLabel(get("Design_Topics"));
81 this.tree = new DesignTree();
82 this.tree_pane = new JPanel();
83 this.view = getControls();
84 // Connect
85 tree.addTreeSelectionListener(new TreeListener());
86 tree_pane.setLayout(new BorderLayout());
87 tree_pane.setPreferredSize(TREE_SIZE);
88 tree_pane.add(title, BorderLayout.NORTH);
89 tree_pane.add(new JScrollPane(tree), BorderLayout.CENTER);
90 // Layout
91 //center_pane.setLeftComponent(tree_pane);
92 //center_pane.setRightComponent(view);
93
94 setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
95 setLayout(new BorderLayout());
96 //add(center_pane, BorderLayout.CENTER);
97 add(tree_pane, BorderLayout.WEST);
98 add(view, BorderLayout.CENTER);
99 }
100 /** Mark the current set of controls as invalid. If they are needed again in the future new controls will be generate.
101 * @see org.greenstone.gatherer.cdm.GUI.Control
102 */
103 public void invalidateControls() {
104 if(controls != null) {
105 controls.destroy();
106 }
107 controls = null;
108 }
109 /** Force the display to show a certain pane of controls.
110 * @param type A <strong>String</strong> giving the name of the submanager view we wish to display.
111 */
112 public void setSelectedView(String type) {
113 tree.setSelectedView(type);
114 }
115 /** Overrides the normal updateUI to ensure that the current view also recieves an update message.
116 */
117 public void updateUI() {
118 if(view != null) {
119 view.updateUI();
120 }
121 super.updateUI();
122 }
123
124 /**Overridden so we can exit when window is closed
125 * @param event A <strong>WindowsEvent</strong> that encapsulates all the information gathered about the event that called this method.
126 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
127 */
128 protected void processWindowEvent(WindowEvent event) {
129 if(event.getID() == WindowEvent.WINDOW_CLOSING) {
130 manager.save();
131 System.exit(0);
132 }
133 }
134 /** Overloaded to call get with both a key and an empty argument array.
135 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
136 * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call.
137 */
138 private String get(String key) {
139 return get(key, null);
140 }
141 /** Used to retrieve a property value from the Locale specific ResourceBundle, based upon the key and arguments supplied. If the key cannot be found or if some other part of the call fails a default (English) error message is returned. <BR>
142 * Here the get recieves a second argument which is an array of Strings used to populate argument fields, denoted {<I>n</I>}, within the value String returned. Note that argument numbers greater than or equal to 32 are automatically mapped to the formatting String named Farg<I>n</I>.
143 * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
144 * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.
145 * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call.
146 * @see org.greenstone.gatherer.Gatherer
147 * @see org.greenstone.gatherer.Dictionary
148 */
149 private String get(String key, String args[]) {
150 if(key.indexOf('.') == -1) {
151 key = "CDM.GUI." + key;
152 }
153 return gatherer.dictionary.get(key, args);
154 }
155 /** Because the CollectionDesignManager has enough to do, this class is resposible for generating the controls for the general options, all of which are stored in the aforementioned manager.
156 * @return A <strong>JPanel</strong> containing controls for editing the general options.
157 */
158 private JPanel getControls() {
159 if(controls == null) {
160 controls = new Control();
161 }
162 return controls;
163 }
164 /** This class represents the visual component of the general options stored in the CollectionDesignManager. */
165 private class Control
166 extends JPanel {
167 /** The collection metadata representing the extra or description of the collection. */
168 private CollectionMeta collection_extra_data = null;
169 /** The collection metadata representing the name of the collection. */
170 private CollectionMeta collection_name_data = null;
171 /** The collection metadata representing the icon file location of the collection. */
172 private CollectionMeta icon_collection_data = null;
173 /** The default size of label on this control. */
174 private Dimension LABEL_SIZE = new Dimension(200,25);
175 /** The checkbox controlling public access to the collection. */
176 private JCheckBox access = null;
177 /** The checkbox controlling the state of the collection. */
178 private JCheckBox beta = null;
179 /** The label denoting the collection extra area. */
180 private JLabel collection_extra_label = null;
181 /** The label denoting the collection extra language (Default). */
182 private JLabel collection_extra_language = null;
183 /** The label denoting the collection name area. */
184 private JLabel collection_name_label = null;
185 /** The label denoting the name language (Default). */
186 private JLabel collection_name_language = null;
187 /** The label denoting the collection icon area. */
188 private JLabel icon_collection_label = null;
189 /** The label denoting the icon language (Default). */
190 private JLabel icon_collection_language = null;
191 /** The label which serves as the title of this view. */
192 private JLabel title = null;
193 /** The panel containing the access controls. */
194 private JPanel access_pane = null;
195 /** The panel containing the state controls. */
196 private JPanel beta_pane = null;
197 /** The central pane that will contain the view. */
198 private JPanel central_pane = null;
199 /** A panel used to affect internal layout of the collection extra area. */
200 private JPanel collection_extra_inner_pane = null;
201 /** The panel containing the collection extra area. */
202 private JPanel collection_extra_pane = null;
203 /** A panel used to affect internal layout of the collection name area. */
204 private JPanel collection_name_inner_pane = null;
205 /** The panel containing the collection name area. */
206 private JPanel collection_name_pane = null;
207 /** A panel used to affect internal layout of the collection icon area. */
208 private JPanel icon_collection_inner_pane = null;
209 /** The panel containing the icon area. */
210 private JPanel icon_collection_pane = null;
211 /** A text area used to display the inline help for this manager. */
212 private JTextArea instructions = null;
213 /** The text field used to edit the collections title. */
214 private JTextField collection_name = null;
215 /** The text field used to edit the file name of the collections icon. */
216 private JTextField icon_collection = null;
217 /** A text area used to modify the collection description. */
218 private JTextArea collection_extra = null;
219 /** Constructor.
220 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
221 * @see org.greenstone.gatherer.cdm.CollectionMeta
222 * @see org.greenstone.gatherer.cdm.CollectionMetaManager
223 * @see org.greenstone.gatherer.cdm.Language
224 * @see org.greenstone.gatherer.cdm.LanguageManager
225 */
226 public Control() {
227 super();
228 collection_extra_data = manager.collectionmetadatum.getCollectionExtra();
229 collection_name_data = manager.collectionmetadatum.getCollectionName();
230 icon_collection_data = manager.collectionmetadatum.getIconCollection();
231 // Creation.
232 access = new JCheckBox(get("CDM.General.Access"));
233 access.setSelected(manager.public_col);
234 access_pane = new JPanel();
235 beta = new JCheckBox(get("CDM.General.Beta"));
236 beta.setSelected(manager.beta);
237 beta_pane = new JPanel();
238 central_pane = new JPanel();
239 collection_extra = new JTextArea();
240 collection_extra_inner_pane = new JPanel();
241 collection_extra_label = new JLabel(get("CDM.General.Collection_Extra"));
242 collection_extra_label.setHorizontalAlignment(JLabel.CENTER);
243 collection_extra_language = new JLabel();
244 collection_extra_pane = new JPanel();
245 if(collection_extra_data != null) {
246 collection_extra.setText(collection_extra_data.getValue());
247 Language language = null;
248 if((language = collection_extra_data.getLanguage()) != null) {
249 collection_extra_language.setText(language.toString());
250 }
251 else {
252 collection_extra_language.setText(manager.languages.getDefaultLanguage().toString());
253 }
254 }
255 collection_name = new JTextField();
256 collection_name_inner_pane = new JPanel();
257 collection_name_label = new JLabel(get("CDM.General.Collection_Name"));
258 collection_name_label.setPreferredSize(LABEL_SIZE);
259 collection_name_language = new JLabel();
260 collection_name_pane = new JPanel();
261 if(collection_name_data != null) {
262 collection_name.setText(collection_name_data.getValue());
263 Language language = null;
264 if((language = collection_name_data.getLanguage()) != null) {
265 collection_name_language.setText(language.toString());
266 }
267 else {
268 collection_name_language.setText(manager.languages.getDefaultLanguage().toString());
269 }
270 }
271 icon_collection = new JTextField();
272 icon_collection_inner_pane = new JPanel();
273 icon_collection_label = new JLabel(get("CDM.General.Icon_Collection"));
274 icon_collection_label.setPreferredSize(LABEL_SIZE);
275 icon_collection_language = new JLabel();
276 icon_collection_pane = new JPanel();
277 if(icon_collection_data != null) {
278 icon_collection.setText(icon_collection_data.getValue());
279 Language language = null;
280 if((language = icon_collection_data.getLanguage()) != null) {
281 icon_collection_language.setText(language.toString());
282 }
283 else {
284 icon_collection_language.setText(manager.languages.getDefaultLanguage().toString());
285 }
286 }
287 instructions = new JTextArea(get("CDM.General.Instructions"));
288 instructions.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
289 instructions.setEditable(false);
290 instructions.setLineWrap(true);
291 instructions.setRows(4);
292 instructions.setWrapStyleWord(true);
293 JPanel lower = new JPanel();
294 title = new JLabel(get("CDM.General.Title"));
295 title.setHorizontalAlignment(JLabel.CENTER);
296 title.setOpaque(true);
297 JPanel upper = new JPanel();
298 // Add listeners.
299 access.addActionListener(new AccessListener());
300 beta.addActionListener(new BetaListener());
301 collection_extra.addKeyListener(new ChangeListener(collection_extra_data, collection_extra, "collectionextra"));
302 collection_name.addKeyListener(new ChangeListener(collection_name_data, collection_name, "collectionname"));
303 collection_name.addKeyListener(new CollectionTitleListener());
304 icon_collection.addKeyListener(new ChangeListener(icon_collection_data, icon_collection, "iconcollection"));
305 // Layout
306 instructions.setBorder(BorderFactory.createEmptyBorder(2,5,2,5));
307
308 upper.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
309 upper.setLayout(new BorderLayout());
310 upper.add(title, BorderLayout.NORTH);
311 upper.add(new JScrollPane(instructions), BorderLayout.CENTER);
312
313 collection_name_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
314 collection_name_language.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
315
316 collection_name_inner_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
317 collection_name_inner_pane.setLayout(new BorderLayout());
318 collection_name_inner_pane.add(collection_name);
319
320 collection_name_pane.setLayout(new BorderLayout());
321 collection_name_pane.add(collection_name_label, BorderLayout.WEST);
322 collection_name_pane.add(collection_name_inner_pane, BorderLayout.CENTER);
323 collection_name_pane.add(collection_name_language, BorderLayout.EAST);
324
325 icon_collection_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
326 icon_collection_language.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
327
328 icon_collection_inner_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
329 icon_collection_inner_pane.setLayout(new BorderLayout());
330 icon_collection_inner_pane.add(icon_collection, BorderLayout.CENTER);
331
332 icon_collection_pane.setLayout(new BorderLayout());
333 icon_collection_pane.add(icon_collection_label, BorderLayout.WEST);
334 icon_collection_pane.add(icon_collection_inner_pane, BorderLayout.CENTER);
335 icon_collection_pane.add(icon_collection_language, BorderLayout.EAST);
336
337 access_pane.add(access);
338
339 beta_pane.add(beta);
340
341 lower.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
342 lower.setLayout(new GridLayout(6,1));
343 lower.add(manager.creator.getControls());
344 lower.add(manager.maintainer.getControls());
345 lower.add(access_pane);
346 lower.add(beta_pane);
347 lower.add(collection_name_pane);
348 lower.add(icon_collection_pane);
349
350 collection_extra_inner_pane.setLayout(new BorderLayout());
351 collection_extra_inner_pane.add(collection_extra_label, BorderLayout.WEST);
352 collection_extra_inner_pane.add(collection_extra_language, BorderLayout.EAST);
353
354 collection_extra.setBorder(BorderFactory.createEmptyBorder(2,5,2,5));
355
356 collection_extra_pane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
357 collection_extra_pane.setLayout(new BorderLayout());
358 collection_extra_pane.add(collection_extra_inner_pane, BorderLayout.NORTH);
359 collection_extra_pane.add(new JScrollPane(collection_extra), BorderLayout.CENTER);
360
361 central_pane.setLayout(new BorderLayout());
362 central_pane.add(lower, BorderLayout.NORTH);
363 central_pane.add(collection_extra_pane, BorderLayout.CENTER);
364
365 setLayout(new BorderLayout());
366 add(upper, BorderLayout.NORTH);
367 add(central_pane, BorderLayout.CENTER);
368 }
369 /** Destructor.
370 */
371 public void destroy() {
372 }
373 /** We override the updateUI method so that we can ensure we are scrolled to the top of the instructions box first.
374 */
375 public void updateUI() {
376 if(instructions != null) {
377 instructions.setCaretPosition(0);
378 }
379 if(collection_extra != null) {
380 collection_extra.setCaretPosition(0);
381 }
382 super.updateUI();
383 }
384 /** Detect when the collection access changes, and update the configuration as necessary.
385 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
386 */
387 private class AccessListener
388 implements ActionListener {
389 public void actionPerformed(ActionEvent event) {
390 manager.public_col = access.isSelected();
391 }
392 }
393 /** Detect when the collection state changes and update the configuration as necessary.
394 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
395 */
396 private class BetaListener
397 implements ActionListener {
398 public void actionPerformed(ActionEvent event) {
399 manager.beta = beta.isSelected();
400 }
401 }
402 /** This class listens for any changes its registered controls, including enter actions and keys typed, and updates the fields stored in CollectionDesignManager as necessary. */
403 private class ChangeListener
404 extends KeyAdapter {
405 /** The collection metadata to alter. */
406 private CollectionMeta metadata = null;
407 /** The control we are watching for changes. */
408 private JTextComponent component = null;
409 /** The name of the metadata to monitor. */
410 private String name = null;
411 /** Construstor.
412 * @param metadata The <strong>CollectionMeta</strong> to alter.
413 * @param component The <strong>JTextComponent</strong> we are monitoring for changes.
414 * @param name The name of the metadata as a <strong>String</strong>.
415 */
416 public ChangeListener(CollectionMeta metadata, JTextComponent component, String name) {
417 this.component = component;
418 this.metadata = metadata;
419 if(metadata != null) {
420 this.name = metadata.getName().toString();
421 }
422 else {
423 this.name = name;
424 }
425 }
426 /** Any extension of a KeyAdapter may override this method so we can be informed when a key has been released (ie after the character etc has been added). In this case we want to update the appropriate metadata, however there are three distinct cases to consider:<br>&nbsp;1. A simple update of the value field is all that is necessary,<br>&nbsp;2. The metadata exists but it currently has no language, so we must set the language to default and update the value, or<br>&nbsp;3. The metadata doesn't exist so we'll create a new one with the specified name, default language and new value.<br>This final case is highly unlikely but still possible.
427 * @param event An <strong>Event</strong> containing information about the key release.
428 * @see org.greenstone.gatherer.Gatherer
429 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
430 * @see org.greenstone.gatherer.cdm.CollectionMeta
431 * @see org.greenstone.gatherer.cdm.CollectionMetaManager
432 * @see org.greenstone.gatherer.cdm.Language
433 * @see org.greenstone.gatherer.cdm.LanguageManager
434 * @see org.greenstone.gatherer.collection.CollectionManager
435 */
436 public void keyReleased(KeyEvent event) {
437 if(metadata != null) {
438 Language language = metadata.getLanguage();
439 if(language == null) {
440 metadata.update(metadata.getName(), manager.languages.getDefaultLanguage(), component.getText());
441 }
442 else {
443 metadata.update(metadata.getName(), metadata.getLanguage(), component.getText());
444 }
445 }
446 else {
447 metadata = new CollectionMeta(manager, name, manager.languages.getDefaultLanguage(), component.getText());
448 manager.collectionmetadatum.addMetadata(metadata);
449 }
450 gatherer.c_man.configurationChanged();
451 }
452 }
453 /** Listens for changes to the collection name and updates the windows title bar appropriately and collection file. */
454 private class CollectionTitleListener
455 extends KeyAdapter {
456 /** Any extension of a KeyAdapter may override this method so we can be informed when a key has been released (ie after the character etc has been added). When such a change occurs update the main guis title bar to reflect the change and fix the collection name.
457 * @param event An <strong>Event</strong> containing information about the key release.
458 */
459 public void keyReleased(KeyEvent event) {
460 String name = collection_name.getText();
461 if(name != null && name.length() > 0) {
462 gatherer.g_man.setTitle(Utility.PROGRAM_NAME + ":\"" + name + "\"");
463 gatherer.c_man.getCollection().setTitle(name);
464 }
465 }
466 }
467 }
468 /** This tree provides a 'table of contents' for the various components of the design process (collection configuration in more technical terms). */
469 private class DesignTree
470 extends JTree {
471 private DesignNode root = null;
472 /** Constructor. Automatically generates all of the nodes, in the order of CONTENTS.
473 */
474 public DesignTree() {
475 super();
476 root = new DesignNode("Root");
477 this.setModel(new DefaultTreeModel(root));
478 // Now add the design categories.
479 for(int i = 0; i < CONTENTS.length; i++) {
480 root.add(new DesignNode(CONTENTS[i]));
481 }
482 expandRow(0);
483 setRootVisible(false);
484 setSelectionRow(0);
485 }
486 /** Set the current view to the one specified.
487 * @param type The name of the desired view as a <strong>String</strong>.
488 * @see org.greenstone.gatherer.Gatherer
489 * @see org.greenstone.gatherer.cdm.GUI.DesignNode
490 */
491 public void setSelectedView(String type) {
492 type = gatherer.get(type);
493 for(int i = 0; i < root.getChildCount(); i++) {
494 DesignNode child = (DesignNode) root.getChildAt(i);
495 if(child.toString().equals(type)) {
496 TreePath path = new TreePath(child.getPath());
497 setSelectionPath(path);
498 }
499 }
500 }
501 }
502 /** A tree node that retains a reference to one of the possible design sub-views relating to the different sub-managers. */
503 private class DesignNode
504 extends DefaultMutableTreeNode {
505 /** Constructor.
506 * @param object The <strong>Object</strong> assigned to this node.
507 */
508 public DesignNode(String object) {
509 super(object);
510 }
511 /** Retrieve a textual representation of the object.
512 * @return A <strong>String</strong>.
513 */
514 public String toString() {
515 return get((String)getUserObject());
516 }
517 }
518 /** Listens for selection changes in the 'contents' tree, and switches to the appropriate view. */
519 private class TreeListener
520 implements TreeSelectionListener {
521 /** Called whenever the selection changes, we must update the view so it matches the node selected.
522 * @param event A <strong>TreeSelectionEvent</strong> containing more information about the tree selection.
523 * @see org.greenstone.gatherer.cdm.ClassifierManager
524 * @see org.greenstone.gatherer.cdm.CollectionDesignManager
525 * @see org.greenstone.gatherer.cdm.CollectionMetaManager
526 * @see org.greenstone.gatherer.cdm.FormatManager
527 * @see org.greenstone.gatherer.cdm.LanguageManager
528 * @see org.greenstone.gatherer.cdm.MetadataSetManager
529 * @see org.greenstone.gatherer.cdm.SubcollectionManager
530 * @see org.greenstone.gatherer.cdm.PlugInManager
531 */
532 public void valueChanged(TreeSelectionEvent event) {
533 if(!tree.isSelectionEmpty()) {
534 TreePath path = tree.getSelectionPath();
535 DesignNode node = (DesignNode)path.getLastPathComponent();
536 String type = (String)node.getUserObject();
537 // Assure user
538 // Build and change panes.
539 remove(view);
540 view.hasFocus(); // Trigger pending information update events.
541 if(type.equals("General")) {
542 view = getControls();
543 }
544 else if(type.equals("Plugins")) {
545 view = manager.plugins.getControls();
546 }
547 else if(type.equals("Indexes")) {
548 view = manager.indexes.getControls();
549 }
550 else if(type.equals("Subcollections")) {
551 view = manager.subcollections.getControls();
552 }
553 else if(type.equals("SuperCollection")) {
554 view = manager.superman.getControls();
555 }
556 else if(type.equals("Classifiers")) {
557 view = manager.classifiers.getControls();
558 }
559 else if(type.equals("Formats")) {
560 view = manager.formats.getControls();
561 }
562 else if(type.equals("Translation")) {
563 view = manager.transman.getControls();
564 }
565 else if(type.equals("MetadataSets")) {
566 view = manager.metadatasets.getControls();
567 }
568 add(view, BorderLayout.CENTER);
569 //center_pane.setRightComponent(view);
570 view.updateUI();
571 // Ready
572 }
573 }
574 }
575}
Note: See TracBrowser for help on using the repository browser.