Changeset 4420
- Timestamp:
- 2003-05-30T12:49:51+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/mem/MetadataEditorManager.java
r4403 r4420 58 58 import org.greenstone.gatherer.valuetree.GValueNode; 59 59 import org.w3c.dom.*; 60 import org.greenstone.gatherer.gui.SimpleMenuBar; 61 import org.greenstone.gatherer.gui.ModalDialog; 62 60 63 /** 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. 61 64 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 63 66 */ 64 67 public class MetadataEditorManager 65 extends JDialog {68 extends ModalDialog { 66 69 private AddElementActionListener add_element_action_listener = null; 67 70 private AddFileActionListener add_file_action_listener = null; … … 140 143 setSize(SIZE); 141 144 setTitle(get("Title")); 145 setJMenuBar(new SimpleMenuBar("11.1")); 142 146 JPanel content_pane = (JPanel) getContentPane(); 143 147 content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); … … 442 446 // Display 443 447 setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2); 444 s how();448 setVisible(true); 445 449 } 446 450 … … 511 515 512 516 private class AddOrEditAttributeActionListener 513 extends JDialog517 extends ModalDialog 514 518 implements ActionListener { 515 519 private boolean add_type = true; … … 696 700 // Hide dialog if we are allowed to continue. 697 701 if(cont) { 698 hide();702 setVisible(false); 699 703 } 700 704 } 701 705 else if(source == cancel_button) { 702 706 // Hide dialog 703 hide();707 setVisible(false); 704 708 } 705 709 else if(source == name) { … … 818 822 values = null; 819 823 } 820 s how();824 setVisible(true); 821 825 } 822 826 else if(current_attribute != -1) { … … 839 843 value.setSelectedItem(value_str); 840 844 value_str = null; 841 s how();845 setVisible(true); 842 846 } 843 847 } … … 856 860 857 861 private class AddElementActionListener 858 extends JDialog862 extends ModalDialog 859 863 implements ActionListener { 860 864 private JButton cancel_button = null; … … 939 943 // Done 940 944 element = null; 941 hide();945 setVisible(false); 942 946 } 943 947 // Otherwise show an error message and do not proceed. … … 949 953 else if(source == cancel_button) { 950 954 // Dispose 951 hide(); 955 setVisible(false); 956 952 957 } 953 958 else { … … 958 963 name_field.setText(""); 959 964 // Display 960 s how();965 setVisible(true); 961 966 } 962 967 // Warn the user that they can't do that dave. … … 978 983 979 984 private class AddFileActionListener 980 extends JDialog985 extends ModalDialog 981 986 implements ActionListener { 982 987 private JButton cancel_button = null; … … 1054 1059 // Add to tree 1055 1060 model.add(model.getProfileNode(), name_str, MEMNode.COLLECTION); 1056 hide();1061 setVisible(false); 1057 1062 } 1058 1063 // Otherwise warn the user and don't hide the prompt. … … 1063 1068 } 1064 1069 else if(source == cancel_button) { 1065 hide(); 1070 setVisible(false); 1071 1066 1072 } 1067 1073 else { 1068 1074 name_field.setText(""); 1069 s how();1075 setVisible(true); 1070 1076 } 1071 1077 source = null; … … 1080 1086 1081 1087 private class AddSetActionListener 1082 extends JDialog1088 extends ModalDialog 1083 1089 implements ActionListener { 1084 1090 private JButton cancel_button = null; … … 1171 1177 // Done 1172 1178 set = null; 1173 hide();1179 setVisible(false); 1174 1180 } 1175 1181 // Otherwise show a warning. … … 1181 1187 } 1182 1188 else if(source == cancel_button) { 1183 hide();1189 setVisible(false); 1184 1190 } 1185 1191 else { 1186 1192 name_field.setText(""); 1187 s how();1193 setVisible(true); 1188 1194 } 1189 1195 } … … 1197 1203 1198 1204 private class AddOrEditValueActionListener 1199 extends JDialog1205 extends ModalDialog 1200 1206 implements ActionListener, TreeSelectionListener { 1201 1207 private boolean add_type = true; … … 1357 1363 model = null; 1358 1364 // Hide dialog 1359 hide(); 1365 setVisible(false); 1366 1360 1367 } 1361 1368 else if(source == cancel_button) { 1362 1369 // Hide dialog 1363 hide(); 1370 setVisible(false); 1371 1364 1372 } 1365 1373 else { … … 1401 1409 } 1402 1410 // Display 1403 s how();1411 setVisible(true); 1404 1412 } 1405 1413 } … … 1437 1445 1438 1446 private class CloseActionListener 1439 extends JDialog1447 extends ModalDialog 1440 1448 implements ActionListener { 1441 1449 /** 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.