Changeset 5564 for trunk/gli/src


Ignore:
Timestamp:
2003-10-03T14:07:35+12:00 (21 years ago)
Author:
mdewsnip
Message:

Many more small improvements and tooltips added. Still more to come!

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

Legend:

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

    r5529 r5564  
    4343import javax.swing.*;
    4444import javax.swing.plaf.*;
    45 import org.greenstone.gatherer.Message;
    4645import org.greenstone.gatherer.cdm.Language;
    4746import org.greenstone.gatherer.gui.Coloring;
  • trunk/gli/src/org/greenstone/gatherer/Dictionary.java

    r5536 r5564  
    235235
    236236
     237    static public String newget(String key, String arg)
     238    {
     239    String[] args = new String[1];
     240    args[0] = arg;
     241    return self.get(key, args);
     242    }
     243
     244
    237245    static public String newget(String key, String[] args)
    238246    {
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r5316 r5564  
    210210
    211211        // Having loaded the configuration (necessary to determine if certain warnings have been disabled) and dictionary, we now check if the necessary path variables have been provided.
    212 
    213212        if(config.exec_file == null && config.exec_address == null) {
    214213        if(config.exec_file == null) {
     
    263262        size.height = config.screen_size.height;
    264263        }
    265                 // Set default font
     264        // Set default font
    266265        setUIFont(config.getFont("general.font", true), config.getFont("general.tooltip_font", true));
    267                 // Set up proxy
     266        // Set up proxy
    268267        setProxy();
    269                 // Now we set up an Authenticator
     268        // Now we set up an Authenticator
    270269        Authenticator.setDefault(new GAuthenticator());
    271270
    272271        assoc_man = new FileAssociationManager();
    273                 // Create File Manager
     272        // Create File Manager
    274273        f_man = new FileManager();
    275                 // Create Collection Manager
     274        // Create Collection Manager
    276275        c_man = new CollectionManager();
    277                 // If there was an open collection last session, reopen it.
     276        // If there was an open collection last session, reopen it.
    278277        if(open_collection == null) {
    279278        open_collection = config.getString("general.open_collection", true);
     
    282281        c_man.loadCollection(open_collection);
    283282        }
    284                 // Create GUI Manager (last) or else suffer the death of a thousand NPE's
     283        // Create GUI Manager (last) or else suffer the death of a thousand NPE's
    285284        splash.toFront();
    286285        g_man = new GUIManager(size);
     
    302301        // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
    303302        g_man.afterDisplay();
    304                 // Hide the splash.
     303        // Hide the splash.
    305304        splash.hide();
    306305        splash.destroy();
     
    326325    config.setString("general.open_collection", true, null);
    327326    if(c_man.ready()) {
    328                 ///ystem.err.println("Collection open.");
     327        ///ystem.err.println("Collection open.");
    329328        if(c_man.saved()) {
    330329        ///ystem.err.println("Collection has been recently saved, so I'll remember it for next time.");
     
    368367    }
    369368    else {
    370         JOptionPane.showMessageDialog(g_man, get("General.Outstanding_Processes"), get("General.Outstanding_Processes_Title"), JOptionPane.ERROR_MESSAGE);
     369        JOptionPane.showMessageDialog(g_man, Dictionary.newget("General.Outstanding_Processes"), Dictionary.newget("General.Outstanding_Processes_Title"), JOptionPane.ERROR_MESSAGE);
    371370        g_man.hide();
    372371    }
    373372    }
    374     /** Overloaded to call get with both a key and an empty argument array.
    375      * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    376      * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call.
    377      */
    378     public String get(String key) {
    379     return dictionary.get(key, (String[])null);
    380     }
    381     /** Overloaded to call get with both a key and an argument array with one element.
    382      * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    383      * @param arg A single argument as a <strong>String</strong>.
    384      * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatiically populated with formatting Strings of with argument String provided in the get call.
    385      */
    386     public String get(String key, String arg) {
    387     String args[] = new String[1];
    388     args[0] = arg;
    389     return dictionary.get(key, args);
    390     }
    391     /** Used to retrieve a property value from the Locale specific ResourceBundle, based upon the key and arguments supplied. If the key cannot be found or if some other part of the call fails a default (English) error message is returned. <BR>
    392      * Here the get recieves a second argument which is an array of Strings used to populate argument fields, denoted {<I>n</I>}, within the value String returned. Note that argument numbers greater than or equal to 32 are automatically mapped to the formatting String named Farg<I>n</I>.
    393      * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    394      * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.
    395      * @return A <strong>String</strong> which has been referenced by the key String and that either contains no argument fields, or has had the argument fields automatically populated with formatting Strings of with argument String provided in the get call.
    396      * @see org.greenstone.gatherer.Gatherer
    397      * @see org.greenstone.gatherer.Dictionary
    398      */
    399     public String get(String key, String args[]) {
    400     return dictionary.get(key, args);
    401     }
     373
    402374    /** Retrieve the metadata directory, as required by any MSMCaller implementation.
    403375     * @return The currently active collection metadata directory as a <strong>String</strong>.
     
    405377     */
    406378    public String getCollectionMetadata() {
    407     if(c_man != null && c_man.ready()) {
     379    if (c_man != null && c_man.ready()) {
    408380        return c_man.getCollectionMetadata();
    409381    }
    410382    return "";
    411383    }
     384
    412385    /** Retrieve a reference to the frame that any dialog boxes will appear relative to, as required by any MSMCaller or CDMCaller implementation.
    413386     * @return A <strong>JFrame</strong>.
     
    417390    return g_man;
    418391    }
     392
    419393    /** Method to retrieve a reference to the metadata set manager class. This is then used to create the 'metadataset' commands in the collection configuration file.
    420394     * @return A reference to the <Strong>MetadataSetManager</strong>.
     
    440414    }
    441415    else {
    442                 ///ystem.err.println("No open command available.");
     416        ///ystem.err.println("No open command available.");
    443417    }
    444418    }
     
    590564                    }
    591565                    // Otherwise its fine as it is
    592                 }
     566                }
    593567            }
    594568        }
     
    613587    dialog.dispose();
    614588    dialog = null;
    615     ///ystem.out.println(dictionary.get("General.Missing_EXEC"));
     589    ///ystem.out.println(Dictionary.newget("General.Missing_EXEC"));
    616590    }
    617591
     
    623597    dialog.dispose();
    624598    dialog = null;
    625     ///ystem.out.println(dictionary.get("General.Missing_GSDL"));
     599    ///ystem.out.println(Dictionary.newget("General.Missing_GSDL"));
    626600    }
    627601
     
    632606    dialog.dispose();
    633607    dialog = null;
    634     ///ystem.out.println(dictionary.get("General.Missing_PERL"));
     608    ///ystem.out.println(Dictionary.newget("General.Missing_PERL"));
    635609    }
    636610
     
    653627     */
    654628    static public void printUsage(Dictionary dictionary) {
    655     System.out.println(dictionary.get("General.Usage"));
     629    System.out.println(Dictionary.newget("General.Usage"));
    656630    }
    657631
     
    742716
    743717    private void startServerEXE() {
    744         if(config.exec_file != null && config.exec_address == null && Utility.isWindows()) {
    745             // First of all we create a GSDLSiteCFG object and check if a URL is already present, in which case the server is already running.
    746             gsdlsite_cfg = new GSDLSiteConfig(config.exec_file);
    747             String url = gsdlsite_cfg.getURL();
    748             // If its already running then set exec address.
    749             if(url != null) {
    750                 try {
    751                     config.exec_address = new URL(url);
    752                 }
    753                 catch(Exception error) {
    754                 }
     718    if(config.exec_file != null && config.exec_address == null && Utility.isWindows()) {
     719        // First of all we create a GSDLSiteCFG object and check if a URL is already present, in which case the server is already running.
     720        gsdlsite_cfg = new GSDLSiteConfig(config.exec_file);
     721        String url = gsdlsite_cfg.getURL();
     722        // If its already running then set exec address.
     723        if(url != null) {
     724        try {
     725            config.exec_address = new URL(url);
     726        }
     727        catch(Exception error) {
     728        }
     729        }
     730        // Otherwise its time to run the server in a spawned process.
     731        if(config.exec_address == null && config.exec_file.exists()) {
     732        // Configure for immediate entry. Note that this only works if the gsdlsite.cfg file exists.
     733        gsdlsite_cfg.set();
     734        // Spawn server
     735        String command = config.exec_file.getAbsolutePath() + " " + gsdlsite_cfg.getSiteConfigFilename();
     736        server = new ExternalApplication(command);
     737        server.start();
     738        command = null;
     739        // Now we have to wait until program has started. We do this by reloading and checking
     740        ///ystem.err.print("Waiting until the local library has loaded");
     741        try {
     742            gsdlsite_cfg.load();
     743           
     744            int try_again = JOptionPane.YES_OPTION;
     745            int attempt_count = 0;
     746            while(gsdlsite_cfg.getURL() == null && try_again == JOptionPane.YES_OPTION) {
     747            ///ystem.err.print(".");
     748            if(attempt_count == 60) {
     749                try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.newget("Server.QuitTimeOut"), Dictionary.newget("General.Warning"), JOptionPane.YES_NO_OPTION);
     750            }
     751            else {
     752                synchronized(this) {
     753                wait(1000); // Wait one second (give or take)
     754                }
     755                gsdlsite_cfg.load();
     756                attempt_count++;
     757            }
    755758            }
    756             // Otherwise its time to run the server in a spawned process.
    757             if(config.exec_address == null && config.exec_file.exists()) {
    758                 // Configure for immediate entry. Note that this only works if the gsdlsite.cfg file exists.
    759                 gsdlsite_cfg.set();
    760                 // Spawn server
    761                 String command = config.exec_file.getAbsolutePath() + " " + gsdlsite_cfg.getSiteConfigFilename();
    762                 server = new ExternalApplication(command);
    763                 server.start();
    764                 command = null;
    765                 // Now we have to wait until program has started. We do this by reloading and checking
    766                 ///ystem.err.print("Waiting until the local library has loaded");
    767                 try {
    768                     gsdlsite_cfg.load();
    769 
    770                     int try_again = JOptionPane.YES_OPTION;
    771                     int attempt_count = 0;
    772                     while(gsdlsite_cfg.getURL() == null && try_again == JOptionPane.YES_OPTION) {
    773                         ///ystem.err.print(".");
    774                         if(attempt_count == 60) {
    775                             try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, dictionary.get("Server.QuitTimeOut"), dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
    776                         }
    777                         else {
    778                             synchronized(this) {
    779                                 wait(1000); // Wait one second (give or take)
    780                             }
    781                             gsdlsite_cfg.load();
    782                             attempt_count++;
    783                         }
    784                     }
    785 
    786                     if((url = gsdlsite_cfg.getURL()) != null) {
    787                         // Ta-da. Now the url should be available.
    788                         config.exec_address = new URL(url);
    789 
    790                         // A quick test involves opening a connection to get the home page  for this collection. If this fails then we try changing the url to be localhost.
    791                         try {
    792                             Gatherer.println("Try connecting to server on config url: '" + config.exec_address + "'");
    793                             URLConnection connection = config.exec_address.openConnection();
    794                             connection.getContent();
    795                         }
    796                         catch(IOException bad_url_connection) {
    797                             try {
    798                                 Gatherer.println("Try connecting to server on local host: '" + gsdlsite_cfg.getLocalHostURL() + "'");
    799                                 config.exec_address = new URL(gsdlsite_cfg.getLocalHostURL  ());
    800                                 URLConnection connection = config.exec_address.openConnection();
    801                                 connection.getContent();
    802                             }
    803                             catch(IOException worse_url_connection) {
    804                                 Gatherer.println("Can't connect to server on either address.");
    805                                 config.exec_address = null;
    806                                 config.exec_file = null;
    807                             }
    808                         }
    809                     }
    810                     // Unable to start local library. Show appropriate message.
    811                     else {
    812                         missingEXEC(dictionary);
    813                     }
    814                 }
    815                 catch (Exception error) {
    816                     error.printStackTrace();
    817                 }
    818             }
     759           
     760            if((url = gsdlsite_cfg.getURL()) != null) {
     761            // Ta-da. Now the url should be available.
     762            config.exec_address = new URL(url);
     763           
     764            // A quick test involves opening a connection to get the home page  for this collection. If this fails then we try changing the url to be localhost.
     765            try {
     766                Gatherer.println("Try connecting to server on config url: '" + config.exec_address + "'");
     767                URLConnection connection = config.exec_address.openConnection();
     768                connection.getContent();
     769            }
     770            catch(IOException bad_url_connection) {
     771                try {
     772                Gatherer.println("Try connecting to server on local host: '" + gsdlsite_cfg.getLocalHostURL() + "'");
     773                config.exec_address = new URL(gsdlsite_cfg.getLocalHostURL  ());
     774                URLConnection connection = config.exec_address.openConnection();
     775                connection.getContent();
     776                }
     777                catch(IOException worse_url_connection) {
     778                Gatherer.println("Can't connect to server on either address.");
     779                config.exec_address = null;
     780                config.exec_file = null;
     781                }
     782            }
     783            }
     784            // Unable to start local library. Show appropriate message.
     785            else {
     786            missingEXEC(dictionary);
     787            }
     788        }
     789        catch (Exception error) {
     790            error.printStackTrace();
     791        }
     792        }
    819793        // Can't do a damb thing.
    820         }
    821         Gatherer.println("Having started server.exe, exec_address is: " + config.exec_address);
     794    }
     795    Gatherer.println("Having started server.exe, exec_address is: " + config.exec_address);
    822796    }
    823797
     
    833807            gsdlsite_cfg.load();
    834808            int try_again = JOptionPane.YES_OPTION;
    835             int attempt_count = 0;
     809            int attempt_count = 0;
    836810            while(gsdlsite_cfg.getURL() != null && try_again == JOptionPane.YES_OPTION) {
    837                 if(attempt_count == 60) {
    838                     try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, dictionary.get("Server.QuitTimeOut"), dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
    839                 }
    840                 else {
    841                     synchronized(this) {
    842                         wait(1000); // Wait one second (give or take)
    843                     }
    844                     gsdlsite_cfg.load();
    845                     attempt_count++;
    846                 }
    847             }
     811            if(attempt_count == 60) {
     812                try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.newget("Server.QuitTimeOut"), Dictionary.newget("General.Warning"), JOptionPane.YES_NO_OPTION);
     813            }
     814            else {
     815                synchronized(this) {
     816                wait(1000); // Wait one second (give or take)
     817                }
     818                gsdlsite_cfg.load();
     819                attempt_count++;
     820            }
     821            }
    848822            //if(gsdlsite_cfg.getURL() != null) {
    849             //JOptionPane.showMessageDialog(Gatherer.g_man, dictionary.get("Server.QuitManual"), dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     823            //JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("Server.QuitManual"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    850824            //}
    851825        }
     
    860834        // If the local server is still running then our changed values will get overwritten.
    861835        if(gsdlsite_cfg.getURL() != null) {
    862         JOptionPane.showMessageDialog(Gatherer.g_man, dictionary.get("Server.QuitFailed"), dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     836        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("Server.QuitFailed"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    863837        }
    864838        gsdlsite_cfg = null;
  • trunk/gli/src/org/greenstone/gatherer/Message.java

    r5527 r5564  
    3535 *########################################################################
    3636 */
     37package org.greenstone.gatherer;
    3738
    38  
    39 
    40 
    41 
    42 
    43 package org.greenstone.gatherer;
    4439/**************************************************************************************
    4540 * Title:        Gatherer
     
    5045 * Revised:      28/05/01
    5146 **************************************************************************************/
     47
    5248import java.util.Date;
    5349import java.util.Random;
     50
    5451/** Provides an event-type wrapper around a message for displaying to the user.
    5552 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    10299    this.message = message;
    103100    }
     101
    104102    /**
    105103     * Used to display a message, stating level and source.
     
    108106     */
    109107    public String toString(Gatherer gatherer) {
     108    // public String toString() {
    110109    String source_str = "";
    111110    switch(source) {
    112111    case GENERAL:
    113         source_str = gatherer.dictionary.get("Source.General");
     112        source_str = Dictionary.newget("Source.General");
    114113        break;
    115114    case BROWSER:
    116         source_str = gatherer.dictionary.get("GUI.Hunt");
     115        source_str = Dictionary.newget("GUI.Hunt");
    117116        break;
    118117    case MIRRORING:
    119         source_str = gatherer.dictionary.get("GUI.Mirror");
     118        source_str = Dictionary.newget("GUI.Mirror");
    120119        break;
    121120    case COLLECT:
    122         source_str = gatherer.dictionary.get("GUI.Gather");
     121        source_str = Dictionary.newget("GUI.Gather");
    123122        break;
    124123    case METAEDIT:
    125         source_str = gatherer.dictionary.get("GUI.Enrich");
     124        source_str = Dictionary.newget("GUI.Enrich");
    126125        break;
    127126    case BUILDING:
    128         source_str = gatherer.dictionary.get("Source.Building");
     127        source_str = Dictionary.newget("Source.Building");
    129128        break;
    130129    default:
    131         source_str = gatherer.dictionary.get("Source.Unknown");
     130        source_str = Dictionary.newget("Source.Unknown");
    132131    }
    133132
     
    135134    switch(level) {
    136135    case MAIN:
    137         level_str = gatherer.dictionary.get("Level.Main");
     136        level_str = Dictionary.newget("Level.Main");
    138137        break;
    139138    case EVENT:
    140         level_str = gatherer.dictionary.get("Level.Event");
     139        level_str = Dictionary.newget("Level.Event");
    141140        break;
    142141    case INFO:
    143         level_str = gatherer.dictionary.get("Level.Information");
     142        level_str = Dictionary.newget("Level.Information");
    144143        break;
    145144    case ERROR:
    146         level_str = gatherer.dictionary.get("Level.Error");
     145        level_str = Dictionary.newget("Level.Error");
    147146        break;
    148147    default:
    149         level_str = gatherer.dictionary.get("Level.Unknown");
     148        level_str = Dictionary.newget("Level.Unknown");
    150149    }
    151150    return source_str + " " + level_str + " > " + message;
    152151    }
     152
    153153    /** Used during testing testing to generate a random message.
    154154     * @return A new <strong>Message</strong> object which has a random source, level and a message body of the current system time.
  • trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMetaManager.java

    r5164 r5564  
    2626 */
    2727package org.greenstone.gatherer.cdm;
     28
    2829import java.awt.*;
    2930import java.awt.event.*;
     
    3637import org.greenstone.gatherer.cdm.DOMProxyListModel;
    3738import org.greenstone.gatherer.cdm.Index;
    38 import org.greenstone.gatherer.gui.EditorDialog;
    3939import org.greenstone.gatherer.util.StaticStrings;
    4040import org.greenstone.gatherer.util.Utility;
  • trunk/gli/src/org/greenstone/gatherer/checklist/Entry.java

    r5159 r5564  
    22
    33import javax.swing.JCheckBox;
     4import org.greenstone.gatherer.Dictionary;
    45import org.greenstone.gatherer.Gatherer;
    56import org.greenstone.gatherer.msm.MetadataSet;
     
    78import org.greenstone.gatherer.util.Utility;
    89import org.w3c.dom.Element;
     10
    911/** An Entry encapsulates a single row of the list, both its check box and the object the row represents. */
    1012public class Entry
     
    2628        MetadataSet set = (MetadataSet) object;
    2729        // Build tooltip
    28         StringBuffer tip = new StringBuffer(Gatherer.dictionary.get("NewCollectionPrompt.Set_Contains"));
     30        StringBuffer tip = new StringBuffer(Dictionary.newget("NewCollectionPrompt.Set_Contains"));
    2931        tip.append(":\n");
    3032        for(int i = 0; i < set.size(); i++) {
     
    6163
    6264    /** Retrieve the object associated with this entry.
    63       * @return An <strong>Object</strong>.
    64       */
     65     * @return An <strong>Object</strong>.
     66     */
    6567    public Object getObject() {
    6668    //Gatherer.println("Retrieving the object for " + toString());
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r5527 r5564  
    1 package org.greenstone.gatherer.collection;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.collection;
     38
    3839import java.io.*;
    3940import java.lang.Class;
     
    4243import javax.swing.event.*;
    4344import javax.swing.tree.*;
     45import org.greenstone.gatherer.Dictionary;
    4446import org.greenstone.gatherer.Gatherer;
    4547import org.greenstone.gatherer.Message;
     
    6971import org.greenstone.gatherer.util.Codec;
    7072import org.greenstone.gatherer.util.GSDLSiteConfig;
    71 import org.greenstone.gatherer.util.MetadataXML;
    7273import org.greenstone.gatherer.util.StaticStrings;
    7374import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
     
    120121    }
    121122    /** Add a special directory mapping.
    122       * @param name The name for this directory mapping as a <strong>String</strong>.
    123       * @param file The directory this mapping maps to as a <strong>File</strong>.
    124       */
     123     * @param name The name for this directory mapping as a <strong>String</strong>.
     124     * @param file The directory this mapping maps to as a <strong>File</strong>.
     125     */
    125126    public void addDirectoryMapping(String name, File file) {
    126127    if(ready()) {
    127                 // Update the information stored in the collection
     128        // Update the information stored in the collection
    128129        collection.addDirectoryMapping(name, file);
    129                 // Now update the tree
     130        // Now update the tree
    130131        FileSystemModel model = (FileSystemModel) Gatherer.g_man.collection_pane.getWorkspaceTree().getModel();
    131132        FileNode parent = (FileNode) model.getRoot();
     
    135136    }
    136137    /** This method calls the builcol.pl scripts via a GShell so as to not lock up the processor.
    137       * @see org.greenstone.gatherer.Configuration
    138       * @see org.greenstone.gatherer.Gatherer
    139       * @see org.greenstone.gatherer.Message
    140       * @see org.greenstone.gatherer.collection.Collection
    141       * @see org.greenstone.gatherer.gui.BuildOptions
    142       * @see org.greenstone.gatherer.shell.GShell
    143       * @see org.greenstone.gatherer.shell.GShellListener
    144       * @see org.greenstone.gatherer.shell.GShellProgressMonitor
    145       * @see org.greenstone.gatherer.util.Utility
    146       */
     138     * @see org.greenstone.gatherer.Configuration
     139     * @see org.greenstone.gatherer.Gatherer
     140     * @see org.greenstone.gatherer.Message
     141     * @see org.greenstone.gatherer.collection.Collection
     142     * @see org.greenstone.gatherer.gui.BuildOptions
     143     * @see org.greenstone.gatherer.shell.GShell
     144     * @see org.greenstone.gatherer.shell.GShellListener
     145     * @see org.greenstone.gatherer.shell.GShellProgressMonitor
     146     * @see org.greenstone.gatherer.util.Utility
     147     */
    147148    public void buildCollection() {
    148149    Gatherer.println("CollectionManager.buildCollection()");
     
    222223    try {
    223224        // Create a progress monitor.
    224         ProgressMonitor progress = new ProgressMonitor(Gatherer.g_man, get("CollectionManager.Creating_New"), "mkcol.pl", 0, 7);
     225        ProgressMonitor progress = new ProgressMonitor(Gatherer.g_man, Dictionary.newget("CollectionManager.Creating_New"), "mkcol.pl", 0, 7);
    225226        // Create the new collection.
    226227        makeCollection(description, email, name, title);
     
    234235        gcache_dir.mkdirs();
    235236        if(progress != null) {
    236         progress.setNote(get("CollectionManager.Gcache_Created"));
     237        progress.setNote(Dictionary.newget("CollectionManager.Gcache_Created"));
    237238        }
    238239
     
    242243        log_dir.mkdirs();
    243244        if(progress != null) {
    244         progress.setNote(get("CollectionManager.Log_Created"));
     245        progress.setNote(Dictionary.newget("CollectionManager.Log_Created"));
    245246        }
    246247
     
    395396        String args[] = new String[1];
    396397        args[0] = name;
    397         progress.setNote(get("CollectionManager.Session_Ready", args));
     398        progress.setNote(Dictionary.newget("CollectionManager.Session_Ready", args));
    398399        progress.close();
    399400    }
     
    436437
    437438    /** Method that is called whenever an element within a set is changed or modified. We want to mark the collection so that it needs saving again.
    438       * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired.
    439       * @see org.greenstone.gatherer.collection.Collection
    440       */
     439     * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired.
     440     * @see org.greenstone.gatherer.collection.Collection
     441     */
    441442    public void elementChanged(MSMEvent event) {
    442443    // This means the state of the collections has changed, so we should set saved to false.
     
    444445    }
    445446    /** Used to retrieve the build options associated with the currently loaded collection. If none yet exist, default ones are created.
    446       * @return A <strong>BuildOptions</strong> object containing the build options for the current collection.
    447       * @see org.greenstone.gatherer.collection.Collection
    448       */
     447     * @return A <strong>BuildOptions</strong> object containing the build options for the current collection.
     448     * @see org.greenstone.gatherer.collection.Collection
     449     */
    449450    public BuildOptions getBuildOptions() {
    450451    return collection.build_options;
     
    452453
    453454    /** Retrieve the current collection.
    454       * @return The <strong>Collection</strong> itself.
    455       */
     455     * @return The <strong>Collection</strong> itself.
     456     */
    456457    public Collection getCollection() {
    457458    return collection;
     
    578579        return collection.getTitle();
    579580    }
    580     return get("Collection.No_Collection");
     581    return Dictionary.newget("Collection.No_Collection");
    581582    }
    582583
     
    610611    // Create and add Greenstone collections node.
    611612    // Starting at the collection directory of gsdl...
    612     FileNode world_root = new FileNode(get("Tree.World"));
     613    FileNode world_root = new FileNode(Dictionary.newget("Tree.World"));
    613614    world_root.unmap();
    614615    workspace_root.insert(world_root);
     
    619620    if(roots != null) {
    620621        FileNode file_root;
    621         String name = get("Tree.Root");
     622        String name = Dictionary.newget("Tree.Root");
    622623        if(roots.length == 1) {
    623624        file_root = new FileNode(roots[0], name);
     
    644645    if(home_folder_str != null && home_folder_str.length() > 0) {
    645646        File home_folder = new File(home_folder_str);
    646         FileNode home_folder_node = new FileNode(home_folder, get("Tree.Home", home_folder.getName()));
     647        String[] args = new String[1];
     648        args[0] = home_folder.getName();
     649        FileNode home_folder_node = new FileNode(home_folder, Dictionary.newget("Tree.Home", args));
    647650        workspace_root.insert(home_folder_node);
    648651    }
     
    651654    if(Gatherer.config.get("workflow.mirror", false)) {
    652655        // Add Public workspace
    653         FileNode public_root = new FileNode(new File(Utility.CACHE_DIR), get("Tree.Public"));
     656        FileNode public_root = new FileNode(new File(Utility.CACHE_DIR), Dictionary.newget("Tree.Public"));
    654657        workspace_root.insert(public_root);
    655658        // Add Private workspace if a collection has been loaded.
    656659        if(ready()) {
    657         FileNode private_root = new FileNode(new File(getCollectionCache()), get("Tree.Private"));
     660        FileNode private_root = new FileNode(new File(getCollectionCache()), Dictionary.newget("Tree.Private"));
    658661        workspace_root.insert(private_root);
    659662        }
     
    753756        File metadata_directory = new File(collection_directory, Utility.META_DIR);
    754757        if(!metadata_directory.exists()) {
    755             JOptionPane.showMessageDialog(Gatherer.g_man, get("CollectionManager.Old_Collection", args2), get("General.Warning"), JOptionPane.INFORMATION_MESSAGE);
     758            JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CollectionManager.Old_Collection", args2), Dictionary.newget("General.Warning"), JOptionPane.INFORMATION_MESSAGE);
    756759        }
    757760        // Normal GLI collection
     
    783786                collection.gdm = new GDMManager();
    784787                // Tell everyone that it worked.
    785                 Gatherer.println(get("CollectionManager.Loading_Successful", name));
     788                String[] args = new String[1];
     789                args[0] = name;
     790                Gatherer.println(Dictionary.newget("CollectionManager.Loading_Successful", args));
    786791                // Now we need to hook up classes that depend on messages from the metadata set manager to keep their content fresh.
    787792                collection.msm.addMSMListener(this);
     
    796801                // There is obviously no existing collection present.
    797802                Gatherer.printStackTrace(error);
    798                 JOptionPane.showMessageDialog(Gatherer.g_man, get("CollectionManager.Cannot_Open", args2), get("General.Error"), JOptionPane.ERROR_MESSAGE);
     803                JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CollectionManager.Cannot_Open", args2), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    799804            }
    800805            }
     
    803808        }
    804809        else {
    805         JOptionPane.showMessageDialog(Gatherer.g_man, get("CollectionManager.File_Not_Found", args2), get("General.Error"), JOptionPane.ERROR_MESSAGE);
     810        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CollectionManager.File_Not_Found", args2), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    806811        }
    807812        collection_directory = null;
    808813    }
    809814    else {
    810         JOptionPane.showMessageDialog(Gatherer.g_man, get("CollectionManager.Not_Col_File", args2), get("General.Error"), JOptionPane.ERROR_MESSAGE);
     815        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CollectionManager.Not_Col_File", args2), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    811816        Gatherer.println("Not a Gatherer Collection.");
    812817    }
     
    929934        workspace_model = null;
    930935        Gatherer.g_man.collectionChanged(ready());
    931         JOptionPane.showMessageDialog(Gatherer.g_man, get("CollectionManager.Preview_Ready"), get("CollectionManager.Preview_Ready_Title"), JOptionPane.INFORMATION_MESSAGE);
     936        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CollectionManager.Preview_Ready"), Dictionary.newget("CollectionManager.Preview_Ready_Title"), JOptionPane.INFORMATION_MESSAGE);
    932937    }
    933938    else if(event.getStatus() == GShell.ERROR) {
    934         JOptionPane.showMessageDialog(Gatherer.g_man, get("CollectionManager.Preview_Ready_Failed"), get("CollectionManager.Preview_Ready_Title"), JOptionPane.ERROR_MESSAGE);
     939        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CollectionManager.Preview_Ready_Failed"), Dictionary.newget("CollectionManager.Preview_Ready_Title"), JOptionPane.ERROR_MESSAGE);
    935940        Gatherer.g_man.collectionChanged(ready());
    936941    }
     
    977982    FileNode greenstone_collections_node = null;
    978983    int root_child_count = root.getChildCount();
    979     String greenstone_collections_str = get("Tree.World");
     984    String greenstone_collections_str = Dictionary.newget("Tree.World");
    980985    for(int i = 0; greenstone_collections_node == null && i < root_child_count; i++) {
    981986        TreeNode child = root.getChildAt(i);
     
    10971102        model.removeNodeFromParent(old);
    10981103                // Create and insert new.
    1099         FileNode private_workspace = new FileNode(new File(getCollectionCache()), get("Tree.Private"));
     1104        FileNode private_workspace = new FileNode(new File(getCollectionCache()), Dictionary.newget("Tree.Private"));
    11001105        model.insertNodeInto(private_workspace, root, 2);
    11011106    }
     
    11081113    collection.setSaved(false);
    11091114    }
    1110     /** Used to retrive a value from the dictionary based on the key.
    1111       * @param key A <strong>String</strong> indicating what value to retrieve.
    1112       * @return A <strong>String</strong> representing the value.
    1113       */
    1114     private String get(String key) {
    1115     return get(key, (String[])null);
    1116     }
    1117 
    1118     /** Used to retrive a value from the dictionary based on the key. */
    1119     private String get(String key, String arg) {
    1120     String[] args = new String[1];
    1121     args[0] = arg;
    1122     return get(key, args);
    1123     }
    1124 
    1125     /** Used to retrive a value from the dictionary based on the key, and an array of arguments.
    1126       * @param key A <strong>String</strong> indicating what value to retrieve.
    1127       * @param args A <strong>String[]</strong> of arguments to be inserted into the phrase.
    1128       * @return A <strong>String</strong> representing the value.
    1129       */
    1130     private String get(String key, String args[]) {
    1131     if(key.indexOf('.') == -1) {
    1132         key = "CollectionManager." + key;
    1133     }
    1134     return Gatherer.dictionary.get(key, args);
    1135     }
     1115
    11361116    /** Install collection by moving its files from building to index after a successful build.
    1137       * @see org.greenstone.gatherer.Gatherer
    1138       * @see org.greenstone.gatherer.util.Utility
    1139       */
     1117     * @see org.greenstone.gatherer.Gatherer
     1118     * @see org.greenstone.gatherer.util.Utility
     1119     */
    11401120    private void installCollection() {
    11411121    Gatherer.println("Build complete. Moving files.");
    11421122
    1143 
    11441123    try {
    1145                 // We have to ensure that the local library
     1124        // We have to ensure that the local library
    11461125        if(Gatherer.config.exec_file != null) {
    11471126        ///ystem.err.println("Local Library Found!");
     
    11611140
    11621141        // Special case for build mode "all": replace index dir with building dir
    1163         if (build_mode == null || build_mode.equals(get("CreatePane.Mode_All"))) {
     1142        if (build_mode == null || build_mode.equals(Dictionary.newget("CreatePane.Mode_All"))) {
    11641143        // Remove the old index directory
    11651144        if (index_dir.exists()) {
     
    12091188    }
    12101189    }
     1190
    12111191    /** Creates and dispatches a message given the initial details.
    1212       * @param level An <i>int</i> indicating the message level for this message.
    1213       * @param message A <strong>String</strong> which contains the payload of this message.
    1214       * @see org.greenstone.gatherer.Log
    1215       * @see org.greenstone.gatherer.Message
    1216       */
     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     */
    12171197    private void message(int level, String message) {
    12181198    Message msg = new Message(Message.COLLECT, level, message);
  • trunk/gli/src/org/greenstone/gatherer/collection/Job.java

    r5335 r5564  
    1 package org.greenstone.gatherer.collection;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.collection;
     38
    3839import java.awt.event.*;
    3940import java.io.*;
     
    4142import java.util.*;
    4243import javax.swing.tree.*;
     44import org.greenstone.gatherer.Dictionary;
    4345import org.greenstone.gatherer.Gatherer;
    4446import org.greenstone.gatherer.WGet;
     
    218220        int count = 0;
    219221        while(count < 3 && (user_pass = (String) Gatherer.authentications.get(address)) == null) {
    220         Authenticator.requestPasswordAuthentication(proxy_host, null, Integer.parseInt(proxy_port), "http://", Gatherer.dictionary.get("WGet.Prompt"), "HTTP");
     222        Authenticator.requestPasswordAuthentication(proxy_host, null, Integer.parseInt(proxy_port), "http://", Dictionary.newget("WGet.Prompt"), "HTTP");
    221223        count++;
    222224        }
  • trunk/gli/src/org/greenstone/gatherer/collection/LoadCollectionBox.java

    r4675 r5564  
    1 package org.greenstone.gatherer.collection;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.collection;
     38
    3839import java.awt.event.*;
    3940import java.io.*;
    4041import javax.swing.*;
    4142import javax.swing.filechooser.*;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    4345import org.greenstone.gatherer.util.Utility;
    4446import org.outerj.pollo.util.*;
     47
    4548/**
    4649 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    5659    String defaultPath = Utility.getCollectionDir(Gatherer.config.gsdl_path);
    5760    chooser = new JFileChooser(new File(defaultPath));
    58     chooser.setDialogTitle(Gatherer.dictionary.get("SaveCollectionBox.Title"));
    59     ExtensionFileFilter filter1 = new ExtensionFileFilter(".col", Gatherer.dictionary.get("General.File_Description"));
     61    chooser.setDialogTitle(Dictionary.newget("SaveCollectionBox.Title"));
     62    ExtensionFileFilter filter1 = new ExtensionFileFilter(".col", Dictionary.newget("General.File_Description"));
    6063    chooser.setFileFilter(filter1);
    6164    chooser.setAcceptAllFileFilterUsed(false);
  • trunk/gli/src/org/greenstone/gatherer/collection/SaveCollectionBox.java

    r5536 r5564  
    1 package org.greenstone.gatherer.collection;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.collection;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
    4041import javax.swing.*;
     42import org.greenstone.gatherer.Dictionary;
    4143import org.greenstone.gatherer.Gatherer;
     44
    4245/** Provides a prompt allowing the user some choice in whether a collection saves. */
    4346public class SaveCollectionBox
     
    6770    // Dialog setup
    6871    this.setModal(true);
    69     this.setTitle(get("SaveCollectionBox.Title"));
     72    this.setTitle(Dictionary.newget("SaveCollectionBox.Title"));
    7073    this.setSize(360,100);
    7174    }
     
    103106    String args[] = new String[1];
    104107    args[0] = name;
    105     JLabel save_label = new JLabel(get("SaveCollectionBox.Label", args));
     108    JLabel save_label = new JLabel();
     109    Dictionary.setText(save_label, "SaveCollectionBox.Label", args);
    106110    content_pane.add(save_label);
    107111    JPanel button_pane = new JPanel(new GridLayout(1,3));
    108112    content_pane.add(button_pane);
    109113    // We add both mnemonics and key listener so that the 'y' of yes is underlined, but pressing just [Y] (rather than [CTL]-[Y]) performs a systematic click.
    110     yes = new JButton(get("General.Yes"));
     114    yes = new JButton();
    111115    yes.addActionListener(this);
    112116    KeyListenerImpl key_listener = new KeyListenerImpl();
    113117    yes.addKeyListener(key_listener);
    114118    yes.setMnemonic(KeyEvent.VK_Y);
     119    Dictionary.setBoth(yes, "General.Yes", "General.Yes_Tooltip");
    115120    button_pane.add(yes);
    116     no = new JButton(get("General.No"));
     121    no = new JButton();
    117122    no.addActionListener(this);
    118123    no.addKeyListener(key_listener);
    119124    no.setMnemonic(KeyEvent.VK_N);
     125    Dictionary.setBoth(no, "General.No", "General.No_Tooltip");
    120126    button_pane.add(no);
    121     cancel = new JButton(get("General.Cancel"));
     127    cancel = new JButton();
    122128    cancel.addActionListener(this);
    123129    cancel.addKeyListener(key_listener);
    124130    cancel.setMnemonic(KeyEvent.VK_C);
     131    Dictionary.setBoth(cancel, "General.Cancel", "General.Cancel_Tooltip");
    125132    button_pane.add(cancel);
    126133    // Center on screen.
     
    144151    return result;
    145152    }
    146     /** Method to retrieve a phrase from the dictionary based of a key.
    147      * @param key A <strong>String</strong> used to find the correct phrase.
    148      * @return A <strong>String</strong> containing the correct phrase with the correct formatting.
    149      */
    150     private String get(String key) {
    151     return get(key, null);
    152     }
    153     /** Method to retrieve a phrase from the dictionary based of a key and including arguments.
    154      * @param key A <strong>String</strong> used to find the correct phrase.
    155      * @param args A <strong>String[]</strong> of arguments used in formatting and filling out the phrase.
    156      * @return A <strong>String</strong> containing the correct phrase with the correct formatting.
    157      */
    158     private String get(String key, String args[]) {
    159     if(key.indexOf('.') == -1) {
    160         key = "SaveCollectionBox." + key;
    161     }
    162     return Gatherer.dictionary.get(key, args);
    163     }
     153
    164154    /** Listens for key presses when the focus is on one of the buttons. Note that the key pressed needn't be the one associated with the button in focus. */
    165155    private class KeyListenerImpl
  • trunk/gli/src/org/greenstone/gatherer/collection/SaveCollectionTask.java

    r4675 r5564  
    1 package org.greenstone.gatherer.collection;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.collection;
     38
    3839import java.io.*;
    3940import java.util.*;
    4041import javax.swing.*;
    4142import org.greenstone.gatherer.Gatherer;
    42 import org.greenstone.gatherer.Message;
    4343import org.greenstone.gatherer.collection.Collection;
    44 import org.greenstone.gatherer.gui.GUIManager;
    45 import org.greenstone.gatherer.undo.UndoManager;
    4644import org.greenstone.gatherer.util.Utility;
     45
    4746/** The actually saving of a collection must run in a thread other than the AWTEvent thread, or else the save progress box will never get updated. To that end this class provides a threaded save method, which saves the various parts of the collection to the appropriate disk location.
    4847 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    111110    // Create progress monitor box. It will display itself as necessary.
    112111    // WARNING: ProgressMonitors seem to be extremely dodgy, and are not recommended!
    113     // ProgressMonitor spd = new ProgressMonitor(Gatherer.g_man, Gatherer.dictionary.get("SaveProgressDialog.Title", collection.getName()), null, 0, 100);
     112    // ProgressMonitor spd = new ProgressMonitor(Gatherer.g_man, Dictionary.newget("SaveProgressDialog.Title", collection.getName()), null, 0, 100);
    114113    // spd.setMillisToDecideToPopup(100);
    115114    // spd.setMillisToPopup(100);
  • trunk/gli/src/org/greenstone/gatherer/file/FileManager.java

    r4675 r5564  
    1 package org.greenstone.gatherer.file;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.file;
     38
    3839import java.io.File;
    3940import javax.swing.*;
     41import org.greenstone.gatherer.Dictionary;
    4042import org.greenstone.gatherer.Gatherer;
    4143import org.greenstone.gatherer.file.FileNode;
     
    4648import org.greenstone.gatherer.util.DragComponent;
    4749import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
     50
    4851/** Manages the moving of files within a separate thread.
    4952 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    7477        // If the source is the workspace then display an error message. Workspace is read only.
    7578        if(source.toString().equals("Workspace")) {
    76             JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("FileActions.Read_Only"), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     79            JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.Read_Only"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    7780            return;
    7881        }
     
    106109        FileSystemModel model = (FileSystemModel) tree.getModel();
    107110        File folder_file = new File(parent_node.getFile(), name);
    108                 //... check if it already exists.
     111        //... check if it already exists.
    109112        if(folder_file.exists()) {
    110         JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("FileActions.Folder_Already_Exists", name), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     113        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.Folder_Already_Exists", name), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    111114        }
    112                 // Otherwise create it.
     115        // Otherwise create it.
    113116        else {
    114117        folder_file.mkdirs();
  • trunk/gli/src/org/greenstone/gatherer/file/FileNode.java

    r5164 r5564  
    66import javax.swing.filechooser.*;
    77import javax.swing.tree.*;
     8import org.greenstone.gatherer.Dictionary;
    89import org.greenstone.gatherer.Gatherer;
    910import org.greenstone.gatherer.file.FileFilter;
     
    237238        children = new ArrayList();
    238239        // Super Special Case: if the name of this node is the Tree.World string, then we actually map the collections installed in greenstone. The file in this case will actually by the collect directory of greenstone.
    239         if(file == null && title.equals(Gatherer.dictionary.get("Tree.World"))) {
     240        if(file == null && title.equals(Dictionary.newget("Tree.World"))) {
    240241        ///atherer.println("Map the 'Greenstone Collections' node.");
    241242        // For each of the children directories, which are collections...
     
    386387    public void unmap() {
    387388    // You cannot unmap nodes that have no file basis.
    388     if(file != null || title.equals(Gatherer.dictionary.get("Tree.World"))) {
     389    if(file != null || title.equals(Dictionary.newget("Tree.World"))) {
    389390        ///atherer.println("Unmap: " + this);
    390391        children = null;
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r5536 r5564  
    3232import javax.swing.event.*;
    3333import javax.swing.tree.*;
     34import org.greenstone.gatherer.Dictionary;
    3435import org.greenstone.gatherer.Gatherer;
    3536import org.greenstone.gatherer.file.FileJob;
    3637import org.greenstone.gatherer.file.FileNode;
    3738import org.greenstone.gatherer.gui.LongProgressBar;
    38 import org.greenstone.gatherer.gui.SmudgyLabel;
    3939import org.greenstone.gatherer.gui.tree.DragTree;
    4040import org.greenstone.gatherer.msm.GDMManager;
     
    4444import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
    4545import org.greenstone.gatherer.util.Utility;
     46
    4647/** A threaded object which processes a queue of file actions such as copying and movement. It also handles updating the various trees involved so they are an accurate representation of the file system they are meant to match.
    4748 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    6465    private HashMap recycle_folder_mappings = new HashMap();
    6566    /** A label explaining the current moving files status. */
    66     private JLabel file_status = null; // was a SmudgyLabel
    67     /** A label explaining the status of this job. */
    68     //private JLabel job_status = null; // no longer used
     67    private JLabel file_status = null;
    6968    /** A list containing a queue of waiting movement jobs. */
    7069    //private LinkedList queue;
     
    7574    private String previous = null;
    7675    /** Constructor.
    77       * @param return_immediately true to cause this file queue to return from run() as soon as there are no jobs left on the queue.
    78       * @see org.greenstone.gatherer.Configuration
    79       * @see org.greenstone.gatherer.gui.Coloring
    80       * @see org.greenstone.gatherer.gui.LongProgressBar
    81       */
     76     * @param return_immediately true to cause this file queue to return from run() as soon as there are no jobs left on the queue.
     77     * @see org.greenstone.gatherer.Configuration
     78     * @see org.greenstone.gatherer.gui.Coloring
     79     * @see org.greenstone.gatherer.gui.LongProgressBar
     80     */
    8281    public FileQueue(boolean return_immediately) {
    8382    this.return_immediately = return_immediately;
     
    8685    args[0] = "0";
    8786    args[1] = "0";
    88     file_status = new JLabel(get("FileActions.Selected", args)); //new SmudgyLabel(get("Selected", args));
    89     //job_status = new JLabel(get("No_Activity"));
     87    file_status = new JLabel();
     88    Dictionary.setText(file_status, "FileActions.Selected", args);
    9089    progress = new LongProgressBar();
    9190    progress.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    9291    progress.setForeground(Gatherer.config.getColor("coloring.collection_tree_foreground", false));
    93     progress.setString(get("FileActions.No_Activity"));
     92    progress.setString(Dictionary.newget("FileActions.No_Activity"));
    9493    progress.setStringPainted(true);
    9594    args = null;
     
    106105
    107106    /** Add a new job to the queue, specifiying as many arguments as is necessary to complete this type of job (ie delete needs no target information).
    108       * @param id A long id unique to all jobs created by a single action.
    109       * @param source The DragComponent source of this file, most likely a DragTree.
    110       * @param child The FileNode you wish to mode.
    111       * @param target The DragComponent to move the file to, again most likely a DragTree.
    112       * @param parent The files new FileNode parent within the target.
    113       * @param type The type of this movement as an int, either COPY or DELETE.
    114       * @param undo true if this job should generate undo jobs, false for redo ones.
    115       * @param undoable true if this job can generate undo or redo jobs at all, false otherwise.
    116       */
     107     * @param id A long id unique to all jobs created by a single action.
     108     * @param source The DragComponent source of this file, most likely a DragTree.
     109     * @param child The FileNode you wish to mode.
     110     * @param target The DragComponent to move the file to, again most likely a DragTree.
     111     * @param parent The files new FileNode parent within the target.
     112     * @param type The type of this movement as an int, either COPY or DELETE.
     113     * @param undo true if this job should generate undo jobs, false for redo ones.
     114     * @param undoable true if this job can generate undo or redo jobs at all, false otherwise.
     115     */
    117116    public void addJob(long id, DragComponent source, FileNode child, DragComponent target, FileNode parent, byte type, boolean undo, boolean undoable, boolean folder_level) {
    118117    addJob(id, source, child, target, parent, type, undo, undoable, folder_level, -1);
    119118    }
     119
    120120    synchronized public void addJob(long id, DragComponent source, FileNode child, DragComponent target, FileNode parent, byte type, boolean undo, boolean undoable, boolean folder_level, int position) {
    121121    FileJob job = new FileJob(id, source, child, target, parent, type, undo, undoable);
     
    131131    }
    132132
    133     /** Calculates the total deep file size of the selected file nodes.
    134     * @param files a FileNode[] of selected files
    135     * @return true if a cancel was signalled, false otherwise
    136     * @see org.greenstone.gatherer.file.FileManager.Task#run()
    137     */
     133    /** Calculates the total deep file size of the selected file nodes.
     134     * @param files a FileNode[] of selected files
     135     * @return true if a cancel was signalled, false otherwise
     136     * @see org.greenstone.gatherer.file.FileManager.Task#run()
     137     */
    138138    public boolean calculateSize(FileNode[] files) {
    139139    progress.reset();
    140     progress.setString(get("FileActions.Calculating_Size"));
     140    progress.setString(Dictionary.newget("FileActions.Calculating_Size"));
    141141    progress.setIndeterminate(true);
    142142    Vector remaining = new Vector();
     
    155155        }
    156156    }
    157     progress.setString(get("FileActions.No_Activity"));
     157    progress.setString(Dictionary.newget("FileActions.No_Activity"));
    158158    progress.setIndeterminate(false);
    159159    // Now we return if calculation was cancelled so that the FileManagers Task can skip the addJob phase correctly.
    160160    if(cancel_action) {
    161         cancel_action = false; // reset
    162         return true;
     161        cancel_action = false; // reset
     162        return true;
    163163    }
    164164    else {
    165         return false;
     165        return false;
    166166    }
    167167    }
     
    188188    }
    189189    /** The run method exists in every thread, and here it is used to work its way through the queue of Jobs. If no jobs are waiting and it cans, it waits until a job arrives. If a job is present then it is either COPIED or DELETED, with the records being copied or removed as necessary, and directories being recursed through. Finally the user can press cancel to cause the loop to prematurely dump the job queue then wait.
    190       * @see org.greenstone.gatherer.Gatherer
    191       * @see org.greenstone.gatherer.collection.CollectionManager
    192       * @see org.greenstone.gatherer.file.FileJob
    193       * @see org.greenstone.gatherer.file.FileNode
    194       * @see org.greenstone.gatherer.gui.LongProgressBar
    195       * @see org.greenstone.gatherer.msm.MetadataSetManager
    196       * @see org.greenstone.gatherer.undo.UndoManager
    197       * @see org.greenstone.gatherer.util.Utility
    198       */
     190     * @see org.greenstone.gatherer.Gatherer
     191     * @see org.greenstone.gatherer.collection.CollectionManager
     192     * @see org.greenstone.gatherer.file.FileJob
     193     * @see org.greenstone.gatherer.file.FileNode
     194     * @see org.greenstone.gatherer.gui.LongProgressBar
     195     * @see org.greenstone.gatherer.msm.MetadataSetManager
     196     * @see org.greenstone.gatherer.undo.UndoManager
     197     * @see org.greenstone.gatherer.util.Utility
     198     */
    199199    public void run() {
    200200    super.setName("FileQueue");
     
    239239                else {
    240240                ///atherer.println("Opps! This filename already exists. Give the user some options.");
    241                 Object[] options = { get("General.Yes"), get("FileActions.Yes_To_All"), get("General.No"), get("General.Cancel") };
    242                 int result = JOptionPane.showOptionDialog(Gatherer.g_man, get("FileActions.File_Exists", target_file.getName()), get("General.Warning"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
     241                Object[] options = { Dictionary.newget("General.Yes"), Dictionary.newget("FileActions.Yes_To_All"), Dictionary.newget("General.No"), Dictionary.newget("General.Cancel") };
     242                int result = JOptionPane.showOptionDialog(Gatherer.g_man, Dictionary.newget("FileActions.File_Exists", target_file.getName()), Dictionary.newget("General.Warning"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
    243243                switch(result) {
    244244                case 1: // Yes To All
     
    271271                String args[] = new String[1];
    272272                args[0] = "" + (queue.size() + 1) + "";
    273                 //job_status.setText(get("Jobs", args));
    274273                if(job.type == FileJob.COPY) {
    275274                args[0] = Utility.formatPath("FileActions.Copying", source_file.getAbsolutePath(), file_status.getSize().width);
    276                 file_status.setText(get("FileActions.Copying", args));
     275                file_status.setText(Dictionary.newget("FileActions.Copying", args));
    277276                }
    278277                else {
    279278                args[0] = Utility.formatPath("FileActions.Moving", source_file.getAbsolutePath(), file_status.getSize().width);
    280                 file_status.setText(get("FileActions.Moving", args));
     279                file_status.setText(Dictionary.newget("FileActions.Moving", args));
    281280                }
    282281                args = null;
     
    293292                    cancel_action = true;
    294293                    // Show warning.
    295                     JOptionPane.showMessageDialog(Gatherer.g_man, get("FileActions.File_Not_Found_Message", source_file.getName()), get("FileActions.File_Not_Found_Title"), JOptionPane.ERROR_MESSAGE);
     294                    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.File_Not_Found_Message", source_file.getName()), Dictionary.newget("FileActions.File_Not_Found_Title"), JOptionPane.ERROR_MESSAGE);
    296295                    // Force refresh of source folder.
    297296                    source_model.refresh(new TreePath(((FileNode)origin_node.getParent()).getPath()));
     
    301300                    cancel_action = true;
    302301                    // Show warning.
    303                     JOptionPane.showMessageDialog(Gatherer.g_man, get("FileActions.File_Already_Exists_Message", target_file.getName()), get("FileActions.File_Already_Exists_Title"), JOptionPane.ERROR_MESSAGE);
     302                    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.File_Already_Exists_Message", target_file.getName()), Dictionary.newget("FileActions.File_Already_Exists_Title"), JOptionPane.ERROR_MESSAGE);
    304303                    // Nothing else can be done by the Gatherer.
    305304                }
     
    308307                    cancel_action = true;
    309308                    // Show warning. The message body of the expection explains how much more space is required for this file copy.
    310                     JOptionPane.showMessageDialog(Gatherer.g_man, get("FileActions.Insufficient_Space_Message", is_exception.getMessage()), get("FileActions.Insufficient_Space_Title"), JOptionPane.ERROR_MESSAGE);
     309                    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.Insufficient_Space_Message", is_exception.getMessage()), Dictionary.newget("FileActions.Insufficient_Space_Title"), JOptionPane.ERROR_MESSAGE);
    311310                    // Nothing else can be done by the Gatherer. In fact if we are really out of space I'm not even sure we can quit safely.
    312311                }
     
    315314                    cancel_action = true;
    316315                    // Show warning
    317                     JOptionPane.showMessageDialog(Gatherer.g_man, get("FileActions.Unknown_File_Error_Message"), get("FileActions.Unknown_File_Error_Title"), JOptionPane.ERROR_MESSAGE);
     316                    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.Unknown_File_Error_Message"), Dictionary.newget("FileActions.Unknown_File_Error_Title"), JOptionPane.ERROR_MESSAGE);
    318317                    // Nothing else we can do.
    319318                }
     
    322321                    cancel_action = true;
    323322                    // Show warning
    324                     JOptionPane.showMessageDialog(Gatherer.g_man, get("FileActions.Write_Not_Permitted_Message", target_file.getAbsolutePath()), get("FileActions.Write_Not_Permitted_Title"), JOptionPane.ERROR_MESSAGE);
     323                    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.Write_Not_Permitted_Message", target_file.getAbsolutePath()), Dictionary.newget("FileActions.Write_Not_Permitted_Title"), JOptionPane.ERROR_MESSAGE);
    325324                    // Nothing else we can do.
    326325                }
     
    378377                // Else inform the users that a directory already exists and files will be copied into it
    379378                //else {
    380                 //    JOptionPane.showMessageDialog(null, get("Directory_Exists", target_file.toString()), get("General.Warning"), JOptionPane.WARNING_MESSAGE);
     379                //    JOptionPane.showMessageDialog(null, Dictionary.newget("Directory_Exists", target_file.toString()), Dictionary.newget("General.Warning"), JOptionPane.WARNING_MESSAGE);
    381380                //}
    382381                // Queue non-filtered child files for copying. If this directory already existed, the child records will have to generate the undo jobs, as we don't want to entirely delete this directory if it already existed.
     
    401400                cancel_action = true;
    402401                // Show warning.
    403                 JOptionPane.showMessageDialog(Gatherer.g_man, get("FileActions.File_Not_Found_Message", source_file.getName()), get("FileActions.File_Not_Found_Title"), JOptionPane.ERROR_MESSAGE);
     402                JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("FileActions.File_Not_Found_Message", source_file.getName()), Dictionary.newget("FileActions.File_Not_Found_Title"), JOptionPane.ERROR_MESSAGE);
    404403                // Force refresh of source folder.
    405404                source_model.refresh(new TreePath(((FileNode)origin_node.getParent()).getPath()));
     
    457456                String args[] = new String[1];
    458457                args[0] = "" + (queue.size() + 1) + "";
    459                 //job_status.setText(get("Jobs", args));
     458                //job_status.setText(Dictionary.newget("Jobs", args));
    460459                args[0] = Utility.formatPath("FileActions.Deleting", source_file.getAbsolutePath(), file_status.getSize().width);
    461                 file_status.setText(get("FileActions.Deleting", args));
     460                file_status.setText(Dictionary.newget("FileActions.Deleting", args));
    462461                args = null;
    463462
     
    593592            }
    594593            // Reset status area
    595             //job_status.setText(get("No_Selection"));
    596             file_status.setText(get("FileActions.No_Activity"));
     594            //job_status.setText(Dictionary.newget("No_Selection"));
     595            file_status.setText(Dictionary.newget("FileActions.No_Activity"));
    597596            progress.reset();
    598             progress.setString(get("FileActions.No_Activity"));
     597            progress.setString(Dictionary.newget("FileActions.No_Activity"));
    599598            yes_to_all = false;
    600599            completed_folder_mappings.clear();
     
    615614    }
    616615    /** A second lock is necessary to prevent the thread waiting, because its notify occured momentarily before it waited. If the flag is set then the thread can't wait, but loops around. This may chew processor time so should only be used if you are certain files are about to be placed on the queue.
    617       * @param wait_allowed The new state of the wait_allowed flag, as a boolean.
    618       */
     616     * @param wait_allowed The new state of the wait_allowed flag, as a boolean.
     617     */
    619618    public void setWaitAllowed(boolean wait_allowed) {
    620619    this.wait_allowed = wait_allowed;
    621620    }
    622621    /** Restore the progress bar so that it updates normally.
    623       * @see org.greenstone.gatherer.gui.LongProgressBar
    624       */
     622     * @see org.greenstone.gatherer.gui.LongProgressBar
     623     */
    625624    synchronized public void unpause() {
    626625    progress.setIndeterminate(false);
     
    730729    }
    731730    }
    732     /** Retrieve a phrase from the dictionary based on the key.
    733       * @param key The key index as a String.
    734       * @return The desired phrase also as a String.
    735       */
    736     private String get(String key) {
    737     return get(key, (String[])null);
    738     }
    739     /** Retrieve a phrase from the dictionary based on the key, and taking into account the given argument.
    740       * @param key The key index as a String.
    741       * @param args A String which is the argument to be added to the phrase.
    742       * @return The desired phrase also as a String.
    743       */
    744     private String get(String key, String arg) {
    745     String args[] = new String[1];
    746     args[0] = arg;
    747     return get(key, args);
    748     }
    749     /** Retrieve a phrase from the dictionary based on the key, and taking into account the given arguments.
    750       * @param key The key index as a String.
    751       * @param args A String[] of arguments to be added to the phrase.
    752       * @return The desired phrase also as a String.
    753       * @see org.greenstone.gatherer.Dictionary
    754       * @see org.greenstone.gatherer.Gatherer
    755       */
    756     private String get(String key, String args[]) {
    757     if(key.indexOf('.') == -1) {
    758         key = "FileActions." + key;
    759     }
    760     return Gatherer.dictionary.get(key, args);
    761     }
     731
    762732
    763733    private FileJob removeJob(int position) {
  • trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java

    r5300 r5564  
    66import javax.swing.event.*;
    77import javax.swing.tree.*;
     8import org.greenstone.gatherer.Dictionary;
    89import org.greenstone.gatherer.Gatherer;
    910import org.greenstone.gatherer.file.FileFilter;
     
    111112        FileNode node = (FileNode) path.getLastPathComponent();
    112113        // If this error node is a dummy node (ie has no associated file) we can't unmap it, so we iterate through its children refreshing each in turn. The exception being Greenstone Collections, as it is a dummy node but we can map/unmap it
    113         if(node.getFile() == null && !node.toString().equals(Gatherer.dictionary.get("Tree.World"))) {
     114        if(node.getFile() == null && !node.toString().equals(Dictionary.newget("Tree.World"))) {
    114115        for(int i = 0; i < node.getChildCount(); i++) {
    115116            FileNode child = (FileNode) node.getChildAt(i);
  • trunk/gli/src/org/greenstone/gatherer/gui/EditorDialog.java

    r5527 r5564  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
    4041import javax.swing.*;
     42import org.greenstone.gatherer.Dictionary;
    4143import org.greenstone.gatherer.Gatherer;
    4244import org.greenstone.gatherer.gui.SimpleMenuBar;
     
    6062    /** The size of the edit pop-up. */
    6163    final static private Dimension SIZE = new Dimension(400,425);
    62     /** Constructor.*/
     64
     65    /** Constructor */
    6366    public EditorDialog() {
    6467    super(Gatherer.g_man);
    65    
    6668    }
     69
    6770    /** Any implementation of ActionListener must include this method so we can be informed when an action has been performed on one of our target controls. In this case we generate a pop-up window to edit in.
    68       * @param event An <strong>ActionEvent</strong> containing information about the event.
    69       */
     71     * @param event An <strong>ActionEvent</strong> containing information about the event.
     72     */
    7073    public void actionPerformed(ActionEvent event) {
    71     if(event.getSource() == ok) {
     74    if (event.getSource() == ok) {
    7275        result = text.getText();
    7376    }
    7477    dispose();
    7578    }
     79
    7680    /** Method to display the editing box on screen.
    77       * @param value The initial text to be displayed in the editing area, as a <strong>String</strong>.
    78       * @return The new value for the metadata value as a <strong>String</strong> or <i>null</i> if the user has pressed cancel.
    79       */
     81     * @param value The initial text to be displayed in the editing area, as a <strong>String</strong>.
     82     * @return The new value for the metadata value as a <strong>String</strong> or <i>null</i> if the user has pressed cancel.
     83     */
    8084    public String display(String value) {
    8185    setModal(true);
    8286    setSize(SIZE);
    83     setTitle(Gatherer.dictionary.get("General.Edit"));
    8487    setJMenuBar(new SimpleMenuBar("theenrichview"));
     88    Dictionary.setText(this, "General.Edit");
     89
    8590    // Create
    86     cancel = new JButton(Gatherer.dictionary.get("General.Cancel"));
    87     ok = new JButton(Gatherer.dictionary.get("General.OK"));
    8891    text = new JTextArea(value);
    8992    text.setCaretPosition(value.length());
     
    9194    text.setLineWrap(true);
    9295    text.setWrapStyleWord(true);
     96    Dictionary.setTooltip(text, "MetaEdit.Value_Field_Tooltip");
     97
     98    cancel = new JButton();
     99    cancel.setMnemonic(KeyEvent.VK_C);
     100    Dictionary.setBoth(cancel, "General.Cancel", "General.Pure_Cancel_Tooltip");
     101    ok = new JButton();
     102    ok.setMnemonic(KeyEvent.VK_0);
     103    Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip");
     104
    93105    // Listeners
    94106    cancel.addActionListener(this);
    95107    ok.addActionListener(this);
     108
    96109    // Layout
    97110    JPanel button_pane = new JPanel();
  • trunk/gli/src/org/greenstone/gatherer/gui/Filter.java

    r5527 r5564  
    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.tree.*;
     45import org.greenstone.gatherer.Dictionary;
    4446import org.greenstone.gatherer.Gatherer;
    4547import org.greenstone.gatherer.file.FileSystemModel;
    4648import org.greenstone.gatherer.gui.tree.DragTree;
     49
    4750/** <p>This object allows the user to set a filter on one of the workspace trees, specifying a preset type, or a regular expression that a files must match to be in the tree. Note that all directories are included. This class includes the controls for editing the filter. The trick is that several instances of the Filter class can share the same internal data (termed a 'run' of filters), so that the filter set on the CollectionPane and the MetaEditPane are virtually the same.</p>
    48  * <p>The regular expression typed can uses '*' as a wildcard character (equivelent to '.*'), and does not use '.' to match any single character (use '?' instead).</p>
     51 * <p>The regular expression typed uses '*' as a wildcard character (equivalent to '.*'), and does not use '.' to match any single character (use '?' instead).</p>
    4952 * @author John Thompson, Greenstone Digital Library, University of Waikato
    5053 * @version 2.3
     
    7275    /** Preprogrammed default filters. */
    7376    static final private String DEFAULTS[] = {"^.*\\.html?$", "^.*\\.xml$", "^.*\\.txt$", "(^.*\\.jpe?g$)|(^.*\\.png$)|(^.\\.gif$)|(^.\\.bmp$)|(^.\\.tif$)"};
     77
    7478    /** Constructor.
    7579     * @param tree A reference to the <strong>JTree</strong> being affected.
     
    7882    this(tree, null);
    7983    }
     84
    8085    /** Constructor.
    8186     * @param tree A reference to the <strong>JTree</strong> being affected.
     
    8489    public Filter(DragTree tree, ArrayList others) {
    8590    super();
    86     if(others == null) {
    87         this.others = new ArrayList();
    88     }
    89     else {
    90         this.others = others;
    91     }
     91    if (others == null) {
     92        others = new ArrayList();
     93    }
     94    this.others = others;
    9295    this.others.add(this);
    9396    this.this_filter = this;
     
    98101    for(int i = 0; i < DEFAULTS.length; i++) {
    99102        try {
    100         Entry entry = new Entry(get((new Integer(i)).toString(), null), Pattern.compile(DEFAULTS[i]));
     103        Entry entry = new Entry(Dictionary.newget("Filter." + i), Pattern.compile(DEFAULTS[i]));
    101104        combobox.add(entry);
    102105        }
     
    106109    }
    107110    combobox.setEditable(true);
    108     label = new JLabel(get("Filter.Filter_Tree"));
     111    label = new JLabel();
    109112    label.setPreferredSize(SIZE);
     113    Dictionary.setText(label, "Filter.Filter_Tree");
    110114    // Add listeners.
    111115    combobox.addActionListener(new ComboBoxListener());
     
    141145    ignore = false;
    142146    }
     147
    143148    /** Set the combobox model for this filter.
    144149     * @param model The new <strong>ComboBoxModel</strong> to use.
     
    147152    combobox.setModel(model);
    148153    }
     154
    149155    /** Ensure that a certain entry is selected from the combobox.
    150156     * @param selection The <strong>Entry</strong> that should be selected.
     
    155161    ignore = false;
    156162    }
     163
    157164    /** Set to signify that this filter is the first in a new run of filters.
    158165     * @param first <i>true</i> if this is the first filter in a run, <i>false</i> if it will just be added to the current run.
     
    161168    this.first = first;
    162169    }
    163     /** Spawn produces a copy of this filter, which has new controls, but shares listeners wih this filter, and vice versa. Thus we can have two synchronized, but differing sets of controls.
     170
     171    /** Spawn produces a copy of this filter, which has new controls, but shares listeners with this filter, and vice versa. Thus we can have two synchronized, but differing sets of controls.
    164172     * @param tree_spawn The <strong>JTree</strong> this filter will affect.
    165173     * @return A new <strong>Filter</strong> which is in the same run as this filter.
     
    172180    return filter;
    173181    }
    174     /** Retrieve a phrase from the dictionary.
    175      * @param key The unique identification <strong>String</strong> of a phrase from the dictionary.
    176      */
    177     private String get(String key) {
    178     return get(key, null);
    179     }
    180     /** Retrieve a phrase from the dictionary, augmenting with the given text fragments
    181      * @param key The unique identification <strong>String</strong> of a phrase from the dictionary.
    182      * @param args A <strong>String[]</strong> of arguments to be used to fill out parameter fields in the phrase returned.
    183      * @see org.greenstone.gatherer.Dictionary
    184      * @see org.greenstone.gatherer.Gatherer
    185      */
    186     private String get(String key, String args[]) {
    187     if(key.indexOf(".") == -1) {
    188         key = "Filter." + key;
    189     }
    190     return Gatherer.dictionary.get(key, args);
    191     }
     182
    192183    /** Encode an expression in pseudo-regular expression into regular expression.
    193184     * @param raw The pseudo-regular expression <strong>String</strong> which includes several characters which differ in meaning from regular expression queries.
     
    231222    Gatherer.g_man.wait(false);
    232223    }
     224
    233225    /** Listens for changes in the combobox as when one is detected attempts to compile a regular expression from whatever text was entered. If successful, or if the item chosen was a predefined filter, it then applies the filter to the target tree. */
    234226    private class ComboBoxListener
     
    246238            ///ystem.err.println("Filter = " + temp_str);
    247239            // Ignore any string which matches a predefined filter, starting with All Files.
    248             if(temp_str.equals(get("Filter.All_Files"))) {
     240            if(temp_str.equals(Dictionary.newget("Filter.All_Files"))) {
    249241            }
    250242            // HTM & HTML
    251             else if(temp_str.equals(get("Filter.0"))) {
     243            else if(temp_str.equals(Dictionary.newget("Filter.0"))) {
    252244            }
    253245            // XML
    254             else if(temp_str.equals(get("Filter.1"))) {
     246            else if(temp_str.equals(Dictionary.newget("Filter.1"))) {
    255247            }
    256248            // Text files
    257             else if(temp_str.equals(get("Filter.2"))) {
     249            else if(temp_str.equals(Dictionary.newget("Filter.2"))) {
    258250            }
    259251            // Images
    260             else if(temp_str.equals(get("Filter.3"))) {
     252            else if(temp_str.equals(Dictionary.newget("Filter.3"))) {
    261253            }
    262254            else {
     
    281273        catch (PatternSyntaxException error) {
    282274        if(first) {
    283             JOptionPane.showMessageDialog(Gatherer.g_man, get("Filter.Invalid_Pattern"), get("General.Error"), JOptionPane.ERROR_MESSAGE);
     275            JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("Filter.Invalid_Pattern"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    284276        }
    285277        }
     
    322314    public String toString() {
    323315        String result = null;
    324         if(name != null) {
     316        if (name != null) {
    325317        result = name;
    326318        }
    327         else if(pattern == null) {
    328         result = get("Filter.All_Files");
     319        else if (pattern == null) {
     320        result = Dictionary.newget("Filter.All_Files");
    329321        }
    330322        else {
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r5536 r5564  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.datatransfer.*;
     
    6667import org.greenstone.gatherer.gui.MirrorPane;
    6768import org.greenstone.gatherer.gui.OpenCollectionDialog;
    68 import org.greenstone.gatherer.gui.OptionsBox;
    6969import org.greenstone.gatherer.gui.Preferences;
    7070import org.greenstone.gatherer.gui.PreviewPane;
     
    7676import org.greenstone.gatherer.msm.ElementWrapper;
    7777import org.greenstone.gatherer.msm.Metadata;
    78 // import org.greenstone.gatherer.sarm.SearchAndReplace;
    7978import org.greenstone.gatherer.shell.GShell;
    8079import org.greenstone.gatherer.util.TreeSynchronizer;
    8180import org.greenstone.gatherer.util.Utility;
    82 import org.greenstone.gatherer.valuetree.GValueNode;
     81
    8382/** The GUIManager is in charge of creating the Gatherer window frame then filling it with the goodness of the view panes. GUIManager not only creates these panes, but allows some messaging between them. Furthermore GUIManager includes functionality from menu driven choices, simply as it was easier to put it here once and have it accessible from all pane children. */
    8483public class GUIManager
     
    154153    thread_group = bob.getThreadGroup();
    155154    // Set up some other UI stuff. (fonts handled in Gatherer.main())
    156     UIManager.put("FileChooser.lookInLabelText", Gatherer.dictionary.get("SaveCollectionBox.Look_In"));
    157     UIManager.put("FileChooser.filesOfTypeLabelText", Gatherer.dictionary.get("SaveCollectionBox.Files_Of_Type"));
    158     UIManager.put("FileChooser.fileNameLabelText", Gatherer.dictionary.get("SaveCollectionBox.File_Name"));
     155    UIManager.put("FileChooser.lookInLabelText", Dictionary.newget("SaveCollectionBox.Look_In"));
     156    UIManager.put("FileChooser.filesOfTypeLabelText", Dictionary.newget("SaveCollectionBox.Files_Of_Type"));
     157    UIManager.put("FileChooser.fileNameLabelText", Dictionary.newget("SaveCollectionBox.File_Name"));
    159158    }
    160159    /** Any implementation of <i>ActionListener</i> must include this method so that we can be informed when an action has occured. In this case we are listening to actions from the menu-bar, and should react appropriately.
     
    264263//          sar = new SearchAndReplace(true);
    265264//      }
     265
    266266    // *************
    267267    // Tools Options.
    268268    // *************
    269     else if(esrc == menu_bar.tools_size) {
    270         FileNode records[] = metaedit_pane.getSelectedNode();
    271         if(records != null && records.length > 0) {
    272         ArrayList metadatum = Gatherer.c_man.getCollection().gdm.getMetadata(records[0].getFile());
    273         if(metadatum.size() >= 4) {
    274             Metadata metadata = (Metadata) metadatum.get(0);
    275             ElementWrapper ew = metadata.getElement();
    276 
    277             int SIZE = 5000;
    278             Object[] array = new Object[SIZE];
    279             Runtime.getRuntime().gc();
    280             long start = Runtime.getRuntime().freeMemory();
    281             for (int i = 0; i < SIZE; i++) {
    282             array[i] = ew.copy();
    283             }
    284             Runtime.getRuntime().gc();
    285             long end = Runtime.getRuntime().freeMemory();
    286             long difference = (( start -  end ) / SIZE);
    287             ///ystem.out.println(difference + " bytes used." );
    288         }
    289         }
    290     }
     269//      else if(esrc == menu_bar.tools_size) {
     270//          FileNode records[] = metaedit_pane.getSelectedNode();
     271//          if(records != null && records.length > 0) {
     272//          ArrayList metadatum = Gatherer.c_man.getCollection().gdm.getMetadata(records[0].getFile());
     273//          if(metadatum.size() >= 4) {
     274//              Metadata metadata = (Metadata) metadatum.get(0);
     275//              ElementWrapper ew = metadata.getElement();
     276
     277//              int SIZE = 5000;
     278//              Object[] array = new Object[SIZE];
     279//              Runtime.getRuntime().gc();
     280//              long start = Runtime.getRuntime().freeMemory();
     281//              for (int i = 0; i < SIZE; i++) {
     282//              array[i] = ew.copy();
     283//              }
     284//              Runtime.getRuntime().gc();
     285//              long end = Runtime.getRuntime().freeMemory();
     286//              long difference = (( start -  end ) / SIZE);
     287//              ///ystem.out.println(difference + " bytes used." );
     288//          }
     289//          }
     290//      }
     291
    291292    // *************
    292293    // Help Options.
     
    322323    // Metadata Options.
    323324    // *****************
    324     else if(esrc == menu_bar.metadata_add) {
     325    else if(esrc == menu_bar.metadata_import) {
    325326        Gatherer.c_man.getCollection().msm.importMDS();
    326327    }
     
    339340    }
    340341    /** 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.
    341       */
     342     */
    342343    public void afterDisplay() {
    343344    if(Gatherer.config.get("workflow.mirror", true)) {
     
    347348    }
    348349    /** Once a collection has been made available to Gatherer, either by its creation or by it being reloaded, we need to inform all the visual components to update necessary data components (such as tree models), enable certain controls that depend on a collection being accessible, and refresh themselves.
    349       * @param ready <i>true</i> if the collection is ready for editing, <i>false</i> otherwise.
    350       */
     350     * @param ready <i>true</i> if the collection is ready for editing, <i>false</i> otherwise.
     351     */
    351352    public void collectionChanged(final boolean ready) {
    352353    if(Gatherer.config.get("workflow.mirror", true)) {
     
    372373    }
    373374    // Finally display the collection name in the title bar.
    374     if(ready) {
     375    if (ready) {
    375376        this.setTitle(Utility.PROGRAM_NAME + ":\"" + Gatherer.c_man.getCollection().getTitle() + "\"");
    376377    }
    377378    else {
    378         this.setTitle(Utility.PROGRAM_NAME + ": " + get("Collection.No_Collection"));
     379        this.setTitle(Utility.PROGRAM_NAME + ": " + Dictionary.newget("Collection.No_Collection"));
    379380    }
    380381    // Now is a good time to force a garbage collect.
     
    396397        }
    397398        else {
    398         this.setTitle(Utility.PROGRAM_NAME + ": " + get("Collection.No_Collection"));
     399        this.setTitle(Utility.PROGRAM_NAME + ": " + Dictionary.newget("Collection.No_Collection"));
    399400        }
    400401        // Pretty corner icon
     
    487488    }
    488489    /** When called this method ensures that all the things needing saving are saved before Gatherer.exit() is called. This includes a save collection prompt if necessary.
    489       */
     490     */
    490491    public void exit() {
    491492    boolean cont = true;
     
    546547    public void setTabEnabled(String rawname, boolean state) {
    547548    // Retrieve the dictionary based name.
    548     String name = get(rawname);
     549    String name = Dictionary.newget("GUI." + rawname);
    549550    int index = tab_pane.indexOfTab(name);
    550551    // Of course we may not have this tab available.
     
    720721    }
    721722
    722     /** This method is used to open the options box on the screen.
    723      */
    724     public void showOptionsBox() {
    725     new OptionsBox();
    726     }
     723
    727724    /** This method is used to open the save collection box/prompt on the screen.
    728725     * @return A <i>boolean</i> which is <i>true</i> if the collection was saved successfully, <i>false</i> otherwise.
     
    827824    }
    828825
    829     /** Retrieves a phrase from the Dictionary based on the key.
    830      * @param key A <strong>String</strong> uniquely identifying a phrase from the Dictionary.
    831      * @return The desired phrase as a <strong>String</strong>.
    832      * @see org.greenstone.gatherer.Dictionary
    833      */
    834     private String get(String key) {
    835     return get(key, null);
    836     }
    837     /** Retrieves a phrase from the Dictionary based on the key and including the arguments.
    838      * @param key A <strong>String</strong> uniquely identifying a phrase from the Dictionary.
    839      * @param args A <strong>String[]</strong> of arguments available to be inserted into the phrase.
    840      * @return The desired phrase as a <strong>String</strong>.
    841      * @see org.greenstone.gatherer.Dictionary
    842      */
    843     private String get(String key, String args[]) {
    844     if(key.indexOf('.') == -1) {
    845         key = "GUI." + key;
    846     }
    847     return Gatherer.dictionary.get(key, args);
    848     }
    849826    /** Called to determine if we should wait for a thread to finish before continuing. We wait for threads if they are named: GSHELL_BUILD, GSHELL_IMPORT, or GSHELL_NEW.
    850       * @return <i>true</i> if we should wait for a thread, <i>false</i> if it is safe to continue.
    851       */
     827     * @return <i>true</i> if we should wait for a thread, <i>false</i> if it is safe to continue.
     828     */
    852829    private boolean waitForThread() {
    853830    Thread active[] = new Thread[thread_group.activeCount()];
  • trunk/gli/src/org/greenstone/gatherer/gui/LockFileDialog.java

    r5536 r5564  
    77import org.greenstone.gatherer.Dictionary;
    88import org.greenstone.gatherer.Gatherer;
     9import org.greenstone.gatherer.gui.SimpleMenuBar;
     10import org.greenstone.gatherer.gui.ModalDialog;
    911import org.greenstone.gatherer.msm.MSMUtils;
    1012import org.greenstone.gatherer.util.Utility;
    11 import org.greenstone.gatherer.gui.SimpleMenuBar;
    12 import org.greenstone.gatherer.gui.ModalDialog;
    1313import org.w3c.dom.*;
    1414
     
    3131
    3232    public LockFileDialog(JFrame parent, String name, File lock_file) {
    33     super(parent, get("LockFileDialog.Title"), true);
     33    super(parent, Dictionary.newget("LockFileDialog.Title"), true);
    3434    setSize(SIZE);
    3535    setJMenuBar(new SimpleMenuBar("openingacollection"));
    3636    this.self = this;
     37
    3738    // Parse the lock file, but do so quietly so that if the XML is poorly formed it doesn't show exception.
    3839    document = Utility.parse(lock_file, false);
     40
    3941    // Creation
    4042    JPanel content_pane = (JPanel) getContentPane();
     
    4446    JLabel icon_label = new JLabel(scaled_icon);
    4547    JPanel title_pane = new JPanel();
    46     JLabel title_one_label = new JLabel(get("General.Warning"));
    47     JLabel title_two_label = new JLabel(get("LockFileDialog.Lockfile_Message_One"));
     48    JLabel title_one_label = new JLabel();
     49    Dictionary.setText(title_one_label, "General.Warning");
     50    JLabel title_two_label = new JLabel();
     51    Dictionary.setText(title_two_label, "LockFileDialog.Lockfile_Message_One");
    4852    JPanel central_pane = new JPanel();
     53
    4954    JPanel name_pane = new JPanel();
    50     JLabel name_label = new JLabel(get("LockFileDialog.Name"));
     55    JLabel name_label = new JLabel();
    5156    name_label.setPreferredSize(LABEL_SIZE);
     57    Dictionary.setText(name_label, "LockFileDialog.Name");
    5258    JTextField name_field = new JTextField(name);
    5359    name_field.setEditable(false);
    5460    name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
     61
    5562    JPanel person_pane = new JPanel();
    56     JLabel person_label = new JLabel(get("LockFileDialog.User"));
     63    JLabel person_label = new JLabel();
    5764    person_label.setPreferredSize(LABEL_SIZE);
     65    Dictionary.setText(person_label, "LockFileDialog.User");
    5866    JTextField person_field = new JTextField(getValue("User"));
    5967    person_field.setEditable(false);
    6068    person_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
     69
    6170    JPanel machine_pane = new JPanel();
    62     JLabel machine_label = new JLabel(get("LockFileDialog.Machine"));
     71    JLabel machine_label = new JLabel();
    6372    machine_label.setPreferredSize(LABEL_SIZE);
     73    Dictionary.setText(machine_label, "LockFileDialog.Machine");
    6474    JTextField machine_field = new JTextField(getValue("Machine"));
    6575    machine_field.setEditable(false);
    6676    machine_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
     77
    6778    JPanel created_pane = new JPanel();
    68     JLabel created_label = new JLabel(get("LockFileDialog.Date"));
     79    JLabel created_label = new JLabel();
    6980    created_label.setPreferredSize(LABEL_SIZE);
     81    Dictionary.setText(created_label, "LockFileDialog.Date");
    7082    JTextField created_field = new JTextField(getValue("Date"));
    7183    created_field.setEditable(false);
    7284    created_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    73     JLabel central_label = new JLabel(get("LockFileDialog.Lockfile_Message_Two"));
     85
     86    JLabel central_label = new JLabel();
     87    Dictionary.setText(central_label, "LockFileDialog.Lockfile_Message_Two");
    7488    JPanel button_pane = new JPanel();
    75     ok_button = new JButton(get("General.OK"));
    76     cancel_button = new JButton(get("General.Cancel"));
     89    ok_button = new JButton();
     90    Dictionary.setBoth(ok_button, "General.OK", "LockFileDialog.OK_Tooltip");
     91    cancel_button = new JButton();
     92    Dictionary.setBoth(cancel_button, "General.Cancel", "LockFileDialog.Cancel_Tooltip");
     93
    7794    // Connection
    7895    ok_button.addActionListener(new MyActionListener());
    7996    cancel_button.addActionListener(new MyActionListener());
     97
    8098    // Layout
    8199    icon_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,10));
     
    121139    content_pane.add(central_pane, BorderLayout.CENTER);
    122140    content_pane.add(button_pane, BorderLayout.SOUTH);
     141
    123142    // Display
    124     if(parent != null) {
     143    if (parent != null) {
    125144        Rectangle frame_bounds = parent.getBounds();
    126145        setLocation(frame_bounds.x + (frame_bounds.width - SIZE.width) / 2, frame_bounds.y + (frame_bounds.height - SIZE.height) / 2);
     
    148167    }
    149168    else {
    150         value = get("LockFileDialog.Error");
     169        value = Dictionary.newget("LockFileDialog.Error");
    151170    }
    152171    return value;
     
    165184    }
    166185    }
    167 
    168     static public void main(String[] args) {
    169     JFrame frame = new JFrame();
    170     frame.setSize(640,480);
    171     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    172     frame.show();
    173     LockFileDialog dialog = new LockFileDialog(frame, "Test", new File(args[0]));
    174     int choice = dialog.getChoice();
    175     }
    176 
    177     static private String get(String key) {
    178     if(key.indexOf(".") == -1) {
    179         key = "LockFileDialog." + key;
    180     }
    181     return Gatherer.dictionary.get(key);
    182     }
    183186}
  • trunk/gli/src/org/greenstone/gatherer/gui/MenuBar.java

    r5527 r5564  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
    4041import javax.swing.*;
    4142import javax.swing.event.*;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    4345import org.greenstone.gatherer.util.Utility;
     46
    4447/** The menu bar for the Gatherer main GUI.
    4548 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    5053    /** The icon to be displayed alongside the context choosen help file. */
    5154    private int current_tab          = -1;
     55
    5256    private JMenu file               = null;
    5357    private JMenu edit               = null;
    5458    private JMenu metadata           = null;
    5559    private JMenu tools              = null;
    56     private JMenu log                = null;
    57     private JMenu window             = null;
    58     private JMenu source             = null;
    59     private JMenu level              = null;
    6060    public JMenu help                = null;
    6161    public JMenuItem file_associations;
     
    7575    public JMenuItem edit_replace = null;
    7676    public JMenuItem edit_search = null;
    77     public JMenuItem metadata_add    = null;
     77    public JMenuItem metadata_import = null;
    7878    public JMenuItem metadata_edit   = null;
    7979    public JMenuItem metadata_export = null;
     
    9292    public MagicMenuItem metadata_view   = null;
    9393
    94     public MenuBar(MenuListener menu_listener) {
    95 
    96     file = new JMenu(get("Menu.File"));
     94    public MenuBar(MenuListener menu_listener)
     95    {
     96    file = new JMenu();
    9797    file.setMnemonic(KeyEvent.VK_F);
    98     this.add(file);
    99 
    100     file_associations = new JMenuItem(get("Menu.File_Associations"), KeyEvent.VK_A);
     98    Dictionary.registerText(file, "Menu.File");
     99
     100    file_associations = new JMenuItem();
    101101    file_associations.addActionListener(Gatherer.g_man);     
    102 
    103     file_close = new JMenuItem(get("Menu.File_Close"), KeyEvent.VK_C);
     102    file_associations.setMnemonic(KeyEvent.VK_A);
     103    Dictionary.registerText(file_associations, "Menu.File_Associations");
     104
     105    file_close = new JMenuItem();
    104106    file_close.addActionListener(Gatherer.g_man);
    105107    file_close.setEnabled(false);
    106 
    107     file_delete = new JMenuItem(get("Menu.File_Delete"), KeyEvent.VK_D);
     108    file_close.setMnemonic(KeyEvent.VK_C);
     109    Dictionary.registerText(file_close, "Menu.File_Close");
     110
     111    file_delete = new JMenuItem();
    108112    file_delete.addActionListener(Gatherer.g_man);
    109 
    110     file_exit = new JMenuItem(get("Menu.File_Exit"), KeyEvent.VK_X);
     113    file_delete.setMnemonic(KeyEvent.VK_D);
     114    Dictionary.registerText(file_delete, "Menu.File_Delete");
     115
     116    file_exit = new JMenuItem();
    111117    file_exit.addActionListener(Gatherer.g_man);
    112 
    113     file_new = new JMenuItem(get("Menu.File_New"), KeyEvent.VK_N);
     118    file_exit.setMnemonic(KeyEvent.VK_X);
     119    Dictionary.registerText(file_exit, "Menu.File_Exit");
     120
     121    file_new = new JMenuItem();
    114122    file_new.addActionListener(Gatherer.g_man);
    115 
    116     file_open = new JMenuItem(get("Menu.File_Open"), KeyEvent.VK_O);
     123    file_new.setMnemonic(KeyEvent.VK_N);
     124    Dictionary.registerText(file_new, "Menu.File_New");
     125
     126    file_open = new JMenuItem();
    117127    file_open.addActionListener(Gatherer.g_man);
    118 
    119     file_options = new JMenuItem(get("Menu.File_Options"), KeyEvent.VK_P);
    120     file_options.addActionListener(Gatherer.g_man);   
    121 
    122     file_save = new JMenuItem(get("Menu.File_Save"), KeyEvent.VK_S);
     128    file_open.setMnemonic(KeyEvent.VK_O);
     129    Dictionary.registerText(file_open, "Menu.File_Open");
     130
     131    file_options = new JMenuItem();
     132    file_options.addActionListener(Gatherer.g_man);
     133    file_options.setMnemonic(KeyEvent.VK_P);
     134    Dictionary.registerText(file_options, "Menu.File_Options");
     135
     136    file_save = new JMenuItem();
    123137    file_save.addActionListener(Gatherer.g_man);
    124138    file_save.setEnabled(false);
    125 
    126     file_save_as = new JMenuItem(get("Menu.File_Save_As"), KeyEvent.VK_A);
    127     //file_save_as.addActionListener(Gatherer.g_man);
    128     file_save_as.setEnabled(false);       
    129 
    130     // Layout file menu
     139    file_save.setMnemonic(KeyEvent.VK_S);
     140    Dictionary.registerText(file_save, "Menu.File_Save");
     141
     142    // file_save_as = new JMenuItem();
     143    // file_save_as.addActionListener(Gatherer.g_man);
     144    // file_save_as.setEnabled(false);
     145    // file_save_as.setMnemonic(KeyEvent.VK_A);
     146    // Dictionary.registerText(file_save_as, "Menu.File_Save_As");
     147
     148    // Layout (file menu)
    131149    file.add(file_new);
    132150    file.add(file_open);
    133151    file.add(file_save);
    134     //file.add(file_save_as);
     152    // file.add(file_save_as);
    135153    file.add(file_close);
    136     //file.add(new JSeparator());
    137154    file.add(file_delete);
    138155    file.add(new JSeparator());
     
    143160
    144161    // Edit menu
    145     edit = new JMenu(get("Menu.Edit"));
     162    edit = new JMenu();
    146163    edit.setMnemonic(KeyEvent.VK_E);
    147     this.add(Box.createHorizontalStrut(15));
    148     this.add(edit);
     164    Dictionary.registerText(edit, "Menu.Edit");
    149165         
    150     edit_cut = new JMenuItem(get("Menu.Edit_Cut") + " (ctrl-x)", KeyEvent.VK_X);
     166    edit_cut = new JMenuItem();
    151167    edit_cut.addActionListener(Gatherer.g_man);
    152 
    153     edit_copy = new JMenuItem(get("Menu.Edit_Copy") + " (ctrl-c)", KeyEvent.VK_C);
     168    edit_cut.setMnemonic(KeyEvent.VK_X);
     169    Dictionary.registerText(edit_cut, "Menu.Edit_Cut");
     170
     171    edit_copy = new JMenuItem();
    154172    edit_copy.addActionListener(Gatherer.g_man);
    155 
    156     edit_paste = new JMenuItem(get("Menu.Edit_Paste") + " (ctrl-v)", KeyEvent.VK_V);
     173    edit_copy.setMnemonic(KeyEvent.VK_C);
     174    Dictionary.registerText(edit_copy, "Menu.Edit_Copy");
     175
     176    edit_paste = new JMenuItem();
    157177    edit_paste.addActionListener(Gatherer.g_man);
    158 
    159     edit_undo = new JMenuItem(get("Menu.Edit_Undo"), KeyEvent.VK_U);
    160     edit_undo.setEnabled(false);
    161 
    162     edit_redo = new JMenuItem(get("Menu.Edit_Redo"), KeyEvent.VK_D);
    163     edit_redo.setEnabled(false);
    164 
    165     edit_search = new JMenuItem(get("Menu.Edit_Search"), KeyEvent.VK_S);
    166     edit_search.addActionListener(Gatherer.g_man);
    167 
    168     edit_replace = new JMenuItem(get("Menu.Edit_Replace"), KeyEvent.VK_R);
    169     edit_replace.addActionListener(Gatherer.g_man);
    170 
     178    edit_paste.setMnemonic(KeyEvent.VK_V);
     179    Dictionary.registerText(edit_paste, "Menu.Edit_Paste");
     180
     181    // edit_undo = new JMenuItem();
     182    // edit_undo.setEnabled(false);
     183    // edit_undo.setMnemonic(KeyEvent.VK_U);
     184    // Dictionary.registerText(edit_undo, "Menu.Edit_Undo");
     185
     186    // edit_redo = new JMenuItem();
     187    // edit_redo.setEnabled(false);
     188    // edit_redo.setMnemonic(KeyEvent.VK_D);
     189    // Dictionary.registerText(edit_redo, "Menu.Edit_Redo");
     190
     191    // edit_search = new JMenuItem();
     192    // edit_search.addActionListener(Gatherer.g_man);
     193    // edit_search.setMnemonic(KeyEvent.VK_S);
     194    // Dictionary.registerText(edit_search, "Menu.Edit_Search");
     195
     196    // edit_replace = new JMenuItem();
     197    // edit_replace.addActionListener(Gatherer.g_man);
     198    // edit_replace.setMnemonic(KeyEvent.VK_R);
     199    // Dictionary.registerText(edit_replace, "Menu.Edit_Replace");
     200
     201    // Layout (edit menu)
    171202    edit.add(edit_cut);
    172203    edit.add(edit_copy);
    173204    edit.add(edit_paste);
    174     //edit.add(new JSeparator());
    175     //edit.add(edit_undo);
    176     //edit.add(edit_redo);
    177     //edit.add(new JSeparator());
    178     //edit.add(edit_search);
    179     //edit.add(edit_replace);
     205    // edit.add(new JSeparator());
     206    // edit.add(edit_undo);
     207    // edit.add(edit_redo);
     208    // edit.add(new JSeparator());
     209    // edit.add(edit_search);
     210    // edit.add(edit_replace);
    180211
    181212    // Metadata menu
    182     metadata = new JMenu(get("Menu.Metadata"));
     213    metadata = new JMenu();
    183214    metadata.setEnabled(false);
    184215    metadata.setMnemonic(KeyEvent.VK_M);
    185 
    186     metadata_add = new JMenuItem(get("Menu.Metadata_Add"), KeyEvent.VK_I);
    187     metadata_add.addActionListener(Gatherer.g_man);
    188 
    189     metadata_edit = new JMenuItem(get("Menu.Metadata_Edit"), KeyEvent.VK_E);
     216    Dictionary.registerText(metadata, "Menu.Metadata");
     217
     218    metadata_import = new JMenuItem();
     219    metadata_import.addActionListener(Gatherer.g_man);
     220    metadata_import.setMnemonic(KeyEvent.VK_I);
     221    Dictionary.registerText(metadata_import, "Menu.Metadata_Import");
     222
     223    metadata_edit = new JMenuItem();
    190224    metadata_edit.addActionListener(Gatherer.g_man);
    191 
    192     metadata_export = new JMenuItem(get("Menu.Metadata_Export"), KeyEvent.VK_X);
     225    metadata_edit.setMnemonic(KeyEvent.VK_E);
     226    Dictionary.registerText(metadata_edit, "Menu.Metadata_Edit");
     227
     228    metadata_export = new JMenuItem();
    193229    metadata_export.addActionListener(Gatherer.g_man);
    194 
    195     metadata_view = new MagicMenuItem(get("Menu.Metadata_View") + " " + get("FileActions.No_Selection"), KeyEvent.VK_A);
     230    metadata_export.setMnemonic(KeyEvent.VK_X);
     231    Dictionary.registerText(metadata_export, "Menu.Metadata_Export");
     232
     233    metadata_view = new MagicMenuItem(Dictionary.newget("Menu.Metadata_View") + " " + Dictionary.newget("FileActions.No_Selection"), KeyEvent.VK_A);
    196234    metadata_view.addActionListener(Gatherer.g_man);   
    197235
    198     metadata.add(metadata_add);
     236    // Layout (metadata sets menu)
     237    metadata.add(metadata_import);
    199238    metadata.add(metadata_edit);
    200239    metadata.add(metadata_export);
    201240    metadata.add(metadata_view);
     241
     242    // Tools menu
     243    // tools = new JMenu();
     244    // tools.setEnabled(false);
     245    // tools.setMnemonic(KeyEvent.VK_T);
     246    // Dictionary.registerText(tools, "Menu.Tools");
     247
     248    // tools_log = new JMenuItem();
     249    // tools_log.addActionListener(Gatherer.g_man);
     250    // tools_log.setMnemonic(KeyEvent.VK_L);
     251    // Dictionary.registerText(tools_log, "Menu.Tools_Log");
     252
     253    // tools_size = new JMenuItem();
     254    // tools_size.addActionListener(Gatherer.g_man);
     255    // tools_size.setMnemonic(KeyEvent.VK_C);
     256    // Dictionary.registerText(tools_size, "Menu.Tools_Calculate_Record_Size");
     257
     258    // Layout (tools menu)
     259    // tools.add(tools_log);
     260    // tools.add(tools_size);
     261
     262    // Help menu
     263    help = new JMenu();
     264    help.setIcon(Utility.HELP_ICON);
     265    Dictionary.setText(help, "Menu.Help");
     266
     267    help_about = new JMenuItem();
     268    help_about.addActionListener(Gatherer.g_man);
     269    Dictionary.registerText(help_about, "Menu.Help_About");
     270
     271    help_browse = new JMenuItem(Utility.BLANK_ICON);
     272    help_browse.addActionListener(Gatherer.g_man);
     273    Dictionary.registerText(help_browse, "GUI.Hunt");
     274
     275    help_build = new JMenuItem(Utility.BLANK_ICON);
     276    help_build.addActionListener(Gatherer.g_man);
     277    Dictionary.registerText(help_build, "GUI.Create");
     278
     279    help_collect = new JMenuItem(Utility.BLANK_ICON);
     280    help_collect.addActionListener(Gatherer.g_man);
     281    Dictionary.registerText(help_collect, "GUI.Gather");
     282
     283    help_design = new JMenuItem(Utility.BLANK_ICON);
     284    help_design.addActionListener(Gatherer.g_man);
     285    Dictionary.registerText(help_design, "GUI.Design");
     286
     287    help_export = new JMenuItem(Utility.BLANK_ICON);
     288    help_export.addActionListener(Gatherer.g_man);
     289    Dictionary.registerText(help_export, "GUI.Export");
     290
     291    help_general = new JMenuItem();
     292    help_general.addActionListener(Gatherer.g_man);
     293    Dictionary.registerText(help_general, "Source.General");
     294
     295    help_metaedit = new JMenuItem(Utility.BLANK_ICON);
     296    help_metaedit.addActionListener(Gatherer.g_man);
     297    Dictionary.registerText(help_metaedit, "GUI.Enrich");
     298
     299    help_mirror = new JMenuItem(Utility.BLANK_ICON);
     300    help_mirror.addActionListener(Gatherer.g_man);
     301    Dictionary.registerText(help_mirror, "GUI.Mirror");
     302
     303    help_preview = new JMenuItem(Utility.BLANK_ICON);
     304    help_preview.addActionListener(Gatherer.g_man);
     305    Dictionary.registerText(help_preview, "GUI.Preview");
     306
     307    // Layout (help menu)
     308    help.add(help_general);
     309    help.add(new JSeparator());
     310    if (Gatherer.config.get("workflow.browse", true)) {
     311        help.add(help_browse);
     312    }
     313    if (Gatherer.config.get("workflow.mirror", true)) {
     314        help.add(help_mirror);
     315    }
     316    if (Gatherer.config.get("workflow.gather", true)) {
     317        help.add(help_collect);
     318    }
     319    if (Gatherer.config.get("workflow.enrich", true)) {
     320        help.add(help_metaedit);
     321    }
     322    if (Gatherer.config.get("workflow.design", true)) {
     323        help.add(help_design);
     324    }
     325    if (Gatherer.config.get("workflow.export", true)) {
     326        help.add(help_export);
     327    }
     328    if (Gatherer.config.get("workflow.create", true)) {
     329        help.add(help_build);
     330    }
     331    if (Gatherer.config.get("workflow.preview", true)) {
     332        help.add(help_preview);
     333    }
     334    help.add(new JSeparator());
     335    help.add(help_about);
     336
     337    // Layout (menu bar)
     338    this.add(file);
     339    this.add(Box.createHorizontalStrut(15));
     340    this.add(edit);
    202341    this.add(Box.createHorizontalStrut(15));
    203342    this.add(metadata);
    204 
    205     // Tools menu
    206     tools = new JMenu(get("Menu.Tools"));
    207 
    208     tools_log = new JMenuItem(get("Menu.Tools_Log"), KeyEvent.VK_L);
    209     tools_log.addActionListener(Gatherer.g_man);
    210 
    211     tools_size = new JMenuItem("Calculate Record Size", KeyEvent.VK_S);
    212     tools_size.addActionListener(Gatherer.g_man);
    213 
    214     tools.add(tools_log);
    215     tools.add(tools_size);
    216     //this.add(Box.createHorizontalStrut(15));
    217     //this.add(tools);
    218 
    219     // Help menu
    220     help = new JMenu(get("Menu.Help"));
    221     //help.addMenuListener(menu_listener);
    222     help.setIcon(Utility.HELP_ICON);
    223 
    224     help_about = new JMenuItem(get("Menu.Help_About"));
    225     help_about.addActionListener(Gatherer.g_man);
    226 
    227     help_browse = new JMenuItem(get("GUI.Hunt"), Utility.BLANK_ICON);
    228     help_browse.addActionListener(Gatherer.g_man);
    229 
    230     help_build = new JMenuItem(get("GUI.Create"), Utility.BLANK_ICON);
    231     help_build.addActionListener(Gatherer.g_man);
    232 
    233     help_collect = new JMenuItem(get("GUI.Gather"), Utility.BLANK_ICON);
    234     help_collect.addActionListener(Gatherer.g_man);
    235 
    236     help_design = new JMenuItem(get("GUI.Design"), Utility.BLANK_ICON);
    237     help_design.addActionListener(Gatherer.g_man);
    238 
    239     help_export = new JMenuItem(get("GUI.Export"), Utility.BLANK_ICON);
    240     help_export.addActionListener(Gatherer.g_man);
    241 
    242     help_general = new JMenuItem(get("Source.General"));
    243     help_general.addActionListener(Gatherer.g_man);
    244 
    245     help_metaedit = new JMenuItem(get("GUI.Enrich"), Utility.BLANK_ICON);
    246     help_metaedit.addActionListener(Gatherer.g_man);
    247 
    248     help_mirror = new JMenuItem(get("GUI.Mirror"), Utility.BLANK_ICON);
    249     help_mirror.addActionListener(Gatherer.g_man);
    250 
    251     help_preview = new JMenuItem(get("GUI.Preview"), Utility.BLANK_ICON);
    252     help_preview.addActionListener(Gatherer.g_man);
    253 
    254     // Layout help
    255     help.add(help_general);
    256     help.add(new JSeparator());
    257     if(Gatherer.config.get("workflow.browse", true)) {
    258         help.add(help_browse);
    259     }
    260     if(Gatherer.config.get("workflow.mirror", true)) {
    261         help.add(help_mirror);
    262     }
    263     if(Gatherer.config.get("workflow.gather", true)) {
    264         help.add(help_collect);
    265     }
    266     if(Gatherer.config.get("workflow.enrich", true)) {
    267         help.add(help_metaedit);
    268     }
    269     if(Gatherer.config.get("workflow.design", true)) {
    270         help.add(help_design);
    271     }
    272     if(Gatherer.config.get("workflow.export", true)) {
    273         help.add(help_export);
    274     }
    275     if(Gatherer.config.get("workflow.create", true)) {
    276         help.add(help_build);
    277     }
    278     if(Gatherer.config.get("workflow.preview", true)) {
    279         help.add(help_preview);
    280     }
    281     help.add(new JSeparator());
    282     help.add(help_about);
     343    // this.add(Box.createHorizontalStrut(15));
     344    // this.add(tools);
    283345    this.add(Box.createHorizontalGlue());
    284346    this.add(help);
     
    288350    file_close.setEnabled(ready);
    289351    file_save.setEnabled(ready);
    290     file_save_as.setEnabled(ready);
     352    // file_save_as.setEnabled(ready);
    291353    metadata.setEnabled(ready);
    292     tools.setEnabled(ready);
    293     if(ready) {
    294         Gatherer.c_man.undo.registerRedoSource(edit_redo);
    295         Gatherer.c_man.undo.registerUndoSource(edit_undo);
     354    // tools.setEnabled(ready);
     355    if (ready) {
     356        // Gatherer.c_man.undo.registerRedoSource(edit_redo);
     357        // Gatherer.c_man.undo.registerUndoSource(edit_undo);
    296358    }
    297359    }
     
    299361    /** Once a quit has been requested by the user, prevent any further menu selections. */
    300362    public void exit() {
     363    file.setEnabled(false);
    301364    edit.setEnabled(false);
    302     file.setEnabled(false);
     365    metadata.setEnabled(false);
     366    // tools.setEnabled(false);
    303367    help.setEnabled(false);
    304     metadata.setEnabled(false);
    305368    }
    306369
     
    308371    ///ystem.err.println("**** Set suffix: " + metaaudit_suffix);
    309372    if(metaaudit_suffix == null) {
    310         metadata_view.setText(get("Menu.Metadata_View") + " " + get("FileActions.No_Selection"));
     373        metadata_view.setText(Dictionary.newget("Menu.Metadata_View") + " " + Dictionary.newget("FileActions.No_Selection"));
    311374        metadata_view.setEnabled(false);
    312375    }
    313376    else {
    314377        ///ystem.err.println("Set metadata view suffix: " + metaaudit_suffix);
    315         metadata_view.setText(get("Menu.Metadata_View") + " " + metaaudit_suffix);
     378        metadata_view.setText(Dictionary.newget("Menu.Metadata_View") + " " + metaaudit_suffix);
    316379        metadata_view.setEnabled(true);
    317380    }
     
    332395    JMenuItem selected;
    333396    if(current_tab != -1) {
    334                 // Remove the image
     397        // Remove the image
    335398        selected = help.getItem(current_tab);
    336399        if(selected != null) {
     
    345408    selected = null;
    346409    }
    347      
    348     /** Retrieves a key from the Dictionary, using no extra arguments.
    349      * @param key A String which maps to a certain phrase from the Dictionary.
    350      * @return The String the matches the key or an error String if no match
    351      * found.
    352      */
    353     private String get(String key) {
    354     // return get(key, null);
    355     return Gatherer.dictionary.get(key, (String[]) null);
    356     }
    357 
    358     /** Retrieves a key from the Dictionary, providing extra arguments to
    359      * be inserted using a String array.
    360      * @param key A String which maps to a certain phrase from the Dictionary.
    361      * @param args A String array containing further arguments (such as
    362      * formatting instructions and variable values) to be taken into account
    363      * when Dictionary creates the return String.
    364      * @return The String the matches the key or an error String if no match
    365      * found.
    366      */
    367     /* private String get(String key, String args[]) {
    368     if(key.indexOf('.') == -1) {
    369         key = "Menu." + key;
    370     }
    371     return Gatherer.dictionary.get(key, args);
    372     } */
     410
    373411
    374412    public class MagicMenuItem
    375413    extends JMenuItem {
    376    
     414
    377415    private boolean can_enable;
    378416    private boolean should_enable;
     
    386424
    387425    public void setCanEnable(boolean can_enable) {
    388         ///ystem.err.println("can_enable = " + can_enable);
    389426        this.can_enable = can_enable;
    390427        if (can_enable) {
    391         ///ystem.err.println("setEnable(" + should_enable + ")");
    392428        super.setEnabled(should_enable);
    393429        }
     
    398434
    399435    public void setEnabled(boolean should_enable) {
    400         ///ystem.err.println("should_enable = " + should_enable);
    401436        this.should_enable = should_enable;
    402         if(can_enable) {
    403         ///ystem.err.println("setEnable(" + should_enable + ")");
     437        if (can_enable) {
    404438        super.setEnabled(should_enable);
    405439        }
    406440    }
    407441    }
    408 
    409     private class NonFocusMenu
    410     extends JMenu {
    411         public NonFocusMenu(String name) {
    412         super(name);
    413             setFocusPainted(false);
    414         }
    415        
    416         public boolean isFocusable(){
    417             return false;
    418         }
    419        
    420         public void requestFocus(){
    421     }
    422 
    423         public boolean requestFocus(boolean t){
    424         return false;
    425     }
    426 
    427     public void setFocusable(boolean f) {
    428     }
    429     }
    430 
    431     private class NonFocusMenuItem
    432     extends JMenuItem {
    433         public NonFocusMenuItem(String name, int key) {
    434         super(name, key);
    435             setFocusPainted(false);
    436         }
    437        
    438         public boolean isFocusable(){
    439             return false;
    440         }
    441        
    442         public void requestFocus(){
    443     }
    444 
    445         public boolean requestFocus(boolean t){
    446         return false;
    447     }
    448 
    449     public void setFocusable(boolean f) {
    450     }
    451          
    452     }
    453442}
  • trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java

    r5536 r5564  
    10081008
    10091009        JPanel value_pane = new JPanel();
    1010         JLabel value_label = new JLabel("MetaEdit.Value");
     1010        JLabel value_label = new JLabel();
    10111011        value_label.setPreferredSize(VALUE_LABEL_SIZE);
     1012        Dictionary.registerText(value_label, "MetaEdit.Value");
    10121013
    10131014        JPanel value_field_pane = new JPanel();
    1014         value = new JTextField("MetaEdit.Value_Field");
     1015        value = new JTextField();
    10151016        value.setBackground(Gatherer.config.getColor("coloring.editable_background", false));
    10161017        value.setForeground(Gatherer.config.getColor("coloring.editable_foreground", false));
     
    10191020        value.addKeyListener(new MetadataFieldListener());
    10201021        value.setFocusTraversalKeysEnabled(false);
     1022        Dictionary.setTooltip(value, "MetaEdit.Value_Field_Tooltip");
    10211023
    10221024        JPanel button_pane = new JPanel();
    10231025
    10241026        JPanel tree_pane = new JPanel();
    1025         JLabel tree_label = new JLabel("MetaEdit.Tree");
     1027        JLabel tree_label = new JLabel();
     1028        Dictionary.registerText(tree_label, "MetaEdit.Tree");
    10261029
    10271030        tree = new JTree(new GValueModel());
  • trunk/gli/src/org/greenstone/gatherer/gui/NewFolderPrompt.java

    r4675 r5564  
    88import org.greenstone.gatherer.Gatherer;
    99import org.greenstone.gatherer.file.FileNode;
    10 import org.greenstone.gatherer.gui.GUIManager;
    1110
    1211public class NewFolderPrompt
     
    2019    static final private Dimension LABEL_SIZE = new Dimension(100,25);
    2120    static final private Dimension SIZE = new Dimension(300,100);
     21
    2222    public NewFolderPrompt(FileNode node) {
    23     super(Gatherer.g_man, Gatherer.dictionary.get("NewFolderPrompt.Title"), true);
     23    super(Gatherer.g_man, Dictionary.newget("NewFolderPrompt.Title"), true);
    2424    this.node = node;
    2525    }
    2626
    2727    public void actionPerformed(ActionEvent event) {
    28     if(event.getSource() == ok_button) {
     28    if (event.getSource() == ok_button) {
    2929        name = name_field.getText();
    3030    }
     
    3939    JPanel content_pane = (JPanel) getContentPane();
    4040    JPanel name_pane = new JPanel();
    41     JLabel name_label = new JLabel(Gatherer.dictionary.get("NewFolderPrompt.Folder_Name"));
     41    JLabel name_label = new JLabel();
    4242    name_label.setPreferredSize(LABEL_SIZE);
     43    Dictionary.setText(name_label, "NewFolderPrompt.Folder_Name");
    4344    name_field = new JTextField(getAutomaticName());
     45    Dictionary.setTooltip(name_field, "NewFolderPrompt.Folder_Name_Tooltip");
     46
    4447    JPanel button_pane = new JPanel();
    45     ok_button = new JButton(Gatherer.dictionary.get("General.OK"));
    46     cancel_button = new JButton(Gatherer.dictionary.get("General.Cancel"));
     48    ok_button = new JButton();
     49    Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
     50    cancel_button = new JButton();
     51    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Good_Cancel_Tooltip");
     52
    4753    // Connection
    4854    cancel_button.addActionListener(this);
    4955    ok_button.addActionListener(this);
     56
    5057    // Layout
    5158    name_pane.setLayout(new BorderLayout());
     
    6168    content_pane.add(name_pane, BorderLayout.CENTER);
    6269    content_pane.add(button_pane, BorderLayout.SOUTH);
     70
    6371    // Display
    6472    Rectangle frame_bounds = Gatherer.g_man.getBounds();
     
    6876    }
    6977
    70     private String getAutomaticName() {
     78    private String getAutomaticName()
     79    {
    7180    File file = node.getFile();
    72     String default_name = Gatherer.dictionary.get("NewFolderPrompt.Default_Folder_Name");
     81    String default_name = Dictionary.newget("NewFolderPrompt.Default_Folder_Name");
    7382    File temp_file = new File(file, default_name);
    7483    int count = 1;
    75     if(temp_file.exists()) {
     84    while (temp_file.exists()) {
    7685        temp_file = new File(file, default_name + " " + count);
    7786        count++;
  • trunk/gli/src/org/greenstone/gatherer/gui/SmarterTextArea.java

    r4675 r5564  
    3535 *########################################################################
    3636 */
    37 
    3837package org.greenstone.gatherer.gui;
    3938
     
    6968    init = false;
    7069    }
     70
    7171    private class UnchangingDocument
    7272    extends PlainDocument {
  • trunk/gli/src/org/greenstone/gatherer/gui/WarningDialog.java

    r5185 r5564  
    77import org.greenstone.gatherer.Dictionary;
    88import org.greenstone.gatherer.Gatherer;
    9 import org.greenstone.gatherer.gui.SmarterTextArea;
     9// import org.greenstone.gatherer.gui.SmarterTextArea;
    1010import org.greenstone.gatherer.util.FocusChangerTask;
    1111import org.greenstone.gatherer.util.Utility;
     
    5757    public WarningDialog(String full_property, boolean can_cancel, String affected_property, Dictionary dictionary) {
    5858    super(Gatherer.g_man, "Warning", true);
     59
    5960    // Determine the name of this prompt.
    6061    this.affected_property = affected_property;
     
    6263    this.full_property = full_property;
    6364    warning_name = full_property.substring(full_property.indexOf(".") + 1);
     65
    6466    // Now build dialog.
    65     if(affected_property != null) {
     67    if (affected_property != null) {
    6668        setSize(SETTING_SIZE);
    6769    }
     
    6971        setSize(NORMAL_SIZE);
    7072    }
    71     setTitle(get("Title"));
     73    Dictionary.setText(this, warning_name + ".Title");
     74
    7275    // Creation
    7376    JPanel content_pane = (JPanel) getContentPane();
    7477    JPanel text_pane = new JPanel();
    7578    JLabel icon_label = new JLabel(Utility.getImage("gatherer_medium.gif"));
    76     SmarterTextArea text_area = new SmarterTextArea(get("Message"), false);
     79
     80    // SmarterTextArea text_area = new SmarterTextArea("", false);
     81    JTextArea text_area = new JTextArea();
    7782    text_area.setCaretPosition(0);
     83    text_area.setEditable(false);
    7884    text_area.setLineWrap(true);
    7985    text_area.setWrapStyleWord(true);
     86    Dictionary.setText(text_area, warning_name + ".Message");
     87
    8088    value_panel = new JPanel();
    81     JLabel value_label = new JLabel(get("WarningDialog.Value"));
     89    JLabel value_label = new JLabel();
    8290    value_label.setPreferredSize(LABEL_SIZE);
     91    Dictionary.setText(value_label, "WarningDialog.Value");
     92
    8393    value_field = new JTextField();
    8494    JPanel bottom_pane = new JPanel();
    85     show_check = new JCheckBox(get("WarningDialog.Dont_Show_Again"), false);
     95    show_check = new JCheckBox();
     96    Dictionary.setText(show_check, "WarningDialog.Dont_Show_Again");
    8697    JPanel control_pane = new JPanel();
    87     ok_button = new JButton(get("General.OK"));
    88     cancel_button = new JButton(get("General.Cancel"));
     98    ok_button = new JButton();
     99    Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
     100    cancel_button = new JButton();
     101    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip");
     102
    89103    // Connection
    90104    ok_button.addActionListener(this);
     
    92106    ok_button.addKeyListener(this);
    93107    cancel_button.addKeyListener(this);
     108
    94109    // Layout
    95110    icon_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
     
    108123        text_pane.add(value_panel, BorderLayout.SOUTH);
    109124    }
    110          
     125
    111126    if(can_cancel) {
    112127        control_pane.setLayout(new GridLayout(1,2,5,0));
     
    128143    content_pane.add(text_pane, BorderLayout.CENTER);
    129144    content_pane.add(bottom_pane, BorderLayout.SOUTH);
     145
    130146    // Position
    131147    Dimension size = getSize();
    132     if(Gatherer.g_man != null) {
     148    if (Gatherer.g_man != null) {
    133149        Rectangle frame_bounds = Gatherer.g_man.getBounds();
    134150        setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
     
    169185    }
    170186    else {
    171         JOptionPane.showMessageDialog(Gatherer.g_man, get("WarningDialog.Invalid_Value"), get("General.Error"), JOptionPane.ERROR_MESSAGE);
     187        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("WarningDialog.Invalid_Value"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    172188    }
    173189    }
     
    222238    value_panel.add(value_field, BorderLayout.CENTER);
    223239    }
    224 
    225     private String get(String key) {
    226     if(key.indexOf(".") == -1) {
    227         key = warning_name + "." + key;
    228     }
    229     return dictionary.get(key);
    230     }
    231240}
  • trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/AutofilterDialog.java

    r5527 r5564  
    1 package org.greenstone.gatherer.gui.metaaudit;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui.metaaudit;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
    4041import java.util.*;
    4142import javax.swing.*;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    4345import org.greenstone.gatherer.gui.metaaudit.Autofilter;
     
    6163    /** The button used to cancel the prompt. */
    6264    private JButton cancel_button = null;
    63     /** The button used to accept and commit any changes to the autofilter. */
    64     private JButton ok_button = null;
    65     /** A check box used to specify that the given filters should be applied conjunctly. */
    66     private JCheckBox and_check = null;
     65    private JButton remove_button = null;
     66    private JButton set_button = null;
     67    /** Used to specify that the given filters should be applied conjunctly. */
     68    private JRadioButton and_radiobutton = null;
    6769    /** The check box used to specify whether the first filter is case sensitive. */
    6870    private JCheckBox first_case = null;
    69     /** The none check is used to disable the second filter. */
    70     private JCheckBox none_check = null;
    71     /** The check box used to specify that the given filters should be applied disjunctly. */
    72     private JCheckBox or_check = null;
     71    /** Used to disable the second filter. */
     72    private JRadioButton none_radiobutton = null;
     73    /** Used to specify that the given filters should be applied disjunctly. */
     74    private JRadioButton or_radiobutton = null;
    7375    /** The check box used to specify whether the second filter is case sensitive. */
    7476    private JCheckBox second_case = null;
     
    9395    /** The default size for the autofilter control. */
    9496    static final private Dimension SIZE = new Dimension(640, 245);
     97
    9598    /** Constructor.
    9699     * @param dialog A reference to the <strong>MetaAuditFrame</strong> that spawned this dialog.
     
    104107    this.self = this;
    105108    setModal(true);
     109    setJMenuBar(new SimpleMenuBar("reviewingmetadata"));
    106110    setSize(SIZE);
    107     setTitle(get("Autofilter.Title"));
    108     setJMenuBar(new SimpleMenuBar("reviewingmetadata"));
     111    Dictionary.setText(this, "Autofilter.Title");
     112
    109113    // Creation
    110114    JPanel content_pane = (JPanel) getContentPane();
    111115    JPanel name_pane = new JPanel();
    112     JLabel name_label = new JLabel(get("Autofilter.Name"));
     116    JLabel name_label = new JLabel();
     117    Dictionary.setText(name_label, "Autofilter.Name");
    113118    JTextField name_template = new JTextField();
    114119    name = new JLabel();
     
    117122    JPanel value_pane = new JPanel();
    118123    JPanel inner_value_pane = new JPanel();
    119     JLabel value_label = new JLabel(get("Autofilter.eqeq"));
     124    JLabel value_label = new JLabel();
     125    Dictionary.setText(value_label, "Autofilter.eqeq");
    120126    value = new JComboBox();
    121127    value.setEditable(false);
    122128    JPanel custom_pane = new JPanel();
     129
    123130    JPanel first_pane = new JPanel();
    124131    first_method = new JComboBox();
     
    127134    first_value.addItem("");
    128135    first_value.setSelectedItem("");
    129     first_case = new JCheckBox(get("Autofilter.Case_Sensitive"));
     136    first_case = new JCheckBox();
     137    Dictionary.setText(first_case, "Autofilter.Case_Sensitive");
    130138    JPanel operator_pane = new JPanel();
    131     JLabel operator_label = new JLabel(get("Autofilter.Operator"));
     139    JLabel operator_label = new JLabel();
     140    Dictionary.setText(operator_label, "Autofilter.Operator");
    132141    ButtonGroup operator_group = new ButtonGroup();
    133     and_check = new JCheckBox(get("Autofilter.AND"));
    134     none_check = new JCheckBox(get("Autofilter.None"));
    135     or_check = new JCheckBox(get("Autofilter.OR"));
    136     none_check.setSelected(true);
    137     operator_group.add(none_check);
    138     operator_group.add(and_check);
    139     operator_group.add(or_check);
     142    and_radiobutton = new JRadioButton();
     143    and_radiobutton.setOpaque(false);
     144    Dictionary.setText(and_radiobutton, "Autofilter.AND");
     145    none_radiobutton = new JRadioButton();
     146    none_radiobutton.setOpaque(false);
     147    none_radiobutton.setSelected(true);
     148    Dictionary.setText(none_radiobutton, "Autofilter.None");
     149    or_radiobutton = new JRadioButton();
     150    or_radiobutton.setOpaque(false);
     151    Dictionary.setText(or_radiobutton, "Autofilter.OR");
     152    operator_group.add(none_radiobutton);
     153    operator_group.add(and_radiobutton);
     154    operator_group.add(or_radiobutton);
     155
    140156    JPanel second_pane = new JPanel();
    141157    second_method = new JComboBox();
     
    146162    second_value.addItem("");
    147163    second_value.setSelectedItem("");
    148     second_case = new JCheckBox(get("Autofilter.Case_Sensitive"));
     164    second_case = new JCheckBox();
     165    Dictionary.setText(second_case, "Autofilter.Case_Sensitive");
    149166    JPanel lower_pane = new JPanel();
    150167    JPanel order_pane = new JPanel();
    151     JLabel order_label = new JLabel(get("Autofilter.Order"));
     168    JLabel order_label = new JLabel();
     169    Dictionary.setText(order_label, "Autofilter.Order");
    152170    order = new JComboBox();
    153     order.addItem(get("Autofilter.Ascending"));
    154     order.addItem(get("Autofilter.Descending"));
     171    order.addItem(Dictionary.newget("Autofilter.Ascending"));
     172    order.addItem(Dictionary.newget("Autofilter.Descending"));
     173    Dictionary.setTooltip(order, "Autofilter.Order_Tooltip");
     174
    155175    // Assign values to method comboboxes.
    156176    for(int i = 0; i < Autofilter.METHOD_LIST.length; i++) {
    157         first_method.addItem(get(Autofilter.METHOD_LIST[i]));
    158         second_method.addItem(get(Autofilter.METHOD_LIST[i]));
     177        first_method.addItem(Dictionary.newget("Autofilter." + Autofilter.METHOD_LIST[i]));
     178        second_method.addItem(Dictionary.newget("Autofilter." + Autofilter.METHOD_LIST[i]));
    159179    }
    160180    JPanel button_pane = new JPanel();
    161     cancel_button = new JButton(get("Autofilter.Clear"));
     181    cancel_button = new JButton();
    162182    cancel_button.setMnemonic(KeyEvent.VK_C);
    163     ok_button = new JButton(get("Autofilter.Set"));
    164     ok_button.setMnemonic(KeyEvent.VK_S);
     183    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Pure_Cancel_Tooltip");
     184    remove_button = new JButton();
     185    remove_button.setMnemonic(KeyEvent.VK_R);
     186    Dictionary.setBoth(remove_button, "Autofilter.Remove", "Autofilter.Remove_Tooltip");
     187    set_button = new JButton();
     188    set_button.setMnemonic(KeyEvent.VK_S);
     189    Dictionary.setBoth(set_button, "Autofilter.Set", "Autofilter.Set_Tooltip");
     190
    165191    // Connection
    166     and_check.addActionListener(new CheckListener(true));
     192    and_radiobutton.addActionListener(new CheckListener(true));
     193    none_radiobutton.addActionListener(new CheckListener(false));
     194    or_radiobutton.addActionListener(new CheckListener(true));
    167195    cancel_button.addActionListener(new ButtonListener(false));
    168     none_check.addActionListener(new CheckListener(false));
    169     ok_button.addActionListener(new ButtonListener(true));
    170     or_check.addActionListener(new CheckListener(true));
     196    remove_button.addActionListener(new ButtonListener(false));
     197    set_button.addActionListener(new ButtonListener(true));
     198
    171199    // Layout         
    172200    name_label.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
     
    194222    operator_pane.setLayout(new GridLayout(1,4));
    195223    operator_pane.add(operator_label);
    196     operator_pane.add(none_check);
    197     operator_pane.add(and_check);
    198     operator_pane.add(or_check);
     224    operator_pane.add(none_radiobutton);
     225    operator_pane.add(and_radiobutton);
     226    operator_pane.add(or_radiobutton);
    199227
    200228    second_pane.setLayout(new BorderLayout());
     
    213241    custom_pane.add(operator_pane);
    214242    custom_pane.add(second_pane);
    215          
    216     control.add(get("Autofilter.Filter_By_Value"), value_pane);
    217     control.add(get("Autofilter.Custom_Filter"), custom_pane);
     243
     244    control.add(Dictionary.newget("Autofilter.Filter_By_Value"), value_pane);
     245    control.add(Dictionary.newget("Autofilter.Custom_Filter"), custom_pane);
    218246
    219247    button_pane.setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
    220     button_pane.setLayout(new GridLayout(1,2));
    221     button_pane.add(ok_button);
     248    button_pane.setLayout(new GridLayout(1, 3));
     249    button_pane.add(set_button);
     250    button_pane.add(remove_button);
    222251    button_pane.add(cancel_button);
    223252
     
    236265    screen_size = null;
    237266    }
     267
    238268    /** Destructor. */
    239269    public void destroy() {
    240270    dispose();
    241     cancel_button = null;
    242     ok_button = null;
    243     and_check = null;
    244271    first_case = null;
    245     none_check = null;
    246     or_check = null;
    247272    second_case = null;
    248273    order = null;
     
    258283    }
    259284    /** Display the modal dialog box, allowing the user to define the filter. When the user presses one of the buttons, dispose and return to the caller providing an indication of which button was pressed.
    260       * @return An <i>int</i> which indicates which button was pressed to dismiss the dialog.
    261       */
     285     * @return An <i>int</i> which indicates which button was pressed to dismiss the dialog.
     286     */
    262287    public Autofilter display(Autofilter filter, ArrayList raw_values, String column_name) {
    263288    this.filter = filter;
     
    277302        first_value.setSelectedItem(filter.value_one);
    278303        first_case.setSelected(filter.casesense_one);
    279         if(filter.value_two == null) {
    280         none_check.setSelected(true);
     304        if (filter.value_two == null) {
     305        none_radiobutton.setSelected(true);
    281306        }
    282307        else {
    283         if(filter.operation) {
    284             and_check.setSelected(true);
     308        if (filter.operation) {
     309            and_radiobutton.setSelected(true);
    285310        }
    286311        else {
    287             or_check.setSelected(true);
     312            or_radiobutton.setSelected(true);
    288313        }
    289314        second_method.setSelectedIndex(filter.method_two);
     
    303328    return this.filter;
    304329    }
    305     /** Use the given key to retrieve a phrase from the dictionary.
    306       * @param key A <strong>String</strong> which uniquely maps to an entry in the Dictionary.
    307       * @return The <strong>String</strong> to key mapped to.
    308       * @see org.greenstone.gatherer.Dictionary
    309       */
    310     private final String get(String key) {
    311     if(key.indexOf(".") == -1) {
    312         key = "Autofilter." + key;
    313     }
    314     return Gatherer.dictionary.get(key, (String[])null);
    315     }
     330
    316331    /** Listens for actions on the button it is attached to, and when notified sets the return_value and disposes of the dialog. */
    317332    private final class ButtonListener
     
    337352        else {
    338353            filter.setFilter(1, first_method.getSelectedIndex(), (String)first_value.getSelectedItem(), first_case.isSelected());
    339             if(!none_check.isSelected()) {
    340             if(and_check.isSelected()) {
     354            if(!none_radiobutton.isSelected()) {
     355            if (and_radiobutton.isSelected()) {
    341356                filter.setOperation(Autofilter.AND);
    342357            }
  • trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/MetaAuditFrame.java

    r5527 r5564  
    1 package org.greenstone.gatherer.gui.metaaudit;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui.metaaudit;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4142import javax.swing.event.*;
    4243import javax.swing.tree.*;
     44import org.greenstone.gatherer.Dictionary;
    4345import org.greenstone.gatherer.Gatherer;
    44 import org.greenstone.gatherer.collection.Collection;
    4546import org.greenstone.gatherer.file.FileNode;
    4647import org.greenstone.gatherer.util.TreeSynchronizer;
     
    9495    /** The default size for the metaaudit dialog. */
    9596    static final private Dimension SIZE = new Dimension(640,505);
    96     /** The tolerance used to determine between a column resize, and a request for an AutoFilterDialog. */
    97     static final private int TOLERANCE = 3;
     97
    9898    /** Constructor.*/
    9999    public MetaAuditFrame(TreeSynchronizer tree_sync, FileNode records[]) {
    100100    super(Gatherer.g_man);
     101
    101102    // Arguments
    102103    this.autofilter_dialog = new AutofilterDialog(this);
     
    104105    this.self = this;
    105106    this.table = new MetaAuditTable(this);
     107
    106108    // Creation
    107109    setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    108110    setSize(SIZE);
    109     setTitle(get("MetaAudit.Title"));
    110111    setJMenuBar(new SimpleMenuBar("reviewingmetadata"));
     112    Dictionary.registerText(this, "MetaAudit.Title");
    111113    JPanel content_pane = (JPanel) getContentPane();
    112114    JPanel button_pane = new JPanel();
    113115
    114     JButton close_button = new JButton(get("MetaAudit.Close"));
     116    JButton close_button = new JButton();
    115117    close_button.setMnemonic(KeyEvent.VK_C);
     118    Dictionary.registerBoth(close_button, "MetaAudit.Close", "MetaAudit.Close_Tooltip");
     119
    116120    // Connection
    117121    close_button.addActionListener(new CloseListener());
    118122    tree_sync.addTreeSelectionListener(this);
     123
    119124    // Layout
    120125    button_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     
    134139    content_pane = null;
    135140    }
     141
    136142    /** Destructor. */
    137143    public void destroy() {
     
    140146    table = null;
    141147    }
     148
    142149    /** Display the dialog on screen. */
    143150    public void display() {
     
    195202    }
    196203
    197     /** Retrieve a phrase from the Dictionary.
    198      * @param key A <strong>String</strong> which uniquely maps to a phrase.
    199      * @return The desired phrase as a </strong>String</strong>.
    200      * @see org.greenstone.gatherer.Dictionary
    201      */
    202     private String get(String key) {
    203     return Gatherer.dictionary.get(key);
    204     }
    205204    /** Rebuild the metaaudit table model using the current collection tree selection.
    206205     */
     
    211210    invalid = false;
    212211    }
    213     /** Listens for actions apon the close button, and if detected closes the dialog (storing its current size first). */
     212
     213    /** Listens for actions upon the close button, and if detected closes the dialog */
    214214    private class CloseListener
    215215    implements ActionListener {
     
    222222    }
    223223}
    224      
    225 
    226 
    227 
    228 
    229 
    230 
    231 
    232 
    233 
  • trunk/gli/src/org/greenstone/gatherer/gui/metaaudit/MetaAuditModel.java

    r4641 r5564  
    1 package org.greenstone.gatherer.gui.metaaudit;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui.metaaudit;
     38
    3839import java.awt.*;
    3940import java.util.*;
    4041import java.io.*;
    4142import javax.swing.table.*;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    4345import org.greenstone.gatherer.file.FileNode;
    44 import org.greenstone.gatherer.msm.ElementWrapper;
    4546import org.greenstone.gatherer.msm.Metadata;
    46 import org.greenstone.gatherer.msm.MetadataSetManager;
    4747import org.greenstone.gatherer.msm.MSMUtils;
    48 import org.greenstone.gatherer.valuetree.GValueNode;
     48
    4949/**
    5050 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    7777    String result;
    7878    if(column == 0) {
    79         result = Gatherer.dictionary.get("AuditTable.File");
     79        result = Dictionary.newget("AuditTable.File");
    8080    }
    8181    else {
     
    179179    }
    180180}
    181 
    182 
    183 
    184 
  • trunk/gli/src/org/greenstone/gatherer/mem/MEMNode.java

    r4365 r5564  
    1 package org.greenstone.gatherer.mem;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.mem;
     38
    3839import java.util.*;
    3940import javax.swing.tree.*;
     41import org.greenstone.gatherer.Dictionary;
    4042import org.greenstone.gatherer.Gatherer;
    4143import org.greenstone.gatherer.mem.AttributeTableModel;
     
    160162        v = null;
    161163                // Add the profile set.
    162         children.add(new MEMNode(PROFILER, Gatherer.dictionary.get("MEM.Profiles"), this));
     164        children.add(new MEMNode(PROFILER, Dictionary.newget("MEM.Profiles"), this));
    163165        break;
    164166    case SET: // Add the elements as children
  • trunk/gli/src/org/greenstone/gatherer/mem/MetadataEditorManager.java

    r5527 r5564  
    1 package org.greenstone.gatherer.mem;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.mem;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
  • trunk/gli/src/org/greenstone/gatherer/msm/ExportMDSPrompt.java

    r5355 r5564  
    1 package org.greenstone.gatherer.msm;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.msm;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4142import javax.swing.*;
    4243import javax.swing.filechooser.*;
     44import org.greenstone.gatherer.Dictionary;
    4345import org.greenstone.gatherer.Gatherer;
    4446import org.greenstone.gatherer.msm.MetadataSet;
     
    8587    /** The default export action (there are several depending on how much information you wish to export). */
    8688    final static public int EXPORT = 0;
     89
    8790    /** Constructor.
    8891     * @param manager A reference to the <strong>MetadataSetManager</strong>.
     
    9396    super(Gatherer.g_man);
    9497    this.export = export;
     98
    9599    // Creation
    96100    setModal(true);
    97101    if(export) {
    98102        setSize(EXPORT_SIZE);
    99         setTitle(get("MSMPrompt.Export_Title"));
    100         setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
     103        Dictionary.setText(this, "MSMPrompt.Export_Title");
     104        setJMenuBar(new SimpleMenuBar("selectingmetadatasets"));
    101105    }
    102106    else {
    103107        setSize(IMPORT_SIZE);
    104         setTitle(get("MSMPrompt.Import_Title"));
    105         setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
     108        Dictionary.setText(this, "MSMPrompt.Import_Title");
     109        setJMenuBar(new SimpleMenuBar("selectingmetadatasets"));
    106110    }
    107111    JPanel content_pane = (JPanel) getContentPane();
    108112    JPanel control_pane = new JPanel();
    109     JLabel set_label = new JLabel(get("MSMPrompt.Export_Set"));
     113    JLabel set_label = new JLabel();
     114    Dictionary.setText(set_label, "MSMPrompt.Export_Set");
    110115    sets = new JComboBox(manager.getSets());
    111     JLabel condition_label = new JLabel(get("MSMPrompt.Export_Conditions"));
     116    Dictionary.setTooltip(sets, "MSMPrompt.Export_Set_Tooltip");
     117    JLabel condition_label = new JLabel();
     118    Dictionary.setText(condition_label, "MSMPrompt.Export_Conditions");
    112119    JPanel condition_pane = new JPanel();
    113120    ButtonGroup condition_group = new ButtonGroup();
    114     all_values = new JRadioButton(get("MSMPrompt.Export_All_Values"));
     121    all_values = new JRadioButton();
    115122    all_values.setOpaque(false);
     123    Dictionary.setText(all_values, "MSMPrompt.Export_All_Values");
    116124    condition_group.add(all_values);
    117     no_values = new JRadioButton(get("MSMPrompt.Export_No_Values"));
     125    no_values = new JRadioButton();
    118126    no_values.setOpaque(false);
     127    Dictionary.setText(no_values, "MSMPrompt.Export_No_Values");
    119128    condition_group.add(no_values);
    120     structure_only = new JRadioButton(get("MSMPrompt.Export_Subjects_Only"));
     129    structure_only = new JRadioButton();
    121130    structure_only.setOpaque(false);
     131    Dictionary.setText(structure_only, "MSMPrompt.Export_Subjects_Only");
    122132    condition_group.add(structure_only);
    123133    all_values.setSelected(true);
    124     JLabel file_label = new JLabel(get("MSMPrompt.Export_File"));
     134    JLabel file_label = new JLabel();
     135    Dictionary.setText(file_label, "MSMPrompt.Export_File");
    125136    JPanel file_pane = new JPanel();
    126137    file_name = new JTextField(Utility.METADATA_DIR);
    127     browse_button = new JButton(get("General.Browse"));
     138    Dictionary.setTooltip(file_name, "MSMPrompt.Export_File_Tooltip");
     139    browse_button = new JButton();
     140    Dictionary.setBoth(browse_button, "General.Browse", "General.Browse_Tooltip");
     141
    128142    JPanel button_pane = new JPanel();
    129143    if(export) {
    130         export_button = new JButton(get("MSMPrompt.File_Export"));
     144        export_button = new JButton();
    131145        export_button.setEnabled(false);
    132     }
    133     else {
    134         export_button = new JButton(get("MSMPrompt.File_Import"));
     146        Dictionary.setBoth(export_button, "MSMPrompt.File_Export", "MSMPrompt.File_Export_Tooltip");
     147    }
     148    else {
     149        export_button = new JButton();
    135150        export_button.setEnabled(true);
    136     }
    137     cancel_button = new JButton(get("General.Cancel"));
     151        Dictionary.setBoth(export_button, "MSMPrompt.File_Import", "MSMPrompt.File_Import_Tooltip");
     152    }
     153
     154    cancel_button = new JButton();
     155    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip");
     156
    138157    // Listeners
    139158    browse_button.addActionListener(this);
     
    141160    export_button.addActionListener(this);
    142161    file_name.addKeyListener(this);
     162
    143163    // Layout
    144164    condition_pane.setLayout(new GridLayout(1,3));
     
    179199    setLocation((screen_size.width - getSize().width) / 2, (screen_size.height - getSize().height) / 2);
    180200    }
     201
    181202    /** Whenever one of the buttons in the dialog is actioned this method is called to trigger the appropriate effects.
    182       * @param event An <strong>ActionEvent</strong> containing information about the action performed.
    183       * @see org.greenstone.gatherer.Gatherer
    184       * @see org.greenstone.gatherer.msm.MDSFileFilter
    185       * @see org.greenstone.gatherer.util.Utility
    186       */
     203     * @param event An <strong>ActionEvent</strong> containing information about the action performed.
     204     * @see org.greenstone.gatherer.Gatherer
     205     * @see org.greenstone.gatherer.msm.MDSFileFilter
     206     * @see org.greenstone.gatherer.util.Utility
     207     */
    187208    public void actionPerformed(ActionEvent event) {
    188209    if(event.getSource() == export_button) {
     
    197218        JFileChooser chooser = new JFileChooser(new File(Utility.METADATA_DIR));
    198219        javax.swing.filechooser.FileFilter filter = new MDSFileFilter();
    199         chooser.setApproveButtonText(get("General.OK"));
     220        chooser.setApproveButtonText(Dictionary.newget("General.OK"));
    200221        chooser.setFileFilter(filter);
    201222        int returnVal = chooser.showSaveDialog(Gatherer.g_man);
     
    211232    }
    212233    /** Show the prompt and get the user input.
    213       * @return An <i>int</i> specifying what action the user has choosen.
    214       */
     234     * @return An <i>int</i> specifying what action the user has choosen.
     235     */
    215236    public int display() {
    216237    setVisible(true);
     
    218239    }
    219240    /** Get the current value of condition.
    220       * @return The value as an <i>int</i>.
    221       * @see org.greenstone.gatherer.msm.MetadataSet
    222       */
     241     * @return The value as an <i>int</i>.
     242     * @see org.greenstone.gatherer.msm.MetadataSet
     243     */
    223244    public int getSelectedCondition() {
    224245    if(all_values.isSelected()) {
     
    233254    }
    234255    /** Get the current value of file.
    235       * @return The value as a <strong>File</strong>.
    236       */
     256     * @return The value as a <strong>File</strong>.
     257     */
    237258    public File getSelectedFile() {
    238259    return file;
    239260    }
    240261    /** Get the current value of set.
    241       * @return The value as a <strong>MetadataSet</strong>.
    242       */
     262     * @return The value as a <strong>MetadataSet</strong>.
     263     */
    243264    public MetadataSet getSelectedSet() {
    244265    return (MetadataSet) sets.getSelectedItem();
    245266    }
    246267    /** Any implementation of KeyListener must include this method so that we can be informed when a key has been pressed. In this case we ignore it.
    247       * @param event A <strong>KeyEvent</strong> containing information about the key pressed.
    248       */
     268     * @param event A <strong>KeyEvent</strong> containing information about the key pressed.
     269     */
    249270    public void keyPressed(KeyEvent event) {
    250271    }
    251272    /** Any implementation of KeyListener must include this method so that we can be informed once a key has been released. This is the earliest the VK code becomes stable and usable, so we will check if the file named in file_name can be written to and if so enable the export button.
    252       * @param event A <strong>KeyEvent</strong> containing information about the key typed.
    253       */
     273     * @param event A <strong>KeyEvent</strong> containing information about the key typed.
     274     */
    254275    public void keyReleased(KeyEvent event) {
    255276    String pos_file = file_name.getText();
     
    265286    }
    266287    /** Any implementation of KeyListener must include this method so that we can be informed when a key has been typed. In this case we ignore it.
    267       * @param event A <strong>KeyEvent</strong> containing information about the key typed.
    268       */
     288     * @param event A <strong>KeyEvent</strong> containing information about the key typed.
     289     */
    269290    public void keyTyped(KeyEvent event) {
    270291    }
    271 
    272     private String get(String key) {
    273     return get(key, null);
    274     }
    275     private String get(String key, String[] args) {
    276     if(key.indexOf(".") == -1) {
    277         key = "MSMPrompt." + key;
    278     }
    279     return Gatherer.dictionary.get(key, args);
    280     }
    281292}
  • trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java

    r5164 r5564  
    1 package org.greenstone.gatherer.msm;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.msm;
     38
    3839import java.io.*;
    3940import java.net.*;
    4041import java.util.*;
    4142import org.greenstone.gatherer.Configuration;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    4345import org.greenstone.gatherer.collection.Collection;
     
    8082            args[0] = document_directories[i].getName();
    8183            args[1] = String.valueOf(count);
    82             shell.fireMessage(GShell.IMPORT, shell.typeAsString(GShell.IMPORT) + "> " + Gatherer.dictionary.get("GShell.Extracted", args), GShell.OK);
     84            shell.fireMessage(GShell.IMPORT, shell.typeAsString(GShell.IMPORT) + "> " + Dictionary.newget("GShell.Extracted", args), GShell.OK);
    8385            args = null;
    8486            progress.increment();
  • trunk/gli/src/org/greenstone/gatherer/msm/MDSFileFilter.java

    r4674 r5564  
    1 package org.greenstone.gatherer.msm;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.msm;
     38
    3839import java.io.*;
    3940import javax.swing.filechooser.*;
     41import org.greenstone.gatherer.Dictionary;
    4042import org.greenstone.gatherer.Gatherer;
     43
    4144/** A custom <strong>FileFilter</strong> for the file choosers. */
    4245final public class MDSFileFilter
    4346    extends javax.swing.filechooser.FileFilter {
    4447    private String description = null;
     48
    4549    /** Constructor.
    4650     * @see org.greenstone.gatherer.Dictionary
    4751     */
    4852    public MDSFileFilter() {
    49     description = Gatherer.dictionary.get("MSMPrompt.File_Filter_Description");
     53    description = Dictionary.newget("MSMPrompt.File_Filter_Description");
    5054    }
     55
    5156    /** Override this method to return <i>true</i> only if the file extension is .mds.
    5257     * @param f A possible mds <strong>File</strong>.
     
    6166    return false;
    6267    }
     68
    6369    /** Retrieve the description for this filter.
    6470     * @return The description as a <strong>String</strong>.
  • trunk/gli/src/org/greenstone/gatherer/msm/MSMPrompt.java

    r5527 r5564  
    1 package org.greenstone.gatherer.msm;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.msm;
     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.gui.ModalDialog;
     
    4951import org.greenstone.gatherer.msm.MetadataSetManager;
    5052import org.greenstone.gatherer.util.ArrayTools;
    51 import org.greenstone.gatherer.util.MED;
    5253import org.w3c.dom.*;
     54
    5355/** A class dedicated to producing the visual components used by the MSM package.
    5456 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    9193    public MSMPrompt(MetadataSetManager manager) {
    9294    this.manager = manager;
     95
    9396    // Create components
    94 
    95     add = new JButton(get("MSMPrompt.Add"));
     97    add = new JButton();
    9698    add.addActionListener(this);
    9799    add.setEnabled(false);
    98100    add.setMnemonic(KeyEvent.VK_A);
    99          
    100 
    101     cancel = new JButton(get("MSMPrompt.Cancel"));
     101    Dictionary.registerBoth(add, "MSMPrompt.Add", "MSMPrompt.Add_Tooltip");
     102
     103    cancel = new JButton();
    102104    cancel.addActionListener(this);
    103105    cancel.setEnabled(true);
    104106    cancel.setMnemonic(KeyEvent.VK_C);
    105 
    106     current_details = new JTextArea(get("MSMPrompt.No_Details"));
    107 
    108     current_details_label = new JLabel(get("MSMPrompt.Current_Details"));
    109 
    110     merge = new JButton(get("MSMPrompt.Merge"));
     107    Dictionary.registerBoth(add, "MSMPrompt.Cancel", "MSMPrompt.Cancel_Tooltip");
     108
     109    current_details = new JTextArea();
     110    Dictionary.registerText(current_details, "MSMPrompt.No_Details");
     111
     112    current_details_label = new JLabel();
     113    Dictionary.registerText(current_details_label, "MSMPrompt.Current_Details");
     114
     115    merge = new JButton();
    111116    merge.addActionListener(this);
    112117    merge.setEnabled(true);
    113118    merge.setMnemonic(KeyEvent.VK_M);
    114 
    115     new_details = new JTextArea(get("MSMPrompt.No_Details"));
    116 
    117     new_details_label = new JLabel(get("MSMPrompt.New_Details"));
     119    Dictionary.registerBoth(merge, "MSMPrompt.Merge", "MSMPrompt.Merge_Tooltip");
     120
     121    new_details = new JTextArea();
     122    Dictionary.registerText(new_details, "MSMPrompt.No_Details");
     123
     124    new_details_label = new JLabel();
     125    Dictionary.registerText(new_details_label, "MSMPrompt.New_Details");
    118126
    119127    progress = new JProgressBar();
    120128    progress.setStringPainted(true);
    121129
    122     progress_label = new JLabel(get("MSMPrompt.Progress"));
    123 
    124     rename = new JButton(get("MSMPrompt.Rename"));
     130    progress_label = new JLabel();
     131    Dictionary.registerText(progress_label, "MSMPrompt.Progress");
     132
     133    rename = new JButton();
    125134    rename.addActionListener(this);
    126135    rename.setEnabled(false);
    127136    rename.setMnemonic(KeyEvent.VK_N);
    128 
    129     replace = new JButton(get("MSMPrompt.Replace"));
     137    Dictionary.registerBoth(rename, "MSMPrompt.Rename", "MSMPrompt.Rename_Tooltip");
     138
     139    replace = new JButton();
    130140    replace.addActionListener(this);
    131141    replace.setEnabled(false);
    132142    replace.setMnemonic(KeyEvent.VK_R);
    133 
    134     skip = new JButton(get("MSMPrompt.Skip"));
     143    Dictionary.registerBoth(replace, "MSMPrompt.Replace", "MSMPrompt.Replace_Tooltip");
     144
     145    skip = new JButton();
    135146    skip.addActionListener(this);
    136147    skip.setEnabled(true);
    137148    skip.setMnemonic(KeyEvent.VK_S);
     149    Dictionary.registerBoth(skip, "MSMPrompt.Skip", "MSMPrompt.Skip_Tooltip");
    138150
    139151    screen_size = Gatherer.config.screen_size;
     
    147159    String args[] = new String[2];
    148160    args[0] = mde_new.getAttribute("name");
    149     args[1] = get(reason, null);
    150     JOptionPane.showMessageDialog(Gatherer.g_man, get("MSMPrompt.Add_Failed", args), get("MSMPrompt.Add_Failed_Title", null), JOptionPane.ERROR_MESSAGE);
     161    args[1] = Dictionary.newget(reason);
     162    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("MSMPrompt.Add_Failed", args), Dictionary.newget("MSMPrompt.Add_Failed_Title"), JOptionPane.ERROR_MESSAGE);
    151163    }
    152164
     
    181193    public void endMerge() {
    182194    }
     195
    183196    /** Method to indicate that yet another element has been succesfully merged, so that progress bar should reflect this.
    184197     */
     
    201214    dialog.setModal(true);
    202215    dialog.setSize(MDE_SIZE);
    203     dialog.setTitle(get("MSMPrompt.Merge_MDE"));
     216    Dictionary.setText(dialog, "MSMPrompt.Merge_MDE");
    204217    dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata"));
    205218    JPanel content_pane = (JPanel)dialog.getContentPane();
    206219
    207     JLabel element_name_label = new JLabel(get("MSMPrompt.Element_Name"));
     220    JLabel element_name_label = new JLabel();
     221    Dictionary.setText(element_name_label, "MSMPrompt.Element_Name");
    208222    JLabel element_name = new JLabel(MSMUtils.getFullName(mde_cur));
    209223   
    210     JLabel attribute_name_label = new JLabel(get("MSMPrompt.Attribute"));
     224    JLabel attribute_name_label = new JLabel();
     225    Dictionary.setText(attribute_name_label, "MSMPrompt.Attribute");
    211226    JLabel attribute_name = new JLabel(att_new.getAttribute("name"));
    212227
     
    231246    JPanel current_pane = new JPanel();
    232247    current_pane.setLayout(new BorderLayout());
    233     current_pane.setBorder(BorderFactory.createTitledBorder(get("MSMPrompt.Current_Values")));
     248    current_pane.setBorder(BorderFactory.createTitledBorder(Dictionary.newget("MSMPrompt.Current_Values")));
    234249    JScrollPane scroll = new JScrollPane(cur_values);
    235250    current_pane.add(scroll, BorderLayout.CENTER);
    236251
    237252    JPanel new_pane = new JPanel();
    238     new_pane.setBorder(BorderFactory.createTitledBorder(get("MSMPrompt.New_Value")));
     253    new_pane.setBorder(BorderFactory.createTitledBorder(Dictionary.newget("MSMPrompt.New_Value")));
    239254    new_pane.setLayout(new BorderLayout());
    240255    JLabel new_att = new JLabel(MSMUtils.getValue(att_new));
     
    304319    dialog.setModal(true);
    305320    dialog.setSize(MDS_SIZE);
    306     dialog.setTitle(get("MSMPrompt.Merge_MDS"));
     321    Dictionary.setText(dialog, "MSMPrompt.Merge_MDS");
    307322    dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata"));
    308323    JPanel content_pane = (JPanel)dialog.getContentPane();
     
    318333        String opt_cur[] = MSMUtils.getOptionListDetails(mde_cur);
    319334        String ass_cur[] = MSMUtils.getAssignedValuesDetails(mds_cur, mde_cur);
    320         String details_cur = get("MSMPrompt.Structural", str_cur);
     335        String details_cur = Dictionary.newget("MSMPrompt.Structural", str_cur);
    321336        if(opt_cur != null) {
    322         details_cur = details_cur + "\n" + get("MSMPrompt.OptionList", opt_cur);
     337        details_cur = details_cur + "\n" + Dictionary.newget("MSMPrompt.OptionList", opt_cur);
    323338        }
    324339        if(ass_cur != null) {
    325         details_cur = details_cur + "\n" + get("MSMPrompt.AssignedValues", ass_cur);
     340        details_cur = details_cur + "\n" + Dictionary.newget("MSMPrompt.AssignedValues", ass_cur);
    326341        }
    327342        current_details.setText(details_cur);
     
    338353        replace.setEnabled(false);
    339354        skip.setEnabled(true);
    340         current_details.setText(get("MSMPrompt.No_Element"));
     355        current_details.setText(Dictionary.newget("MSMPrompt.No_Element"));
    341356    }
    342357    // New details.
     
    344359    String opt_new[] = MSMUtils.getOptionListDetails(mde_new);
    345360    String ass_new[] = MSMUtils.getAssignedValuesDetails(mds_new, mde_new);
    346     String details_new = get("MSMPrompt.Structural", str_new);
     361    String details_new = Dictionary.newget("MSMPrompt.Structural", str_new);
    347362    if(opt_new != null) {
    348         details_new = details_new + "\n" + get("MSMPrompt.OptionList", opt_new);
     363        details_new = details_new + "\n" + Dictionary.newget("MSMPrompt.OptionList", opt_new);
    349364    }
    350365    if(ass_new != null) {
    351         details_new = details_new + "\n" + get("MSMPrompt.AssignedValues", ass_new);
     366        details_new = details_new + "\n" + Dictionary.newget("MSMPrompt.AssignedValues", ass_new);
    352367    }
    353368    new_details.setText(details_new);
     
    439454    dialog.setModal(true);
    440455    dialog.setSize(RENAME_SIZE);
    441     dialog.setTitle(get("MSMPrompt.Rename"));
    442456    dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata"));
    443     JLabel old_name_label = new JLabel(get("MSMPrompt.Old_Name"));
     457    Dictionary.setText(dialog, "MSMPrompt.Rename");
     458
     459    JLabel old_name_label = new JLabel();
    444460    old_name_label.setPreferredSize(RENAME_LABEL_SIZE);
     461    Dictionary.setText(old_name_label, "MSMPrompt.Old_Name");
    445462
    446463    JLabel old_name = new JLabel(mde_new.getAttribute("name"));
    447464    old_name.setBackground(Color.white);
    448465    old_name.setOpaque(true);
    449 
    450     JLabel new_name_label = new JLabel(get("MSMPrompt.New_Name"));
     466    Dictionary.setTooltip(old_name, "MSMPrompt.Old_Name_Tooltip");
     467
     468    JLabel new_name_label = new JLabel();
    451469    new_name_label.setPreferredSize(RENAME_LABEL_SIZE);
    452          
     470    Dictionary.setText(new_name_label, "MSMPrompt.New_Name");
     471
    453472    JTextField new_name = new JTextField("");
    454473    new_name.grabFocus();
    455 
    456     JButton ok = new JButton(get("General.OK"));
     474    Dictionary.setTooltip(new_name, "MSMPrompt.New_Name_Tooltip");
     475
     476    JButton ok = new JButton();
    457477    ok.addActionListener(this);
    458478    ok.setMnemonic(KeyEvent.VK_O);
     479    Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip");
    459480
    460481    JPanel content_pane = (JPanel) dialog.getContentPane();
     
    523544    String args[] = new String[2];
    524545    args[0] = mde_cur.getAttribute("name");
    525     args[1] = get(reason, null);
    526     JOptionPane.showMessageDialog(Gatherer.g_man, get("MSMPrompt.Remove_Failed", args), get("MSMPrompt.Remove_Failed_Title", null), JOptionPane.ERROR_MESSAGE);
     546    args[1] = Dictionary.newget(reason);
     547    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("MSMPrompt.Remove_Failed", args), Dictionary.newget("MSMPrompt.Remove_Failed_Title"), JOptionPane.ERROR_MESSAGE);
    527548    }
    528549
     
    536557    args[0] = mde_new.getAttribute("name");
    537558    args[1] = new_name;
    538     args[2] = get(reason, null);
    539     JOptionPane.showMessageDialog(Gatherer.g_man, get("MSMPrompt.Rename_Failed", args), get("MSMPrompt.Rename_Failed_Title", null), JOptionPane.ERROR_MESSAGE);
     559    args[2] = Dictionary.newget(reason);
     560    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("MSMPrompt.Rename_Failed", args), Dictionary.newget("MSMPrompt.Rename_Failed_Title"), JOptionPane.ERROR_MESSAGE);
    540561    }
    541562
     
    546567    public Element selectElement(MetadataSet mds_cur) {
    547568    action = Declarations.NO_ACTION;
     569
    548570    // Create
    549571    JDialog dialog = new ModalDialog(Gatherer.g_man);
    550572    dialog.setModal(true);
    551573    dialog.setSize(SELECT_SIZE);
    552     dialog.setTitle(get("MSMPrompt.Select"));
    553574    dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata"));
    554 
    555     JButton ok = new JButton(get("General.OK"));
     575    Dictionary.setText(dialog, "MSMPrompt.Select");
     576
     577    JButton ok = new JButton();
    556578    ok.addActionListener(this);
    557579    ok.setMnemonic(KeyEvent.VK_O);
    558580    ok.setEnabled(false);
     581    Dictionary.setBoth(ok, "General.OK", "General.OK_Tooltip");
    559582
    560583    Node elements_raw[] = ArrayTools.nodeListToNodeArray(mds_cur.getElements());
     
    567590    list.addListSelectionListener(element_list_listener);
    568591    JPanel content_pane = (JPanel) dialog.getContentPane();
     592
    569593    // Layout
    570594    JPanel list_pane = new JPanel();
     
    582606    content_pane.add(list_pane, BorderLayout.CENTER);
    583607    content_pane.add(button_pane, BorderLayout.SOUTH);
     608
    584609    // Display
    585610    dialog.setLocation((screen_size.width - SELECT_SIZE.width) / 2, (screen_size.height - SELECT_SIZE.height) / 2);
     
    615640     * @return An ElementWrapper around the element that it has been matched to.
    616641     * @see org.greenstone.gatherer.msm.MSMPrompt.MSMDialog
    617      * @see org.greenstone.gatherer.util.MED
    618642     */
    619643    public ElementWrapper selectElement(String name) {
     
    626650    dialog.setModal(true);
    627651    dialog.setSize(SELECT_ELEMENT_SIZE);
    628     dialog.setTitle(get("MSMPrompt.Select_Element_Title"));
    629652    dialog.setJMenuBar(new SimpleMenuBar("importingpreviouslyassignedmetadata"));
     653    Dictionary.setText(dialog, "MSMPrompt.Select_Element_Title");
     654
    630655    JPanel content_pane = (JPanel) dialog.getContentPane();
    631656    JPanel control_pane = new JPanel();
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataSet.java

    r5154 r5564  
    1 package org.greenstone.gatherer.msm;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.msm;
     38
    3839import java.io.*;
    3940import java.net.*;
    4041import java.util.*;
    4142import org.apache.xerces.dom.*;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    4345import org.greenstone.gatherer.valuetree.GValueModel;
     
    102104        ElementWrapper value_element = new ElementWrapper((Element)elements.item(i));
    103105        File value_file = new File(file.getParentFile(), value_element.getName() + ".mdv");
    104                 ///ystem.err.println("Searching for " + value_file.getAbsolutePath());
     106        ///ystem.err.println("Searching for " + value_file.getAbsolutePath());
    105107        if(value_file.exists()) {
    106108        Document value_document = Utility.parse(value_file, false);
     
    354356                // Failing all that set an error message
    355357        if(description == null) {
    356         description = Gatherer.dictionary.get("MSM.No_Description");
     358        description = Dictionary.newget("MSM.No_Description");
    357359        }
    358360    }
     
    461463                // Failing all that set an error message
    462464        if(name == null) {
    463         name = Gatherer.dictionary.get("MSM.No_Name");
     465        name = Dictionary.newget("MSM.No_Name");
    464466        }
    465467    }
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataSetManager.java

    r5305 r5564  
    1 package org.greenstone.gatherer.msm;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.msm;
     38
    3839import java.io.*;
    3940import java.util.*;
     
    4142import javax.swing.filechooser.*;
    4243import org.greenstone.gatherer.Configuration;
     44import org.greenstone.gatherer.Dictionary;
    4345import org.greenstone.gatherer.Gatherer;
    4446import org.greenstone.gatherer.cdm.CommandTokenizer;
     
    6163import org.w3c.dom.*;
    6264import org.xml.sax.*;
     65
    6366/** This class is responsible for managing all the metadata sets in the collection and for providing methods for manipulating the aforementioned sets contents.
    6467 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    545548    javax.swing.filechooser.FileFilter filter = new MDSFileFilter();
    546549    chooser.setFileFilter(filter);
    547     int returnVal = chooser.showDialog(Gatherer.g_man, Gatherer.dictionary.get("MSMPrompt.File_Import"));
     550    int returnVal = chooser.showDialog(Gatherer.g_man, Dictionary.newget("MSMPrompt.File_Import"));
    548551    if(returnVal == JFileChooser.APPROVE_OPTION) {
    549552        return importMDS(chooser.getSelectedFile(), true);
  • trunk/gli/src/org/greenstone/gatherer/shell/GImportProgressMonitor.java

    r5325 r5564  
    1 package org.greenstone.gatherer.shell;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.shell;
     38
    3839import java.awt.Component;
    3940import java.util.StringTokenizer;
    4041import javax.swing.JProgressBar;
     42import org.greenstone.gatherer.Dictionary;
    4143import org.greenstone.gatherer.Gatherer;
    4244import org.greenstone.gatherer.shell.GShellProgressMonitor;
     45
    4346/** This implementation of <i>GShellProgressMonitor</i> is designed to parse and translate the progress of a import.pl call.
    4447 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    156159
    157160    public void saving() {
    158     progress_bar.setString(Gatherer.dictionary.get("SaveProgressDialog.Title", (String)null));
     161    progress_bar.setString(Dictionary.newget("SaveProgressDialog.Title"));
    159162    progress_bar.setValue(MAX / (10 * 2));
    160163    }
     
    171174     */
    172175    public void start() {
    173     progress_bar.setString(Gatherer.dictionary.get("FileActions.Calculating_Size", (String)null));
     176    progress_bar.setString(Dictionary.newget("FileActions.Calculating_Size"));
    174177    progress_bar.setValue(MAX / 10);
    175178    num_files = Gatherer.c_man.getCollection().getDocumentCount();
  • trunk/gli/src/org/greenstone/gatherer/shell/GShell.java

    r5349 r5564  
    1 package org.greenstone.gatherer.shell;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.shell;
     38
    3839import java.io.*;
    3940import javax.swing.*;
    4041import javax.swing.event.*;
    4142import javax.swing.tree.*;
     43import org.greenstone.gatherer.Dictionary;
    4244import org.greenstone.gatherer.Gatherer;
    43 import org.greenstone.gatherer.Message;
    4445import org.greenstone.gatherer.msm.GreenstoneArchiveParser;
    4546import org.greenstone.gatherer.shell.GShellListener;
     
    106107    }
    107108    /** This method adds another shell listener to this process.
    108       * @param listener The new <i>GShellListener</i>.
    109       */
     109     * @param listener The new <i>GShellListener</i>.
     110     */
    110111    public void addGShellListener(GShellListener listener) {
    111112    listeners.add(GShellListener.class, listener);
    112113    }
    113114    /** This method removes a certain shell listener from this process.
    114       * @param listener The <i>GShellListener</i> to be removed.
    115       */
     115     * @param listener The <i>GShellListener</i> to be removed.
     116     */
    116117    public void removeGShellListener(GShellListener listener) {
    117118    listeners.remove(GShellListener.class, listener);
     
    150151        }
    151152        ///ystem.err.println("Command: " + command);
    152         fireMessage(type, get("GShell.Command") + ": " + command, status);
     153        fireMessage(type, Dictionary.newget("GShell.Command") + ": " + command, status);
    153154               
    154155        Runtime rt = Runtime.getRuntime();
     
    188189        if(prcs.exitValue() == 0) {
    189190            status = OK;
    190             fireMessage(type, typeAsString(type) + "> " + get("GShell.Success"), status);
     191            fireMessage(type, typeAsString(type) + "> " + Dictionary.newget("GShell.Success"), status);
    191192           
    192193        } else {
    193194            status = ERROR;
    194             fireMessage(type, typeAsString(type) + "> " + get("GShell.Failure"), status);
     195            fireMessage(type, typeAsString(type) + "> " + Dictionary.newget("GShell.Failure"), status);
    195196           
    196197        }
     
    211212    // If no error occured, and this was an import process we now extract any new metadata from the archive directory.
    212213    if(status == OK && type == IMPORT) {
    213         fireMessage(type, typeAsString(type) + "> " + get("GShell.Parsing_Metadata_Start"), status);
     214        fireMessage(type, typeAsString(type) + "> " + Dictionary.newget("GShell.Parsing_Metadata_Start"), status);
    214215        new GreenstoneArchiveParser(progress, this);
    215         fireMessage(type, typeAsString(type) + "> " + get("GShell.Parsing_Metadata_Complete"), status);
     216        fireMessage(type, typeAsString(type) + "> " + Dictionary.newget("GShell.Parsing_Metadata_Complete"), status);
    216217    }
    217218    // Tidy up.
     
    233234    }
    234235    /** Method for firing a message to all interested listeners.
    235       * @param type An <strong>int</strong> indicating the process type.
    236       * @param message The message as a <strong>String</strong>.
    237       * @param status An <strong>int</strong> specifying the current status of the process.
    238       */
     236     * @param type An <strong>int</strong> indicating the process type.
     237     * @param message The message as a <strong>String</strong>.
     238     * @param status An <strong>int</strong> specifying the current status of the process.
     239     */
    239240    public void fireMessage(int type, String message, int status) {
    240241    GShellEvent event = new GShellEvent(this, 0, type, message, status);
     
    248249
    249250    /** Method for firing a process begun event which is called, strangly enough, when the process begins.
    250       * @param type An <strong>int</strong> indicating the process type.
    251       * @param status An <strong>int</strong> specifying the current status of the process.
    252       */
     251     * @param type An <strong>int</strong> indicating the process type.
     252     * @param status An <strong>int</strong> specifying the current status of the process.
     253     */
    253254    protected void fireProcessBegun(int type, int status) {
    254255    GShellEvent event = new GShellEvent(this, 0, type, "", status);
     
    261262    }
    262263    /** Method for firing a process complete event which is called, no surprise here, when the process ends.
    263       * @param type An <strong>int</strong> indicating the process type.
    264       * @param status An <strong>int</strong> specifying the current status of the process.
    265       */
     264     * @param type An <strong>int</strong> indicating the process type.
     265     * @param status An <strong>int</strong> specifying the current status of the process.
     266     */
    266267    protected void fireProcessComplete(int type, int status) {
    267268    GShellEvent event = new GShellEvent(this, 0, type, "", status);
     
    273274    }
    274275    }
    275     /** Retrieve a phrase from the dictionary based on the given key.
    276       * @param key A <strong>String</strong> used to match against a phrase from the <strong>Dictionary</strong>.
    277       * @return The phrase as a <strong>String</strong>.
    278       */
    279     private String get(String key) {
    280     if(key.indexOf('.') == -1) {
    281         key = "GShell." + key;
    282     }
    283     return Gatherer.dictionary.get(key);
    284     }
     276
    285277    /** Method to determine if the user, via the progress monitor, has signalled stop.
    286       * @return A <strong>boolean</strong> indicating if the user wanted to stop.
    287       */
     278     * @return A <strong>boolean</strong> indicating if the user wanted to stop.
     279     */
    288280    private boolean hasSignalledStop() {
    289281    boolean has_signalled_stop = false;
     
    295287
    296288    /** Converts a type into a text representation.
    297       * @param type An <strong>int</strong> which maps to a shell process type.
    298       * @return A <strong>String</strong> which is the thread process's text name.
    299       */
     289     * @param type An <strong>int</strong> which maps to a shell process type.
     290     * @return A <strong>String</strong> which is the thread process's text name.
     291     */
    300292    public String typeAsString(int type) {
    301293    String name = null;
    302294    switch(type) {
    303295    case BUILD:
    304         name = get("GShell.Build");
     296        name = Dictionary.newget("GShell.Build");
    305297        break;
    306298    case IMPORT:
    307         name = get("GShell.Import");
     299        name = Dictionary.newget("GShell.Import");
    308300        break;
    309301    case NEW:
    310         name = get("GShell.New");
     302        name = Dictionary.newget("GShell.New");
    311303        break;
    312304    default:
    313         name = get("GShell.Other");
     305        name = Dictionary.newget("GShell.Other");
    314306    }
    315307    return name;
  • trunk/gli/src/org/greenstone/gatherer/util/ApplyXSLT.java

    r5524 r5564  
    2020package org.greenstone.gatherer.util;
    2121
     22// General Java classes
     23import java.io.StringReader;
     24import java.io.StringWriter;
     25import java.io.File;
     26
    2227// XML classes
    2328import javax.xml.transform.Transformer;
     
    2530import javax.xml.transform.TransformerConfigurationException;
    2631import javax.xml.transform.TransformerException;
    27 
    2832import javax.xml.transform.stream.StreamSource;
    2933import javax.xml.transform.stream.StreamResult;
    30 
    31 // other java classes
    32 import java.io.StringReader;
    33 import java.io.StringWriter;
    34 import java.io.File;
    3534
    3635
     
    5352    }
    5453
    55 
    5654    String stylesheet = args[0];
    5755    String xml_in = args[1];
     
    6563        System.out.println(output.toString());
    6664    }
    67     catch (TransformerConfigurationException e) {
    68         System.err.println("XMLTransformer: couldn't create transformer object: "+e.getMessageAndLocation());
    69         System.err.println(e.getLocationAsString()); 
     65    catch (TransformerConfigurationException ex) {
     66        System.err.println("XMLTransformer: couldn't create transformer object: " + ex.getMessageAndLocation());
     67        System.err.println(ex.getLocationAsString()); 
    7068    }
    71     catch (TransformerException e) {
    72         System.err.println("XMLTransformer: couldn't transform the source: " + e.getMessage());
     69    catch (TransformerException ex) {
     70        System.err.println("XMLTransformer: couldn't transform the source: " + ex.getMessage());
    7371    }
    7472    }
  • trunk/gli/src/org/greenstone/gatherer/util/DragTreeSelectionModel.java

    r4674 r5564  
    1 package org.greenstone.gatherer.util;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.util;
    3838
    3939import java.awt.Point;
     
    114114        args[0] = String.valueOf(file_count);
    115115        args[1] = String.valueOf(folder_count);
    116         suffix = Gatherer.dictionary.get("FileActions.Selected", args);
     116        suffix = Dictionary.newget("FileActions.Selected", args);
    117117        }
    118118        else if(file_count > 1) {
    119119        args = new String[1];
    120120        args[0] = String.valueOf(file_count);
    121         suffix = Gatherer.dictionary.get("FileActions.Files_And_Directory_Selected", args);
     121        suffix = Dictionary.newget("FileActions.Files_And_Directory_Selected", args);
    122122        }
    123123        else if(folder_count > 1) {
    124124        args = new String[1];
    125125        args[0] = String.valueOf(folder_count);
    126         suffix = Gatherer.dictionary.get("FileActions.File_And_Directories_Selected", args);
     126        suffix = Dictionary.newget("FileActions.File_And_Directories_Selected", args);
    127127        }
    128128        else {
    129         suffix = Gatherer.dictionary.get("FileActions.File_And_Directory_Selected");
     129        suffix = Dictionary.newget("FileActions.File_And_Directory_Selected");
    130130        }
    131131    }
     
    134134        args = new String[1];
    135135        args[0] = String.valueOf(file_count);
    136         suffix = Gatherer.dictionary.get("FileActions.Files_Selected", args);
     136        suffix = Dictionary.newget("FileActions.Files_Selected", args);
    137137        }
    138138        else if(file_count == 1) {
    139         suffix = Gatherer.dictionary.get("FileActions.File_Selected");
     139        suffix = Dictionary.newget("FileActions.File_Selected");
    140140        }
    141141    }
     
    144144        args = new String[1];
    145145        args[0] = String.valueOf(folder_count);
    146         suffix = Gatherer.dictionary.get("FileActions.Directories_Selected", args);
     146        suffix = Dictionary.newget("FileActions.Directories_Selected", args);
    147147        }
    148148        else {
    149         suffix = Gatherer.dictionary.get("FileActions.Directory_Selected");
     149        suffix = Dictionary.newget("FileActions.Directory_Selected");
    150150        }
    151151    }
  • trunk/gli/src/org/greenstone/gatherer/util/MetadataXML.java

    r5523 r5564  
    1 package org.greenstone.gatherer.util;
    21/**
    32 *#########################################################################
     
    2625 *########################################################################
    2726 */
    28 import java.awt.Point;
    29 import java.io.BufferedReader;
    30 import java.io.BufferedWriter;
    31 import java.io.File;
    32 import java.io.FileInputStream;
    33 import java.io.FileOutputStream;
    34 import java.io.FileReader;
    35 import java.io.OutputStreamWriter;
    36 import java.io.Writer;
    37 import java.util.ArrayList;
    38 import java.util.Collections;
    39 import java.util.Hashtable;
    40 import java.util.Vector;
    41 import javax.swing.tree.TreePath;
     27package org.greenstone.gatherer.util;
     28
     29import java.io.*;
     30import java.util.*;
     31import javax.swing.tree.*;
    4232import org.greenstone.gatherer.Gatherer;
    43 import org.greenstone.gatherer.gui.SaveProgressDialog;
    4433import org.greenstone.gatherer.msm.ElementWrapper;
    45 import org.greenstone.gatherer.msm.Metadata;
    4634import org.greenstone.gatherer.msm.MetadataSetManager;
    4735import org.greenstone.gatherer.util.Utility;
    4836import org.greenstone.gatherer.valuetree.GValueModel;
    4937import org.greenstone.gatherer.valuetree.GValueNode;
    50 import org.w3c.dom.Element;
    5138
    52 public class MetadataXML {
    53     //private boolean can_wait = true;
    54     private Gatherer gatherer = null;
    55     private Hashtable known_indexes = null;
    56     //private int spare_processes = 25;
    57     //private MetadataXML mummy = null;
    58     private SaveProgressDialog spd = null;
    59     //private Vector complete = null;
    60     //private Vector processes = null;
    61 
    62     static public String METADATA_FILE = "metadata.xml";
    63 
    64     /**
    65     public static void write(Gatherer gatherer, String etc_dir) {
    66     if(gatherer != null && gatherer.c_man != null && gatherer.c_man.getCollection() != null && gatherer.c_man.getCollection().msm != null) {
    67         Vector elements = gatherer.c_man.getCollection().msm.getElements(true);
    68         for(int i = 0; i < elements.size(); i++) {
    69         ElementWrapper element = (ElementWrapper)elements.get(i);
    70         ///ystem.err.print("Checking " + element + " for HFile: ");
    71         GValueModel model = gatherer.c_man.getCollection().msm.getValueTree(element);
    72         if(model != null && (element.getNamespace().equals(MetadataSetManager.HIDDEN) || model.isHierarchy())) {
    73             ///ystem.err.println("Found. Writing file.");
    74             write(model, gatherer.c_man.getCollection().msm, etc_dir);
    75         }
    76         else {
    77             ///ystem.err.println("No file found.");
    78         }
    79         }
    80     }
    81     }
    82     */
    83 
    84     private String getHIndex(Gatherer gatherer, GValueModel model, String value) {
    85     String index = null;
    86     index = (String) known_indexes.get(value);
    87     if(index == null) {
    88         index = model.getHIndex(value);
    89         ///ystem.err.println("Adding to known indexes: " + value + " -> " + index);
    90         known_indexes.put(value, index);
    91     }
    92     return index;
    93     }
    94 
    95     static private String safe(String unsafe) {
    96     String safe_str = "";
    97     for(int i = 0; i < unsafe.length(); i++) {
    98         char c = unsafe.charAt(i);
    99         if(c != ' ') {
    100         safe_str = safe_str + c;
    101         }
    102     }
    103     return safe_str;
    104     }
    105 
     39public class MetadataXML
     40{
    10641    static private void write(Writer w, String text)
    10742    throws Exception {
     
    12964        write(bw, "\"" + Utility.stripNL(value) + "\"\t" + index + "\t\"" + Utility.stripNL(value) + "\"");
    13065        }
    131                 // Very important we do this, or else buffer may not have
    132                 // flushed.
     66        // Very important we do this, or else buffer may not have
     67        // flushed.
    13368        bw.flush();
    13469        bw.close();
     
    13873    }
    13974    }
    140 
    141     /** Returns the given tree path as path formatted string (ie subject\subject\subject).
    142      * @param tree The <strong>JTree</strong> the TreePath came from. Used to determine if the root node should be encoded as well.
    143      * @param path A <strong>TreePath</strong> that you wish to encode to String.
    144      * @param full <i>true</i> if this is the full path (ie a leaf node), <i>false</i> otherwise.
    145      * @return A <strong>String</strong> encoding the information from the TreePath.
    146      * @see javax.swing.JTree
    147      * @see javax.swing.tree.TreePath
    148      */
    149 //      static public String formatPath(JTree tree, TreePath path, boolean full) {
    150 //      String text = "";
    151 //      int i = 0;
    152 //      if(tree == null || (!tree.isRootVisible() && !full)) {
    153 //          i = 1;
    154 //      }
    155 //      for( ; i < path.getPathCount(); i++) {
    156 //          GValueNode node = (GValueNode)path.getPathComponent(i);
    157 //          text = text + node.toString();
    158 //          if(node.getChildCount() > 0) {
    159 //          text = text + "\\";
    160 //          }
    161 //      }
    162 //      if(full && text.endsWith("\\")) {
    163 //          return text.substring(0, text.length() - 1);
    164 //      }
    165 //      return text;
    166 //      }
    167 
    168     static final private long showTime(String message, long time) {
    169     if(time == -1) {
    170                 ///ystem.err.println(message + System.currentTimeMillis());
    171     }
    172     else {
    173                 ///ystem.err.println(message + (System.currentTimeMillis() - time));
    174     }
    175     return System.currentTimeMillis();
    176     }
    17775}
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r5287 r5564  
    1 package org.greenstone.gatherer.util;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.util;
     38
    3839import java.awt.*;
    3940import java.io.*;
     
    4445import org.apache.xerces.parsers.*;
    4546import org.apache.xml.serialize.*;
     47import org.greenstone.gatherer.Dictionary;
    4648import org.greenstone.gatherer.Gatherer;
    4749import org.greenstone.gatherer.util.HTMLStringTokenizer;
    4850import org.w3c.dom.*;
    4951import org.xml.sax.*;
     52
    5053/** To provide a library of common methods, in a static context, for use in the Gatherer.
    5154 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    167170    String abs_path = file.getAbsolutePath();
    168171    while(file != null) {
    169                 // If we are looking for a node within our collection, we expect
    170                 // its path from root to be <col_name>/... without any higher
    171                 // details and without gimport. So if we encounter a gimport we
    172                 // skip to its parent, add that, then return.
     172        // If we are looking for a node within our collection, we expect
     173        // its path from root to be <col_name>/... without any higher
     174        // details and without gimport. So if we encounter a gimport we
     175        // skip to its parent, add that, then return.
    173176        if(in_col && file.getName().equals("gimport")) {
    174177        file = file.getParentFile();
     
    251254    }
    252255    if(result) {
    253                 // Delete file.
     256        // Delete file.
    254257        return file.delete();
    255258    }
     
    490493     */
    491494    static public String formatPath(String key, String raw, int width) {
    492     JLabel label = new JLabel(Gatherer.dictionary.get(key, raw));
     495    JLabel label = new JLabel(Dictionary.newget(key, raw));
    493496    int position = -1;
    494497    while(label.getPreferredSize().width > width && (position = raw.indexOf(File.separator)) != -1) {
    495498        raw = "..." + raw.substring(position + 1);
    496         label.setText(Gatherer.dictionary.get(key, raw));
     499        label.setText(Dictionary.newget(key, raw));
    497500    }
    498501    if(raw.indexOf(File.separator) == -1 && raw.startsWith("...")) {
     
    599602    ImageIcon image = null;
    600603    try {
    601         image = new ImageIcon(ClassLoader.getSystemResource("images/" + Gatherer.dictionary.get("Version") + "/" + filename));
     604        image = new ImageIcon(ClassLoader.getSystemResource("images/" + Dictionary.newget("Version") + "/" + filename));
    602605    }
    603606    catch(NullPointerException exception) {
     
    659662     * @return An <i>int</i> representing the value of the hexidecimal character or -1 if not a hexidecimal.
    660663     */
    661     public static int hexidecimal(char chr) {
     664    static private int hexidecimal(char chr) {
    662665    switch(chr) {
    663666    case '0':
Note: See TracChangeset for help on using the changeset viewer.