Changeset 5589
- Timestamp:
- 2003-10-06T17:55:00+13:00 (21 years ago)
- Location:
- trunk/gli
- Files:
-
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/classes/dictionary.properties
r5582 r5589 337 337 CreatePane.Build_Progress:Build Progress 338 338 CreatePane.Cancel_Build:Cancel Build 339 CreatePane.Cancel_Build_Tooltip: Cancelthe collection formation process339 CreatePane.Cancel_Build_Tooltip:Stop the collection formation process 340 340 CreatePane.Copy_Progress:Copy Progress 341 341 CreatePane.Document_Count:Collection contains {0} files. … … 567 567 #*******Metadata Edit Manager ************** 568 568 MEM.Add:Add 569 MEM.Add_Attribute_Tooltip:Add a new attribute to the selected item 570 MEM.Add_Element_Tooltip:Add a new element to the selected set 571 MEM.Add_Set_Tooltip:Add a new metadata set 572 MEM.Add_Value_Tooltip:Add a new value to the selected element 569 573 MEM.AddAttribute:Add Attribute 570 574 MEM.AddSet:Add Set 571 575 MEM.AddValue:Add Value 572 576 MEM.Alias:Alias 577 MEM.Alias_Tooltip:An alias for this value 573 578 MEM.Attribute:Attribute 574 579 MEM.Attribute_Already_Exists:This attribute already exists. 580 MEM.Attribute_Name_Tooltip:The name of the new attribute 581 MEM.Attribute_Language_Tooltip:The language of the new attribute 582 MEM.Attribute_Value_Tooltip:The value of the new attribute 575 583 MEM.Attributes:Attributes 576 584 MEM.Cannot_Add_Elements_To_Greenstone_MDS:You cannot manually add elements to the Greenstone Metadata. If\nnecessary create a new set, then add your new element to it instead. … … 578 586 MEM.Confirm_Removal_Title:Confirm Removal 579 587 MEM.Edit:Edit 588 MEM.Edit_Attribute_Tooltip:Change the value of the selected attribute 589 MEM.Edit_Value_Tooltip:Change the selected value 580 590 MEM.EditAttribute:Edit Attribute 581 591 MEM.EditValue:Edit Value 582 592 MEM.Element:Element 593 MEM.Element_Name_Tooltip:The name of the new element 583 594 MEM.Element_Details:Metadata Element Details 584 595 MEM.File:Profile … … 592 603 MEM.Profile_Details:Profile Details 593 604 MEM.Remove:Remove 605 MEM.Remove_Attribute_Tooltip:Remove the selected attribute 606 MEM.Remove_Element_Tooltip:Remove the selected element from the set 607 MEM.Remove_Set_Tooltip:Remove the selected set 608 MEM.Remove_Value_Tooltip:Remove the selected value 594 609 MEM.Set:Set 595 610 MEM.Set_Details:Metadata Set Details 611 MEM.Set_Name_Tooltip:The name of the new metadata set 612 MEM.Set_Namespace_Tooltip:The unique namespace for the new metadata set 596 613 MEM.Source:From 597 614 MEM.Subject:Subject … … 599 616 MEM.Title:Edit Metadata Sets 600 617 MEM.Value:Value 618 MEM.Value_Tooltip:The new value 601 619 MEM.Values:Values 602 620 #************************** … … 738 756 MSMPrompt.Attribute:Attribute 739 757 MSMPrompt.AssignedValues:\nAssigned Values:\n{0} 740 MSMPrompt.Cancel:Cancel741 758 MSMPrompt.Current_Details:Details of existing Metadata Element 742 759 MSMPrompt.Current_Values:Current Values … … 765 782 MSMPrompt.New_Details:Details of new Metadata Element 766 783 MSMPrompt.New_Name:New Name 784 MSMPrompt.New_Name_Tooltip:Enter the new element name 767 785 MSMPrompt.New_Value:Imported Value 768 786 MSMPrompt.No_Details:No Details Available … … 779 797 MSMPrompt.Select:Merge with Element 780 798 MSMPrompt.Select_Element_Add:Add 799 MSMPrompt.Select_Element_Add_Tooltip:Add the metadata element to the selected set 781 800 MSMPrompt.Select_Element_Element:Select Element: 801 MSMPrompt.Select_Element_Element_Tooltip:Select the metadata element to import as 782 802 MSMPrompt.Select_Element_Ignore:Ignore 783 MSMPrompt.Select_Element_Instructions:The metadata element {0} cannot be automatically imported into the collection. Select a metadata set and either:\n(1) press 'Add' to add the metadata to that set (only if there is not already {0} metadata in the set), or\n(2) choose an element and press 'Merge' to import {0} metadata to this element. 803 MSMPrompt.Select_Element_Ignore_Tooltip:Ignore this metadata element 804 MSMPrompt.Select_Element_Instructions:The metadata element {0} cannot be automatically imported into the collection. Select a metadata set and either:\n(1) press 'Add' to add the metadata to that set (only if there is not already {0} metadata in the set), or\n(2) choose an element and press 'Merge' to import {0} metadata to this element, or\n(3) ignore this metadata element. 784 805 MSMPrompt.Select_Element_Merge:Merge 806 MSMPrompt.Select_Element_Merge_Tooltip:Map the metadata element to the specified element in the selected set 785 807 MSMPrompt.Select_Element_Original:Original element name: 786 808 MSMPrompt.Select_Element_Set:Select Set: 809 MSMPrompt.Select_Element_Set_Tooltip:Select the metadata set to import into 787 810 MSMPrompt.Select_Element_Title:Importing Metadata 788 811 MSMPrompt.Select_Set_Instructions:The metadata element {0} cannot be automatically imported into the collection, as it matches no existing metadata set. Select a default metadata set to add this and subsequent metadata elements to. … … 852 875 Preferences.Connection.Library_Path:Library path 853 876 Preferences.Connection.Proxy_Host:Proxy host 877 Preferences.Connection.Proxy_Host_Tooltip:The address of your proxy server 854 878 Preferences.Connection.Proxy_Port:Proxy port 879 Preferences.Connection.Proxy_Port_Tooltip:The port number of your proxy server 855 880 Preferences.Connection.Use_Proxy:Use proxy connection? 856 881 Preferences.General:General -
trunk/gli/src/org/greenstone/gatherer/gui/AboutDialog.java
r5345 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 42 43 import org.greenstone.gatherer.Gatherer; 43 44 import org.greenstone.gatherer.util.Utility; 45 44 46 /** 45 47 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 48 50 49 51 // RICOH SOURCE CODE PUBLIC LICENSE - http://www.risource.org/RPL/RPL-1.0A.shtml 50 51 52 public class AboutDialog 52 53 extends JDialog { … … 58 59 59 60 public AboutDialog(JFrame parent) { 60 super(parent, get("AboutDialog.Title"), true);61 super(parent, Dictionary.newget("AboutDialog.Title"), true); 61 62 this.self = this; 62 63 setSize(SIZE); … … 68 69 JLabel icon_label = new JLabel(scaled_icon); 69 70 JPanel title_pane = new JPanel(); 70 JLabel title_one_label = new JLabel(get("AboutDialog.Title_One")); 71 JLabel title_two_label = new JLabel(Utility.PROGRAM_NAME + " " + Utility.PROGRAM_VERSION + " " + get("AboutDialog.Date")); 72 JLabel title_three_label = new JLabel(get("AboutDialog.Title_Two")); 73 JLabel copyright_label = new JLabel(get("AboutDialog.Copyright")); 71 JLabel title_one_label = new JLabel(); 72 Dictionary.setText(title_one_label, "AboutDialog.Title_One"); 73 JLabel title_two_label = new JLabel(Utility.PROGRAM_NAME + " " + Utility.PROGRAM_VERSION + " " + Dictionary.newget("AboutDialog.Date")); 74 JLabel title_three_label = new JLabel(); 75 Dictionary.setText(title_three_label, "AboutDialog.Title_Two"); 76 JLabel copyright_label = new JLabel(); 77 Dictionary.setText(copyright_label, "AboutDialog.Copyright"); 78 74 79 JTextArea text = new JTextArea(); 75 80 text.setLineWrap(true); 76 81 text.setWrapStyleWord(true); 82 77 83 JPanel button_pane = new JPanel(); 78 close_button = new JButton(get("General.Close")); 84 close_button = new JButton(); 85 Dictionary.setBoth(close_button, "General.Close", "General.Close_Tooltip"); 79 86 80 87 // Connection … … 104 111 content_pane.add(new JScrollPane(text), BorderLayout.CENTER); 105 112 content_pane.add(button_pane, BorderLayout.SOUTH); 113 106 114 // Build text content 107 text.append( get("AboutDialog.Java_Req"));115 text.append(Dictionary.newget("AboutDialog.Java_Req")); 108 116 text.append("\n"); 109 text.append( get("AboutDialog.Java_Req_One"));117 text.append(Dictionary.newget("AboutDialog.Java_Req_One")); 110 118 text.append("\n"); 111 text.append( get("AboutDialog.Java_Req_Two"));119 text.append(Dictionary.newget("AboutDialog.Java_Req_Two")); 112 120 text.append("\n\n"); 113 text.append("*****" + get("AboutDialog.Acknowledgement") + "*****");121 text.append("*****" + Dictionary.newget("AboutDialog.Acknowledgement") + "*****"); 114 122 text.append("\n\n"); 115 text.append( get("AboutDialog.Item0"));123 text.append(Dictionary.newget("AboutDialog.Item0")); 116 124 text.append("\n\n"); 117 text.append( get("AboutDialog.Item1"));125 text.append(Dictionary.newget("AboutDialog.Item1")); 118 126 text.append("\n\n"); 119 text.append( get("AboutDialog.Item2"));127 text.append(Dictionary.newget("AboutDialog.Item2")); 120 128 text.append("\n\n"); 121 text.append( get("AboutDialog.Item3"));129 text.append(Dictionary.newget("AboutDialog.Item3")); 122 130 text.append("\n\n"); 123 text.append("*****" + get("AboutDialog.Thanks") + "*****");131 text.append("*****" + Dictionary.newget("AboutDialog.Thanks") + "*****"); 124 132 text.append("\n\n"); 125 text.append( get("AboutDialog.Item4"));133 text.append(Dictionary.newget("AboutDialog.Item4")); 126 134 text.append("\n\n"); 127 text.append( get("AboutDialog.Item5"));135 text.append(Dictionary.newget("AboutDialog.Item5")); 128 136 text.append("\n\n"); 129 text.append( get("AboutDialog.Item6"));137 text.append(Dictionary.newget("AboutDialog.Item6")); 130 138 text.append("\n\n"); 131 text.append( get("AboutDialog.Item7"));139 text.append(Dictionary.newget("AboutDialog.Item7")); 132 140 text.append("\n\n"); 133 text.append(get("AboutDialog.Item8")); 134 141 text.append(Dictionary.newget("AboutDialog.Item8")); 135 142 text.setCaretPosition(0); 136 143 … … 148 155 } 149 156 } 150 151 static private String get(String key) {152 if(key.indexOf(".") == -1) {153 key = "AboutDialog." + key;154 }155 return Gatherer.dictionary.get(key);156 }157 157 } -
trunk/gli/src/org/greenstone/gatherer/gui/BuildOptions.java
r4933 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.io.*; 39 40 import java.util.*; … … 41 42 import org.greenstone.gatherer.util.ArrayTools; 42 43 import org.greenstone.gatherer.util.Utility; 44 43 45 /** This data-only class contains all of the import and build options which persist between sessions, which currently is all of them. 44 46 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 163 165 } 164 166 /** This method returns a copy of this current <strong>BuildOptions</strong> object. Tried using stupid <i>Clonable</i> interface but it didn't work. 165 166 167 * @return A <strong>BuildOptions</strong> object with the same settings as this one. 168 */ 167 169 public BuildOptions copy() { 168 170 BuildOptions options = new BuildOptions(); … … 201 203 } 202 204 /** When called this method returns the required arguments selected by the user. Only those arguments that are selected are returned, and even then some are never returned (i.e -out which is handled within the GShells instead). 203 204 205 205 * @param type The type of process that will recieve these arguments as a <strong>byte</strong>. 206 * @return A <strong>String[]</strong> containing the arguments and any required parameters as set by the user. 207 */ 206 208 public String[] getArguments(byte type) { 207 209 ArrayList arguments = new ArrayList(); -
trunk/gli/src/org/greenstone/gatherer/gui/Coloring.java
r4675 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.gui; 37 38 38 39 40 41 42 43 /* GPL_HEADER */44 package org.greenstone.gatherer.gui;45 39 /************************************************************************************** 46 40 * Title: Gatherer -
trunk/gli/src/org/greenstone/gatherer/gui/ComboArea.java
r4832 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; … … 44 45 import org.greenstone.gatherer.gui.SmarterTextArea; 45 46 import org.greenstone.gatherer.util.Utility; 47 46 48 /** Combines the idea of a combobox with a text area so that multiline entries can be displayed properly. Basically takes a JCombobox, (or in this case a SteppedComboBox that allows us to control the popup window that appears), butchers out the JTextField editor while retaining the button and the data model, then uses a JTextArea for the editor instead. 47 49 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 100 102 add(text_pane, BorderLayout.CENTER); 101 103 } 104 102 105 /** Add an element to our combobox model. Remember to tell the listeners to ignore this action unless you want an infinite loop. 103 104 106 * @param item The <strong>Object</strong> to add. 107 */ 105 108 public void add(Object item) { 106 109 ignore = true; … … 108 111 ignore = false; 109 112 } 113 110 114 /** Clear the combobox model. 111 115 */ 112 116 public void clear() { 113 117 combobox.clear(); 114 118 } 119 115 120 /** Retrieve the text currently displayed in the text area. 116 117 121 * @return A <strong>String</strong> containing the required text. 122 */ 118 123 public String getText() { 119 124 return text_area.getText(); 120 125 } 126 121 127 /** Retrieve a reference to the text area. 122 123 128 * @return A <strong>JTextComponent</strong> reference. 129 */ 124 130 public JTextComponent getTextComponent() { 125 131 return text_area; 126 132 } 133 127 134 /** Change the selected item in the combobox to the one given. If such an object doesn't exist in the model, ignore it. Notice that this time we don't ignore, as we want a selection to update the text field. 128 129 135 * @param item The <strong>Object</strong> that we want to select from the combobox. 136 */ 130 137 public void setSelectedItem(Object item) { 131 138 combobox.setSelectedItem(item); 132 139 } 140 133 141 /** Set the text shown in the text area to the value provided. Note that this has no effect on the combobox, nor will this value be stored in the model. 134 135 142 * @param text The <strong>String</strong> to display. 143 */ 136 144 public void setText(String text) { 137 145 text_area.setText(text); 138 146 } 147 139 148 /** This clas listens for changes in the selected item in the combobox and if applicable updates the text area to match. */ 140 149 private class ComboAreaListener -
trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r5571 r5589 139 139 /** An identifier for the progress panel within the card layout. */ 140 140 static private String PROGRESS = "Progress"; 141 141 142 /** The constructor creates important helper classes, and initializes all the components. 142 143 * @see org.greenstone.gatherer.collection.CollectionManager … … 159 160 // Control Pane 160 161 control_pane = new JPanel(); 161 args = new String[1];162 args[0] = "0";163 document_count = new JLabel(get("CreatePane.Document_Count", args));164 162 tree = new OptionTree(); 163 165 164 // Progress Pane 166 165 progress_pane = new JPanel(); 167 166 168 progress_copy_label = new JLabel( get("CreatePane.Copy_Progress"));167 progress_copy_label = new JLabel(); 169 168 progress_copy_label.setForeground(Color.black); 170 169 progress_copy_label.setHorizontalAlignment(JLabel.LEFT); … … 172 171 progress_copy_label.setMinimumSize(LABEL_SIZE); 173 172 progress_copy_label.setSize(LABEL_SIZE); 173 Dictionary.registerText(progress_copy_label, "CreatePane.Copy_Progress"); 174 174 175 175 copy_monitor = new GBasicProgressMonitor(); 176 176 Gatherer.c_man.registerCopyMonitor(copy_monitor); 177 177 178 progress_import_label = new JLabel( get("CreatePane.Import_Progress"));178 progress_import_label = new JLabel(); 179 179 progress_import_label.setForeground(Color.black); 180 180 progress_import_label.setHorizontalAlignment(JLabel.LEFT); … … 182 182 progress_import_label.setMinimumSize(LABEL_SIZE); 183 183 progress_import_label.setSize(LABEL_SIZE); 184 Dictionary.registerText(progress_import_label, "CreatePane.Import_Progress"); 184 185 185 186 import_monitor = new GImportProgressMonitor(); //GBasicProgressMonitor(); 186 187 Gatherer.c_man.registerImportMonitor(import_monitor); 187 188 188 progress_build_label = new JLabel( get("CreatePane.Build_Progress"));189 progress_build_label = new JLabel(); 189 190 progress_build_label.setForeground(Color.black); 190 191 progress_build_label.setHorizontalAlignment(JLabel.LEFT); … … 192 193 progress_build_label.setMinimumSize(LABEL_SIZE); 193 194 progress_build_label.setSize(LABEL_SIZE); 195 Dictionary.registerText(progress_build_label, "CreatePane.Build_Progress"); 194 196 195 197 build_monitor = new GBuildProgressMonitor((GImportProgressMonitor)import_monitor); //GBasicProgressMonitor(); … … 234 236 235 237 // Build control_pane 236 JPanel stats_area = new JPanel();237 stats_area.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createTitledBorder(get("CreatePane.Statistics_Title"))));238 stats_area.setLayout(new GridLayout(1,1));239 stats_area.add(document_count);240 241 238 JPanel left = new JPanel(); 242 239 left.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); … … 249 246 250 247 JPanel options_area = new JPanel(); 251 options_area.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createTitledBorder( get("CreatePane.Options_Title"))));248 options_area.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createTitledBorder(Dictionary.newget("CreatePane.Options_Title")))); 252 249 options_area.setLayout(new BorderLayout()); 253 250 options_area.add(left, BorderLayout.WEST); … … 301 298 this.add(button_pane, BorderLayout.SOUTH); 302 299 } 300 303 301 /** This method is called whenever the 'Create' tab is selected from the view bar. It allows this view to perform any preactions required prior to display. In this case this entails gathering up to date information about the status of the collection including number of documents etc. 304 302 * @see org.greenstone.gatherer.Gatherer … … 315 313 tree.setSelectionPath(path); 316 314 } 315 317 316 /** Method to acquire the progress monitor associated with builds. 318 317 * @return The build <strong>GShellProgressMonitor</strong>. … … 321 320 return build_monitor; 322 321 } 322 323 323 /** Method to acquire the progress monitor associated with copying. 324 324 * @return The copying <strong>GShellProgressMonitor</strong>. … … 327 327 return copy_monitor; 328 328 } 329 329 330 /** Method to acquire the progress monitor associated with import. 330 331 * @return The import <strong>GShellProgressMonitor</strong>. … … 381 382 card_layout.show(main_pane, CONTROL); 382 383 } 383 }384 /** This method retrieves a phrase from the dictionary based apon the key.385 * @param key A <strong>String</strong> used as a reference to the correct phrase.386 * @return A phrase, matching the key, as a <strong>String</strong>.387 */388 private String get(String key) {389 return get(key, null);390 }391 /** This method retrieves a phrase from the dictionary based apon the key and arguments.392 * @param key A <strong>String</strong> used as a reference to the correct phrase.393 * @param args A <strong>String[]</strong> whose contents are often substituted into the phrase before it is returned.394 * @return A phrase, matching the key and constructed using the arguments, as a <strong>String</strong>.395 * @see org.greenstone.gatherer.Dictionary396 * @see org.greenstone.gatherer.Gatherer397 */398 private String get(String key, String args[]) {399 if(key.indexOf(".") == -1) {400 key = "CreatePane." + key;401 }402 return Gatherer.dictionary.get(key, args);403 384 } 404 385 … … 485 466 public OptionTree() { 486 467 super(); 468 469 ToolTipManager.sharedInstance().registerComponent(this); 487 470 addTreeSelectionListener(this); 488 471 getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); … … 490 473 setRootVisible(false); 491 474 setToggleClickCount(1); 475 492 476 // Create tree. 493 building = new OptionTreeNode( get("CreatePane.Build"));494 building.setToolTipText( get("CreatePane.Build_Tooltip"));495 importing = new OptionTreeNode( get("CreatePane.Import"));496 importing.setToolTipText( get("CreatePane.Import_Tooltip"));497 log = new OptionTreeNode( get("CreatePane.Log"));498 log.setToolTipText( get("CreatePane.Log_Tooltip"));499 options = new OptionTreeNode( get("CreatePane.Options"));477 building = new OptionTreeNode(Dictionary.newget("CreatePane.Build")); 478 building.setToolTipText(Dictionary.newget("CreatePane.Build_Tooltip")); 479 importing = new OptionTreeNode(Dictionary.newget("CreatePane.Import")); 480 importing.setToolTipText(Dictionary.newget("CreatePane.Import_Tooltip")); 481 log = new OptionTreeNode(Dictionary.newget("CreatePane.Log")); 482 log.setToolTipText(Dictionary.newget("CreatePane.Log_Tooltip")); 483 options = new OptionTreeNode(Dictionary.newget("CreatePane.Options")); 500 484 501 485 model = new DefaultTreeModel(options); … … 556 540 } 557 541 } 542 558 543 /** The <strong>OptionTree</strong> is built from these nodes, each of which has several methods used in creating the option panes. 559 544 */ 560 545 private class OptionTreeNode 561 546 extends DefaultMutableTreeNode … … 572 557 this.title = title; 573 558 } 559 574 560 /** This method compares two nodes for ordering. 575 561 * @param obj The <strong>Object</strong> to compare to. … … 579 565 return title.compareTo(obj.toString()); 580 566 } 581 /** This method checks if two nodes are equivelent. 567 568 /** This method checks if two nodes are equivalent. 582 569 * @param obj The <strong>Object</strong> to be tested against. 583 570 * @return A <strong>boolean</strong> which is <i>true</i> if the objects are equal, <i>false</i> otherwise. … … 594 581 return tool_tip; 595 582 } 596 583 597 584 /** set the tool tip */ 598 585 public void setToolTipText(String tip) { 599 586 tool_tip = tip; 600 587 } 601 602 588 603 589 /** Method to translate this node into a textual representation. … … 609 595 } 610 596 611 // this is supposed to add tool tips to teh nodes in the tree but it doesn't work. michael - fix me!!612 private class ToolTipTreeCellRenderer 597 // Adds tooltips to the tree nodes 598 private class ToolTipTreeCellRenderer 613 599 extends DefaultTreeCellRenderer { 614 600 … … 620 606 int row, 621 607 boolean hasFocus) { 622 608 623 609 super.getTreeCellRendererComponent(tree, value, sel, 624 610 expanded, leaf, row, 625 611 hasFocus); 626 ///ystem.out.println("getting component");627 612 if (value instanceof OptionTreeNode) { 628 String tip = ((OptionTreeNode)value).getToolTipText(); 629 ///ystem.out.println("setting tool tip to "+tip); 630 this.setToolTipText(tip); 613 String tip = ((OptionTreeNode) value).getToolTipText(); 614 if (tip != null) { 615 setToolTipText(tip); 616 } 631 617 } 632 618 return this; -
trunk/gli/src/org/greenstone/gatherer/gui/FileAssociationDialog.java
r5571 r5589 327 327 /** When a click on OK is detected, save the current information, then dispose. 328 328 * @param event An <strong>ActionEvent</strong> with details about the button press. 329 329 */ 330 330 public void actionPerformed(ActionEvent event) { 331 331 if(save_required) { -
trunk/gli/src/org/greenstone/gatherer/gui/GComboBox.java
r4833 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.util.*; … … 66 67 public GComboBox(ComboBoxModel model) { 67 68 super(model); 68 init();69 }70 71 /** Legacy constructor. */72 public GComboBox(Gatherer gatherer) {73 super();74 69 init(); 75 70 } -
trunk/gli/src/org/greenstone/gatherer/gui/GConfigPane.java
r5340 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.io.*; … … 57 58 } 58 59 /** This method is called whenever the state of the current collection 59 60 61 60 * changes. 61 * @param ready <i>true</i> if a collection is loaded and ready, <i>false</i> otherwise. 62 */ 62 63 public void collectionChanged(boolean ready) { 63 64 ///atherer.println("CollectionChanged(" + ready + ")"); … … 76 77 } 77 78 /** Called to cause the components to lay themselves out and be displayed. 78 79 */ 79 80 public void display() { 80 81 // Layout -
trunk/gli/src/org/greenstone/gatherer/gui/LongProgressBar.java
r4675 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 26 25 *######################################################################## 27 26 */ 27 package org.greenstone.gatherer.gui; 28 28 29 import java.math.BigInteger; 29 30 import javax.swing.JProgressBar; 30 31 import javax.swing.SwingUtilities; 32 31 33 /** A progress bar that doesn't pack a sad when you feed it longs (such as the sizes of files) which get mangled into negative numbers. I know how it feels, as I often have negative progress. Also tries to be efficent when updating the JProgressBar, so only updates when the value actually changes, which become necessary when you move a large number of files with millions of bytes (where upon shifting a file of a thousand bytes would be pretty insignificant, maybe not even a percent, but would fire several progress updates). 32 34 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 43 45 private SafeSetString safe_set_string = null; 44 46 private SafeSetValue safe_set_value = null; 47 45 48 public LongProgressBar() { 46 49 super(0, 100); -
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java
r5564 r5589 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import java.awt.*; 39 40 import java.awt.event.*; -
trunk/gli/src/org/greenstone/gatherer/gui/ModalDialog.java
r5304 r5589 32 32 */ 33 33 package org.greenstone.gatherer.gui; 34 34 35 import java.awt.*; 35 36 import javax.swing.*; … … 42 43 /** true if this dialog is currently waiting some thread. */ 43 44 protected boolean waiting = false; 45 44 46 /** Constructor. 45 47 */ 46 48 public ModalDialog() { 47 49 super((Frame)null, "", false); 48 49 50 } 51 50 52 /** Constructor. 51 53 * @param parent the Dialog which is the owener of this dialog. … … 54 56 super(parent, "", false); 55 57 } 58 56 59 /** Constructor. 57 60 * @param parent the Dialog which is the owener of this dialog. … … 61 64 super(parent, "", false); 62 65 this.modal = modal; 63 64 66 } 65 67 … … 89 91 super(parent, "", false); 90 92 } 93 91 94 /** Constructor. 92 95 * @param parent the Frame which is the owener of this dialog. … … 106 109 super (parent, title, false); 107 110 } 111 108 112 /** Constructor. 109 113 * @param parent the Frame which is the owener of this dialog. -
trunk/gli/src/org/greenstone/gatherer/gui/NewFolderPrompt.java
r5564 r5589 49 49 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 50 50 cancel_button = new JButton(); 51 Dictionary.setBoth(cancel_button, "General.Cancel", "General. Good_Cancel_Tooltip");51 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 52 52 53 53 // Connection -
trunk/gli/src/org/greenstone/gatherer/gui/NonWhitespaceField.java
r4939 r5589 26 26 */ 27 27 package org.greenstone.gatherer.gui; 28 28 29 /************************************************************************************** 29 30 * Written: 04/07/03 -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r5571 r5589 14 14 import org.greenstone.gatherer.checklist.Entry; 15 15 import org.greenstone.gatherer.gui.ModalDialog; 16 import org.greenstone.gatherer.gui.NumberField;17 16 import org.greenstone.gatherer.gui.SimpleMenuBar; 18 17 import org.greenstone.gatherer.util.StaticStrings; … … 48 47 private JTextField library_path_field; 49 48 private JTextField proxy_host_field; 50 private J TextFieldproxy_port_field;49 private JSpinner proxy_port_field; 51 50 private Preferences self; 52 51 … … 144 143 proxy_port_label = new JLabel(); 145 144 proxy_port_label.setPreferredSize(LABEL_SIZE); 146 Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port"); 147 proxy_port_field = new NumberField(Gatherer.config.getString("general.proxy_port", true)); 145 Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port"); 146 String port_value = Gatherer.config.getString("general.proxy_port", true); 147 proxy_port_field = new JSpinner(new SpinnerNumberModel((new Integer(port_value)).intValue(), 0, 65535, 1)); 148 148 proxy_port_field.setEnabled(currently_enabled); 149 149 Dictionary.registerTooltip(proxy_port_field, "Preferences.Connection.Proxy_Port_Tooltip"); … … 417 417 Gatherer.config.set("general.use_proxy", true, use_proxy_checkbox.isSelected()); 418 418 Gatherer.config.setString("general.proxy_host", true, proxy_host_field.getText()); 419 Gatherer.config.setString("general.proxy_port", true, proxy_port_field.get Text());419 Gatherer.config.setString("general.proxy_port", true, proxy_port_field.getValue() + ""); 420 420 Gatherer.setProxy(); 421 421 -
trunk/gli/src/org/greenstone/gatherer/gui/SmarterTable.java
r4675 r5589 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 37 package org.greenstone.gatherer.gui; 44 38 45 import java.awt.Color; 46 import java.awt.Component; 39 import java.awt.*; 47 40 import javax.swing.JTable; 48 import javax.swing.table.DefaultTableCellRenderer; 49 import javax.swing.table.JTableHeader; 50 import javax.swing.table.TableCellRenderer; 51 import javax.swing.table.TableColumn; 41 import javax.swing.table.*; 52 42 53 43 /** An extension of a JTable that allows for the background, foreground, heading and selection colors to be set in single actions. */ -
trunk/gli/src/org/greenstone/gatherer/gui/SmarterTextArea.java
r5564 r5589 84 84 } 85 85 } 86 87 88 86 } -
trunk/gli/src/org/greenstone/gatherer/gui/SmarterTree.java
r4675 r5589 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 37 package org.greenstone.gatherer.gui; 44 38 45 39 import java.awt.Color; 46 40 import javax.swing.JTree; 47 import javax.swing.tree.DefaultTreeCellRenderer; 48 import javax.swing.tree.TreeModel; 41 import javax.swing.tree.*; 49 42 50 43 /** An extension of a JTree that allows for the background, foreground and selection colors to be set in single actions. */ -
trunk/gli/src/org/greenstone/gatherer/gui/Splash.java
r4675 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.gui; 37 38 38 39 import java.awt.*; 40 import javax.swing.*; 41 import org.greenstone.gatherer.util.Utility; 39 42 40 41 42 43 package org.greenstone.gatherer.gui;44 import java.awt.BorderLayout;45 import java.awt.Dimension;46 import java.awt.Toolkit;47 import javax.swing.BorderFactory;48 import javax.swing.JDialog;49 import javax.swing.JLabel;50 import javax.swing.JPanel;51 import org.greenstone.gatherer.util.Utility;52 43 final public class Splash 53 44 extends JDialog { 54 45 private Dimension size = new Dimension(450,450); 46 55 47 public Splash() { 56 48 super(); … … 62 54 content_pane.setLayout(new BorderLayout()); 63 55 content_pane.add(logo, BorderLayout.CENTER); 56 64 57 // Center and display 65 58 Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize(); 66 59 setLocation((screen_size.width - size.width) / 2, (screen_size.height - size.height) / 2); 67 show(); 60 show(); 68 61 } 69 /** Destructor. */ 62 63 /** Destructor */ 70 64 public void destroy() { 71 65 dispose(); -
trunk/gli/src/org/greenstone/gatherer/gui/WarningDialog.java
r5571 r5589 77 77 JLabel icon_label = new JLabel(Utility.getImage("gatherer_medium.gif")); 78 78 79 // SmarterTextArea text_area = new SmarterTextArea("", false);80 79 JTextArea text_area = new JTextArea(); 81 80 text_area.setCaretPosition(0); -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/Autofilter.java
r5156 r5589 26 26 */ 27 27 package org.greenstone.gatherer.gui.metaaudit; 28 28 29 /************************************************************************************** 29 30 * Title: Gatherer … … 38 39 import java.util.ArrayList; 39 40 import org.greenstone.gatherer.util.StaticStrings; 41 40 42 /** An Autofilter object stores the filters set on a single column, and provides a method for determining if a certain value passes the filter. 41 43 * @author John Thompson … … 384 386 } 385 387 } 386 387 388 389 390 391 392 393 -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/AutofilterDialog.java
r5564 r5589 393 393 } 394 394 } 395 396 397 398 399 400 401 402 403 -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/Filter.java
r4366 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.gui.metaaudit; 37 38 38 39 40 41 42 43 /* GPL_HEADER */44 package org.greenstone.gatherer.gui.metaaudit;45 39 /************************************************************************************** 46 40 * Title: Gatherer … … 58 52 import javax.swing.table.TableModel; 59 53 import org.greenstone.gatherer.gui.metaaudit.Autofilter; 54 60 55 /** This class essentially manages the autofilters applied to the metaaudit table. 61 56 * @author John Thompson … … 70 65 /** Constructor. 71 66 * @param columns The number of columns this Filter will be expected to filter, as an <i>int</i>. 72 67 */ 73 68 public Filter(int columns) { 74 69 filters = new Autofilter[columns]; 75 70 } 76 71 /** Add a TableModelFilterListener to the TableModelFilter. 77 78 72 * @param listener The <strong>TableModelFilterListener</strong> to add, if it isn't already registered. 73 */ 79 74 public synchronized void addTableModelFilterListener(TableModelFilterListener listener) { 80 75 if (!listeners.contains(listener)) { … … 83 78 } 84 79 /** Remove a filter from a column. 85 86 80 * @param column The column number to remove the filter from, as an <i>int</i>. 81 */ 87 82 public void clearFilter(int column) { 88 83 if(filters[column] != null) { … … 91 86 } 92 87 /** Determine if a certain row should be shown in the table by checking it against all the current filters. 93 94 95 96 88 * @param model The <strong>TableModel</strong> the row is from. 89 * @param row The row number as an <i>int</i> 90 * @return <i>true</i> if the rows data matches all autofilters set and should be displayed, <i>false</i> otherwise. 91 */ 97 92 public boolean filter(TableModel model, int row) { 98 93 boolean result = true; … … 106 101 } 107 102 /** Retrieve the autofilter associated with a certain column. 108 109 110 103 * @param column The column number as an <i>int</i>. 104 * @return The <strong>Autofilter</strong> assigned to that column. 105 */ 111 106 public Autofilter getFilter(int column) { 112 107 Autofilter filter = filters[column]; … … 118 113 } 119 114 /** Determine if a certain column is filtered. 120 121 122 115 * @param column The column number as an <i>int</i>. 116 * @return <i>true</i> if there is an active autofilter assigned to this column, <i>false</i> otherwise. 117 */ 123 118 public boolean isFiltered(int column) { 124 119 boolean result = false; … … 129 124 } 130 125 /** Remove a TableModelFilterListener from the TableModelFilter. 131 132 126 * @param listener The <strong>TableModelFilterListener</strong> to remove. 127 */ 133 128 public synchronized void removeTableModelFilterListener(TableModelFilterListener listener) { 134 129 listeners.removeElement(listener); -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/HeaderListener.java
r4366 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.gui.metaaudit; 37 38 38 39 40 41 42 43 /* GPL_HEADER */44 package org.greenstone.gatherer.gui.metaaudit;45 39 /************************************************************************************** 46 40 * Title: Gatherer … … 91 85 } 92 86 } 93 -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/HeaderRenderer.java
r4366 r5589 1 package org.greenstone.gatherer.gui.metaaudit;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui.metaaudit; 38 38 39 import java.awt.*; 39 40 import javax.swing.*; … … 42 43 import org.greenstone.gatherer.gui.metaaudit.MetaAuditTable; 43 44 import org.greenstone.gatherer.util.Utility; 45 44 46 /** This custom button renderer replaces the boring old column headers with clickable versions which are based on JToggleButtons. 45 47 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 49 51 extends JToggleButton 50 52 implements TableCellRenderer { 53 51 54 /** The constructor sets up a margin around the button, and adds the filter icons. 52 55 * @see org.greenstone.gatherer.util.Utility … … 57 60 setSelectedIcon(Utility.getImage("filter-on.gif")); 58 61 } 62 59 63 /** Called to create the component to be used as the 'rubber-stamp' for the table cell given the follwing arguments. 60 61 62 63 64 65 66 67 64 * @param table The <strong>JTable</strong> that is asking the renderer to draw; can be <i>null</i>. 65 * @param value The value of the cell to be rendered as an <strong>Object</strong>. It is up to the specific renderer to interpret and draw the value. For example, if value is the string "true", it could be rendered as a string or it could be rendered as a check box that is checked. null is a valid value. 66 * @param isSelected <i>true</i> if the cell is to be rendered with the selection highlighted; otherwise <i>false</i>. 67 * @param hasFocus If <i>true</i>, render cell appropriately. For example, put a special border on the cell, if the cell can be edited, render in the color used to indicate editing. 68 * @param row The row index of the cell being drawn as an <i>int</i>. When drawing the header, the value of row is -1. 69 * @param column The column index of the cell being drawn as an <i>int</i>. 70 * @see org.greenstone.gatherer.gui.metaaudit.MetaAuditTable 71 */ 68 72 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 69 73 setText(value.toString()); 70 74 MetaAuditTable temp = (MetaAuditTable) table; 71 if (temp != null) { // And it may if this is called during table init.75 if (temp != null) { // And it may if this is called during table init. 72 76 setSelected(temp.isFiltered(column)); 73 77 } -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/MetaAuditRenderer.java
r4366 r5589 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 37 package org.greenstone.gatherer.gui.metaaudit; 44 38 45 import java.awt.Component; 46 import java.awt.GridLayout; 39 import java.awt.*; 47 40 import java.util.ArrayList; 48 import javax.swing.JLabel; 49 import javax.swing.JPanel; 50 import javax.swing.JTable; 41 import javax.swing.*; 51 42 import javax.swing.table.DefaultTableCellRenderer; 52 43 -
trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/MetaAuditTable.java
r4640 r5589 1 package org.greenstone.gatherer.gui.metaaudit;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui.metaaudit; 38 38 39 import de.qfs.lib.gui.*; 39 40 import java.awt.*; … … 203 204 } 204 205 } 205 -
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; -
trunk/gli/src/org/greenstone/gatherer/msm/ExportMDSPrompt.java
r5581 r5589 144 144 export_button = new JButton(); 145 145 export_button.setEnabled(false); 146 export_button.setMnemonic(KeyEvent.VK_E); 146 147 Dictionary.setBoth(export_button, "MSMPrompt.File_Export", "MSMPrompt.File_Export_Tooltip"); 147 148 } … … 149 150 export_button = new JButton(); 150 151 export_button.setEnabled(true); 152 export_button.setMnemonic(KeyEvent.VK_I); 151 153 Dictionary.setBoth(export_button, "MSMPrompt.File_Import", "MSMPrompt.File_Import_Tooltip"); 152 154 } 153 155 154 156 cancel_button = new JButton(); 155 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip"); 157 cancel_button.setMnemonic(KeyEvent.VK_C); 158 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 156 159 157 160 // Listeners -
trunk/gli/src/org/greenstone/gatherer/msm/GDMDocument.java
r5305 r5589 1 package org.greenstone.gatherer.msm;2 1 /** 3 2 *######################################################################### … … 26 25 *######################################################################## 27 26 */ 27 package org.greenstone.gatherer.msm; 28 28 29 import java.io.*; 29 30 import java.util.*; … … 37 38 import org.greenstone.gatherer.valuetree.GValueNode; 38 39 import org.w3c.dom.*; 40 39 41 /** This class wraps around a DOM Document providing methods for accessing the data within. In this case the DOM represents a Greenstone Directory metadata file. It provides the necessary functionality to create a new metadata.xml file. 40 42 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 57 59 static final private String NAME_ATTRIBUTE = "name"; 58 60 static final private String OVERWRITE = "overwrite"; 61 59 62 /** Constructor which creates a brand new metadata.xml document. */ 60 63 public GDMDocument() { … … 62 65 this.base_document = Utility.parse(Utility.GREENSTONEDIRECTORYMETADATA_TEMPLATE, true); 63 66 } 67 64 68 /** Constructor which parses an existing metadata.xml document. */ 65 69 public GDMDocument(File file) { … … 71 75 } 72 76 } 77 73 78 /** Constructor which wraps around an existing metadata.xml document. */ 74 79 public GDMDocument(Document base_document) { 75 80 this.base_document = base_document; 76 81 } 82 77 83 /** Add this metadata to the named file. There is one tricky thing to consider. Whenever a metadata entry is added it is taken to be accumulating except if it is the first added, in which case it overwrites! */ 78 84 public void addMetadata(String filename, Metadata metadata) { -
trunk/gli/src/org/greenstone/gatherer/msm/GDMManager.java
r5581 r5589 1 package org.greenstone.gatherer.msm;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.msm; 38 38 39 import java.io.*; 39 40 import java.util.*; … … 49 50 import org.greenstone.gatherer.util.HashMap3D; 50 51 import org.greenstone.gatherer.util.Utility; 51 // import org.greenstone.gatherer.valuetree.GValueNode;52 52 import org.w3c.dom.*; 53 53 54 /** This object manages the metadata attached to file records. By storing all of the metadata in one place you garner several advantages. Firstly only one copy of each metadata object is retained, all actual entries are converted to references. Next you can immediately determine what metadata is assigned to an entire directory, thus the metadata.xml files can be built more effeciently (whereas the current 'optimal' method uses recursion through the tree contents). Finally, and perhaps most importantly, it allows for dynamic 'on demand' lookup of metadata. This is especially necessary with large collections, where the raw, unconnected metadata files could range into the tens of megabytes of memory and require hundreds of megabytes to read by in using serialization. Dynamic loading allows you to connect the metadata objects on load, reducing value node paths (possibly of hundreds of characters) down to a single reference pointer! At the very worst this object uses far less memory than the current method, and given that the current method is completely incapable of handling large collections, is necessary. The trade off of course is in time needed to load metadata.xml on demand, the worst possible case being the user selecting the root node of the collection tree of a large collection immediately after opening the collection. The subsequent attempt to build the metadata table will result in the metadata being loaded for every single file. But since this process is sequential and a small cache of metadata.xml files is implemented, and given that the table will actually be build on a separate thread, the wait should not be too arduous.<BR> 54 55 As for the size of the GDMParser cache, I was at first tempted to put around five. However after analysis of cache usage, I determined that no gain occured because of caching (in fact if everythings working as it should there should only ever be one call for a certain metadata.xml). … … 84 85 } 85 86 /** Destructor necessary for clean exit, subsequent to saving of metadata.xml files. 86 87 88 89 90 87 * @see org.greenstone.gatherer.Gatherer 88 * @see org.greenstone.gatherer.collection.CollectionManager 89 * @see org.greenstone.gatherer.msm.GDMParser 90 * @see org.greenstone.gatherer.msm.MetadataSetManager 91 */ 91 92 public void destroy() { 92 93 // Destroy all the cached documents. … … 109 110 } 110 111 /** Method that is called whenever an element within a set is changed or modified. Ensure all cached GDMDocuments are marked as stale. 111 112 112 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 113 */ 113 114 public void elementChanged(MSMEvent event) { 114 115 for(Iterator values = values().iterator(); values.hasNext(); ) { … … 119 120 } 120 121 /** Retrieve the GreenstoneMetadataDocument that is associated with a certain file. If the document is in cache returns it. If the document exists but isn't in cache loads, caches, then returns it. Otherwise it creates a brand new document, caches it, then returns it. 121 122 122 * @see org.greenstone.gatherer.msm.GDMParser 123 */ 123 124 public GDMDocument getDocument(File file) { 124 125 ///ystem.err.println("Get the GDMDocument for " + file.getAbsolutePath()); … … 137 138 } 138 139 else { 139 140 // Now the two potential cache misses. The first requires us to load an existing metadata.xml 140 141 if(metadata_file.exists()) { 141 142 metadata_xml = new GDMDocument(metadata_file); 142 143 } 143 144 // The final case is where no current metadata.xml exists. Create a new one just by creating a new GDMDocument. 144 145 else { 145 146 metadata_xml = new GDMDocument(); … … 206 207 ///ystem.err.println("Start directory = " + start_file.getAbsolutePath()); 207 208 while(!start_file.equals(collection_dir)) { 208 209 ///ystem.err.println("Blip!"); 209 210 search_files.add(0, new MetadataXMLFileSearch(start_file, filename)); 210 211 if(filename != null) { … … 215 216 } 216 217 start_file = start_file.getParentFile(); 217 218 ///ystem.err.println("Start directory = " + start_file.getAbsolutePath()); 218 219 } 219 220 // Now search each of these metadata xml for metadata, remembering to accumulate or overwrite as we go along. 220 221 for(int i = 0; i < search_files.size(); i++) { 221 222 MetadataXMLFileSearch a_search = (MetadataXMLFileSearch) search_files.get(i); 222 223 223 ///ystem.err.println("Search " + a_search.file.getAbsolutePath() + File.separator + "metadata.xml for " + (a_search.filename != null ? a_search.filename : "directory metadata")); 224 // Retrieve the document 224 225 GDMDocument document = getDocument(a_search.file); 225 226 if(document != null) { … … 261 262 262 263 /** Called whenever the metadata value changes in some way, such as the addition of a new value. This is the only event type we care about, but we care about it a lot. It tells us what metadata to add, remove, etc from the cached metadata.xml files. Note that this method is synchronized so that the data objects don't need to be. 263 264 265 266 267 264 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 265 * @see org.greenstone.gatherer.msm.GDMDocument 266 * @see org.greenstone.gatherer.msm.Metadata 267 * @see org.greenstone.gatherer.util.HashMap3D 268 */ 268 269 public synchronized void metadataChanged(MSMEvent event) { 269 270 ///ystem.err.println("Recieved Event: " + event.toString()); … … 308 309 309 310 /** Causes all currently loaded GDMDocuments to write themselves out. 310 311 311 * @see org.greenstone.gatherer.msm.GDMDocument 312 */ 312 313 public void save() { 313 314 Iterator iterator = keySet().iterator(); … … 357 358 358 359 /** Method that is called whenever the metadata set collection changes in some way, such as the addition of a new set or the merging of two sets. If a set changes, mark all cached GDMDocuments as being stale. 359 360 360 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 361 */ 361 362 public void setChanged(MSMEvent event) { 362 363 for(Iterator values = values().iterator(); values.hasNext(); ) { … … 367 368 } 368 369 /** Called whenever the value tree of an metadata element changes in some way, such as the addition of a new value. --While the comments below are now obsolete, I'll keep them just to remind me of how easy it is to back yourself into a corner with issues such as caching and persisitant references--. Such an action would require us to painstakingly reload every metadata.xml file using the value model prior to the change, then painstakingly write out each metadata.xml file again using the modified model, but I'm a glutton for punishment so thats ok. The alternative is to not do this and watch in horror as heirarchy references quickly fall into disarray, pointing to the wrong place. This task gets even more complicated by three facts:<br>1. We want to do this is a seperate thread, as we don't want the program to come to a screaming halt while we're updating metadata.xml files.<br>2. We have to prevent any metadata.xml files being removed from cache while we're doing this, as if we encounter these more recently written files their heirarchy references will already be correct and that will balls up our little process. Note that this means the saving process may have to block while pending metadata heirarchy updates are in progress.<br>3. Regarding (2) we don't have to rewrite any metadata.xml files already in cache as they will be correctly written out whenever they happen to be dumped from cache.<br>4. We need the ability to pre-empt the general update to load a user demanded metadata.xml and store it in cache, using the old value tree model as per usual, and<br>5. We have to store a cue of these events, and process them one at a time. Perhaps one day when I'm feeling masacistic I'll figure out someway to merge several updates into one, but for now we have to change the tree one node at a time in order for references to remain correct.<br>Ok, so thats five facts, but you get the gist. Not an easy task, but crucial for accurate storage and recall of metadata heirarchies. 369 370 370 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 371 */ 371 372 public void valueChanged(MSMEvent event) {} 372 373 … … 377 378 private Metadata checkCache(Metadata metadata) { 378 379 if(metadata != null) { 379 380 ///ystem.err.println("Search for " + metadata.toString()); 380 381 if(metadata_cache.contains(metadata.getElement(), metadata.getValueNode())) { 381 382 metadata = (Metadata) metadata_cache.get(metadata.getElement(), metadata.getValueNode()); … … 390 391 private boolean complete = false; 391 392 public void run() { 392 393 // Can't open a collections metadata when the collection isn't open! 393 394 while(!Gatherer.c_man.ready()) { 394 395 try { … … 398 399 } 399 400 } 400 401 // Now for each non-file directory in the tree, ask it to load its metadata 401 402 ArrayList remaining = new ArrayList(); 402 403 remaining.add((FileNode)Gatherer.c_man.getRecordSet().getRoot()); -
trunk/gli/src/org/greenstone/gatherer/msm/GDMParser.java
r4674 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.msm; 37 38 38 39 40 41 42 43 /* GPL_HEADER */44 package org.greenstone.gatherer.msm;45 39 /************************************************************************************** 46 40 * Title: Gatherer … … 68 62 import org.w3c.dom.Document; 69 63 import org.xml.sax.InputSource; 64 70 65 /** Parses metadata.xml documents of the GreenstoneDirectoryMetadata variety, caching where possible. */ 71 66 // #################################################################################### … … 90 85 try { 91 86 parser = new DOMParser(); 92 87 // Don't let it import external dtds. If it does it'll probably spit the dummy. If people try to use a poorly formated xml file more fool them. 93 88 parser.setFeature("http://xml.org/sax/features/validation", false); 94 89 parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); 95 90 // May or may not be ignored, the documentation for Xerces is contradictory. If it works then parsing -should- be faster. 96 91 parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", true); 97 92 } 98 93 catch(Exception error) { 99 94 ///ystem.err.println("Fatal Error in GDMParser.init(): " + error); 100 95 error.printStackTrace(); 101 96 System.exit(1); … … 103 98 } 104 99 /** Constructor with maximum size set. 105 106 100 * @param max_size The maximum size of the cache, as an <i>int</i>. 101 */ 107 102 public GDMParser(int max_size) { 108 103 this(); … … 117 112 } 118 113 /** Fetches the document for the given xml file. This may mean (re)parsing it or simply fetching it from cache. 119 120 121 114 * @param file The metadata.xml <strong>File</strong> you wish to get the document for. 115 * @return A <strong>Document</strong> which is sourced from file. 116 */ 122 117 public Document parse(File file) { 123 118 ///ystem.err.println("Parse: " + file.getAbsolutePath()); 124 119 Document result = null; 125 120 if(file.exists()) { 126 121 // Check if we've already parsed this file in an earlier attempt. 127 122 if(containsKey(file)) { 128 123 ///ystem.err.println("Already cached previously."); … … 136 131 } 137 132 } 138 133 // Check the ignore list and see if we've already detected this isn't a greenstone metadata file. 139 134 if(result == null && !ignore.contains(file)) { 140 135 ///ystem.err.println("Reparse file."); … … 171 166 } 172 167 else { 173 168 ///ystem.err.println("File does not exist!"); 174 169 } 175 170 return result; 176 171 } 177 172 /** Automatically called by the LinkedHashMap object whenever an object is added, to determine whether it should remove the oldest entry. 178 179 180 173 * @param eldest The eldest <strong>Map.Entry</strong> which may mean in terms of age, or in terms of usage. 174 * @return <i>true</i> if the given entry should be removed, <i>false</i> otherwise. 175 */ 181 176 protected boolean removeEldestEntry(Map.Entry eldest) { 182 177 return size() > max_size; -
trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java
r5564 r5589 61 61 private GShell shell; 62 62 63 static final String ignore_list[] = {"assocfilepath", "gsdl", "Identifier", "URL"}; //"Source",63 static final String ignore_list[] = {"assocfilepath", "gsdl", "Identifier", "URL"}; //"Source", 64 64 65 65 public GreenstoneArchiveParser(GShellProgressMonitor progress, GShell shell) { -
trunk/gli/src/org/greenstone/gatherer/msm/MSMAction.java
r4674 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.msm; 37 38 38 39 40 41 42 43 package org.greenstone.gatherer.msm;44 39 /** 45 40 * Title: The Gatherer<br> -
trunk/gli/src/org/greenstone/gatherer/msm/MSMAdapter.java
r4674 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.msm; 37 38 38 39 40 41 42 43 /* GPL_HEADER */44 package org.greenstone.gatherer.msm;45 39 /************************************************************************************** 46 40 * Title: Gatherer … … 55 49 import org.greenstone.gatherer.msm.MSMEvent; 56 50 import org.greenstone.gatherer.msm.MSMListener; 51 57 52 /** The default adapter for a MSMListener doesn't actually do anything, thus users can override whatever methods they want. */ 58 53 public class MSMAdapter … … 60 55 /** Method that is called whenever an element within a set is changed or modified. 61 56 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 62 57 */ 63 58 public void elementChanged(MSMEvent event){} 64 59 /** Called whenever the metadata value changes in some way, such as the addition of a new value. 65 66 60 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 61 */ 67 62 public void metadataChanged(MSMEvent event){} 68 63 /** Method that is called whenever the metadata set collection changes in some way, such as the addition of a new set or the merging of two sets. 69 70 64 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 65 */ 71 66 public void setChanged(MSMEvent event){} 72 67 /** Called whenever the value tree of an metadata element changes in some way, such as the addition of a new value. 73 74 68 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 69 */ 75 70 public void valueChanged(MSMEvent event){} 76 71 } -
trunk/gli/src/org/greenstone/gatherer/msm/MSMEvent.java
r4674 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.msm; 37 38 38 39 40 41 42 43 package org.greenstone.gatherer.msm;44 39 /** 45 40 * Title: The Gatherer<br> … … 86 81 * @param id An <i>long</i> identifier. 87 82 * @param element The <strong>ElementWrapper</strong> affected. 88 83 */ 89 84 public MSMEvent(Object source, long id, ElementWrapper element, GValueModel old_model, GValueModel new_model) { 90 85 super(source, 0); … … 117 112 } 118 113 /** Constructor. 119 120 121 122 114 * @param source The <strong>Object</strong> that caused this event. 115 * @param id An <i>long</i> identifier. 116 * @param profile The <strong>MSMAction</strong> profile if one is applicable. 117 */ 123 118 public MSMEvent(Object source, long id, MSMAction profile) { 124 119 super(source, 00); … … 129 124 } 130 125 /** Constructor for a metadata element changed event. 131 132 133 134 126 * @param source The <strong>Object</strong> that caused this event. 127 * @param element A reference to the effected metadata <strong>ElementWrapper</strong>, or <i>null</i> if element no longer exists. 128 * @param value The old name of the element (if its name has changed). If <i>null</i> old name defaults to element.toString(). 129 */ 135 130 public MSMEvent(Object source, ElementWrapper element, String value) { 136 131 super(source, count++); … … 139 134 } 140 135 /** Method to retrieve of the element associated with this event. 141 142 136 * @return A <strong>ElementWrapper</strong>, or <i>null</i> if there is none. 137 */ 143 138 public ElementWrapper getElement() { 144 139 return element; … … 149 144 } 150 145 /** Method to retrieve the new metadata associated with this event. 151 152 146 * @return A <strong>Metadata</strong>, or <i>null</i> if there is none. 147 */ 153 148 public Metadata getNewMetadata() { 154 149 return new_metadata; … … 158 153 } 159 154 /** Method to retrieve the old metadata associated with this event. 160 161 155 * @return A <strong>Metadata</strong>, or <i>null</i> if there is none. 156 */ 162 157 public Metadata getOldMetadata() { 163 158 return old_metadata; … … 167 162 } 168 163 /** Method to retrieve of the profile associated with this event. 169 170 164 * @return A <strong>MSMAction</strong> which details the action profile, or <i>null</i> if no profile exists. 165 */ 171 166 public MSMAction getProfile() { 172 167 return profile; … … 177 172 } 178 173 /** Retrieve the associated with this event. 179 180 174 * @return A <strong>String</strong>. 175 */ 181 176 public String getValue() { 182 177 String result = null; -
trunk/gli/src/org/greenstone/gatherer/msm/MSMListener.java
r4674 r5589 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.msm; 37 38 38 39 40 41 42 43 package org.greenstone.gatherer.msm;44 39 /** 45 40 * Title: The Gatherer<br> … … 51 46 */ 52 47 import org.greenstone.gatherer.msm.MSMEvent; 48 53 49 /** This class provides an interface for classes who wish to listener for events within the <strong>MetadataSetManager</strong>. There are events which are fired whenever a set or an element within a set changes. The events are either very broad, of the <i>metadataSetChanged()</i> variaty down to the more explicit <i>elementChanged(Profile change)</i> which actually details what change occured so the GUI etc can update just that element. */ 54 50 public interface MSMListener { -
trunk/gli/src/org/greenstone/gatherer/msm/MSMProfiler.java
r4674 r5589 1 package org.greenstone.gatherer.msm;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 38 import java.io.File; 39 import java.io.FileInputStream; 40 import java.io.FileOutputStream; 41 import java.io.InputStream; 42 import java.io.OutputStreamWriter; 43 import java.util.ArrayList; 44 import java.util.HashMap; 45 import java.util.Iterator; 37 package org.greenstone.gatherer.msm; 38 39 import java.io.*; 40 import java.util.*; 46 41 import org.greenstone.gatherer.Gatherer; 47 import org.greenstone.gatherer.msm.Declarations;48 42 import org.greenstone.gatherer.msm.MSMAdapter; 49 43 import org.greenstone.gatherer.util.HashMap3D; 50 44 import org.greenstone.gatherer.util.Utility; 51 import org.w3c.dom.Document; 52 import org.w3c.dom.Element; 53 import org.w3c.dom.NodeList; 45 import org.w3c.dom.*; 46 54 47 /** This class is essentially records what actions a user took when merging two metadata sets, so we can avoid having to get the user to repeat the proceedure. 55 48 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 64 57 static final private String IGNORE = "\nIGNORE\n"; 65 58 /** The constructor loads the previous profile for this collection if there is one. 66 67 68 59 * @see org.greenstone.gatherer.collection.CollectionManager 60 * @see org.greenstone.gatherer.msm.MetadataSetManager 61 */ 69 62 public MSMProfiler() { 70 63 this.profile_file = new File(Gatherer.c_man.getCollectionMetadata(), "profile.xml"); … … 80 73 } 81 74 /** Adds a new action mapping to the profile. Such a mapping records that for a certain collection (file) and metadata element a specific action must occur. The action is either a renaming to a new metadata element name, also provided, or an instruction to ignore this particular metadata element, is the target is null. 82 83 84 85 75 * @param collection_file The aboslute path name to the collection where the metadata was sourced, as a <strong>String</strong>. 76 * @param source A <strong>String</strong> containing the fully qualified name of the source metadata element. 77 * @param target Another <strong>String</strong> which is either the fully qualified name of the target element, or <i>null</i> if this is actually an ignore action addition. 78 */ 86 79 public void addAction(String collection_file, String source, String target) { 87 80 if(target == null) { … … 96 89 97 90 /** Determine if an action exists for the given collection and source. 98 99 100 101 91 * @param collection_file The aboslute path name to the collection where the metadata was sourced, as a <strong>String</strong>. 92 * @param source A <strong>String</strong> containing the fully qualified name of the source metadata element. 93 * @return <i>true</i> if such an action exists, <i>false</i> otherwise. 94 */ 102 95 public boolean containsAction(String collection_file, String source) { 103 96 return profiles.contains(collection_file, source); … … 116 109 } 117 110 /** Method that is called whenever an element within a set is changed or modified, in which case we must modify the action profiles to suit. If an element was removed, remove all action profiles with this element as the target. If an elements name changes, update all matching targets to reflect new name. 118 119 111 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 112 */ 120 113 public void elementChanged(MSMEvent event) { 121 114 Gatherer.println("Element changed: " + event); … … 164 157 } 165 158 /** Search the profilerer for any previous actions regarding the indicated collection and metadata element. 166 * @param collection_file The absolute path name to the collection where the metadata was sourced, as a <strong>String</strong>. 167 * @param source A <strong>String</strong> containing the fully qualified name of the source metadata element. 168 * @return The fully qualified name of the target metadata element, as a <strong>String</strong>, or <i>null</i> if we are to ignore this metadata. Note that the target elements name may be exactly the source elements one. 169 * @see org.greenstone.gatherer.msm.Declarations 170 */ 159 * @param collection_file The absolute path name to the collection where the metadata was sourced, as a <strong>String</strong>. 160 * @param source A <strong>String</strong> containing the fully qualified name of the source metadata element. 161 * @return The fully qualified name of the target metadata element, as a <strong>String</strong>, or <i>null</i> if we are to ignore this metadata. Note that the target elements name may be exactly the source elements one. 162 */ 171 163 public String getAction(String collection_file, String source) { 172 164 ///atherer.println("Get action."); … … 261 253 } 262 254 /** Reload the mapping information stored in this document. 263 264 255 * @param document The <strong>Document</strong> to parse. 256 */ 265 257 private void load(Document document) { 266 258 Element root = document.getDocumentElement(); -
trunk/gli/src/org/greenstone/gatherer/msm/MSMPrompt.java
r5564 r5589 71 71 private JDialog on_screen = null; 72 72 private JDialog dialog = null; 73 private JLabel current_details_label = null;74 private JLabel new_details_label = null;75 private JLabel progress_label = null;76 73 private JProgressBar progress = null; 77 private JTextArea current_details = null;78 private JTextArea new_details = null;79 74 private MetadataSetManager manager = null; 80 75 private Object result = null; … … 95 90 96 91 // Create components 97 add = new JButton(); 98 add.addActionListener(this); 99 add.setEnabled(false); 100 add.setMnemonic(KeyEvent.VK_A); 101 Dictionary.registerBoth(add, "MSMPrompt.Add", "MSMPrompt.Add_Tooltip"); 102 103 cancel = new JButton(); 104 cancel.addActionListener(this); 105 cancel.setEnabled(true); 106 cancel.setMnemonic(KeyEvent.VK_C); 107 Dictionary.registerBoth(add, "MSMPrompt.Cancel", "MSMPrompt.Cancel_Tooltip"); 108 109 current_details = new JTextArea(); 110 Dictionary.registerText(current_details, "MSMPrompt.No_Details"); 111 112 current_details_label = new JLabel(); 113 Dictionary.registerText(current_details_label, "MSMPrompt.Current_Details"); 114 115 merge = new JButton(); 116 merge.addActionListener(this); 117 merge.setEnabled(true); 118 merge.setMnemonic(KeyEvent.VK_M); 119 Dictionary.registerBoth(merge, "MSMPrompt.Merge", "MSMPrompt.Merge_Tooltip"); 120 121 new_details = new JTextArea(); 122 Dictionary.registerText(new_details, "MSMPrompt.No_Details"); 123 124 new_details_label = new JLabel(); 125 Dictionary.registerText(new_details_label, "MSMPrompt.New_Details"); 126 127 progress = new JProgressBar(); 128 progress.setStringPainted(true); 129 130 progress_label = new JLabel(); 131 Dictionary.registerText(progress_label, "MSMPrompt.Progress"); 132 133 rename = new JButton(); 134 rename.addActionListener(this); 135 rename.setEnabled(false); 136 rename.setMnemonic(KeyEvent.VK_N); 137 Dictionary.registerBoth(rename, "MSMPrompt.Rename", "MSMPrompt.Rename_Tooltip"); 138 139 replace = new JButton(); 140 replace.addActionListener(this); 141 replace.setEnabled(false); 142 replace.setMnemonic(KeyEvent.VK_R); 143 Dictionary.registerBoth(replace, "MSMPrompt.Replace", "MSMPrompt.Replace_Tooltip"); 144 145 skip = new JButton(); 146 skip.addActionListener(this); 147 skip.setEnabled(true); 148 skip.setMnemonic(KeyEvent.VK_S); 149 Dictionary.registerBoth(skip, "MSMPrompt.Skip", "MSMPrompt.Skip_Tooltip"); 92 cancel = new JButton(); 93 cancel.addActionListener(this); 94 cancel.setEnabled(true); 95 cancel.setMnemonic(KeyEvent.VK_C); 96 Dictionary.registerBoth(cancel, "General.Cancel", "General.Cancel_Tooltip"); 97 98 progress = new JProgressBar(); 99 progress.setStringPainted(true); 150 100 151 101 screen_size = Gatherer.config.screen_size; … … 169 119 Object source = event.getSource(); 170 120 action = Declarations.NO_ACTION; 171 if (source == add) {121 if (add != null && source == add) { 172 122 action = Declarations.ADD; 173 123 } 174 else if (source == cancel) {124 else if (cancel != null && source == cancel) { 175 125 action = Declarations.CANCEL; 176 126 } 177 else if (source == merge) {127 else if (merge != null && source == merge) { 178 128 action = Declarations.MERGE; 179 129 } 180 else if (source == rename) {130 else if (rename != null && source == rename) { 181 131 action = Declarations.RENAME; 182 132 } 183 else if (source == replace) {133 else if (replace != null && source == replace) { 184 134 action = Declarations.REPLACE; 185 135 } 186 else if (source == skip) {136 else if (skip != null && source == skip) { 187 137 action = Declarations.SKIP; 188 138 } 189 139 on_screen.setVisible(false); 190 140 } 141 191 142 /** Method called when the merging process is complete and the progress bar is no longer needed. 192 143 */ … … 201 152 progress.setString(percent); 202 153 } 154 203 155 /** Method to display the metadata element merging prompt, wherein the user determines how the attributes within an element should be merged. 204 156 * @param mde_cur The current <strong>Element</strong> we are merging against. … … 210 162 public Object mDEPrompt(Element mde_cur, Element[] atts_cur, Element mde_new, Element att_new) { 211 163 action = Declarations.NO_ACTION; 164 212 165 // Construction and configuration 213 166 JDialog dialog = new ModalDialog(Gatherer.g_man); 214 167 dialog.setModal(true); 215 168 dialog.setSize(MDE_SIZE); 169 dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata")); 216 170 Dictionary.setText(dialog, "MSMPrompt.Merge_MDE"); 217 dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata")); 171 218 172 JPanel content_pane = (JPanel)dialog.getContentPane(); 219 173 … … 226 180 JLabel attribute_name = new JLabel(att_new.getAttribute("name")); 227 181 228 add.setEnabled(true); 229 replace.setEnabled(false); 230 skip.setEnabled(true); 182 add = new JButton(); 183 add.addActionListener(this); 184 add.setEnabled(true); 185 add.setMnemonic(KeyEvent.VK_A); 186 Dictionary.registerBoth(add, "MSMPrompt.Add", "MSMPrompt.Add_Tooltip"); 187 188 replace = new JButton(); 189 replace.addActionListener(this); 190 replace.setEnabled(false); 191 replace.setMnemonic(KeyEvent.VK_R); 192 Dictionary.registerBoth(replace, "MSMPrompt.Replace", "MSMPrompt.Replace_Tooltip"); 193 194 skip = new JButton(); 195 skip.addActionListener(this); 196 skip.setEnabled(true); 197 skip.setMnemonic(KeyEvent.VK_S); 198 Dictionary.registerBoth(skip, "MSMPrompt.Skip", "MSMPrompt.Skip_Tooltip"); 231 199 232 200 JList cur_values = new JList(atts_cur); … … 236 204 cur_values.setCellRenderer(new AttributeListCellRenderer()); 237 205 cur_values.addListSelectionListener(new ElementListListener(cur_values, replace)); 238 //Layout 206 207 // Layout 239 208 JPanel title_pane = new JPanel(); 240 209 title_pane.setLayout(new GridLayout(2,2)); … … 275 244 276 245 // Display 277 278 dialog.setLocation((screen_size.width - MDE_SIZE.width) / 2, (screen_size.height - MDE_SIZE.height) / 2); 246 dialog.setLocation((screen_size.width - MDE_SIZE.width) / 2, (screen_size.height - MDE_SIZE.height) / 2); 279 247 on_screen = dialog; 280 248 on_screen.setVisible(true); // blocks until hidden … … 303 271 on_screen = null; 304 272 dialog = null; 305 273 306 274 return result; 307 275 } 276 308 277 /** This method displays the metadata data set merging prompt, wherein the user determines how the elements within a set should be merged. 309 278 * @param mds_cur The current <strong>MetadataSet</strong> containing our document. … … 315 284 public int mDSPrompt(MetadataSet mds_cur, Element mde_cur, MetadataSet mds_new, Element mde_new) { 316 285 action = Declarations.NO_ACTION; 286 317 287 // Construction and configuration 318 288 JDialog dialog = new ModalDialog(Gatherer.g_man); 319 289 dialog.setModal(true); 320 290 dialog.setSize(MDS_SIZE); 291 dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata")); 321 292 Dictionary.setText(dialog, "MSMPrompt.Merge_MDS"); 322 dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata")); 293 294 JTextArea current_details = new JTextArea(); 295 Dictionary.registerText(current_details, "MSMPrompt.No_Details"); 296 297 JLabel current_details_label = new JLabel(); 298 Dictionary.registerText(current_details_label, "MSMPrompt.Current_Details"); 299 300 JTextArea new_details = new JTextArea(); 301 Dictionary.registerText(new_details, "MSMPrompt.No_Details"); 302 303 JLabel new_details_label = new JLabel(); 304 Dictionary.registerText(new_details_label, "MSMPrompt.New_Details"); 305 306 JLabel progress_label = new JLabel(); 307 Dictionary.registerText(progress_label, "MSMPrompt.Progress"); 308 309 add = new JButton(); 310 add.addActionListener(this); 311 add.setEnabled(false); 312 add.setMnemonic(KeyEvent.VK_A); 313 Dictionary.registerBoth(add, "MSMPrompt.Add", "MSMPrompt.Add_Tooltip"); 314 315 merge = new JButton(); 316 merge.addActionListener(this); 317 merge.setEnabled(true); 318 merge.setMnemonic(KeyEvent.VK_M); 319 Dictionary.registerBoth(merge, "MSMPrompt.Merge", "MSMPrompt.Merge_Tooltip"); 320 321 rename = new JButton(); 322 rename.addActionListener(this); 323 rename.setEnabled(false); 324 rename.setMnemonic(KeyEvent.VK_N); 325 Dictionary.registerBoth(rename, "MSMPrompt.Rename", "MSMPrompt.Rename_Tooltip"); 326 327 replace = new JButton(); 328 replace.addActionListener(this); 329 replace.setEnabled(false); 330 replace.setMnemonic(KeyEvent.VK_R); 331 Dictionary.registerBoth(replace, "MSMPrompt.Replace", "MSMPrompt.Replace_Tooltip"); 332 333 skip = new JButton(); 334 skip.addActionListener(this); 335 skip.setEnabled(true); 336 skip.setMnemonic(KeyEvent.VK_S); 337 Dictionary.registerBoth(skip, "MSMPrompt.Skip", "MSMPrompt.Skip_Tooltip"); 338 323 339 JPanel content_pane = (JPanel)dialog.getContentPane(); 324 if (mde_cur != null) {340 if (mde_cur != null) { 325 341 add.setEnabled(false); 326 342 cancel.setEnabled(true); … … 329 345 replace.setEnabled(true); 330 346 skip.setEnabled(true); 331 347 // Current details. 332 348 String str_cur[] = MSMUtils.getStructuralDetails(mds_cur, mde_cur); 333 349 String opt_cur[] = MSMUtils.getOptionListDetails(mde_cur); … … 353 369 replace.setEnabled(false); 354 370 skip.setEnabled(true); 355 current_details.setText(Dictionary.newget("MSMPrompt.No_Element")); 356 } 371 Dictionary.setText(current_details, "MSMPrompt.No_Element"); 372 } 373 357 374 // New details. 358 375 String str_new[] = MSMUtils.getStructuralDetails(mds_new, mde_new); … … 367 384 } 368 385 new_details.setText(details_new); 386 369 387 // Layout 370 388 JPanel current_details_pane = new JPanel(); … … 434 452 return action; 435 453 } 454 436 455 /** This method initialises the progress bar. 437 456 * @param element_count An <i>int</i> specifying the total number of elements to be merged. … … 450 469 public String rename(Element mde_new) { 451 470 action = Declarations.NO_ACTION; 471 452 472 // Create 453 473 JDialog dialog = new ModalDialog(Gatherer.g_man); … … 464 484 old_name.setBackground(Color.white); 465 485 old_name.setOpaque(true); 466 Dictionary.setTooltip(old_name, "MSMPrompt.Old_Name_Tooltip");467 486 468 487 JLabel new_name_label = new JLabel(); … … 508 527 content_pane.add(control_pane, BorderLayout.CENTER); 509 528 content_pane.add(button_pane, BorderLayout.SOUTH); 529 510 530 // Display 511 531 dialog.setLocation((screen_size.width - RENAME_SIZE.width) / 2, (screen_size.height - RENAME_SIZE.height) / 2); … … 596 616 list_pane.setLayout(new BorderLayout()); 597 617 list_pane.add(new JScrollPane(list), BorderLayout.CENTER); 598 618 599 619 JPanel button_pane = new JPanel(); 600 620 button_pane.setBorder(BorderFactory.createEmptyBorder(0,5,5,5)); … … 628 648 button_pane = null; 629 649 dialog = null; 630 // Return selected element .650 // Return selected element 631 651 if(action == Declarations.CANCEL) { 632 652 return null; … … 646 666 String args[] = new String[1]; 647 667 args[0] = name; 668 648 669 // Create 649 670 MSMDialog dialog = new MSMDialog(); … … 655 676 JPanel content_pane = (JPanel) dialog.getContentPane(); 656 677 JPanel control_pane = new JPanel(); 657 JTextArea instructions = new JTextArea( get("MSMPrompt.Select_Element_Instructions", args));678 JTextArea instructions = new JTextArea(); 658 679 instructions.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 659 680 instructions.setEditable(false); … … 661 682 instructions.setRows(SELECT_LINE_COUNT); 662 683 instructions.setWrapStyleWord(true); 684 Dictionary.setText(instructions, "MSMPrompt.Select_Element_Instructions", args); 685 663 686 JPanel original_pane = new JPanel(); 664 JLabel original_label = new JLabel( get("MSMPrompt.Select_Element_Original"));687 JLabel original_label = new JLabel(); 665 688 original_label.setPreferredSize(SELECT_LABEL_SIZE); 689 Dictionary.setText(original_label, "MSMPrompt.Select_Element_Original"); 666 690 JTextField original = new JTextField(name); 667 691 original.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 668 692 original.setEditable(false); 693 694 JPanel set_pane = new JPanel(); 695 JLabel set_label = new JLabel(); 696 set_label.setPreferredSize(SELECT_LABEL_SIZE); 697 Dictionary.setText(set_label, "MSMPrompt.Select_Element_Set"); 698 JComboBox set = new JComboBox(manager.getSets(false)); // Don't include the greenstone metadata set. 699 Dictionary.setTooltip(set, "MSMPrompt.Select_Element_Set_Tooltip"); 700 669 701 JPanel element_pane = new JPanel(); 670 JLabel element_label = new JLabel( get("MSMPrompt.Select_Element_Element"));702 JLabel element_label = new JLabel(); 671 703 element_label.setPreferredSize(SELECT_LABEL_SIZE); 704 Dictionary.setText(element_label, "MSMPrompt.Select_Element_Element"); 672 705 JComboBox element = new JComboBox(); 673 JButton add_button = new JButton(get("MSMPrompt.Select_Element_Add")); 706 Dictionary.setTooltip(element, "MSMPrompt.Select_Element_Element_Tooltip"); 707 708 JButton add_button = new JButton(); 674 709 add_button.setEnabled(false); 675 710 add_button.setMnemonic(KeyEvent.VK_A); 676 JButton cancel_button = new JButton(get("General.Cancel")); 711 Dictionary.setBoth(add_button, "MSMPrompt.Select_Element_Add", "MSMPrompt.Select_Element_Add_Tooltip"); 712 713 JButton cancel_button = new JButton(); 677 714 cancel_button.setMnemonic(KeyEvent.VK_C); 678 JButton merge_button = new JButton(get("MSMPrompt.Select_Element_Merge")); 715 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip"); 716 717 JButton merge_button = new JButton(); 679 718 merge_button.setEnabled(false); 680 719 merge_button.setMnemonic(KeyEvent.VK_M); 681 JButton ignore_button = new JButton(get("MSMPrompt.Select_Element_Ignore")); 720 Dictionary.setBoth(merge_button, "MSMPrompt.Select_Element_Merge", "MSMPrompt.Select_Element_Merge_Tooltip"); 721 722 JButton ignore_button = new JButton(); 682 723 ignore_button.setMnemonic(KeyEvent.VK_I); 683 JPanel set_pane = new JPanel(); 684 JLabel set_label = new JLabel(get("MSMPrompt.Select_Element_Set")); 685 set_label.setPreferredSize(SELECT_LABEL_SIZE); 686 JComboBox set = new JComboBox(manager.getSets(false)); // Don't include the greenstone metadata set. 724 Dictionary.setBoth(ignore_button, "MSMPrompt.Select_Element_Ignore", "MSMPrompt.Select_Element_Ignore_Tooltip"); 725 687 726 JPanel button_pane = new JPanel(); 727 688 728 // Connect 689 729 AddListener add_listener = new AddListener(dialog, name, set); … … 743 783 } 744 784 merge_button.setEnabled(element.getItemCount() > 0); 785 745 786 // Layout 746 787 original_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,5)); … … 772 813 content_pane.add(control_pane, BorderLayout.CENTER); 773 814 content_pane.add(button_pane, BorderLayout.SOUTH); 815 774 816 // Display 775 817 dialog.setLocation((screen_size.width - SELECT_ELEMENT_SIZE.width) / 2, (screen_size.height - SELECT_ELEMENT_SIZE.height) / 2); … … 814 856 } 815 857 816 private String get(String key) {817 return get(key, null);818 }819 820 private String get(String key, String args[]) {821 if(key.indexOf(".") == -1) {822 key = "MSMPrompt." + key;823 }824 return Gatherer.dictionary.get(key, args);825 }826 827 858 /** Prompts the user to select a metadata set from the given list. Uses the name parameter to attempt to automatically select the correct collection (ie the only collection that has an element with the same name). 828 859 * @param name The name of the metadata element whose set name is unknown. … … 832 863 String args[] = new String[1]; 833 864 args[0] = name; 865 834 866 // Creation 835 867 MSMDialog dialog = new MSMDialog(); 836 868 dialog.setModal(true); 837 869 dialog.setSize(SELECT_SET_SIZE); 838 dialog.setTitle(get("MSMPrompt.Select_Set_Title"));839 870 dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata")); 871 Dictionary.setText(dialog, "MSMPrompt.Select_Set_Title"); 872 840 873 JPanel content_pane = (JPanel) dialog.getContentPane(); 841 874 JPanel control_pane = new JPanel(); 842 JTextArea instructions = new JTextArea( get("MSMPrompt.Select_Set_Instructions", args));875 JTextArea instructions = new JTextArea(); 843 876 instructions.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); 844 877 instructions.setEditable(false); … … 846 879 instructions.setRows(SELECT_LINE_COUNT); 847 880 instructions.setWrapStyleWord(true); 881 Dictionary.setText(instructions, "MSMPrompt.Select_Set_Instructions", args); 882 848 883 JComboBox set = new JComboBox(); 849 884 set.setBackground(Color.white); 850 set.addItem( get("MSMPrompt.Select_Set_None"));885 set.addItem(Dictionary.newget("MSMPrompt.Select_Set_None")); 851 886 Vector sets = manager.getSets(); 852 887 for(int i = sets.size() - 1; i >= 0; i--) { 853 888 set.addItem(sets.get(i)); 854 889 } 855 JButton ok = new JButton(get("General.OK")); 890 Dictionary.setTooltip(set, "MSMPrompt.Select_Element_Set_Tooltip"); 891 892 JButton ok = new JButton(); 856 893 ActionListener ok_listener = new IgnoreListener(dialog); 857 894 ok.addActionListener(ok_listener); // Doesn't really ignore. Just disposes() 858 // Select most likely set. 895 Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip"); 896 897 // Select most likely set 859 898 if(name.indexOf(".") != -1) { 860 899 String set_name = name.substring(0, name.indexOf(".")); … … 873 912 matches = null; 874 913 } 914 875 915 // Layout 876 916 control_pane.setLayout(new GridLayout(2,1)); … … 881 921 content_pane.add(new JScrollPane(instructions), BorderLayout.CENTER); 882 922 content_pane.add(control_pane, BorderLayout.SOUTH); 923 883 924 // Display 884 925 dialog.setLocation((screen_size.width - SELECT_SET_SIZE.width) / 2, (screen_size.height - SELECT_SET_SIZE.height) / 2); … … 921 962 // However, before we attempt to add a new element to the set, we should check that none already exists. 922 963 Element element = mds.getElement(name); 923 if (element == null) {924 result = mds.addElement(n );964 if (element == null) { 965 result = mds.addElement(n, Gatherer.config.interface_language); 925 966 } 926 967 else { -
trunk/gli/src/org/greenstone/gatherer/msm/MSMUtils.java
r5154 r5589 26 26 */ 27 27 package org.greenstone.gatherer.msm; 28 28 29 /************************************************************************************** 29 30 * Title: Gatherer … … 306 307 307 308 /*************************************************************************/ 308 309 309 /** This method is a slight variation on getNodeNamed in that it is especially written to retrieve the attribute Nodes of a certain name present under the given element. Note that this method is language specific. 310 310 * @param element The target element <strong>Node</strong>. … … 889 889 if(av.getNodeName().equals("Value") && 890 890 bv.getNodeName().equals("Value")) { 891 891 // Retrieve and then compare their text values. 892 892 Node at = av.getFirstChild(); 893 893 Node bt = bv.getFirstChild(); -
trunk/gli/src/org/greenstone/gatherer/msm/Metadata.java
r5515 r5589 1 package org.greenstone.gatherer.msm;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.msm; 38 38 39 import java.io.*; 39 40 import org.greenstone.gatherer.Gatherer; … … 66 67 /** Constructs a new Metadata object with no current value. 67 68 * @param element The <strong>ElementWrapper</strong> associated with this metadata. 68 69 */ 69 70 public Metadata(ElementWrapper element) { 70 71 super(); … … 73 74 } 74 75 /** Default constructor simply creates a new Metadata object based on the given parameters. 75 76 77 76 * @param element The <strong>ElementWrapper</strong> associated with this metadata. 77 * @param value The assigned value for the given element, as a <strong>GValueNode</strong>. 78 */ 78 79 public Metadata(ElementWrapper element, GValueNode value) { 79 80 super(); … … 82 83 } 83 84 /** Constructs a new Metadata object, given the value. The metadata element is extracted from the value tree information. 84 85 86 87 88 85 * @param value The assigned value for the given element, as a <strong>GValueNode</strong>. 86 * @see org.greenstone.gatherer.Gatherer 87 * @see org.greenstone.gatherer.collection.CollectionManager 88 * @see org.greenstone.gatherer.msm.MetadataSetManager 89 */ 89 90 public Metadata(GValueNode value) { 90 91 super(); … … 97 98 } 98 99 /** Compares two Metadata objects for ordering purposes. 99 100 101 102 100 * @param object The other metadata as an <strong>Object</strong>. 101 * @return An <i>int</i> value as specified in java.lang.String#compareTo 102 * @see java.lang.String#compareTo 103 */ 103 104 public int compareTo(Object object) { 104 105 return toString().compareTo(object.toString()); … … 109 110 } 110 111 /** Tests to metadata objects for equality. 111 112 113 112 * @param object The other metadata as an <strong>Object</strong>. 113 * @return <i>true</i> if the metadata are equal, <i>false</i> otherwise. 114 */ 114 115 public boolean equals(Object object) { 115 116 if(compareTo(object) == 0) { … … 137 138 } 138 139 /** Retrieve the reference count. 139 140 140 * @return The count as an <i>int</i>. 141 */ 141 142 public int getCount() { 142 143 return count; 143 144 } 144 145 /** Retrieve the element associated with this metadata. 145 146 146 * @return An <strong>ElementWrapper</strong>. 147 */ 147 148 public ElementWrapper getElement() { 148 149 return element; … … 155 156 156 157 /** Get the textual value of this metadata. 157 158 158 * @return A <strong>String</strong> representing the value of this Metadata. Note that if the value node is null, then the String returned is "". 159 */ 159 160 public String getValue() { 160 161 String result = ""; … … 165 166 } 166 167 /** Retrieve the value node associated with this metadata. 167 168 168 * @return A <strong>GValueNode</strong>. 169 */ 169 170 public GValueNode getValueNode() { 170 171 return value; … … 185 186 } 186 187 /** Sets the reference count. 187 188 188 * @param value The new value of count as an <i>int</i>. 189 */ 189 190 public void setCount(int value) { 190 191 count = value; … … 201 202 202 203 /** Translates this object into a string representation. 203 204 204 * @return A <strong>String</strong>. 205 */ 205 206 public String toString() { 206 207 return element.toString() + "=" + getValue(); -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataComboBoxModel.java
r4674 r5589 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 37 package org.greenstone.gatherer.msm; 44 38 45 import java.util.Collections; 46 import java.util.Vector; 39 import java.util.*; 47 40 import javax.swing.DefaultComboBoxModel; 48 41 import org.greenstone.gatherer.msm.MetadataSetManager; 49 42 import org.greenstone.gatherer.msm.MSMEvent; 50 43 import org.greenstone.gatherer.msm.MSMListener; 51 import org.w3c.dom. Element;52 import org.w3c.dom.NodeList; 44 import org.w3c.dom.*; 45 53 46 /** A combobox model that contains information from an array of NodeLists. */ 54 47 public class MetadataComboBoxModel -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataParser.java
r4674 r5589 1 package org.greenstone.gatherer.msm;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.msm; 38 38 39 import org.greenstone.gatherer.Gatherer; 39 40 import org.greenstone.gatherer.file.FileNode; 41 40 42 /** Provides an interface for all parsers which should be called during the 'search for existing metadata' phase of a file copy. 41 43 * @author John Thompson, Greenstone Digital Library, University of Waikato -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataSet.java
r5581 r5589 181 181 * @param name The name of this element as a <strong>String</strong>. 182 182 * @return An <strong>ElementWrapper</strong> around the newly created element or null if the element was not created. 183 * @deprecated All elements should be created with a language. 184 */ 185 public ElementWrapper addElement(String name) { 186 Text text = document.createTextNode(name); 187 Element identifier = document.createElementNS("","Attribute"); 188 identifier.setAttribute("name","identifier"); 189 identifier.appendChild(text); 190 Element element = document.createElementNS("","Element"); 191 element.setAttribute("name",name); 192 element.appendChild(identifier); 193 root.appendChild(element); 194 ElementWrapper wrapper = new ElementWrapper(element); 195 ///ystem.err.println("Added a new element " + wrapper); 196 return wrapper; 197 } 198 183 */ 199 184 public ElementWrapper addElement(String name, String language) 200 185 { -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataSetManager.java
r5564 r5589 151 151 public MetadataSet addSet(String namespace, String name) { 152 152 MetadataSet mds = new MetadataSet(Utility.METADATA_SET_TEMPLATE); 153 mds.setAttribute("creator", "The Gatherer");153 mds.setAttribute("creator", "The Greenstone Librarian Interface"); 154 154 // Calculate lastchanged to right now on this machine by this user 155 155 String user_name = System.getProperty("user.name"); … … 203 203 int result = emdsp.display(); 204 204 MetadataSet set = emdsp.getSelectedSet(); 205 if (result == ExportMDSPrompt.EXPORT && set != null) {205 if (result == ExportMDSPrompt.EXPORT && set != null) { 206 206 File file = emdsp.getSelectedFile(); 207 207 MetadataSet set_copy = new MetadataSet(set, emdsp.getSelectedCondition()); … … 283 283 for(int i = 0; i < listeners.size(); i++) { 284 284 ((MSMListener)listeners.get(i)).valueChanged(event); 285 } 285 } 286 286 } 287 287 /** Builds a list of elements that have been assigned as metadata in this collection. We go through all of the elements, looking for elements whose occurances are greater than 0. A convenience call to the version with one parameter. … … 1304 1304 } 1305 1305 } 1306 -
trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java
r5581 r5589 26 26 */ 27 27 package org.greenstone.gatherer.msm.parsers; 28 28 29 /************************************************************************************** 29 30 * Written: ??/??/02 -
trunk/gli/src/org/greenstone/gatherer/undo/UndoManager.java
r5581 r5589 54 54 import org.greenstone.gatherer.msm.Metadata; 55 55 import org.greenstone.gatherer.msm.MSMEvent; 56 import org.greenstone.gatherer.msm.MSMListenerAdapter;57 56 import org.greenstone.gatherer.util.ArrayTools; 58 57 import org.greenstone.gatherer.util.DragComponent;
Note:
See TracChangeset
for help on using the changeset viewer.