Changeset 5571
- Timestamp:
- 2003-10-03T17:09:38+12:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Dictionary.java
r5564 r5571 473 473 ((JLabel) component).setText(text); 474 474 } 475 else if (component instanceof JProgressBar) { 476 ((JProgressBar) component).setString(text); 477 } 475 478 else if (component instanceof JTextComponent) { 476 479 ((JTextComponent) component).setText(text); -
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r5564 r5571 26 26 */ 27 27 package org.greenstone.gatherer; 28 28 29 /************************************************************************************** 29 30 * Written: ??/??/02 … … 62 63 import org.greenstone.gatherer.util.Utility; 63 64 import sun.misc.*; 65 64 66 /** Containing the main() method for the Gatherer, this class is the starting point for the rest of the application. It first parses the command line arguments, preparing to update the configuration as required. Next it loads several important support classes such as the Configuration and Dictionary. Finally it creates the other important managers and sends them on their way. 65 67 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 113 115 /** A static reference to ourselves. */ 114 116 static public Gatherer self; 115 /** A public reference to the message log. */116 static public Log log;117 117 /** The debug print stream. */ 118 118 static public PrintStream debug; … … 192 192 } 193 193 try { 194 // Create log195 log = new Log();196 194 // Load Config 197 195 loadConfig(gsdl_path, exec_path, perl_path); … … 581 579 */ 582 580 static public void missingEXEC(Dictionary dictionary) { 583 WarningDialog dialog = new WarningDialog("warning.MissingEXEC", "general.exec_address", dictionary); 584 //NoSettingDialog dialog = new NoSettingDialog("warning.MissingEXEC", "NoSettingEXEC.Message", false, dictionary); 581 WarningDialog dialog = new WarningDialog("warning.MissingEXEC", "general.exec_address"); 585 582 dialog.setValueField(new URLField(Gatherer.config.getColor("coloring.editable_foreground", false), Gatherer.config.getColor("coloring.editable_background", false), Gatherer.config.getColor("coloring.error_foreground", false), Gatherer.config.getColor("coloring.error_background", false))); 586 583 dialog.display(); … … 593 590 */ 594 591 static public void missingGSDL(Dictionary dictionary) { 595 WarningDialog dialog = new WarningDialog("warning.MissingGSDL", false , dictionary);592 WarningDialog dialog = new WarningDialog("warning.MissingGSDL", false); 596 593 dialog.display(); 597 594 dialog.dispose(); … … 602 599 /** Prints a warning message about a missing PERL path, which although not fatal pretty much ensures no collection creation/building will work properly in the Gatherer. */ 603 600 static public void missingPERL(Dictionary dictionary) { 604 WarningDialog dialog = new WarningDialog("warning.MissingPERL", false , dictionary);601 WarningDialog dialog = new WarningDialog("warning.MissingPERL", false); 605 602 dialog.display(); 606 603 dialog.dispose(); … … 693 690 Gatherer.printStackTrace(error); 694 691 } 695 }696 697 /** Creates and dispatches a message given the initial details.698 * @param level An <i>int</i> indicating the message level for this message.699 * @param message A <strong>String</strong> which contains the payload of this message.700 * @see org.greenstone.gatherer.Message701 * @see org.greenstone.gatherer.Log702 */703 private void message(int level, String message) {704 Message msg = new Message(Message.GENERAL, level, message);705 log.add(msg);706 692 } 707 693 -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r5564 r5571 45 45 import org.greenstone.gatherer.Dictionary; 46 46 import org.greenstone.gatherer.Gatherer; 47 import org.greenstone.gatherer.Message;48 47 import org.greenstone.gatherer.cdm.CollectionDesignManager; 49 48 import org.greenstone.gatherer.cdm.CommandTokenizer; … … 75 74 import org.greenstone.gatherer.util.Utility; 76 75 import org.w3c.dom.*; 76 77 77 /** This class manages many aspects of the collection, from its creation via scripts, data access via methods and its importing and building into the final collection. It is also resposible for firing appropriate event when significant changes have occured within the collection, and for creating a new metadata set manager as necessary. 78 78 * @author John Thompson … … 112 112 static final public int NO_SPECIAL_CASE = -1; 113 113 static final public int SPECIAL_DLS = 0; 114 115 /** Used to indicate the source of the message is the file collection methods. */ 116 static final public int COLLECT = 3; 117 /** Used to indicate the source of the message is the building methods. */ 118 static final public int BUILDING = 5; 119 114 120 /** Constructor. */ 115 121 public CollectionManager() { … … 164 170 } 165 171 args = ArrayTools.add(args, collection.build_options.getBuildValues()); 166 GShell shell = new GShell(args, GShell.BUILD, Message.BUILDING, this, build_monitor, GShell.GSHELL_BUILD);172 GShell shell = new GShell(args, GShell.BUILD, BUILDING, this, build_monitor, GShell.GSHELL_BUILD); 167 173 shell.addGShellListener(Gatherer.g_man.create_pane); 168 174 shell.start(); … … 726 732 collection_import = null; 727 733 args = ArrayTools.add(args, collection.build_options.getImportValues()); 728 GShell shell = new GShell(args, GShell.IMPORT, Message.BUILDING, this, import_monitor, GShell.GSHELL_IMPORT);734 GShell shell = new GShell(args, GShell.IMPORT, BUILDING, this, import_monitor, GShell.GSHELL_IMPORT); 729 735 shell.addGShellListener(Gatherer.g_man.create_pane); 730 736 shell.start(); … … 871 877 } 872 878 } 873 GShell process = new GShell(command, GShell.NEW, Message.COLLECT, this, null, GShell.GSHELL_NEW);879 GShell process = new GShell(command, GShell.NEW, COLLECT, this, null, GShell.GSHELL_NEW); 874 880 process.addGShellListener(this); 875 881 process.run(); // Don't bother threading this... yet … … 877 883 878 884 /** Any implementation of GShellListener must include this method to allow the GShell to send messages to listeners. However in this case the CollectionManager is in no way interested in what the messages are, just the import events which have a specific type and are handled elsewhere. Thus we can safely ignore this event. 879 880 885 * @param event A <strong>GShellEvent</strong> which contains a the message. 886 */ 881 887 public synchronized void message(GShellEvent event) { 882 888 } 883 889 /** Called whenever the metadata value changes in some way, such as the addition of a new value. We want to mark the collection so that it needs saving again. 884 885 886 890 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 891 * @see org.greenstone.gatherer.collection.Collection 892 */ 887 893 public void metadataChanged(MSMEvent event) { 888 894 // Again this change means we need to save the collection again. … … 890 896 } 891 897 /** This call is fired whenever a process within a GShell created by this class begins. 892 893 894 895 896 898 * @param event A <strong>GShellEvent</strong> containing information about the GShell process. 899 * @see org.greenstone.gatherer.Gatherer 900 * @see org.greenstone.gatherer.gui.GUIManager 901 * @see org.greenstone.gatherer.shell.GShell 902 */ 897 903 public synchronized void processBegun(GShellEvent event) { 898 904 Gatherer.println("CollectionManager.processBegun(" + event.getType() + ")"); … … 1186 1192 catch (Exception exception) { 1187 1193 JOptionPane.showMessageDialog(Gatherer.g_man, "Exception detected during collection install.\nMost likely caused by Windows or Local Library holding locks on files:\n" + exception.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); 1188 }1189 }1190 1191 /** Creates and dispatches a message given the initial details.1192 * @param level An <i>int</i> indicating the message level for this message.1193 * @param message A <strong>String</strong> which contains the payload of this message.1194 * @see org.greenstone.gatherer.Log1195 * @see org.greenstone.gatherer.Message1196 */1197 private void message(int level, String message) {1198 Message msg = new Message(Message.COLLECT, level, message);1199 if(Gatherer.g_man != null) {1200 Gatherer.log.add(msg);1201 } else {1202 Gatherer.println(msg.toString());1203 1194 } 1204 1195 } … … 1404 1395 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1405 1396 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1406 1397 */ 1407 1398 public void treeNodesChanged(TreeModelEvent event) { 1408 1399 if(collection != null) { … … 1411 1402 } 1412 1403 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1413 1414 1404 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1405 */ 1415 1406 public void treeNodesInserted(TreeModelEvent event) { 1416 1407 if(collection != null) { … … 1419 1410 } 1420 1411 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1421 1422 1412 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1413 */ 1423 1414 public void treeNodesRemoved(TreeModelEvent event) { 1424 1415 if(collection != null) { … … 1427 1418 } 1428 1419 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1429 1430 1420 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1421 */ 1431 1422 public void treeStructureChanged(TreeModelEvent event) { 1432 1423 if(collection != null) { -
trunk/gli/src/org/greenstone/gatherer/gui/BrowsingPane.java
r5536 r5571 89 89 back_button = new JButton(Utility.getImage("back.gif")); 90 90 back_button.setEnabled(false); 91 Dictionary.registerTooltip(back_button, "Browser.Back ");91 Dictionary.registerTooltip(back_button, "Browser.Back_Tooltip"); 92 92 93 93 // refresh_button = new JButton(Utility.getImage("reload.gif")); … … 100 100 101 101 home_button = new JButton(Utility.getImage("home.gif")); 102 Dictionary.registerTooltip(home_button, "Browser.Home ");102 Dictionary.registerTooltip(home_button, "Browser.Home_Tooltip"); 103 103 104 104 JPanel address_pane = new JPanel(); … … 108 108 JPanel right_button_pane = new JPanel(); 109 109 go_button = new JButton(Utility.getImage("go.gif")); 110 Dictionary.registerTooltip(go_button, "Browser.Go ");110 Dictionary.registerTooltip(go_button, "Browser.Go_Tooltip"); 111 111 112 112 stop_button = new JButton(Utility.getImage("stop.gif")); 113 113 stop_button.setEnabled(false); 114 Dictionary.registerTooltip(stop_button, "Browser.Stop ");114 Dictionary.registerTooltip(stop_button, "Browser.Stop_Tooltip"); 115 115 116 116 forward_button = new JButton(Utility.getImage("forward.gif")); 117 117 forward_button.setEnabled(false); 118 Dictionary.registerTooltip(forward_button, "Browser.Forward ");118 Dictionary.registerTooltip(forward_button, "Browser.Forward_Tooltip"); 119 119 120 120 // Calpa Pane stuff -
trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java
r5536 r5571 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.*; … … 57 58 import org.greenstone.gatherer.util.TreeSynchronizer; 58 59 import org.greenstone.gatherer.util.Utility; 59 import org.greenstone.gatherer.util.WinRegistry; 60 60 61 /** The collection pane is analogous with a file manager. It is there that the user chooses which files to include in their collection and what structure the file hierarchy should take. The later aspect is not important for the Greenstone Suite, but is usefull for grouping files for ease of metadata markup. The view essentially consists of two file trees, one denoting the entire source workspace and the other the files within your collection. The trees themselves have a title bar at the top, a filter control at the bottom, and are coloured to indicate activity (grey for disabled). The remainder of the screen is taken by a status area, to indicate current file job progress during copying etc, and three buttons for controlling features of the view. 61 62 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 198 199 FileNode node = (FileNode) collection_tree.getModel().getRoot(); 199 200 Gatherer.f_man.newFolder(collection_tree, node); 200 //JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary. get("FileActions.No_Parent_For_New_Folder"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);201 //JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.No_Parent_For_New_Folder"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE); 201 202 } 202 203 } -
trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
r5536 r5571 57 57 import org.greenstone.gatherer.shell.GShellProgressMonitor; 58 58 import org.greenstone.gatherer.util.AppendLineOnlyFileDocument; 59 59 60 /** This class provides a GUI view showing some statistics on your current collection, and options for building it. As the collection is built this initial view is replaced with one showing progress bars and a message log of the creation process. This log can be later accessed via the options tree located in the center of the initial pane. This class is also responsible for creating the GShellProgressMonitors that are then attatched to external shell processes, and calling the methods in the CollectionManager for actually importing and building the collection. <br><BR> 60 61 * <center><table width=80% border=2 cellspacing=0 cellpadding=2><tr><td align=center colspan=4> -
trunk/gli/src/org/greenstone/gatherer/gui/FileAssociationDialog.java
r5527 r5571 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 javax.swing.*; 43 44 import javax.swing.event.*; 45 import org.greenstone.gatherer.Dictionary; 44 46 import org.greenstone.gatherer.Gatherer; 45 47 import org.greenstone.gatherer.file.FileAssociationManager; … … 82 84 /** The default size for the dialog. */ 83 85 static final private Dimension SIZE = new Dimension(600, 270); 86 84 87 /** Create a new file association dialog. 85 88 * @param manager A reference to the <strong>FileAssociationManager</strong> so we can determine what extensions are already associated. … … 95 98 setModal(true); 96 99 setSize(SIZE); 97 setTitle(get("FileAssociationDialog.Title"));98 100 setJMenuBar(new SimpleMenuBar("fileassociations")); 101 Dictionary.setText(this, "FileAssociationDialog.Title"); 102 99 103 JPanel content_pane = (JPanel) getContentPane(); 100 104 content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false)); 101 105 JPanel control_pane = new JPanel(); 102 JTextArea instructions_area = new JTextArea(get("FileAssociationDialog.Instructions")); 106 107 JTextArea instructions_area = new JTextArea(); 103 108 instructions_area.setEditable(false); 104 109 instructions_area.setLineWrap(true); 105 110 instructions_area.setRows(5); 106 111 instructions_area.setWrapStyleWord(true); 112 Dictionary.setText(instructions_area, "FileAssociationDialog.Instructions"); 113 107 114 JPanel extension_pane = new JPanel(); 108 115 extension_pane.setOpaque(false); 109 JLabel extension_label = new JLabel( get("FileAssociationDialog.Extension"));116 JLabel extension_label = new JLabel(); 110 117 extension_label.setPreferredSize(LABEL_SIZE); 118 Dictionary.setText(extension_label, "FileAssociationDialog.Extension"); 119 111 120 extension = new GComboBox(); 112 121 extension.setEditable(true); … … 115 124 extension.add(manager.getExtension(i)); 116 125 } 126 Dictionary.setTooltip(extension, "FileAssociationDialog.Extension_Tooltip"); 127 117 128 JPanel command_pane = new JPanel(); 118 129 command_pane.setOpaque(false); 119 JLabel command_label = new JLabel( get("FileAssociationDialog.Command"));130 JLabel command_label = new JLabel(); 120 131 command_label.setPreferredSize(LABEL_SIZE); 132 Dictionary.setText(command_label, "FileAssociationDialog.Command"); 121 133 JPanel inner_pane = new JPanel(); 122 134 inner_pane.setOpaque(false); … … 128 140 command.setText(manager.getCommandString((String)extension.get(0))); 129 141 } 130 browse = new JButton(get("FileAssociationDialog.Browse")); 142 Dictionary.setTooltip(command, "FileAssociationDialog.Command_Tooltip"); 143 144 browse = new JButton(); 131 145 browse.setBackground(Gatherer.config.getColor("coloring.button_background", false)); 146 browse.setMnemonic(KeyEvent.VK_B); 132 147 browse.setPreferredSize(LABEL_SIZE); 148 Dictionary.setBoth(browse, "FileAssociationDialog.Browse", "FileAssociationDialog.Browse_Tooltip"); 149 133 150 JPanel button_pane = new JPanel(); 134 151 button_pane.setOpaque(false); 135 ok = new JButton( get("General.OK"));152 ok = new JButton(); 136 153 ok.setBackground(Gatherer.config.getColor("coloring.button_background", false)); 137 cancel = new JButton(get("General.Cancel")); 154 ok.setMnemonic(KeyEvent.VK_O); 155 Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip"); 156 cancel = new JButton(); 138 157 cancel.setBackground(Gatherer.config.getColor("coloring.button_background", false)); 158 cancel.setMnemonic(KeyEvent.VK_C); 159 Dictionary.setBoth(cancel, "General.Cancel", "General.Pure_Cancel_Tooltip"); 160 139 161 // Connection 140 162 browse.addActionListener(new BrowseListener()); … … 143 165 extension.addActionListener(new ExtensionListener()); 144 166 command.getDocument().addDocumentListener(new CommandListener()); 167 145 168 // Layout 146 169 extension_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0)); … … 186 209 previous_extension = null; 187 210 } 211 188 212 /** Redisplay the dialog, ensuring that the details (or lack thereof) for a certain extension is apparent. In fact if an extension is provided force the user to add it or cancel. 189 213 * @param new_extension The extension code as a <strong>String</strong>. … … 191 215 public String display(String new_extension) { 192 216 if(new_extension != null) { 193 ok.setText(get("FileAssociationDialog.Add"));217 Dictionary.setBoth(ok, "FileAssociationDialog.Add", "FileAssociationDialog.Add_Tooltip"); 194 218 int index = extension.add(new_extension); 195 219 extension.setSelectedIndex(index); … … 197 221 } 198 222 else { 199 ok.setText(get("General.OK"));223 Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip"); 200 224 extension.setEnabled(true); 201 225 } … … 212 236 } 213 237 } 214 215 private String get(String key) {216 return get(key, null);217 }218 219 private String get(String key, String args[]) {220 if(key.indexOf(".") == -1) {221 key = "FileAssociationDialog." + key;222 }223 return Gatherer.dictionary.get(key, args);224 }225 238 226 239 private String setCommand(String extension, String command, boolean process) { … … 239 252 /** Open up a simple JFileChooser when the user clicks the button. 240 253 * @param event An <strong>ActionEvent</strong> containing information about the event. 241 254 */ 242 255 public void actionPerformed(ActionEvent event) { 243 256 JFileChooser chooser = new JFileChooser(new File(Utility.BASE_DIR)); 244 chooser.setDialogTitle( get("FileAssociationDialog.Browse_Title"));245 chooser.setFileFilter(new ExtensionFileFilter(".bat", get("FileAssociationDialog.Batch_File")));246 chooser.setFileFilter(new ExtensionFileFilter(".com", get("FileAssociationDialog.Command_File")));247 chooser.setFileFilter(new ExtensionFileFilter(".exe", get("FileAssociationDialog.Executable_File")));257 chooser.setDialogTitle(Dictionary.newget("FileAssociationDialog.Browse_Title")); 258 chooser.setFileFilter(new ExtensionFileFilter(".bat", Dictionary.newget("FileAssociationDialog.Batch_File"))); 259 chooser.setFileFilter(new ExtensionFileFilter(".com", Dictionary.newget("FileAssociationDialog.Command_File"))); 260 chooser.setFileFilter(new ExtensionFileFilter(".exe", Dictionary.newget("FileAssociationDialog.Executable_File"))); 248 261 chooser.setAcceptAllFileFilterUsed(true); 249 262 int return_val = chooser.showOpenDialog(null); … … 254 267 } 255 268 } 269 256 270 /** Listens for actions apon the cancel button, and if detected disposes of the dialog without saving changes. */ 257 271 private class CancelListener … … 266 280 } 267 281 } 282 268 283 /** If any changes occur to the command field, mark it as needing saving before we can change extensions, or dispose of this dialog (other than cancelling. */ 269 284 private class CommandListener … … 283 298 } 284 299 } 300 285 301 /** Whenever the user selects an extension, we should fill out the command field with whatever value has been previously entered for the command (if any). */ 286 302 private class ExtensionListener … … 305 321 } 306 322 } 323 307 324 /** Listen for clicks on the ok button, and dispose when detected. */ 308 325 private class OKListener -
trunk/gli/src/org/greenstone/gatherer/gui/GProgressBar.java
r5322 r5571 35 35 *######################################################################## 36 36 */ 37 38 39 40 41 42 43 37 package org.greenstone.gatherer.gui; 44 38 45 import java.awt.BorderLayout; 46 import java.awt.Component; 47 import java.awt.Dimension; 48 import java.awt.Graphics2D; 49 import java.awt.GridLayout; 50 import java.awt.Image; 51 import java.awt.event.ActionEvent; 52 import java.awt.event.ActionListener; 53 import java.awt.geom.AffineTransform; 54 import java.awt.image.BufferedImage; 55 import javax.swing.BorderFactory; 56 import javax.swing.ImageIcon; 57 import javax.swing.JButton; 58 import javax.swing.JLabel; 59 import javax.swing.JPanel; 60 import javax.swing.JProgressBar; 61 import javax.swing.border.BevelBorder; 39 import java.awt.*; 40 import java.awt.event.*; 41 import javax.swing.*; 42 import javax.swing.border.*; 43 import org.greenstone.gatherer.Dictionary; 62 44 import org.greenstone.gatherer.Gatherer; 63 45 import org.greenstone.gatherer.collection.Job; … … 71 53 72 54 private Dimension bar_size = new Dimension(520, 15); 73 74 private Gatherer gatherer;75 76 private ImageIcon busy_bar;77 private ImageIcon ready_bar;78 55 79 56 private int current_action; … … 104 81 public JButton cancel; 105 82 106 //public GProgressBar(Gatherer gatherer, WGet owner, String initial_url) {107 // this.gatherer = gatherer;108 83 public GProgressBar(Job owner, String initial_url, boolean simple) { 109 84 this.owner = owner; … … 120 95 this.setLayout(new BorderLayout()); 121 96 this.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); 122 //this.setMinimumSize(Utility.PROGRESS_BAR_SIZE);123 //this.setSize(Utility.PROGRESS_BAR_SIZE);124 //this.setMaximumSize(Utility.PROGRESS_BAR_SIZE);125 //this.setAlignmentY(Component.LEFT_ALIGNMENT);126 //this.setHorizontalAlignment(JLabel.LEFT);127 97 128 98 this.current_action = Job.STOPPED; 129 99 130 100 inner_pane = new JPanel(new BorderLayout()); 131 101 inner_pane.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); 132 102 133 103 action = new JButton(Utility.getImage("vcrplay.gif")); 134 //action.setToolTipText(get("Action_Tip"));135 action.setToolTipText("Start current download");136 104 action.addActionListener(this); 137 105 action.addActionListener(owner); 106 Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip"); 138 107 139 108 center_pane = new JPanel(new GridLayout(3,1)); … … 146 115 147 116 progress = new JProgressBar(); 148 progress.setString("Waiting to start");149 117 progress.setStringPainted(true); 150 118 progress.setMinimum(0); 151 119 progress.setMaximum(0); 152 120 progress.setEnabled(false); 121 Dictionary.setText(progress, "Mirroring.Job.Waiting"); 153 122 inner_pane.add(progress, BorderLayout.CENTER); 154 123 … … 158 127 159 128 cancel = new JButton(Utility.getImage("vcrstop.gif")); 160 //cancel.setToolTipText(get("Cancel_Tip"));161 cancel.setToolTipText("Cancel current download");162 129 cancel.addActionListener(owner); 163 130 cancel.addActionListener(this); 131 Dictionary.setTooltip(cancel, "Mirroring.Job.Stop_Tooltip"); 164 132 165 133 inner_pane.add(center_pane, BorderLayout.NORTH); … … 175 143 public void actionPerformed(ActionEvent event) { 176 144 if(event.getSource() == action) { 177 if (current_action == Job.RUNNING) {145 if (current_action == Job.RUNNING) { 178 146 current_action = Job.STOPPED; 179 147 action.setIcon(Utility.getImage("vcrplay.gif")); 180 action.setToolTipText("Start current download");148 Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip"); 181 149 cancel.setEnabled(true); 182 150 } … … 184 152 current_action = Job.RUNNING; 185 153 action.setIcon(Utility.getImage("vcrpause.gif")); 186 action.setToolTipText("Pause current download");154 Dictionary.setTooltip(action, "Mirroring.Job.Pause_Tooltip"); 187 155 cancel.setEnabled(false); 188 156 } … … 212 180 } 213 181 progress.setValue(progress.getMaximum()); 214 progress.setString("Download Complete.");182 Dictionary.setText(progress, "Mirroring.Job.Download_Complete"); 215 183 refresh(); 216 184 } … … 232 200 } 233 201 234 public Dimension getP erferredSize() {202 public Dimension getPreferredSize() { 235 203 return Utility.PROGRESS_BAR_SIZE; 236 204 } … … 259 227 this.err_count = 0; 260 228 this.warning_count = 0; 261 } 229 } 262 230 current_action = Job.RUNNING; 263 231 action.setIcon(Utility.getImage("vcrpause.gif")); 264 action.setToolTipText("Pause current download");232 Dictionary.setTooltip(cancel, "Mirroring.Job.Pause_Tooltip"); 265 233 // If this is a simple download, then pause is not available (nor is prematurely stopping!) 266 234 action.setEnabled(!simple); … … 283 251 } 284 252 progress.setValue(progress.getMaximum()); 285 progress.setString("Mirroring Complete.");253 Dictionary.setText(progress, "Mirroring.Job.Mirror_Complete"); 286 254 287 255 action.setIcon(Utility.getImage("vcrfastforward.gif")); 288 action.setToolTipText("Restart current download");256 Dictionary.setText(action, "Mirroring.Job.Restart"); 289 257 action.setEnabled(true); 290 258 cancel.setEnabled(true); … … 298 266 file_size = file_size + current; 299 267 if(!progress.isIndeterminate()) { 300 301 268 // If current is zero, then this is the 'precall' before the 269 // downloading actually starts. 302 270 if(current == 0) { 303 271 // Remove the old progress bar, then deallocate it. … … 305 273 progress = null; 306 274 if(expected == 0) { 307 // We don't have a content length. This bar will go from 308 // 0 to 100 only! 275 // We don't have a content length. This bar will go from 0 to 100 only! 309 276 progress = new JProgressBar(0, 100); 310 277 } 311 278 else { 312 // Assign a new progress bar of length expected content 313 // length. 314 progress = 315 new JProgressBar(0, (new Long(expected)).intValue()); 279 // Assign a new progress bar of length expected content length. 280 progress = new JProgressBar(0, (new Long(expected)).intValue()); 316 281 } 317 282 progress.setEnabled(true); … … 320 285 inner_pane.updateUI(); 321 286 } 322 323 287 // Otherwise if expected is not zero move the progress bar and 288 // update percent complete. 324 289 else if (expected != 0) { 325 290 progress.setValue((new Long(file_size)).intValue()); 326 int p_c = 327 (new Double( 328 progress.getPercentComplete() * 100)).intValue(); 291 int p_c = (new Double(progress.getPercentComplete() * 100)).intValue(); 329 292 progress.setString(p_c + "%"); 330 293 progress.setStringPainted(true); 331 294 } 332 333 295 // Finally, in the case we have no content length, we'll instead 296 // write the current number of bytes downloaded again. 334 297 else { 335 progress.setString( file_size + " bytes");298 progress.setString(file_size + " b"); 336 299 progress.setStringPainted(true); 337 300 } 338 301 } 339 302 refresh(); 340 }341 342 /** Retrieve a String from the dictionary using no arguments.343 * @param key The String which acts as a key mapping for the344 * ResourceBundle.345 * @return A String which is the value for the given key.346 */347 private String get(String key) {348 return get(key, null);349 }350 351 /** Retrieve a String from the dictionary using the given arguments.352 * @param key The String which acts as a key mapping for the353 * ResourceBundle.354 * @param args A String array of arguments to be filled out inside the355 * dictionary value.356 * @return A String which is the value for the given key.357 */358 private String get(String key, String args[]) {359 if(key.indexOf('.') == -1) {360 return gatherer.dictionary.get("GProgressBar."+key, args);361 }362 return gatherer.dictionary.get(key, args);363 }364 365 /** The given parameter is taken as the number of bytes and is366 * formatted into a strings such as:367 * 45 bytes368 * 1.21 Kbytes369 * 2.12 Mbytes370 * etc371 * @param size The number to be formatted, in bytes, as a Long.372 * @return A String which contains the size formatting into a373 * nice little number - unit label.374 */375 private String formatMetric(long size) {376 if(size > 1024) {377 return (size / 1024) + " Kbytes";378 }379 return size + " bytes";380 303 } 381 304 … … 389 312 String args1[] = new String[1]; 390 313 args1[0] = initial_url.toString(); 391 392 //main_status.setText(get("Main_Status", args1)); 393 main_status.setText("Mirroring " + args1[0] + "."); 394 395 if(current_url != null) { 396 // Refresh the current label contents. 314 Dictionary.setText(main_status, "Mirroring.Job.Mirroring", args1); 315 316 if (current_url != null) { 317 // Refresh the current label contents. 397 318 String args2[] = new String[1]; 398 319 args2[0] = current_url; 399 400 String cstext = "Downloading " + args2[0]; 401 current_status.setText(Utility.trim(cstext, 50)); 402 } 403 else if(current_action == Job.STOPPED 404 || current_action == Job.PAUSED) { 405 current_status.setText("Waiting for user action."); 406 } 320 Dictionary.setText(current_status, "Mirroring.Job.Downloading", args2); 321 } 322 else if (current_action == Job.STOPPED || current_action == Job.PAUSED) { 323 Dictionary.setText(current_status, "Mirroring.Job.Waiting_User"); 324 } 407 325 else { 408 current_status.setText("Mirroring Complete.");326 Dictionary.setText(current_status, "Mirroring.Job.Mirroring_Complete"); 409 327 } 410 328 … … 415 333 args3[2] = warning_count + ""; 416 334 args3[3] = err_count + ""; 417 418 results_status.setText("Downloaded " + args3[0] + " of " + 419 args3[1] + " files (" + args3[2] + 420 " warnings, " + args3[3] + " errors)"); 335 Dictionary.setText(results_status, "Mirroring.Job.Status", args3); 421 336 422 337 this.updateUI(); -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r5564 r5571 70 70 import org.greenstone.gatherer.gui.PreviewPane; 71 71 import org.greenstone.gatherer.gui.SimpleOpenCollectionDialog; 72 import org.greenstone.gatherer.gui.messages.MessagePane;73 72 import org.greenstone.gatherer.gui.metaaudit.MetaAuditFrame; 74 73 import org.greenstone.gatherer.gui.tree.DragTree; … … 99 98 /** The menu bar. */ 100 99 public MenuBar menu_bar = null; 101 /** The message pane is optional and contains the log of messages sent. */102 public MessagePane message_pane = null;103 104 100 public MetaAuditFrame meta_audit; 105 101 /** The metaedit pane is used to assign, edit and remove metadata from files within the collection. */ … … 335 331 showMetaAuditBox(); 336 332 } 337 else if(esrc == menu_bar.tools_log) {338 showLogBox();339 }340 333 } 341 334 /** Any actions that should happen after the display of the Gatherer window can be called here. Currently only updates the browser pane if it is active to work around bug in Mozilla renderer implementation. … … 641 634 return result; 642 635 } 643 /** When called this method causes the Log class in Gatherer to display a nice dialog box which contains the log. 644 */ 645 public void showLogBox() { 646 Gatherer.log.display(); 647 } 636 648 637 /** When called this method causes the MetaAuditBox class in CollectionManager to display a nice dialog box which contains all the metadata assigned in the collection. 649 638 */ -
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java
r5536 r5571 298 298 title_final = title.getText(); 299 299 if(title_final.length() == 0) { 300 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Title_Error"), "error.gif", null); 301 err_msg.display(); 302 err_msg.destroy(); 303 err_msg = null; 300 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("NewCollectionPrompt.Title_Error"), Dictionary.newget("NewCollectionPrompt.Error"), JOptionPane.ERROR_MESSAGE); 304 301 title.setForeground(Gatherer.config.getColor("coloring.error_foreground", false)); 305 302 title.setBackground(Gatherer.config.getColor("coloring.error_background", false)); … … 313 310 for(int i = 0; children != null && i < children.length; i++) { 314 311 if(children[i].getName().equals(name_final)) { 315 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Name_Error"), "error.gif", null); 316 err_msg.display(); 317 err_msg.destroy(); 318 err_msg = null; 312 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("NewCollectionPrompt.Name_Error"), Dictionary.newget("NewCollectionPrompt.Error"), JOptionPane.ERROR_MESSAGE); 319 313 file.setForeground(Gatherer.config.getColor("coloring.error_foreground", false)); 320 314 file.setBackground(Gatherer.config.getColor("coloring.error_background", false)); … … 324 318 } 325 319 else { 326 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Name_Error"), "error.gif", null); 327 err_msg.display(); 328 err_msg.destroy(); 329 err_msg = null; 320 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("NewCollectionPrompt.Name_Error"), Dictionary.newget("NewCollectionPrompt.Error"), JOptionPane.ERROR_MESSAGE); 330 321 file.setForeground(Gatherer.config.getColor("coloring.error_foreground", false)); 331 322 file.setBackground(Gatherer.config.getColor("coloring.error_background", false)); … … 334 325 email_final = address.getText() + "@" + host.getText(); 335 326 if(email_final.length() == 0 || email_final.startsWith("@") || email_final.endsWith("@")) { 336 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Email_Error"), "error.gif", null); 337 err_msg.display(); 338 err_msg.destroy(); 339 err_msg = null; 327 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("NewCollectionPrompt.Email_Error"), Dictionary.newget("NewCollectionPrompt.Error"), JOptionPane.ERROR_MESSAGE); 340 328 address.setForeground(Gatherer.config.getColor("coloring.error_foreground", false)); 341 329 address.setBackground(Gatherer.config.getColor("coloring.error_background", false)); … … 346 334 description_final = description.getText(); 347 335 if(description_final.length() == 0) { 348 GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Description_Error"), "error.gif", null); 349 err_msg.display(); 350 err_msg.destroy(); 351 err_msg = null; 336 JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("NewCollectionPrompt.Description_Error"), Dictionary.newget("NewCollectionPrompt.Error"), JOptionPane.ERROR_MESSAGE); 352 337 description.setForeground(Gatherer.config.getColor("coloring.error_foreground", false)); 353 338 description.setBackground(Gatherer.config.getColor("coloring.error_background", false)); -
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionMetadataPrompt.java
r5527 r5571 7 7 import javax.swing.*; 8 8 import javax.swing.event.*; 9 import org.greenstone.gatherer.Dictionary; 9 10 import org.greenstone.gatherer.Gatherer; 10 11 import org.greenstone.gatherer.checklist.CheckList; 11 12 import org.greenstone.gatherer.checklist.Entry; 12 import org.greenstone.gatherer.gui.GUIManager;13 13 import org.greenstone.gatherer.gui.SimpleMenuBar; 14 14 import org.greenstone.gatherer.gui.ModalDialog; 15 15 import org.greenstone.gatherer.cdm.ElementWrapper; 16 16 import org.greenstone.gatherer.msm.MetadataSet; 17 import org.greenstone.gatherer.msm.MetadataSetManager;18 17 import org.greenstone.gatherer.util.StaticStrings; 19 18 import org.greenstone.gatherer.util.Utility; … … 35 34 setModal(true); 36 35 setSize(size); 37 setTitle(get("NewCollectionPrompt.Title"));36 Dictionary.setText(this, "NewCollectionPrompt.Title"); 38 37 39 38 // And the remaining metadata sets. … … 53 52 54 53 JPanel instructions_panel = new JPanel(); 55 JLabel instructions_label1 = new JLabel(get("NewCollectionPrompt.Metadata_Instructions1")); 56 JLabel instructions_label2 = new JLabel(get("NewCollectionPrompt.Metadata_Instructions2")); 54 JLabel instructions_label1 = new JLabel(); 55 Dictionary.setText(instructions_label1, "NewCollectionPrompt.Metadata_Instructions1"); 56 JLabel instructions_label2 = new JLabel(); 57 Dictionary.setText(instructions_label2, "NewCollectionPrompt.Metadata_Instructions2"); 57 58 58 59 JPanel center_pane = new JPanel(); 59 60 60 61 JPanel sets_list_pane = new JPanel(); 61 JLabel sets_list_label = new JLabel( get("NewCollectionPrompt.Select_MDS"));62 JLabel sets_list_label = new JLabel(); 62 63 sets_list_label.setOpaque(false); 64 Dictionary.setText(sets_list_label, "NewCollectionPrompt.Select_MDS"); 63 65 sets_list = new CheckList(sets, true); 64 66 65 67 JPanel elements_list_pane = new JPanel(); 66 JLabel elements_list_label = new JLabel(get("NewCollectionPrompt.Metadata_Elements")); 68 JLabel elements_list_label = new JLabel(); 69 Dictionary.setText(elements_list_label, "NewCollectionPrompt.Metadata_Elements"); 67 70 elements_list = new JList(); 68 71 elements_list.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false)); … … 72 75 73 76 JPanel button_pane = new JPanel(); 74 JButton ok_button = new JButton(get("General.OK")); 75 JButton cancel_button = new JButton(get("General.Cancel")); 77 JButton ok_button = new JButton(); 78 ok_button.setMnemonic(KeyEvent.VK_O); 79 Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip"); 80 JButton cancel_button = new JButton(); 81 cancel_button.setMnemonic(KeyEvent.VK_C); 82 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 83 76 84 // Connection 77 85 ok_button.addActionListener(new OKButtonListener()); 78 86 cancel_button.addActionListener(new CancelButtonListener()); 79 87 sets_list.addListSelectionListener(new MetadataListSelectionListener()); 88 80 89 // Display 81 90 instructions_panel.setLayout(new GridLayout(2,1)); … … 106 115 content_pane.add(center_pane, BorderLayout.CENTER); 107 116 content_pane.add(button_pane, BorderLayout.SOUTH); 117 108 118 // Show 109 119 Dimension screen_size = Gatherer.config.screen_size; … … 118 128 public boolean isCancelled() { 119 129 return cancelled; 120 }121 122 /** Gets a phrase from the dictionary based on key.123 * @param key A <strong>String</strong> which serves as the unique identifier of a phrase.124 * @return The desired phrase as a <strong>String</strong> or at least a meaningful error message.125 */126 private String get(String key) {127 if(key.indexOf(".") == -1) {128 key = "NewCollectionPrompt." + key;129 }130 return Gatherer.dictionary.get(key);131 130 } 132 131 -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r5536 r5571 13 13 import org.greenstone.gatherer.checklist.CheckList; 14 14 import org.greenstone.gatherer.checklist.Entry; 15 import org.greenstone.gatherer.gui.GUIManager;16 15 import org.greenstone.gatherer.gui.ModalDialog; 17 16 import org.greenstone.gatherer.gui.NumberField; -
trunk/gli/src/org/greenstone/gatherer/gui/PreviewPane.java
r5347 r5571 1 package org.greenstone.gatherer.gui;2 1 /** 3 2 *######################################################################### … … 36 35 *######################################################################## 37 36 */ 37 package org.greenstone.gatherer.gui; 38 38 39 import calpa.html.*; 39 40 import java.awt.*; … … 41 42 import java.net.*; 42 43 import javax.swing.*; 44 import org.greenstone.gatherer.Dictionary; 43 45 import org.greenstone.gatherer.Gatherer; 44 46 import org.greenstone.gatherer.util.GURL; … … 67 69 68 70 // Create components 69 back = new JButton( get("Browser.Back"),Utility.getImage("back.gif"));71 back = new JButton(Utility.getImage("back.gif")); 70 72 back.addActionListener(new BackListener()); 71 73 back.setEnabled(false); 72 73 home = new JButton(get("Browser.Home"), Utility.getImage("home.gif")); 74 Dictionary.registerBoth(back, "Browser.Back", "Browser.Back_Tooltip"); 75 76 home = new JButton(Utility.getImage("home.gif")); 74 77 home.addActionListener(new HomeListener()); 75 78 home.setEnabled(false); 76 77 forward = new JButton(get("Browser.Forward"), Utility.getImage("forward.gif")); 79 Dictionary.registerBoth(home, "Browser.Home", "Browser.Home_Tooltip"); 80 81 forward = new JButton(Utility.getImage("forward.gif")); 78 82 forward.addActionListener(new ForwardListener()); 79 83 forward.setEnabled(false); 80 81 reload = new JButton(get("Browser.Reload"), Utility.getImage("reload.gif")); 84 Dictionary.registerBoth(forward, "Browser.Forward", "Browser.Forward_Tooltip"); 85 86 reload = new JButton(Utility.getImage("reload.gif")); 82 87 reload.addActionListener(new ReloadListener()); 83 88 reload.setEnabled(false); 89 Dictionary.registerBoth(reload, "Browser.Reload", "Browser.Reload_Tooltip"); 84 90 85 91 CalHTMLPreferences prefs = new CalHTMLPreferences(); … … 87 93 view = new CalHTMLPane(prefs, observer, "Default"); 88 94 89 status = new JLabel(get("Browser.Ready")); 95 status = new JLabel(); 96 Dictionary.registerText(status, "Browser.Ready"); 90 97 } 91 98 … … 101 108 // Now load the collection 102 109 homepage = new URL(Gatherer.config.exec_address.toString() + "?a=p&p=about&c=" + Gatherer.c_man.getCollection().getName()); 103 ///atherer.println("Loading " + url); 104 status.setText(get("Browser.Loading", homepage.toString())); 110 String[] args = new String[1]; 111 args[0] = homepage.toString(); 112 Dictionary.registerText(status, "Browser.Loading", args); 105 113 view.showHTMLDocument(homepage, null, true); 106 114 } … … 139 147 // Now load the collection 140 148 homepage = new URL(Gatherer.config.exec_address.toString() + "?a=p&p=about&c=" + Gatherer.c_man.getCollection().getName()); 141 ///atherer.println("Loading " + url); 142 status.setText(get("Browser.Loading", homepage.toString())); 149 String[] args = new String[1]; 150 args[0] = homepage.toString(); 151 Dictionary.registerText(status, "Browser.Loading", args); 143 152 view.showHTMLDocument(homepage); 144 153 } … … 149 158 } 150 159 validate(); 151 }152 153 /** Used to retrieve the phrase that matches the given key from the loaded dictionary.154 */155 public String get(String key) {156 return get(key, null);157 }158 159 public String get(String key, String arg) {160 if(key.indexOf(".") == -1) {161 key = "Browser." + key;162 }163 return Gatherer.dictionary.get(key, arg);164 160 } 165 161 … … 231 227 validate(); 232 228 } 229 233 230 public void linkFocusUpdate(CalHTMLPane pane, URL url) { 234 ///ystem.err.println("Link in focus " + url.toString()); 235 status.setText(get("Browser.Follow", url.toString())); 236 } 231 String[] args = new String[1]; 232 args[0] = url.toString(); 233 Dictionary.registerText(status, "Browser.Follow", args); 234 } 235 237 236 public void statusUpdate(CalHTMLPane pane, int state, URL url, int value, String message) { 238 237 this.state = state; 238 String[] args = new String[1]; 239 args[0] = url.toString(); 240 239 241 switch(state) { 240 242 // The Pane is attempting to connect to the given URL to receive data. … … 245 247 case CalCons.PARSE_FAILED: 246 248 ///ystem.err.println("Parse Failed: " + state + " - " + message); 247 status.setText(get("Browser.CannotConnect", url.toString()));249 Dictionary.registerText(status, "Browser.CannotConnect", args); 248 250 break; 249 251 // The Pane has established a connection to the given URL and is receiving any content. 250 252 case CalCons.CONNECTED: 251 253 ///ystem.err.println("Connected: " + state + " - " + message); 252 status.setText(get("Browser.Loading", url.toString()));254 Dictionary.registerText(status, "Browser.Loading", args); 253 255 break; 254 256 // The size of the content at the given URL is known and is contained in the value argument. … … 263 265 case CalCons.PARSE_FAILED_POST_CONNECT: 264 266 ///ystem.err.println("Parse Failed Post Connect: " + state + " - " + message); 265 status.setText(get("Browser.TimedOut", url.toString()));267 Dictionary.registerText(status, "Browser.TimedOut", args); 266 268 break; 267 269 // The document has been parsed but formatting cannot be completed because the document contains images of unspecified size. The parsing thread is waiting for image updates to give it the information it needs to format and display the document. … … 272 274 case CalCons.DOC_LOADED: 273 275 ///ystem.err.println("Doc Loaded: " + state + " - " + message); 274 status.setText(get("Browser.Ready"));276 Dictionary.registerText(status, "Browser.Ready"); 275 277 break; 276 278 } -
trunk/gli/src/org/greenstone/gatherer/gui/SimpleMenuBar.java
r4675 r5571 1 1 package org.greenstone.gatherer.gui; 2 2 3 import java.awt.*; 3 4 import java.awt.event.*; 4 5 import javax.swing.*; 6 import org.greenstone.gatherer.Dictionary; 5 7 import org.greenstone.gatherer.Gatherer; 6 import org.greenstone.gatherer.gui.GUIManager;7 8 import org.greenstone.gatherer.util.Utility; 9 8 10 public class SimpleMenuBar 9 11 extends JMenuBar 10 12 implements ActionListener { 11 13 12 14 private String page_name; 13 15 14 16 public SimpleMenuBar(String page_name) { 15 17 this.page_name = page_name; 16 JMenu help = new JMenu( Gatherer.dictionary.get("Menu.Help"));18 JMenu help = new JMenu(); 17 19 help.setIcon(Utility.HELP_ICON); 18 19 JMenuItem help_help = new JMenuItem(Gatherer.dictionary.get("Menu.Help")); 20 Dictionary.setText(help, "Menu.Help"); 21 22 JMenuItem help_help = new JMenuItem(); 20 23 help_help.addActionListener(this); 21 24 Dictionary.setText(help_help, "Menu.Help"); 25 22 26 help.add(help_help); 23 27 24 28 add(Box.createHorizontalGlue()); 25 29 add(help); -
trunk/gli/src/org/greenstone/gatherer/gui/SimpleOpenCollectionDialog.java
r5286 r5571 33 33 import javax.swing.*; 34 34 import javax.swing.event.*; 35 import org.greenstone.gatherer.Configuration;36 35 import org.greenstone.gatherer.Dictionary; 37 36 import org.greenstone.gatherer.Gatherer; 38 37 import org.greenstone.gatherer.collection.CollectionConfiguration; 39 import org.greenstone.gatherer.gui.GUIManager;40 38 import org.greenstone.gatherer.gui.ModalDialog; 41 39 import org.greenstone.gatherer.util.StaticStrings; 42 40 import org.greenstone.gatherer.util.Utility; 41 43 42 /** A dialog which provides a straight-forward access to the currently installed collections. It also will contain the ability to continue through to the original OpenCollectionDialog if your source collection is located somewhere other than the gsdl collect folder. */ 44 43 public class SimpleOpenCollectionDialog … … 66 65 super(Gatherer.g_man, "", true); 67 66 setSize(SIZE); 68 setTitle(get("OpenCollectionDialog.Title"));69 67 Dictionary.setText(this, "OpenCollectionDialog.Title"); 68 70 69 // Creation 71 70 JPanel content_pane = (JPanel) getContentPane(); … … 74 73 75 74 JPanel collection_list_pane = new JPanel(); 76 JLabel collection_list_label = new JLabel(get("OpenCollectionDialog.Available_Collections")); 75 JLabel collection_list_label = new JLabel(); 76 Dictionary.setText(collection_list_label, "OpenCollectionDialog.Available_Collections"); 77 77 collection_list = new JList(new CollectionListModel()); 78 78 … … 83 83 84 84 JPanel description_textarea_pane = new JPanel(); 85 JLabel description_textarea_label = new JLabel(get("OpenCollectionDialog.Description")); 85 JLabel description_textarea_label = new JLabel(); 86 Dictionary.setText(description_textarea_label, "OpenCollectionDialog.Description"); 86 87 description_textarea = new JTextArea(); 87 88 88 89 JPanel button_pane = new JPanel(); 89 open_button = new JButton( get("OpenCollectionDialog.Open"));90 open_button = new JButton(); 90 91 open_button.setEnabled(false); 91 92 open_button.setMnemonic(KeyEvent.VK_O); 92 advanced_button = new JButton(get("OpenCollectionDialog.Advanced")); 93 Dictionary.setBoth(open_button, "OpenCollectionDialog.Open", "OpenCollectionDialog.Open_Tooltip"); 94 advanced_button = new JButton(); 93 95 advanced_button.setMnemonic(KeyEvent.VK_B); 94 cancel_button = new JButton(get("General.Cancel")); 96 Dictionary.setBoth(advanced_button, "OpenCollectionDialog.Browse", "OpenCollectionDialog.Browse_Tooltip"); 97 cancel_button = new JButton(); 95 98 cancel_button.setMnemonic(KeyEvent.VK_C); 99 Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip"); 100 96 101 // Connection 97 102 advanced_button.addActionListener(new AdvancedListener()); … … 99 104 open_button.addActionListener(new OpenListener()); 100 105 collection_list.addListSelectionListener(new CollectionListSelectionListener()); 106 101 107 // Layout 102 108 collection_list_pane.setLayout(new BorderLayout()); … … 142 148 public String getFileName() { 143 149 return filename; 144 }145 146 private String get(String key) {147 return Gatherer.dictionary.get(key);148 150 } 149 151 -
trunk/gli/src/org/greenstone/gatherer/gui/WarningDialog.java
r5564 r5571 7 7 import org.greenstone.gatherer.Dictionary; 8 8 import org.greenstone.gatherer.Gatherer; 9 // import org.greenstone.gatherer.gui.SmarterTextArea;10 9 import org.greenstone.gatherer.util.FocusChangerTask; 11 10 import org.greenstone.gatherer.util.Utility; -
trunk/gli/src/org/greenstone/gatherer/gui/table/GTableModel.java
r5158 r5571 1 package org.greenstone.gatherer.gui.table;2 1 /** 3 2 *######################################################################### … … 26 25 *######################################################################## 27 26 */ 27 package org.greenstone.gatherer.gui.table; 28 28 29 import java.awt.*; 29 30 import java.io.File; … … 32 33 import javax.swing.table.*; 33 34 import org.greenstone.gatherer.Configuration; 35 import org.greenstone.gatherer.Dictionary; 34 36 import org.greenstone.gatherer.Gatherer; 35 37 import org.greenstone.gatherer.file.FileNode; … … 43 45 import org.greenstone.gatherer.util.ArrayTools; 44 46 import org.greenstone.gatherer.util.Utility; 47 45 48 /** Provides the model for a GTable component, filling it with metadata values for the choosen files or folders. The model also provides several different view of this data; assigned folder metadata, assigned file metadata, all assigned metadata, unassigned metadata, and all metadata. It also differentiates between metadata that is common to all of the files or folders, and that which isn't. The building of the actual model is done on a separate thread so that the gui remains responsive, and the gui is intermitantly updated by this thread. Updating of the model is triggered by events recieved from the metadata set manager in terms of new or obsolete metadata. A new model is rebuilt whenever the user selects a different group of files or folders. 46 49 * @author John Thompson, Greenstone Digital Library, University of Waikato … … 60 63 private ModelBuilder builder = null; 61 64 62 static final private String[] COLUMN_NAMES = {"", Gatherer.dictionary.get("Metadata.Element"), Gatherer.dictionary.get("Metadata.Value")};65 static final private String[] COLUMN_NAMES = {"", Dictionary.newget("Metadata.Element"), Dictionary.newget("Metadata.Value")}; 63 66 64 67 -
trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java
r4801 r5571 113 113 // Is row at top of screen? 114 114 if(pt.y + bounds.y <= AUTOSCROLL_MARGIN) { 115 115 // Yes, scroll up one row 116 116 if(row <= 0) { 117 117 row = 0; … … 122 122 } 123 123 else { 124 124 // No, scroll down one row 125 125 if(row < getRowCount() - 1) { 126 126 row = row + 1; … … 131 131 132 132 /** In order for the appearance to be consistant, given we may be in the situation where the pointer has left our focus but the ghost remains, this method allows other members of the GGroup to tell this component to clear its ghost. 133 133 */ 134 134 public void clearGhost() { 135 135 // Erase the last ghost image and cue line … … 138 138 139 139 /** Any implementation of DragSourceListener must include this method so we can be notified when the drag event ends (somewhere else), which will in turn remove actions. 140 141 140 * @param event A <strong>DragSourceDropEvent</strong> containing all the information about the end of the drag event. 141 */ 142 142 public void dragDropEnd(DragSourceDropEvent event) { 143 143 if(event.getDropSuccess()) { 144 144 // Do whatever I do when the drop is successful. 145 145 } 146 146 } 147 147 /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus enters this component. 148 149 150 148 * @param event A <strong>DragSourceDragEvent</strong> containing all the information 149 * about the drag event. 150 */ 151 151 public void dragEnter(DragSourceDragEvent event) { 152 152 // Handled elsewhere. 153 153 } 154 154 /** Any implementation of DropTargetListener must include this method so we can be notified when the drag focus enters this component, which in this case is to grab focus from within our group. 155 156 155 * @param event A <strong>DropTargetDragEvent</strong> containing all the information about the drag event. 156 */ 157 157 public void dragEnter(DropTargetDragEvent event) { 158 158 group.grabFocus(this); 159 159 } 160 160 /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus leaves this component. 161 162 161 * @param event A <strong>DragSourceEvent</strong> containing all the information about the drag event. 162 */ 163 163 public void dragExit(DragSourceEvent event) { 164 164 clearGhost(); … … 166 166 167 167 /** Any implementation of DropTargetListener must include this method 168 169 170 171 168 * so we can be notified when the drag focus leaves this component. 169 * @param event A DropTargetEvent containing all the information 170 * about the drag event. 171 */ 172 172 public void dragExit(DropTargetEvent event) { 173 173 clearGhost(); … … 175 175 176 176 /** Any implementation of DragGestureListener must include this method 177 178 179 180 181 177 * so we can be notified when a drag action has been noticed, thus a 178 * drag action has begun. 179 * @param event A DragGestureEvent containing all the information about 180 * the drag event. 181 */ 182 182 public void dragGestureRecognized(DragGestureEvent event) { 183 183 // Can never drag from MetaEdit tree … … 253 253 254 254 /** Implementation side-effect. 255 256 255 * @param event A DragSourceDragEvent containing all the information about the drag event. 256 */ 257 257 public void dragOver(DragSourceDragEvent event) { 258 258 } 259 259 260 260 /** Any implementation of DropTargetListener must include this method 261 262 263 264 261 * so we can be notified when the drag moves in this component. 262 * @param event A DropTargetDragEvent containing all the information 263 * about the drag event. 264 */ 265 265 public void dragOver(DropTargetDragEvent event) { 266 266 // Draw the mouse ghost … … 324 324 target = (FileNode) target_path.getLastPathComponent(); 325 325 } 326 //else {327 // // Warn that this is an invalid drop.328 // MessageTask invalid_target_task = new MessageTask(Gatherer.dictionary.get("General.Error"), Gatherer.dictionary.get("FileActions.InvalidTarget"));329 // invalid_target_task.start();330 // invalid_target_task = null;331 //}332 326 } 333 327 else { … … 357 351 } 358 352 } 359 //else {360 // Warn that this is an invalid drop.361 // ///ystem.err.println("About to show a modal dialog box from JOptionPane.");362 // MessageTask read_only_task = new MessageTask(Gatherer.dictionary.get("General.Error"), Gatherer.dictionary.get("FileActions.ReadOnlyTarget"));363 // read_only_task.start();364 // read_only_task = null;365 // ///ystem.err.println("Returning from a modal dialog box.");366 //}367 353 // Clear up the group.image_ghost 368 354 paintImmediately(ra_ghost.getBounds()); … … 370 356 } 371 357 372 //private class MessageTask373 // extends Thread {374 // private String message;375 // private String title;376 //377 // MessageTask(String title, String message) {378 // this.message = message;379 // this.title = title;380 // }381 //382 // public void run() {383 // JOptionPane.showMessageDialog(Gatherer.g_man, message, title, JOptionPane.ERROR_MESSAGE);384 // }385 //}386 358 387 359 /** Any implementation of DragSourceListener must include this method 388 389 390 391 360 * so we can be notified when the action to be taken upon drop changes. 361 * @param event A DragSourceDragEvent containing all the information 362 * about the drag event. 363 */ 392 364 public void dropActionChanged(DragSourceDragEvent event) { 393 365 } 394 366 395 367 /** Any implementation of DropTargetListener must include this method 396 397 398 399 368 * so we can be notified when the action to be taken upon drop changes. 369 * @param event A DropTargetDragEvent containing all the information 370 * about the drag event. 371 */ 400 372 public void dropActionChanged(DropTargetDragEvent event) { 401 373 } 402 374 403 375 /** Used to notify this component that it has gained focus. It should 404 405 376 * make some effort to inform the user of this. 377 */ 406 378 public void gainFocus() { 407 379 ///ystem.err.println("Gained focus: " + this); … … 411 383 412 384 /** Autoscroll Interface... 413 414 415 416 417 418 419 420 421 422 423 385 * The following code was borrowed from the book: 386 * Java Swing 387 * By Robert Eckstein, Marc Loy & Dave Wood 388 * Paperback - 1221 pages 1 Ed edition (September 1998) 389 * O'Reilly & Associates; ISBN: 156592455X 390 * 391 * The relevant chapter of which can be found at: 392 * http://www.oreilly.com/catalog/jswing/chapter/dnd.beta.pdf 393 * Calculate the insets for the *JTREE*, not the viewport 394 * the tree is in. This makes it a bit messy. 395 */ 424 396 public Insets getAutoscrollInsets() 425 397 { … … 441 413 442 414 /** This method is used to inform this component when it loses focus, 443 444 415 * and should indicate this somehow. 416 */ 445 417 public void loseFocus() { 446 418 ///ystem.err.println("Lost focus: " + this); … … 501 473 502 474 /** Override the normal setEnabled so the Tree exhibits a little more 503 504 505 475 * change, which in this instance is the background colour changing. 476 * @param state Whether this GTree should be in an enabled state. 477 */ 506 478 public void setEnabled(boolean state) { 507 479 super.setEnabled(state); … … 571 543 } 572 544 } 573 545 // 3c. If not found then return as this node can't exists somehow. 574 546 if(!found) { 575 547 return; -
trunk/gli/src/org/greenstone/gatherer/shell/GShellListener.java
r4364 r5571 35 35 *######################################################################## 36 36 */ 37 package org.greenstone.gatherer.shell; 37 38 38 39 40 41 42 43 package org.greenstone.gatherer.shell;44 39 /** 45 40 * Title: The Gatherer<br>
Note:
See TracChangeset
for help on using the changeset viewer.