Changeset 4420


Ignore:
Timestamp:
2003-05-30T12:49:51+12:00 (21 years ago)
Author:
kjdon
Message:

the modal dialog now is one of our special ModalDialogs which only block the parent, enabling the use of help files while the dialog is open. A SimpleMenuBar with help on it has been added to the dialog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/mem/MetadataEditorManager.java

    r4403 r4420  
    5858import org.greenstone.gatherer.valuetree.GValueNode;
    5959import org.w3c.dom.*;
     60import org.greenstone.gatherer.gui.SimpleMenuBar;
     61import org.greenstone.gatherer.gui.ModalDialog;
     62
    6063/** Provides a GUI and relevant suite of tools for the editing of the metadata set associated with this collection. Again I have tried to capture a file manager type feel, with a tree showing the various set-element relations to the left of the dialog, and the right side showing details on the current tree selection. When a set is selected these details include a list of attributes, while when an element is selected this list is joined by another showing assigned values. In order for the editor to be stable and consistant with the rest of the tool, care must be taken for fire appropriate events whenever the sets are changed. There is also the addded complexity of determining what actions have to occur in order for a users edit of an assigned value to be completed, i.e. if the user chooses to remove a value then a call must be made to record_set.root.removeMetadata() to ensure all such values are actually removed, so it is not enough just to remove the value from the value model.
    6164 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    6366 */
    6467public class MetadataEditorManager
    65     extends JDialog {
     68    extends ModalDialog {
    6669    private AddElementActionListener add_element_action_listener = null;
    6770    private AddFileActionListener add_file_action_listener = null;
     
    140143    setSize(SIZE);
    141144    setTitle(get("Title"));
     145    setJMenuBar(new SimpleMenuBar("11.1"));
    142146    JPanel content_pane = (JPanel) getContentPane();
    143147    content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false));
     
    442446    // Display
    443447    setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
    444     show();
     448    setVisible(true);
    445449    }
    446450     
     
    511515
    512516    private class AddOrEditAttributeActionListener
    513     extends JDialog
     517    extends ModalDialog
    514518    implements ActionListener {
    515519    private boolean add_type = true;
     
    696700        // Hide dialog if we are allowed to continue.
    697701        if(cont) {
    698             hide();
     702            setVisible(false);
    699703        }
    700704        }
    701705        else if(source == cancel_button) {
    702706        // Hide dialog
    703         hide();
     707        setVisible(false);
    704708        }
    705709        else if(source == name) {
     
    818822            values = null;
    819823            }
    820             show();
     824            setVisible(true);
    821825        }
    822826        else if(current_attribute != -1) {
     
    839843            value.setSelectedItem(value_str);
    840844            value_str = null;
    841             show();
     845            setVisible(true);
    842846        }
    843847        }
     
    856860     
    857861    private class AddElementActionListener
    858     extends JDialog
     862    extends ModalDialog
    859863    implements ActionListener {
    860864    private JButton cancel_button = null;
     
    939943            // Done
    940944            element = null;
    941             hide();
     945            setVisible(false);
    942946        }
    943947        // Otherwise show an error message and do not proceed.
     
    949953        else if(source == cancel_button) {
    950954        // Dispose
    951         hide();
     955        setVisible(false);
     956       
    952957        }
    953958        else {
     
    958963            name_field.setText("");
    959964            // Display
    960             show();
     965            setVisible(true);
    961966            }
    962967            // Warn the user that they can't do that dave.
     
    978983     
    979984    private class AddFileActionListener
    980     extends JDialog
     985    extends ModalDialog
    981986    implements ActionListener {
    982987    private JButton cancel_button = null;
     
    10541059            // Add to tree
    10551060            model.add(model.getProfileNode(), name_str, MEMNode.COLLECTION);
    1056             hide();
     1061            setVisible(false);
    10571062        }
    10581063        // Otherwise warn the user and don't hide the prompt.
     
    10631068        }
    10641069        else if(source == cancel_button) {
    1065         hide();
     1070        setVisible(false);
     1071
    10661072        }
    10671073        else {
    10681074        name_field.setText("");
    1069         show();
     1075        setVisible(true);
    10701076        }
    10711077        source = null;
     
    10801086
    10811087    private class AddSetActionListener
    1082     extends JDialog
     1088    extends ModalDialog
    10831089    implements ActionListener {
    10841090    private JButton cancel_button = null;
     
    11711177            // Done
    11721178            set = null;
    1173             hide();
     1179            setVisible(false);
    11741180        }
    11751181        // Otherwise show a warning.
     
    11811187        }
    11821188        else if(source == cancel_button) {
    1183         hide();
     1189        setVisible(false);
    11841190        }
    11851191        else {
    11861192        name_field.setText("");
    1187         show();
     1193        setVisible(true);
    11881194        }
    11891195    }
     
    11971203     
    11981204    private class AddOrEditValueActionListener
    1199     extends JDialog
     1205    extends ModalDialog
    12001206    implements ActionListener, TreeSelectionListener {
    12011207    private boolean add_type = true;
     
    13571363        model = null;
    13581364        // Hide dialog
    1359         hide();
     1365        setVisible(false);
     1366
    13601367        }
    13611368        else if(source == cancel_button) {
    13621369        // Hide dialog
    1363         hide();
     1370        setVisible(false);
     1371
    13641372        }
    13651373        else {
     
    14011409        }
    14021410        // Display
    1403         show();
     1411        setVisible(true);
    14041412        }
    14051413    }
     
    14371445     
    14381446    private class CloseActionListener
    1439     extends JDialog
     1447    extends ModalDialog
    14401448    implements ActionListener {
    14411449    /** Any implementation of ActionListener must include this method so that we can be informed when an action as occured on our registered component, allowing us to close the editor dialog.
Note: See TracChangeset for help on using the changeset viewer.