Changeset 5571


Ignore:
Timestamp:
2003-10-03T17:09:38+12:00 (21 years ago)
Author:
mdewsnip
Message:

More small updates and tooltips added.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
19 edited

Legend:

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

    r5564 r5571  
    473473            ((JLabel) component).setText(text);
    474474        }
     475        else if (component instanceof JProgressBar) {
     476            ((JProgressBar) component).setString(text);
     477        }
    475478        else if (component instanceof JTextComponent) {
    476479            ((JTextComponent) component).setText(text);
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r5564 r5571  
    2626 */
    2727package org.greenstone.gatherer;
     28
    2829/**************************************************************************************
    2930 * Written:      ??/??/02
     
    6263import org.greenstone.gatherer.util.Utility;
    6364import sun.misc.*;
     65
    6466/** 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.
    6567 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    113115    /** A static reference to ourselves. */
    114116    static public Gatherer self;
    115     /** A public reference to the message log. */
    116     static public Log log;
    117117    /** The debug print stream. */
    118118    static public PrintStream debug;
     
    192192    }
    193193    try {
    194         // Create log
    195         log = new Log();
    196194        // Load Config
    197195        loadConfig(gsdl_path, exec_path, perl_path);
     
    581579     */
    582580    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");
    585582    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)));
    586583    dialog.display();
     
    593590     */
    594591    static public void missingGSDL(Dictionary dictionary) {
    595     WarningDialog dialog = new WarningDialog("warning.MissingGSDL", false, dictionary);
     592    WarningDialog dialog = new WarningDialog("warning.MissingGSDL", false);
    596593    dialog.display();
    597594    dialog.dispose();
     
    602599    /** 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. */
    603600    static public void missingPERL(Dictionary dictionary) {
    604     WarningDialog dialog = new WarningDialog("warning.MissingPERL", false, dictionary);
     601    WarningDialog dialog = new WarningDialog("warning.MissingPERL", false);
    605602    dialog.display();
    606603    dialog.dispose();
     
    693690        Gatherer.printStackTrace(error);
    694691    }
    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.Message
    701      * @see org.greenstone.gatherer.Log
    702      */
    703     private void message(int level, String message) {
    704     Message msg = new Message(Message.GENERAL, level, message);
    705     log.add(msg);
    706692    }
    707693
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r5564 r5571  
    4545import org.greenstone.gatherer.Dictionary;
    4646import org.greenstone.gatherer.Gatherer;
    47 import org.greenstone.gatherer.Message;
    4847import org.greenstone.gatherer.cdm.CollectionDesignManager;
    4948import org.greenstone.gatherer.cdm.CommandTokenizer;
     
    7574import org.greenstone.gatherer.util.Utility;
    7675import org.w3c.dom.*;
     76
    7777/** 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.
    7878 * @author John Thompson
     
    112112    static final public int NO_SPECIAL_CASE = -1;
    113113    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
    114120    /** Constructor. */
    115121    public CollectionManager() {
     
    164170    }
    165171    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);
    167173    shell.addGShellListener(Gatherer.g_man.create_pane);
    168174    shell.start();
     
    726732        collection_import = null;
    727733        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);
    729735        shell.addGShellListener(Gatherer.g_man.create_pane);
    730736        shell.start();
     
    871877        }
    872878    }
    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);
    874880    process.addGShellListener(this);
    875881    process.run(); // Don't bother threading this... yet
     
    877883
    878884    /** 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       * @param event A <strong>GShellEvent</strong> which contains a the message.
    880       */
     885     * @param event A <strong>GShellEvent</strong> which contains a the message.
     886     */
    881887    public synchronized void message(GShellEvent event) {
    882888    }
    883889    /** 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       * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired.
    885       * @see org.greenstone.gatherer.collection.Collection
    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     */
    887893    public void metadataChanged(MSMEvent event) {
    888894    // Again this change means we need to save the collection again.
     
    890896    }
    891897    /** This call is fired whenever a process within a GShell created by this class begins.
    892       * @param event A <strong>GShellEvent</strong> containing information about the GShell process.
    893       * @see org.greenstone.gatherer.Gatherer
    894       * @see org.greenstone.gatherer.gui.GUIManager
    895       * @see org.greenstone.gatherer.shell.GShell
    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     */
    897903    public synchronized void processBegun(GShellEvent event) {
    898904    Gatherer.println("CollectionManager.processBegun(" + event.getType() + ")");
     
    11861192    catch (Exception exception) {
    11871193        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.Log
    1195      * @see org.greenstone.gatherer.Message
    1196      */
    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());
    12031194    }
    12041195    }
     
    14041395    /** 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.
    14051396     * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
    1406             */
     1397     */
    14071398    public void treeNodesChanged(TreeModelEvent event) {
    14081399        if(collection != null) {
     
    14111402    }
    14121403    /** 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             * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
    1414             */
     1404     * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
     1405     */
    14151406    public void treeNodesInserted(TreeModelEvent event) {
    14161407        if(collection != null) {
     
    14191410    }
    14201411    /** 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             * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
    1422             */
     1412     * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
     1413     */
    14231414    public void treeNodesRemoved(TreeModelEvent event) {
    14241415        if(collection != null) {
     
    14271418    }
    14281419    /** 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             * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
    1430             */
     1420     * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree.
     1421     */
    14311422    public void treeStructureChanged(TreeModelEvent event) {
    14321423        if(collection != null) {
  • trunk/gli/src/org/greenstone/gatherer/gui/BrowsingPane.java

    r5536 r5571  
    8989    back_button = new JButton(Utility.getImage("back.gif"));
    9090    back_button.setEnabled(false);
    91     Dictionary.registerTooltip(back_button, "Browser.Back");
     91    Dictionary.registerTooltip(back_button, "Browser.Back_Tooltip");
    9292
    9393    // refresh_button = new JButton(Utility.getImage("reload.gif"));
     
    100100
    101101    home_button = new JButton(Utility.getImage("home.gif"));
    102     Dictionary.registerTooltip(home_button, "Browser.Home");
     102    Dictionary.registerTooltip(home_button, "Browser.Home_Tooltip");
    103103
    104104    JPanel address_pane = new JPanel();
     
    108108    JPanel right_button_pane = new JPanel();
    109109    go_button = new JButton(Utility.getImage("go.gif"));
    110     Dictionary.registerTooltip(go_button, "Browser.Go");
     110    Dictionary.registerTooltip(go_button, "Browser.Go_Tooltip");
    111111
    112112    stop_button = new JButton(Utility.getImage("stop.gif"));
    113113    stop_button.setEnabled(false);
    114     Dictionary.registerTooltip(stop_button, "Browser.Stop");
     114    Dictionary.registerTooltip(stop_button, "Browser.Stop_Tooltip");
    115115
    116116    forward_button = new JButton(Utility.getImage("forward.gif"));
    117117    forward_button.setEnabled(false);
    118     Dictionary.registerTooltip(forward_button, "Browser.Forward");
     118    Dictionary.registerTooltip(forward_button, "Browser.Forward_Tooltip");
    119119
    120120    // Calpa Pane stuff
  • trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java

    r5536 r5571  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    5758import org.greenstone.gatherer.util.TreeSynchronizer;
    5859import org.greenstone.gatherer.util.Utility;
    59 import org.greenstone.gatherer.util.WinRegistry;
     60
    6061/** 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.
    6162 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    198199        FileNode node = (FileNode) collection_tree.getModel().getRoot();
    199200        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);
    201202        }
    202203    }
  • trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java

    r5536 r5571  
    5757import org.greenstone.gatherer.shell.GShellProgressMonitor;
    5858import org.greenstone.gatherer.util.AppendLineOnlyFileDocument;
     59
    5960/** 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>
    6061 * <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;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4243import javax.swing.*;
    4344import javax.swing.event.*;
     45import org.greenstone.gatherer.Dictionary;
    4446import org.greenstone.gatherer.Gatherer;
    4547import org.greenstone.gatherer.file.FileAssociationManager;
     
    8284    /** The default size for the dialog. */
    8385    static final private Dimension SIZE = new Dimension(600, 270);
     86
    8487    /** Create a new file association dialog.
    8588     * @param manager A reference to the <strong>FileAssociationManager</strong> so we can determine what extensions are already associated.
     
    9598    setModal(true);
    9699    setSize(SIZE);
    97     setTitle(get("FileAssociationDialog.Title"));
    98100    setJMenuBar(new SimpleMenuBar("fileassociations"));
     101    Dictionary.setText(this, "FileAssociationDialog.Title");
     102
    99103    JPanel content_pane = (JPanel) getContentPane();
    100104    content_pane.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false));
    101105    JPanel control_pane = new JPanel();
    102     JTextArea instructions_area = new JTextArea(get("FileAssociationDialog.Instructions"));
     106
     107    JTextArea instructions_area = new JTextArea();
    103108    instructions_area.setEditable(false);
    104109    instructions_area.setLineWrap(true);
    105110    instructions_area.setRows(5);
    106111    instructions_area.setWrapStyleWord(true);
     112    Dictionary.setText(instructions_area, "FileAssociationDialog.Instructions");
     113
    107114    JPanel extension_pane = new JPanel();
    108115    extension_pane.setOpaque(false);
    109     JLabel extension_label = new JLabel(get("FileAssociationDialog.Extension"));
     116    JLabel extension_label = new JLabel();
    110117    extension_label.setPreferredSize(LABEL_SIZE);
     118    Dictionary.setText(extension_label, "FileAssociationDialog.Extension");
     119
    111120    extension = new GComboBox();
    112121    extension.setEditable(true);
     
    115124        extension.add(manager.getExtension(i));
    116125    }
     126    Dictionary.setTooltip(extension, "FileAssociationDialog.Extension_Tooltip");
     127
    117128    JPanel command_pane = new JPanel();
    118129    command_pane.setOpaque(false);
    119     JLabel command_label = new JLabel(get("FileAssociationDialog.Command"));
     130    JLabel command_label = new JLabel();
    120131    command_label.setPreferredSize(LABEL_SIZE);
     132    Dictionary.setText(command_label, "FileAssociationDialog.Command");
    121133    JPanel inner_pane = new JPanel();
    122134    inner_pane.setOpaque(false);
     
    128140        command.setText(manager.getCommandString((String)extension.get(0)));
    129141    }
    130     browse = new JButton(get("FileAssociationDialog.Browse"));
     142    Dictionary.setTooltip(command, "FileAssociationDialog.Command_Tooltip");
     143
     144    browse = new JButton();
    131145    browse.setBackground(Gatherer.config.getColor("coloring.button_background", false));
     146    browse.setMnemonic(KeyEvent.VK_B);
    132147    browse.setPreferredSize(LABEL_SIZE);
     148    Dictionary.setBoth(browse, "FileAssociationDialog.Browse", "FileAssociationDialog.Browse_Tooltip");
     149
    133150    JPanel button_pane = new JPanel();
    134151    button_pane.setOpaque(false);
    135     ok = new JButton(get("General.OK"));
     152    ok = new JButton();
    136153    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();
    138157    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
    139161    // Connection
    140162    browse.addActionListener(new BrowseListener());
     
    143165    extension.addActionListener(new ExtensionListener());
    144166    command.getDocument().addDocumentListener(new CommandListener());
     167
    145168    // Layout
    146169    extension_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
     
    186209    previous_extension = null;
    187210    }
     211
    188212    /** 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.
    189213     * @param new_extension The extension code as a <strong>String</strong>.
     
    191215    public String display(String new_extension) {
    192216    if(new_extension != null) {
    193         ok.setText(get("FileAssociationDialog.Add"));
     217        Dictionary.setBoth(ok, "FileAssociationDialog.Add", "FileAssociationDialog.Add_Tooltip");
    194218        int index = extension.add(new_extension);
    195219        extension.setSelectedIndex(index);
     
    197221    }
    198222    else {
    199         ok.setText(get("General.OK"));
     223        Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip");
    200224        extension.setEnabled(true);
    201225    }
     
    212236    }
    213237    }
    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     }   
    225238
    226239    private String setCommand(String extension, String command, boolean process) {
     
    239252    /** Open up a simple JFileChooser when the user clicks the button.
    240253     * @param event An <strong>ActionEvent</strong> containing information about the event.
    241             */
     254     */
    242255    public void actionPerformed(ActionEvent event) {
    243256        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")));
    248261        chooser.setAcceptAllFileFilterUsed(true);
    249262        int return_val = chooser.showOpenDialog(null);
     
    254267    }
    255268    }
     269
    256270    /** Listens for actions apon the cancel button, and if detected disposes of the dialog without saving changes. */
    257271    private class CancelListener
     
    266280    }
    267281    }
     282
    268283    /** 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. */
    269284    private class CommandListener
     
    283298    }
    284299    }
     300
    285301    /** 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). */
    286302    private class ExtensionListener
     
    305321    }
    306322    }
     323
    307324    /** Listen for clicks on the ok button, and dispose when detected. */
    308325    private class OKListener
  • trunk/gli/src/org/greenstone/gatherer/gui/GProgressBar.java

    r5322 r5571  
    3535 *########################################################################
    3636 */
    37 
    38  
    39 
    40 
    41 
    42 
    4337package org.greenstone.gatherer.gui;
    4438
    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;
     39import java.awt.*;
     40import java.awt.event.*;
     41import javax.swing.*;
     42import javax.swing.border.*;
     43import org.greenstone.gatherer.Dictionary;
    6244import org.greenstone.gatherer.Gatherer;
    6345import org.greenstone.gatherer.collection.Job;
     
    7153
    7254    private Dimension bar_size = new Dimension(520, 15);
    73 
    74     private Gatherer gatherer;
    75 
    76     private ImageIcon busy_bar;
    77     private ImageIcon ready_bar;
    7855
    7956    private int current_action;
     
    10481    public JButton cancel;
    10582
    106     //public GProgressBar(Gatherer gatherer, WGet owner, String initial_url) {
    107     //    this.gatherer = gatherer;
    10883    public GProgressBar(Job owner, String initial_url, boolean simple) {
    10984    this.owner = owner;
     
    12095    this.setLayout(new BorderLayout());
    12196    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);
    12797
    12898    this.current_action = Job.STOPPED;
    129          
     99
    130100    inner_pane = new JPanel(new BorderLayout());
    131101    inner_pane.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
    132102
    133103    action = new JButton(Utility.getImage("vcrplay.gif"));
    134     //action.setToolTipText(get("Action_Tip"));
    135     action.setToolTipText("Start current download");
    136104    action.addActionListener(this);
    137105    action.addActionListener(owner);
     106    Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip");
    138107
    139108    center_pane = new JPanel(new GridLayout(3,1));
     
    146115
    147116    progress = new JProgressBar();
    148     progress.setString("Waiting to start");
    149117    progress.setStringPainted(true);
    150118    progress.setMinimum(0);
    151119    progress.setMaximum(0);
    152120    progress.setEnabled(false);
     121    Dictionary.setText(progress, "Mirroring.Job.Waiting");
    153122    inner_pane.add(progress, BorderLayout.CENTER);
    154123
     
    158127
    159128    cancel = new JButton(Utility.getImage("vcrstop.gif"));
    160     //cancel.setToolTipText(get("Cancel_Tip"));
    161     cancel.setToolTipText("Cancel current download");
    162129    cancel.addActionListener(owner);
    163130    cancel.addActionListener(this);
     131    Dictionary.setTooltip(cancel, "Mirroring.Job.Stop_Tooltip");
    164132
    165133    inner_pane.add(center_pane, BorderLayout.NORTH);
     
    175143    public void actionPerformed(ActionEvent event) {
    176144    if(event.getSource() == action) {
    177         if(current_action == Job.RUNNING) {
     145        if (current_action == Job.RUNNING) {
    178146        current_action = Job.STOPPED;
    179147        action.setIcon(Utility.getImage("vcrplay.gif"));
    180         action.setToolTipText("Start current download");
     148        Dictionary.setTooltip(action, "Mirroring.Job.Start_Tooltip");
    181149        cancel.setEnabled(true);
    182150        }
     
    184152        current_action = Job.RUNNING;
    185153        action.setIcon(Utility.getImage("vcrpause.gif"));
    186         action.setToolTipText("Pause current download");
     154        Dictionary.setTooltip(action, "Mirroring.Job.Pause_Tooltip");
    187155        cancel.setEnabled(false);
    188156        }
     
    212180    }
    213181    progress.setValue(progress.getMaximum());
    214     progress.setString("Download Complete.");
     182    Dictionary.setText(progress, "Mirroring.Job.Download_Complete");
    215183    refresh();
    216184    }
     
    232200    }
    233201
    234     public Dimension getPerferredSize() {
     202    public Dimension getPreferredSize() {
    235203    return Utility.PROGRESS_BAR_SIZE;
    236204    }
     
    259227        this.err_count = 0;
    260228        this.warning_count = 0;
    261     }               
     229    }
    262230    current_action = Job.RUNNING;
    263231    action.setIcon(Utility.getImage("vcrpause.gif"));
    264     action.setToolTipText("Pause current download");
     232    Dictionary.setTooltip(cancel, "Mirroring.Job.Pause_Tooltip");
    265233    // If this is a simple download, then pause is not available (nor is prematurely stopping!)
    266234    action.setEnabled(!simple);
     
    283251    }
    284252    progress.setValue(progress.getMaximum());
    285     progress.setString("Mirroring Complete.");
     253    Dictionary.setText(progress, "Mirroring.Job.Mirror_Complete");
    286254
    287255    action.setIcon(Utility.getImage("vcrfastforward.gif"));
    288     action.setToolTipText("Restart current download");
     256    Dictionary.setText(action, "Mirroring.Job.Restart");
    289257    action.setEnabled(true);
    290258    cancel.setEnabled(true);
     
    298266    file_size = file_size + current;
    299267    if(!progress.isIndeterminate()) {
    300                 // If current is zero, then this is the 'precall' before the
    301                 // downloading actually starts.
     268        // If current is zero, then this is the 'precall' before the
     269        // downloading actually starts.
    302270        if(current == 0) {
    303271        // Remove the old progress bar, then deallocate it.
     
    305273        progress = null;
    306274        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!
    309276            progress = new JProgressBar(0, 100);
    310277        }
    311278        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());
    316281        }
    317282        progress.setEnabled(true);
     
    320285        inner_pane.updateUI();
    321286        }
    322                 // Otherwise if expected is not zero move the progress bar and
    323                 // update percent complete.
     287        // Otherwise if expected is not zero move the progress bar and
     288        // update percent complete.
    324289        else if (expected != 0) {
    325290        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();
    329292        progress.setString(p_c + "%");
    330293        progress.setStringPainted(true);
    331294        }
    332                 // Finally, in the case we have no content length, we'll instead
    333                 // write the current number of bytes downloaded again.
     295        // Finally, in the case we have no content length, we'll instead
     296        // write the current number of bytes downloaded again.
    334297        else {
    335         progress.setString( file_size + " bytes");
     298        progress.setString(file_size + " b");
    336299        progress.setStringPainted(true);
    337300        }
    338301    }
    339302    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 the
    344      * 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 the
    353      * ResourceBundle.
    354      * @param args A String array of arguments to be filled out inside the
    355      * 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 is
    366      * formatted into a strings such as:
    367      *   45 bytes
    368      * 1.21 Kbytes
    369      * 2.12 Mbytes
    370      * etc
    371      * @param size The number to be formatted, in bytes, as a Long.
    372      * @return A String which contains the size formatting into a
    373      * 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";
    380303    }
    381304
     
    389312    String args1[] = new String[1];
    390313    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.
    397318        String args2[] = new String[1];
    398319        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    }
    407325    else {
    408         current_status.setText("Mirroring Complete.");
     326        Dictionary.setText(current_status, "Mirroring.Job.Mirroring_Complete");
    409327    }
    410328
     
    415333    args3[2] = warning_count + "";
    416334    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);
    421336
    422337    this.updateUI();
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r5564 r5571  
    7070import org.greenstone.gatherer.gui.PreviewPane;
    7171import org.greenstone.gatherer.gui.SimpleOpenCollectionDialog;
    72 import org.greenstone.gatherer.gui.messages.MessagePane;
    7372import org.greenstone.gatherer.gui.metaaudit.MetaAuditFrame;
    7473import org.greenstone.gatherer.gui.tree.DragTree;
     
    9998    /** The menu bar. */
    10099    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 
    104100    public MetaAuditFrame meta_audit;
    105101    /** The metaedit pane is used to assign, edit and remove metadata from files within the collection. */
     
    335331        showMetaAuditBox();
    336332    }
    337     else if(esrc == menu_bar.tools_log) {
    338         showLogBox();
    339     }
    340333    }
    341334    /** 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.
     
    641634    return result;
    642635    }
    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
    648637    /** 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.
    649638     */
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r5536 r5571  
    298298        title_final = title.getText();
    299299        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);
    304301        title.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
    305302        title.setBackground(Gatherer.config.getColor("coloring.error_background", false));
     
    313310        for(int i = 0; children != null && i < children.length; i++) {
    314311            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);
    319313            file.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
    320314            file.setBackground(Gatherer.config.getColor("coloring.error_background", false));
     
    324318        }
    325319        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);
    330321        file.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
    331322        file.setBackground(Gatherer.config.getColor("coloring.error_background", false));
     
    334325        email_final = address.getText() + "@" + host.getText();
    335326        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);
    340328        address.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
    341329        address.setBackground(Gatherer.config.getColor("coloring.error_background", false));
     
    346334        description_final = description.getText();
    347335        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);
    352337        description.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
    353338        description.setBackground(Gatherer.config.getColor("coloring.error_background", false));
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionMetadataPrompt.java

    r5527 r5571  
    77import javax.swing.*;
    88import javax.swing.event.*;
     9import org.greenstone.gatherer.Dictionary;
    910import org.greenstone.gatherer.Gatherer;
    1011import org.greenstone.gatherer.checklist.CheckList;
    1112import org.greenstone.gatherer.checklist.Entry;
    12 import org.greenstone.gatherer.gui.GUIManager;
    1313import org.greenstone.gatherer.gui.SimpleMenuBar;
    1414import org.greenstone.gatherer.gui.ModalDialog;
    1515import org.greenstone.gatherer.cdm.ElementWrapper;
    1616import org.greenstone.gatherer.msm.MetadataSet;
    17 import org.greenstone.gatherer.msm.MetadataSetManager;
    1817import org.greenstone.gatherer.util.StaticStrings;
    1918import org.greenstone.gatherer.util.Utility;
     
    3534    setModal(true);
    3635    setSize(size);
    37     setTitle(get("NewCollectionPrompt.Title"));
     36    Dictionary.setText(this, "NewCollectionPrompt.Title");
    3837
    3938    // And the remaining metadata sets.
     
    5352
    5453    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");
    5758
    5859    JPanel center_pane = new JPanel();
    5960
    6061    JPanel sets_list_pane = new JPanel();
    61     JLabel sets_list_label = new JLabel(get("NewCollectionPrompt.Select_MDS"));
     62    JLabel sets_list_label = new JLabel();
    6263    sets_list_label.setOpaque(false);
     64    Dictionary.setText(sets_list_label, "NewCollectionPrompt.Select_MDS");
    6365    sets_list = new CheckList(sets, true);
    6466
    6567    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");
    6770    elements_list = new JList();
    6871    elements_list.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
     
    7275
    7376    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
    7684    // Connection
    7785    ok_button.addActionListener(new OKButtonListener());
    7886    cancel_button.addActionListener(new CancelButtonListener());
    7987    sets_list.addListSelectionListener(new MetadataListSelectionListener());
     88
    8089    // Display
    8190    instructions_panel.setLayout(new GridLayout(2,1));
     
    106115    content_pane.add(center_pane, BorderLayout.CENTER);
    107116    content_pane.add(button_pane, BorderLayout.SOUTH);
     117
    108118    // Show
    109119    Dimension screen_size = Gatherer.config.screen_size;
     
    118128    public boolean isCancelled() {
    119129    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);
    131130    }
    132131
  • trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java

    r5536 r5571  
    1313import org.greenstone.gatherer.checklist.CheckList;
    1414import org.greenstone.gatherer.checklist.Entry;
    15 import org.greenstone.gatherer.gui.GUIManager;
    1615import org.greenstone.gatherer.gui.ModalDialog;
    1716import org.greenstone.gatherer.gui.NumberField;
  • trunk/gli/src/org/greenstone/gatherer/gui/PreviewPane.java

    r5347 r5571  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import calpa.html.*;
    3940import java.awt.*;
     
    4142import java.net.*;
    4243import javax.swing.*;
     44import org.greenstone.gatherer.Dictionary;
    4345import org.greenstone.gatherer.Gatherer;
    4446import org.greenstone.gatherer.util.GURL;
     
    6769
    6870    // Create components
    69     back = new JButton(get("Browser.Back"), Utility.getImage("back.gif"));
     71    back = new JButton(Utility.getImage("back.gif"));
    7072    back.addActionListener(new BackListener());
    7173    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"));
    7477    home.addActionListener(new HomeListener());
    7578    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"));
    7882    forward.addActionListener(new ForwardListener());
    7983    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"));
    8287    reload.addActionListener(new ReloadListener());
    8388    reload.setEnabled(false);
     89    Dictionary.registerBoth(reload, "Browser.Reload", "Browser.Reload_Tooltip");
    8490
    8591    CalHTMLPreferences prefs = new CalHTMLPreferences();
     
    8793    view = new CalHTMLPane(prefs, observer, "Default");
    8894
    89     status = new JLabel(get("Browser.Ready"));
     95    status = new JLabel();
     96    Dictionary.registerText(status, "Browser.Ready");
    9097    }
    9198
     
    101108        // Now load the collection
    102109        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);
    105113        view.showHTMLDocument(homepage, null, true);
    106114        }
     
    139147            // Now load the collection
    140148            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);
    143152            view.showHTMLDocument(homepage);
    144153        }
     
    149158    }
    150159    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);
    164160    }
    165161
     
    231227        validate();
    232228    }
     229
    233230    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
    237236    public void statusUpdate(CalHTMLPane pane, int state, URL url, int value, String message) {
    238237        this.state = state;
     238        String[] args = new String[1];
     239        args[0] = url.toString();
     240
    239241        switch(state) {
    240242        // The Pane is attempting to connect to the given URL to receive data.
     
    245247        case CalCons.PARSE_FAILED:
    246248        ///ystem.err.println("Parse Failed: " + state + " - " + message);
    247         status.setText(get("Browser.CannotConnect", url.toString()));
     249        Dictionary.registerText(status, "Browser.CannotConnect", args);
    248250        break;
    249251        // The Pane has established a connection to the given URL and is receiving any content.
    250252        case CalCons.CONNECTED:
    251253        ///ystem.err.println("Connected: " + state + " - " + message);
    252         status.setText(get("Browser.Loading", url.toString()));
     254        Dictionary.registerText(status, "Browser.Loading", args);
    253255        break;
    254256        // The size of the content at the given URL is known and is contained in the value argument.
     
    263265        case CalCons.PARSE_FAILED_POST_CONNECT:
    264266        ///ystem.err.println("Parse Failed Post Connect: " + state + " - " + message);
    265         status.setText(get("Browser.TimedOut", url.toString()));
     267        Dictionary.registerText(status, "Browser.TimedOut", args);
    266268        break;
    267269        // 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.
     
    272274        case CalCons.DOC_LOADED:
    273275        ///ystem.err.println("Doc Loaded: " + state + " - " + message);
    274         status.setText(get("Browser.Ready"));
     276        Dictionary.registerText(status, "Browser.Ready");
    275277        break;
    276278        }
  • trunk/gli/src/org/greenstone/gatherer/gui/SimpleMenuBar.java

    r4675 r5571  
    11package org.greenstone.gatherer.gui;
     2
    23import java.awt.*;
    34import java.awt.event.*;
    45import javax.swing.*;
     6import org.greenstone.gatherer.Dictionary;
    57import org.greenstone.gatherer.Gatherer;
    6 import org.greenstone.gatherer.gui.GUIManager;
    78import org.greenstone.gatherer.util.Utility;
     9
    810public class SimpleMenuBar
    911    extends JMenuBar
    1012    implements ActionListener {
    11      
     13
    1214    private String page_name;
    1315
    1416    public SimpleMenuBar(String page_name) {
    1517    this.page_name = page_name;
    16     JMenu help = new JMenu(Gatherer.dictionary.get("Menu.Help"));
     18    JMenu help = new JMenu();
    1719    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();
    2023    help_help.addActionListener(this);
    21          
     24    Dictionary.setText(help_help, "Menu.Help");
     25
    2226    help.add(help_help);
    23          
     27
    2428    add(Box.createHorizontalGlue());
    2529    add(help);
  • trunk/gli/src/org/greenstone/gatherer/gui/SimpleOpenCollectionDialog.java

    r5286 r5571  
    3333import javax.swing.*;
    3434import javax.swing.event.*;
    35 import org.greenstone.gatherer.Configuration;
    3635import org.greenstone.gatherer.Dictionary;
    3736import org.greenstone.gatherer.Gatherer;
    3837import org.greenstone.gatherer.collection.CollectionConfiguration;
    39 import org.greenstone.gatherer.gui.GUIManager;
    4038import org.greenstone.gatherer.gui.ModalDialog;
    4139import org.greenstone.gatherer.util.StaticStrings;
    4240import org.greenstone.gatherer.util.Utility;
     41
    4342/** 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. */
    4443public class SimpleOpenCollectionDialog
     
    6665    super(Gatherer.g_man, "", true);
    6766    setSize(SIZE);
    68     setTitle(get("OpenCollectionDialog.Title"));
    69    
     67    Dictionary.setText(this, "OpenCollectionDialog.Title");
     68
    7069    // Creation
    7170    JPanel content_pane = (JPanel) getContentPane();
     
    7473   
    7574    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");
    7777    collection_list = new JList(new CollectionListModel());
    7878
     
    8383
    8484    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");
    8687    description_textarea = new JTextArea();
    8788
    8889    JPanel button_pane = new JPanel();
    89     open_button = new JButton(get("OpenCollectionDialog.Open"));
     90    open_button = new JButton();
    9091    open_button.setEnabled(false);
    9192    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();
    9395    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();
    9598    cancel_button.setMnemonic(KeyEvent.VK_C);
     99    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip");
     100
    96101    // Connection
    97102    advanced_button.addActionListener(new AdvancedListener());
     
    99104    open_button.addActionListener(new OpenListener());
    100105    collection_list.addListSelectionListener(new CollectionListSelectionListener());
     106
    101107    // Layout
    102108    collection_list_pane.setLayout(new BorderLayout());
     
    142148    public String getFileName() {
    143149    return filename;
    144     }
    145 
    146     private String get(String key) {
    147     return Gatherer.dictionary.get(key);
    148150    }
    149151
  • trunk/gli/src/org/greenstone/gatherer/gui/WarningDialog.java

    r5564 r5571  
    77import org.greenstone.gatherer.Dictionary;
    88import org.greenstone.gatherer.Gatherer;
    9 // import org.greenstone.gatherer.gui.SmarterTextArea;
    109import org.greenstone.gatherer.util.FocusChangerTask;
    1110import org.greenstone.gatherer.util.Utility;
  • trunk/gli/src/org/greenstone/gatherer/gui/table/GTableModel.java

    r5158 r5571  
    1 package org.greenstone.gatherer.gui.table;
    21/**
    32 *#########################################################################
     
    2625 *########################################################################
    2726 */
     27package org.greenstone.gatherer.gui.table;
     28
    2829import java.awt.*;
    2930import java.io.File;
     
    3233import javax.swing.table.*;
    3334import org.greenstone.gatherer.Configuration;
     35import org.greenstone.gatherer.Dictionary;
    3436import org.greenstone.gatherer.Gatherer;
    3537import org.greenstone.gatherer.file.FileNode;
     
    4345import org.greenstone.gatherer.util.ArrayTools;
    4446import org.greenstone.gatherer.util.Utility;
     47
    4548/** 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.
    4649 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    6063    private ModelBuilder builder = null;
    6164
    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")};
    6366
    6467
  • trunk/gli/src/org/greenstone/gatherer/gui/tree/DragTree.java

    r4801 r5571  
    113113    // Is row at top of screen?
    114114    if(pt.y + bounds.y <= AUTOSCROLL_MARGIN) {
    115                 // Yes, scroll up one row
     115        // Yes, scroll up one row
    116116        if(row <= 0) {
    117117        row = 0;
     
    122122    }
    123123    else {
    124                 // No, scroll down one row
     124        // No, scroll down one row
    125125        if(row < getRowCount() - 1) {
    126126        row = row + 1;
     
    131131
    132132    /** 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     */
    134134    public void clearGhost() {
    135135    // Erase the last ghost image and cue line
     
    138138
    139139    /** 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       * @param event A <strong>DragSourceDropEvent</strong> containing all the information about the end of the drag event.
    141       */
     140     * @param event A <strong>DragSourceDropEvent</strong> containing all the information about the end of the drag event.
     141     */
    142142    public void dragDropEnd(DragSourceDropEvent event) {
    143143    if(event.getDropSuccess()) {
    144                 // Do whatever I do when the drop is successful.
     144        // Do whatever I do when the drop is successful.
    145145    }
    146146    }
    147147    /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus enters this component.
    148       * @param event A <strong>DragSourceDragEvent</strong> containing all the information
    149       * about the drag event.
    150       */
     148     * @param event A <strong>DragSourceDragEvent</strong> containing all the information
     149     * about the drag event.
     150     */
    151151    public void dragEnter(DragSourceDragEvent event) {
    152152    // Handled elsewhere.
    153153    }
    154154    /** 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       * @param event A <strong>DropTargetDragEvent</strong> containing all the information about the drag event.
    156       */
     155     * @param event A <strong>DropTargetDragEvent</strong> containing all the information about the drag event.
     156     */
    157157    public void dragEnter(DropTargetDragEvent event) {
    158158    group.grabFocus(this);
    159159    }
    160160    /** Any implementation of DragSourceListener must include this method so we can be notified when the drag focus leaves this component.
    161       * @param event A <strong>DragSourceEvent</strong> containing all the information about the drag event.
    162       */
     161     * @param event A <strong>DragSourceEvent</strong> containing all the information about the drag event.
     162     */
    163163    public void dragExit(DragSourceEvent event) {
    164164    clearGhost();
     
    166166
    167167    /** Any implementation of DropTargetListener must include this method
    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       */
     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     */
    172172    public void dragExit(DropTargetEvent event) {
    173173    clearGhost();
     
    175175
    176176    /** Any implementation of DragGestureListener must include this method
    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       */
     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     */
    182182    public void dragGestureRecognized(DragGestureEvent event) {
    183183    // Can never drag from MetaEdit tree
     
    253253
    254254    /** Implementation side-effect.
    255       * @param event A DragSourceDragEvent containing all the information about the drag event.
    256       */
     255     * @param event A DragSourceDragEvent containing all the information about the drag event.
     256     */
    257257    public void dragOver(DragSourceDragEvent event) {
    258258    }
    259259
    260260    /** Any implementation of DropTargetListener must include this method
    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       */
     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     */
    265265    public void dragOver(DropTargetDragEvent event) {
    266266    // Draw the mouse ghost
     
    324324            target = (FileNode) target_path.getLastPathComponent();
    325325        }
    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         //}
    332326        }
    333327        else {
     
    357351        }
    358352    }
    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     //}
    367353    // Clear up the group.image_ghost
    368354    paintImmediately(ra_ghost.getBounds());
     
    370356    }
    371357
    372     //private class MessageTask
    373     //  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     //}
    386358
    387359    /** Any implementation of DragSourceListener must include this method
    388       * so we can be notified when the action to be taken upon drop changes.
    389       * @param event A DragSourceDragEvent containing all the information
    390       * about the drag event.
    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     */
    392364    public void dropActionChanged(DragSourceDragEvent event) {
    393365    }
    394366
    395367    /** Any implementation of DropTargetListener must include this method
    396       * so we can be notified when the action to be taken upon drop changes.
    397       * @param event A DropTargetDragEvent containing all the information
    398       * about the drag event.
    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     */
    400372    public void dropActionChanged(DropTargetDragEvent event) {
    401373    }
    402374
    403375    /** Used to notify this component that it has gained focus. It should
    404       * make some effort to inform the user of this.
    405       */
     376     * make some effort to inform the user of this.
     377     */
    406378    public void gainFocus() {
    407379    ///ystem.err.println("Gained focus: " + this);
     
    411383
    412384    /** Autoscroll Interface...
    413       * The following code was borrowed from the book:
    414       *              Java Swing
    415       *              By Robert Eckstein, Marc Loy & Dave Wood
    416       *              Paperback - 1221 pages 1 Ed edition (September 1998)
    417       *              O'Reilly & Associates; ISBN: 156592455X
    418       *
    419       * The relevant chapter of which can be found at:
    420       *              http://www.oreilly.com/catalog/jswing/chapter/dnd.beta.pdf
    421       * Calculate the insets for the *JTREE*, not the viewport
    422       * the tree is in. This makes it a bit messy.
    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     */
    424396    public Insets getAutoscrollInsets()
    425397    {
     
    441413
    442414    /** This method is used to inform this component when it loses focus,
    443       * and should indicate this somehow.
    444       */
     415     * and should indicate this somehow.
     416     */
    445417    public void loseFocus() {
    446418    ///ystem.err.println("Lost focus: " + this);
     
    501473
    502474    /** Override the normal setEnabled so the Tree exhibits a little more
    503       * change, which in this instance is the background colour changing.
    504       * @param state Whether this GTree should be in an enabled state.
    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     */
    506478    public void setEnabled(boolean state) {
    507479    super.setEnabled(state);
     
    571543        }
    572544        }
    573                 // 3c. If not found then return as this node can't exists somehow.
     545        // 3c. If not found then return as this node can't exists somehow.
    574546        if(!found) {
    575547        return;
  • trunk/gli/src/org/greenstone/gatherer/shell/GShellListener.java

    r4364 r5571  
    3535 *########################################################################
    3636 */
     37package org.greenstone.gatherer.shell;
    3738
    38  
    39 
    40 
    41 
    42 
    43 package org.greenstone.gatherer.shell;
    4439/**
    4540 * Title:        The Gatherer<br>
Note: See TracChangeset for help on using the changeset viewer.