Changeset 5589 for trunk/gli/src/org/greenstone/gatherer/mem
- Timestamp:
- 2003-10-06T17:55:00+13:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/mem
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/mem/Attribute.java
r4365 r5589 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 37 package org.greenstone.gatherer.mem; 44 38 -
trunk/gli/src/org/greenstone/gatherer/mem/AttributeTableModel.java
r4535 r5589 1 package org.greenstone.gatherer.mem;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.mem; 38 38 39 import java.awt.*; 39 40 import java.util.*; -
trunk/gli/src/org/greenstone/gatherer/mem/MEMModel.java
r4501 r5589 1 package org.greenstone.gatherer.mem;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.mem; 38 38 39 import javax.swing.tree.DefaultTreeModel; 39 40 import org.greenstone.gatherer.Gatherer; 40 41 import org.greenstone.gatherer.mem.MEMNode; 41 import org.greenstone.gatherer.msm.MetadataSet;42 42 import org.greenstone.gatherer.util.SynchronizedTreeModelTools; 43 43 /** -
trunk/gli/src/org/greenstone/gatherer/mem/MetadataEditorManager.java
r5564 r5589 44 44 import javax.swing.text.*; 45 45 import javax.swing.tree.*; 46 import org.greenstone.gatherer.Dictionary; 46 47 import org.greenstone.gatherer.Gatherer; 47 48 import org.greenstone.gatherer.cdm.LanguageListCellRenderer; … … 51 52 import org.greenstone.gatherer.gui.SmarterTable; 52 53 import org.greenstone.gatherer.gui.SmarterTree; 54 import org.greenstone.gatherer.gui.SimpleMenuBar; 55 import org.greenstone.gatherer.gui.ModalDialog; 53 56 import org.greenstone.gatherer.mem.Attribute; 54 57 import org.greenstone.gatherer.mem.AttributeTableModel; … … 60 63 import org.greenstone.gatherer.valuetree.GValueNode; 61 64 import org.w3c.dom.*; 62 import org.greenstone.gatherer.gui.SimpleMenuBar;63 import org.greenstone.gatherer.gui.ModalDialog;64 65 65 66 /** 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. … … 143 144 this.self = this; 144 145 145 dialog_options[0] = Gatherer.dictionary.get("General.OK"); 146 dialog_options[1] = Gatherer.dictionary.get("General.Cancel"); 146 dialog_options[0] = Dictionary.newget("General.OK"); 147 dialog_options[1] = Dictionary.newget("General.Cancel"); 148 147 149 // Creation 148 150 setDefaultCloseOperation(DISPOSE_ON_CLOSE); 149 151 setModal(true); 150 152 setSize(SIZE); 151 setTitle(get("MEM.Title"));152 153 setJMenuBar(new SimpleMenuBar("editingmetadatasets")); 154 Dictionary.setText(this, "MEM.Title"); 155 153 156 JPanel content_pane = (JPanel) getContentPane(); 154 157 content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); … … 179 182 JPanel set_name_pane = new JPanel(); 180 183 set_name_pane.setOpaque(false); 181 JLabel set_name_label = new JLabel( get("MEM.Name"));184 JLabel set_name_label = new JLabel(); 182 185 set_name_label.setOpaque(false); 183 186 set_name_label.setPreferredSize(LABEL_SIZE); 187 Dictionary.setText(set_name_label, "MEM.Name"); 184 188 set_name = new JLabel(); 185 189 set_name.setBorder(BorderFactory.createLoweredBevelBorder()); … … 207 211 JPanel element_name_pane = new JPanel(); 208 212 element_name_pane.setOpaque(false); 209 JLabel element_name_label = new JLabel( get("MEM.Name"));213 JLabel element_name_label = new JLabel(); 210 214 element_name_label.setOpaque(false); 211 215 element_name_label.setPreferredSize(LABEL_SIZE); 216 Dictionary.setText(element_name_label, "MEM.Name"); 212 217 element_name = new JLabel(); 213 218 element_name.setBorder(BorderFactory.createLoweredBevelBorder()); … … 243 248 244 249 JPanel element_novalues_pane = new JPanel(); 245 250 246 251 keep_root_expanded_listener = new KeepTreeRootExpandedListener(); 247 252 … … 250 255 JPanel profile_name_pane = new JPanel(); 251 256 profile_name_pane.setOpaque(false); 252 JLabel profile_name_label = new JLabel( get("MEM.Name"));257 JLabel profile_name_label = new JLabel(); 253 258 profile_name_label.setOpaque(false); 254 259 profile_name_label.setPreferredSize(LABEL_SIZE); 260 Dictionary.setText(profile_name_label, "MEM.Name"); 255 261 profile_name = new JLabel(); 256 262 profile_name.setBorder(BorderFactory.createLoweredBevelBorder()); 257 263 profile_name.setOpaque(false); 258 264 259 265 JPanel profile_attributes_pane = new JPanel(); 260 266 profile_attributes_pane.setOpaque(false); … … 277 283 JPanel button_label_pane = new JPanel(); 278 284 button_label_pane.setOpaque(false); 279 JLabel attribute_label = new JLabel(get("MEM.Attribute")); 285 286 JLabel attribute_label = new JLabel(); 280 287 attribute_label.setOpaque(false); 281 //attribute_label.setHorizontalAlignment(JLabel.CENTER);282 288 attribute_label.setPreferredSize(LABEL_SIZE); 283 JLabel element_label = new JLabel(get("MEM.Element")); 289 Dictionary.setText(attribute_label, "MEM.Attribute"); 290 291 JLabel element_label = new JLabel(); 284 292 element_label.setOpaque(false); 285 //element_label.setHorizontalAlignment(JLabel.CENTER);286 293 element_label.setPreferredSize(LABEL_SIZE); 287 JLabel file_label = new JLabel(get("MEM.File")); 294 Dictionary.setText(element_label, "MEM.Element"); 295 296 JLabel file_label = new JLabel(); 288 297 file_label.setOpaque(false); 289 //element_label.setHorizontalAlignment(JLabel.CENTER);290 298 file_label.setPreferredSize(LABEL_SIZE); 291 JLabel set_label = new JLabel(get("MEM.Set")); 299 Dictionary.setText(file_label, "MEM.File"); 300 301 JLabel set_label = new JLabel(); 292 302 set_label.setOpaque(false); 293 //set_label.setHorizontalAlignment(JLabel.CENTER);294 303 set_label.setPreferredSize(LABEL_SIZE); 295 JLabel value_label = new JLabel(get("MEM.Value")); 304 Dictionary.setText(set_label, "MEM.Set"); 305 306 JLabel value_label = new JLabel(); 296 307 value_label.setOpaque(false); 297 //value_label.setHorizontalAlignment(JLabel.CENTER);298 308 value_label.setPreferredSize(LABEL_SIZE); 309 Dictionary.setText(value_label, "MEM.Value"); 299 310 300 311 JPanel inner_button_pane = new JPanel(); 301 312 inner_button_pane.setOpaque(false); 302 add_attribute = new JButton(get("MEM.Add")); 303 add_element = new JButton(get("MEM.Add")); 304 add_file = new JButton(get("MEM.Add")); 305 add_set = new JButton(get("MEM.Add")); 306 add_value = new JButton(get("MEM.Add")); 307 edit_attribute = new JButton(get("MEM.Edit")); 308 edit_value = new JButton(get("MEM.Edit")); 309 remove_attribute = new JButton(get("MEM.Remove")); 310 remove_element = new JButton(get("MEM.Remove")); 311 remove_file = new JButton(get("MEM.Remove")); 312 remove_set = new JButton(get("MEM.Remove")); 313 remove_value = new JButton(get("MEM.Remove")); 313 add_attribute = new JButton(); 314 Dictionary.setBoth(add_attribute, "MEM.Add", "MEM.Add_Attribute_Tooltip"); 315 add_element = new JButton(); 316 Dictionary.setBoth(add_element, "MEM.Add", "MEM.Add_Element_Tooltip"); 317 add_file = new JButton(); 318 Dictionary.setBoth(add_file, "MEM.Add", "MEM.Add_File_Tooltip"); 319 add_set = new JButton(); 320 Dictionary.setBoth(add_set, "MEM.Add", "MEM.Add_Set_Tooltip"); 321 add_value = new JButton(); 322 Dictionary.setBoth(add_value, "MEM.Add", "MEM.Add_Value_Tooltip"); 323 324 edit_attribute = new JButton(); 325 Dictionary.setBoth(edit_attribute, "MEM.Edit", "MEM.Edit_Attribute_Tooltip"); 326 edit_value = new JButton(); 327 Dictionary.setBoth(edit_value, "MEM.Edit", "MEM.Edit_Value_Tooltip"); 328 329 remove_attribute = new JButton(); 330 Dictionary.setBoth(remove_attribute, "MEM.Remove", "MEM.Remove_Attribute_Tooltip"); 331 remove_element = new JButton(); 332 Dictionary.setBoth(remove_element, "MEM.Remove", "MEM.Remove_Element_Tooltip"); 333 remove_file = new JButton(); 334 Dictionary.setBoth(remove_file, "MEM.Remove", "MEM.Remove_File_Tooltip"); 335 remove_set = new JButton(); 336 Dictionary.setBoth(remove_set, "MEM.Remove", "MEM.Remove_Set_Tooltip"); 337 remove_value = new JButton(); 338 Dictionary.setBoth(remove_value, "MEM.Remove", "MEM.Remove_Value_Tooltip"); 314 339 setControls(false, false, false, false, false, false, false, false, false, false, false, false); 315 340 316 close = new JButton(get("General.Close")); 341 close = new JButton(); 342 Dictionary.setBoth(close, "General.Close", "General.Close_Tooltip"); 317 343 318 344 add_element_action_listener = new AddElementActionListener(); … … 331 357 JPanel edit_set_pane = new JPanel(); 332 358 edit_set_pane.setOpaque(false); 359 333 360 // Connection 334 335 361 add_attribute.addActionListener(add_or_edit_attribute_action_listener); 336 362 add_element.addActionListener(add_element_action_listener); … … 361 387 set_attributes_scroll.setViewportView(set_attributes); 362 388 363 set_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2)));389 set_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2))); 364 390 set_attributes_pane.setLayout(new BorderLayout()); 365 391 set_attributes_pane.add(set_attributes_scroll, BorderLayout.CENTER); 366 392 367 set_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Set_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));393 set_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Set_Details")), BorderFactory.createEmptyBorder(2,2,2,2))); 368 394 set_details_pane.setLayout(new BorderLayout()); 369 395 //set_details_pane.add(set_name_pane, BorderLayout.NORTH); 370 396 set_details_pane.add(set_attributes_pane, BorderLayout.CENTER); 371 397 372 398 element_name_pane.setLayout(new BorderLayout()); 373 399 element_name_pane.add(element_name_label, BorderLayout.WEST); … … 376 402 element_attributes_scroll.setViewportView(element_attributes); 377 403 378 element_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2)));404 element_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2))); 379 405 element_attributes_pane.setLayout(new BorderLayout()); 380 406 element_attributes_pane.add(element_attributes_scroll, BorderLayout.CENTER); 381 407 382 element_values_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Values")), BorderFactory.createEmptyBorder(2,2,2,2)));408 element_values_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Values")), BorderFactory.createEmptyBorder(2,2,2,2))); 383 409 //element_values_pane.setLayout(new BorderLayout()); 384 410 //element_values_pane.add(new JScrollPane(element_values), BorderLayout.CENTER); … … 386 412 element_values_pane.add(element_novalues_pane, BLANK); 387 413 element_values_pane.add(new JScrollPane(element_values), VALUES); 388 414 389 415 element_inner_pane.setLayout(new GridLayout(2,1)); 390 416 element_inner_pane.add(element_attributes_pane); 391 417 element_inner_pane.add(element_values_pane); 392 418 393 element_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Element_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));419 element_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Element_Details")), BorderFactory.createEmptyBorder(2,2,2,2))); 394 420 element_details_pane.setLayout(new BorderLayout()); 395 421 //element_details_pane.add(element_name_pane, BorderLayout.NORTH); … … 399 425 profile_name_pane.add(profile_name_label, BorderLayout.WEST); 400 426 profile_name_pane.add(profile_name, BorderLayout.CENTER); 401 427 402 428 profile_attributes_scroll.setViewportView(profile_attributes); 403 429 404 profile_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Profiles")), BorderFactory.createEmptyBorder(2,2,2,2)));430 profile_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Profiles")), BorderFactory.createEmptyBorder(2,2,2,2))); 405 431 profile_attributes_pane.setLayout(new BorderLayout()); 406 432 profile_attributes_pane.add(profile_attributes_scroll, BorderLayout.CENTER); 407 408 profile_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder( get("MEM.Profile_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));433 434 profile_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.newget("MEM.Profile_Details")), BorderFactory.createEmptyBorder(2,2,2,2))); 409 435 profile_details_pane.setLayout(new BorderLayout()); 410 436 //profile_details_pane.add(profile_name_pane, BorderLayout.NORTH); 411 437 profile_details_pane.add(profile_attributes_pane, BorderLayout.CENTER); 412 438 413 439 details_pane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); 414 440 details_pane.setLayout(card_layout); … … 488 514 mds_tree = null; 489 515 target = null; 516 490 517 // Dispose of inner dialogs 491 if (add_element_action_listener != null) {518 if (add_element_action_listener != null) { 492 519 add_element_action_listener.dispose(); 493 520 add_element_action_listener = null; 494 521 } 495 if (add_or_edit_attribute_action_listener != null) {522 if (add_or_edit_attribute_action_listener != null) { 496 523 add_or_edit_attribute_action_listener.dispose(); 497 524 add_or_edit_attribute_action_listener = null; 498 525 } 499 if (add_or_edit_value_action_listener != null) {526 if (add_or_edit_value_action_listener != null) { 500 527 add_or_edit_value_action_listener.dispose(); 501 528 add_or_edit_value_action_listener = null; 502 529 } 503 ///ystem.err.println("Dispose MetadataEditorManager.");504 530 super.dispose(); 505 531 } 506 532 507 private String get(String key) {508 return get(key, (String[])null);509 }510 511 private String get(String key, String arg) {512 String[] args = new String[1];513 args[0] = arg;514 return get(key, args);515 }516 517 private String get(String key, String[] args) {518 if(key.indexOf(".") == -1) {519 key = "MEM." + key;520 }521 return Gatherer.dictionary.get(key, args);522 }523 533 524 534 private void setControls(boolean a_s, boolean r_s, boolean a_f, boolean r_f, boolean a_e, boolean r_e, boolean a_a, boolean e_a, boolean r_a, boolean a_v, boolean e_v, boolean r_v) { … … 554 564 setSize(ADD_OR_EDIT_ATTRIBUTE_SIZE); 555 565 name_to_values = new HashMap(); 566 556 567 // Creation 557 568 JPanel content_pane = (JPanel) getContentPane(); … … 562 573 JPanel target_pane = new JPanel(); 563 574 target_pane.setOpaque(false); 564 JLabel target_label = new JLabel( get("MEM.Target"));575 JLabel target_label = new JLabel(); 565 576 target_label.setOpaque(false); 566 577 target_label.setPreferredSize(LABEL_SIZE); 578 Dictionary.setText(target_label, "MEM.Target"); 567 579 target = new JLabel(); 568 580 target.setOpaque(false); 569 581 570 571 582 JPanel name_pane = new JPanel(); 572 583 name_pane.setOpaque(false); 573 JLabel name_label = new JLabel( get("MEM.Name"));584 JLabel name_label = new JLabel(); 574 585 name_label.setOpaque(false); 575 586 name_label.setPreferredSize(LABEL_SIZE); 587 Dictionary.setText(name_label, "MEM.Name"); 576 588 name = new GComboBox(); 577 589 name.setEditable(true); 590 Dictionary.setTooltip(name, "MEM.Attribute_Name_Tooltip"); 578 591 579 592 JPanel language_pane = new JPanel(); 580 593 language_pane.setOpaque(false); 581 JLabel language_label = new JLabel( get("MEM.Language"));594 JLabel language_label = new JLabel(); 582 595 language_label.setOpaque(false); 583 596 language_label.setPreferredSize(LABEL_SIZE); 597 Dictionary.setText(language_label, "MEM.Language"); 584 598 language_box = new JComboBox(Gatherer.g_man.config_pane.getLanguageCodes().toArray()); 585 599 language_box.setRenderer(new LanguageListCellRenderer()); 600 Dictionary.setTooltip(language_box, "MEM.Attribute_Language_Tooltip"); 586 601 587 602 JPanel center_pane = new JPanel(); 588 603 center_pane.setOpaque(false); 589 value = new ComboArea( get("MEM.Values"), LABEL_SIZE);604 value = new ComboArea(Dictionary.newget("MEM.Values"), LABEL_SIZE); 590 605 value.setOpaque(false); 606 591 607 JTextArea v_text_area = (JTextArea) value.getTextComponent(); 592 608 v_text_area.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 594 610 v_text_area.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 595 611 v_text_area.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 612 Dictionary.setTooltip(v_text_area, "MEM.Attribute_Value_Tooltip"); 613 596 614 JPanel button_pane = new JPanel(); 597 615 button_pane.setOpaque(false); 598 ok_button = new JButton(get("General.OK")); 599 cancel_button = new JButton(get("General.Cancel")); 600 // Connection 616 ok_button = new JButton(); 617 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 618 cancel_button = new JButton(); 619 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 620 621 // Connection 601 622 TextFieldEnabler ok_button_enabler = new TextFieldEnabler(ok_button); 602 623 cancel_button.addActionListener(this); … … 604 625 ok_button.addActionListener(this); 605 626 ok_button_enabler.add((JTextComponent)name.getEditor()); // Assuming the default editor is a JTextField! 606 // Layout 627 628 // Layout 607 629 target_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 608 630 target_pane.setLayout(new BorderLayout()); 609 631 target_pane.add(target_label, BorderLayout.WEST); 610 632 target_pane.add(target, BorderLayout.CENTER); 611 633 612 634 language_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 613 635 language_pane.setLayout(new BorderLayout()); … … 784 806 if(source == add_attribute) { 785 807 add_type = true; 786 setTitle(get("MEM.AddAttribute"));808 Dictionary.setText(this, "MEM.AddAttribute"); 787 809 if(current_collection_file != null) { 788 810 // Name is empty in this one, however values must be the current elements in the collection. … … 809 831 } 810 832 add_type = false; 811 setTitle(get("MEM.EditAttribute"));833 Dictionary.setText(this, "MEM.EditAttribute"); 812 834 String name_str = (String) model.getValueAt(current_attribute, 0); 813 835 String value_str = (String) model.getValueAt(current_attribute, model.getColumnCount() - 1); … … 864 886 else { 865 887 cont = false; 866 JOptionPane.showMessageDialog(self, get("MEM.Attribute_Already_Exists"),get("General.Error"), JOptionPane.ERROR_MESSAGE);888 JOptionPane.showMessageDialog(self, Dictionary.newget("MEM.Attribute_Already_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 867 889 } 868 890 … … 896 918 else { 897 919 cont = false; 898 JOptionPane.showMessageDialog(self, get("MEM.Attribute_Already_Exists"),get("General.Error"), JOptionPane.ERROR_MESSAGE);920 JOptionPane.showMessageDialog(self, Dictionary.newget("MEM.Attribute_Already_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 899 921 } 900 922 … … 963 985 JPanel center_pane = new JPanel(); 964 986 center_pane.setOpaque(false); 987 965 988 JPanel set_pane = new JPanel(); 966 989 set_pane.setOpaque(false); 967 JLabel set_label = new JLabel( get("MEM.Set"));990 JLabel set_label = new JLabel(); 968 991 set_label.setOpaque(false); 969 992 set_label.setPreferredSize(LABEL_SIZE); 993 Dictionary.setText(set_label, "MEM.Set"); 970 994 set_field = new JLabel(); 971 995 set_field.setOpaque(false); 996 972 997 JPanel name_pane = new JPanel(); 973 998 name_pane.setOpaque(false); 974 JLabel name_label = new JLabel( get("MEM.Name"));999 JLabel name_label = new JLabel(); 975 1000 name_label.setOpaque(false); 976 1001 name_label.setPreferredSize(LABEL_SIZE); 1002 Dictionary.setText(name_label, "MEM.Name"); 977 1003 name_field = new JTextField(); 978 1004 name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 980 1006 name_field.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 981 1007 name_field.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1008 Dictionary.setTooltip(name_field, "MEM.Element_Name_Tooltip"); 1009 982 1010 JPanel button_pane = new JPanel(); 983 1011 button_pane.setOpaque(false); 984 ok_button = new JButton(get("General.OK")); 985 cancel_button = new JButton(get("General.Cancel")); 1012 1013 ok_button = new JButton(); 1014 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 1015 cancel_button = new JButton(); 1016 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 1017 986 1018 TextFieldEnabler ok_button_enabler = new TextFieldEnabler(ok_button); 987 // Connection 1019 1020 // Connection 988 1021 cancel_button.addActionListener(this); 989 1022 ok_button.addActionListener(this); 990 1023 ok_button_enabler.add(name_field); 991 // Layout 1024 1025 // Layout 992 1026 set_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 993 1027 set_pane.setLayout(new BorderLayout()); … … 1015 1049 setLocation((Gatherer.config.screen_size.width - ADD_ELEMENT_SIZE.width) / 2, (Gatherer.config.screen_size.height - ADD_ELEMENT_SIZE.height) / 2); 1016 1050 } 1051 1017 1052 /** 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 1018 1053 * @param event An <strong>ActionEvent</strong> containing information about the event. … … 1039 1074 // Otherwise show an error message and do not proceed. 1040 1075 else { 1041 JOptionPane.showMessageDialog(self, get("MEM.Element_Already_Exists"),get("General.Error"), JOptionPane.ERROR_MESSAGE);1076 JOptionPane.showMessageDialog(self, Dictionary.newget("MEM.Element_Already_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 1042 1077 } 1043 1078 name_str = null; … … 1046 1081 // Dispose 1047 1082 setVisible(false); 1048 1049 1083 } 1050 1084 else { … … 1059 1093 // Warn the user that they can't do that dave. 1060 1094 else { 1061 JOptionPane.showMessageDialog(self, get("MEM.Cannot_Add_Elements_To_Greenstone_MDS"),get("General.Error"), JOptionPane.ERROR_MESSAGE);1095 JOptionPane.showMessageDialog(self, Dictionary.newget("MEM.Cannot_Add_Elements_To_Greenstone_MDS"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 1062 1096 } 1063 1097 } … … 1086 1120 setModal(true); 1087 1121 setSize(ADD_FILE_SIZE); 1088 1122 // Creation 1089 1123 JPanel content_pane = (JPanel) getContentPane(); 1090 1124 content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); … … 1093 1127 JPanel profile_pane = new JPanel(); 1094 1128 profile_pane.setOpaque(false); 1095 JLabel profile_label = new JLabel( get("MEM.Profile"));1129 JLabel profile_label = new JLabel(); 1096 1130 profile_label.setOpaque(false); 1097 1131 profile_label.setPreferredSize(LABEL_SIZE); 1132 Dictionary.setText(profile_label, "MEM.Profile"); 1133 1098 1134 JPanel name_pane = new JPanel(); 1099 1135 name_pane.setOpaque(false); 1100 JLabel name_label = new JLabel( get("MEM.Name"));1136 JLabel name_label = new JLabel(); 1101 1137 name_label.setOpaque(false); 1102 1138 name_label.setPreferredSize(LABEL_SIZE); 1139 Dictionary.setText(name_label, "MEM.Name"); 1103 1140 name_field = new JTextField(); 1104 1141 name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 1106 1143 name_field.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 1107 1144 name_field.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1145 Dictionary.setTooltip(name_field, "MEM.Profile_Name_Tooltip"); 1146 1108 1147 JPanel button_pane = new JPanel(); 1109 1148 button_pane.setOpaque(false); 1110 ok_button = new JButton(get("General.OK")); 1111 cancel_button = new JButton(get("General.Cancel")); 1149 1150 ok_button = new JButton(); 1151 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 1152 cancel_button = new JButton(); 1153 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 1154 1112 1155 TextFieldEnabler ok_button_enabler = new TextFieldEnabler(ok_button); 1113 // Connection 1156 1157 // Connection 1114 1158 cancel_button.addActionListener(this); 1115 1159 ok_button.addActionListener(this); 1116 1160 ok_button_enabler.add(name_field); 1117 // Layout 1161 1162 // Layout 1118 1163 profile_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 1119 1164 profile_pane.setLayout(new BorderLayout()); … … 1157 1202 // Otherwise warn the user and don't hide the prompt. 1158 1203 else { 1159 JOptionPane.showMessageDialog(self, get("MEM.File_Already_Exists"),get("General.Error"), JOptionPane.ERROR_MESSAGE);1204 JOptionPane.showMessageDialog(self, Dictionary.newget("MEM.File_Already_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 1160 1205 } 1161 1206 name_str = null; … … 1163 1208 else if(source == cancel_button) { 1164 1209 setVisible(false); 1165 1166 1210 } 1167 1211 else { … … 1192 1236 setModal(true); 1193 1237 setSize(ADD_SET_SIZE); 1194 setTitle(get("MEM.AddSet")); 1195 // Creation 1238 Dictionary.setText(this, "MEM.AddSet"); 1239 1240 // Creation 1196 1241 JPanel content_pane = (JPanel) getContentPane(); 1197 1242 content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); … … 1201 1246 JPanel namespace_pane = new JPanel(); 1202 1247 namespace_pane.setOpaque(false); 1203 JLabel namespace_label = new JLabel( get("MEM.Namespace"));1248 JLabel namespace_label = new JLabel(); 1204 1249 namespace_label.setOpaque(false); 1205 1250 namespace_label.setPreferredSize(LABEL_SIZE); 1251 Dictionary.setText(namespace_label, "MEM.Namespace"); 1206 1252 namespace_field = new JTextField(); 1207 1253 namespace_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 1209 1255 namespace_field.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 1210 1256 namespace_field.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1257 Dictionary.setTooltip(namespace_field, "MEM.Set_Namespace_Tooltip"); 1211 1258 1212 1259 JPanel name_pane = new JPanel(); 1213 1260 name_pane.setOpaque(false); 1214 JLabel name_label = new JLabel( get("MEM.Name"));1261 JLabel name_label = new JLabel(); 1215 1262 name_label.setOpaque(false); 1216 1263 name_label.setPreferredSize(LABEL_SIZE); 1264 Dictionary.setText(name_label, "MEM.Name"); 1217 1265 name_field = new JTextField(); 1218 1266 name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 1220 1268 name_field.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 1221 1269 name_field.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1270 Dictionary.setTooltip(name_field, "MEM.Set_Name_Tooltip"); 1222 1271 1223 1272 JPanel button_pane = new JPanel(); 1224 1273 button_pane.setOpaque(false); 1225 ok_button = new JButton(get("General.OK")); 1226 ok_button.setEnabled(false); 1227 cancel_button = new JButton(get("General.Cancel")); 1274 1275 ok_button = new JButton(); 1276 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 1277 cancel_button = new JButton(); 1278 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 1228 1279 TextFieldEnabler ok_button_enabler = new TextFieldEnabler(ok_button); 1229 // Connection 1280 1281 // Connection 1230 1282 cancel_button.addActionListener(this); 1231 1283 ok_button.addActionListener(this); 1232 1284 ok_button_enabler.add(name_field); 1233 1285 ok_button_enabler.add(namespace_field); 1234 // Layout 1286 1287 // Layout 1235 1288 namespace_pane.setBorder(BorderFactory.createEmptyBorder(0,0,5,0)); 1236 1289 namespace_pane.setLayout(new BorderLayout()); … … 1277 1330 // Otherwise show a warning. 1278 1331 else { 1279 JOptionPane.showMessageDialog(self, get("MEM.Set_Already_Exists"),get("General.Error"), JOptionPane.ERROR_MESSAGE);1332 JOptionPane.showMessageDialog(self, Dictionary.newget("MEM.Set_Already_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 1280 1333 } 1281 1334 name_str = null; … … 1317 1370 this.setModal(true); 1318 1371 this.setSize(ADD_OR_EDIT_VALUE_SIZE); 1372 1319 1373 // Create 1320 1374 JPanel content_pane = (JPanel) getContentPane(); … … 1326 1380 JPanel subject_tree_pane = new JPanel(); 1327 1381 subject_tree_pane.setOpaque(false); 1328 JLabel subject_tree_label = new JLabel( get("MEM.Subject"));1382 JLabel subject_tree_label = new JLabel(); 1329 1383 subject_tree_label.setOpaque(false); 1384 Dictionary.setText(subject_tree_label, "MEM.Subject"); 1330 1385 subject_tree = new SmarterTree(); 1331 1386 subject_tree.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 1335 1390 JPanel value_pane = new JPanel(); 1336 1391 value_pane.setOpaque(false); 1337 JLabel value_label = new JLabel( get("MEM.Value"));1392 JLabel value_label = new JLabel(); 1338 1393 value_label.setOpaque(false); 1394 Dictionary.setText(value_label, "MEM.Value"); 1339 1395 value = new JTextArea(); 1340 1396 value.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 1342 1398 value.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 1343 1399 value.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1400 Dictionary.setTooltip(value, "MEM.Value_Tooltip"); 1401 1344 1402 JPanel alias_pane = new JPanel(); 1345 1403 alias_pane.setOpaque(false); 1346 JLabel alias_label = new JLabel( get("MEM.Alias"));1404 JLabel alias_label = new JLabel(); 1347 1405 alias_label.setOpaque(false); 1348 1406 alias_label.setPreferredSize(LABEL_SIZE); 1407 Dictionary.setText(alias_label, "MEM.Alias"); 1408 1349 1409 alias = new JTextField(); 1350 1410 alias.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 1352 1412 alias.setSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false)); 1353 1413 alias.setSelectedTextColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false)); 1414 Dictionary.setText(alias, "MEM.Alias_Tooltip"); 1415 1354 1416 JPanel button_pane = new JPanel(); 1355 1417 button_pane.setOpaque(false); 1356 ok_button = new JButton(get("General.OK")); 1418 1419 ok_button = new JButton(); 1357 1420 ok_button.setEnabled(false); 1421 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 1422 cancel_button = new JButton(); 1423 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 1358 1424 TextFieldEnabler ok_button_enabler = new TextFieldEnabler(ok_button); 1359 cancel_button = new JButton(get("General.Cancel")); 1425 1360 1426 // Connect 1361 1427 ok_button_enabler.add(value); … … 1363 1429 ok_button.addActionListener(this); 1364 1430 subject_tree.addTreeSelectionListener(this); 1431 1365 1432 // Layout 1366 1433 subject_tree_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); … … 1485 1552 value.setText(""); 1486 1553 alias.setText(""); 1487 setTitle(get("MEM.AddValue"));1554 Dictionary.setText(this, "MEM.AddValue"); 1488 1555 } 1489 1556 else { … … 1497 1564 value.setText(current_value_node.toString()); 1498 1565 alias.setText(current_value_node.getAlias()); 1499 setTitle(get("MEM.EditValue"));1566 Dictionary.setText(this, "MEM.EditValue"); 1500 1567 } 1501 1568 model = null; … … 1553 1620 // I don't know why this is causing a problem even after the dialog has been disposed, but it is. 1554 1621 GValueModel value_model = Gatherer.c_man.msm.getValueTree(current_element); 1555 if (value_model != null) {1622 if (value_model != null) { 1556 1623 value_model.removeTreeModelListener(keep_root_expanded_listener); 1557 1624 } … … 1586 1653 public void actionPerformed(ActionEvent event) { 1587 1654 if(current_attribute != -1) { 1588 int result = JOptionPane.showOptionDialog(self, get("MEM.Confirm_Removal", get("MEM.Attribute")),get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);1655 int result = JOptionPane.showOptionDialog(self, Dictionary.newget("MEM.Confirm_Removal", Dictionary.newget("MEM.Attribute")), Dictionary.newget("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]); 1589 1656 // Remove this attribute 1590 1657 if(result == 0) { … … 1634 1701 public void actionPerformed(ActionEvent event) { 1635 1702 if(current_element != null) { 1636 int result = JOptionPane.showOptionDialog(self, get("MEM.Confirm_Removal", get("MEM.Element")),get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);1703 int result = JOptionPane.showOptionDialog(self, Dictionary.newget("MEM.Confirm_Removal", Dictionary.newget("MEM.Element")), Dictionary.newget("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]); 1637 1704 // Remove this attribute 1638 1705 if(result == 0) { … … 1662 1729 public void actionPerformed(ActionEvent event) { 1663 1730 if(current_collection_file != null) { 1664 int result = JOptionPane.showOptionDialog(self, get("MEM.Confirm_Removal", get("MEM.File")),get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);1731 int result = JOptionPane.showOptionDialog(self, Dictionary.newget("MEM.Confirm_Removal", Dictionary.newget("MEM.File")), Dictionary.newget("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]); 1665 1732 // Remove the current collection file profile from the profiler. 1666 1733 if(result == 0) { … … 1687 1754 public void actionPerformed(ActionEvent event) { 1688 1755 if(current_set != null) { 1689 int result = JOptionPane.showOptionDialog(self, get("MEM.Confirm_Removal", get("MEM.Set")),get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);1756 int result = JOptionPane.showOptionDialog(self, Dictionary.newget("MEM.Confirm_Removal", Dictionary.newget("MEM.Set")), Dictionary.newget("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]); 1690 1757 // Remove the currently selected set 1691 1758 if(result == 0) { … … 1712 1779 public void actionPerformed(ActionEvent event) { 1713 1780 if(current_value_node != null) { 1714 int result = JOptionPane.showOptionDialog(self, get("MEM.Confirm_Removal", get("MEM.Value")),get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);1781 int result = JOptionPane.showOptionDialog(self, Dictionary.newget("MEM.Confirm_Removal", Dictionary.newget("MEM.Value")), Dictionary.newget("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]); 1715 1782 // Remove the current selected value 1716 1783 if(result == 0) { … … 1842 1909 String source = (String) sources.get(i); 1843 1910 String action = Gatherer.c_man.msm.profiler.getAction(current_collection_file, source); 1844 if (action == null) {1845 action = get("MEM.Ignore");1911 if (action == null) { 1912 action = Dictionary.newget("MEM.Ignore"); 1846 1913 } 1847 1914 attributes.add(new Attribute(source, action)); 1848 1915 } 1849 atm = new AttributeTableModel(attributes, get("MEM.Source"), get("MEM.Target"),get("MEM.Ignore"));1916 atm = new AttributeTableModel(attributes, Dictionary.newget("MEM.Source"), Dictionary.newget("MEM.Target"), Dictionary.newget("MEM.Ignore")); 1850 1917 //current_node.setModel(atm); 1851 1918 } … … 1861 1928 atm = current_node.getModel(); 1862 1929 if(atm == null) { 1863 atm = new AttributeTableModel(current_element.getAttributes(), get("MEM.Name"), get("MEM.Language_Code"),get("MEM.Value"), "");1930 atm = new AttributeTableModel(current_element.getAttributes(), Dictionary.newget("MEM.Name"), Dictionary.newget("MEM.Language_Code"), Dictionary.newget("MEM.Value"), ""); 1864 1931 //current_node.setModel(atm); 1865 1932 } … … 1899 1966 attribute = null; 1900 1967 } 1901 atm = new AttributeTableModel(attributes, get("MEM.Name"),get("MEM.Value"), "");1968 atm = new AttributeTableModel(attributes, Dictionary.newget("MEM.Name"), Dictionary.newget("MEM.Value"), ""); 1902 1969 //current_node.setModel(atm); 1903 1970 temp = null;
Note:
See TracChangeset
for help on using the changeset viewer.