Changeset 5536


Ignore:
Timestamp:
2003-09-26T14:58:33+12:00 (21 years ago)
Author:
mdewsnip
Message:

Many more tooltips and improvements to the Dictionary. Still more to come.

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

Legend:

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

    r5529 r5536  
    1 package org.greenstone.gatherer;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer;
     38
    3839import java.awt.Component;
    3940import java.io.*;
     
    4344import javax.swing.text.*;
    4445import javax.swing.tree.*;
    45 import org.greenstone.gatherer.gui.GComboBox;
    46 import org.greenstone.gatherer.gui.border.TitledBorder;
    47 import org.greenstone.gatherer.util.DictionaryTreeNode;
    48 import org.greenstone.gatherer.util.MutableComboBoxEntry;
    49 import org.greenstone.gatherer.util.ArrayTools;
    5046import org.greenstone.gatherer.util.Utility;
     47
    5148/** Extends the ResourceBundle class to allow for the automatic insertion of  arguments. Note that the key names beginning Farg are reserved for formatting. <BR>
    5249 * <BR>
     
    9188    /**  Constructs the Dictionary class by first checking if a Locale has been set. If not the default locale is used, and a ResourceBundle is created. Finally a single important String, Language, is made available outside the class so a more read-able version of the Locale of this Dictionary is present.
    9289     * @param locale The <strong>Locale</strong> used to load the desired dictionary resource bundle.
    93       */
     90     */
    9491    public Dictionary(Locale locale, FontUIResource font) {
    9592    super();
    9693    this.self = this;
    9794
    98     if(KEY_LIST_DEBUG) {
     95    if (KEY_LIST_DEBUG) {
    9996        // Reload the keylist
    10097        File file = new File(KEY_LIST_FILENAME);
     
    116113    // Initialize.
    117114    this.font = font;
    118     if(locale == null) {
     115    if (locale == null) {
    119116        this.locale = Locale.getDefault();
    120117    }
     
    127124    language = dictionary.getString("Language");
    128125    }
    129     /** Change the currently loaded dictionary and update registered (ie dynamic) components as possible. */
    130     public void changeDictionary(Locale locale) {
     126
     127
     128    /** Change the currently loaded dictionary and update registered components */
     129    public void changeDictionary(Locale locale)
     130    {
    131131    this.locale = locale;
     132
    132133    // Load new dictionary
    133134    dictionary = ResourceBundle.getBundle(Utility.DICTIONARY, locale);
    134135    language = dictionary.getString("Language");
    135     Gatherer.println("Having loaded new dictionary: " + language);
     136    Gatherer.println("Loaded new dictionary: " + language);
     137
    136138    // Refresh all registered component
    137     Gatherer.println("Updating components");
    138     for(Iterator keys = keySet().iterator(); keys.hasNext(); ) {
    139         Object component = keys.next();
    140         String[] args = (String[]) get(component);
    141         if(component instanceof AbstractButton) {
    142         register((AbstractButton)component, args, true);
    143         }
    144         else if(component instanceof JComboBox) {
    145         register((JComboBox)component, args, true);
    146         }
    147         else if(component instanceof JDialog) {
    148         register((JDialog)component, args, true);
    149         }
    150         else if(component instanceof JFrame) {
    151         register((JFrame)component, args, true);
    152         }
    153         else if(component instanceof JLabel) {
    154         register((JLabel)component, args, true);
    155         }
    156         else if(component instanceof JTabbedPane) {
    157         register((JTabbedPane)component, args, true);
    158         }
    159         else if(component instanceof JTextComponent) {
    160         register((JTextComponent)component, args, true);
    161         }
    162         else if(component instanceof JTree) {
    163         register((JTree)component, args, true);
    164         }
    165         else if(component instanceof TitledBorder) {
    166         register((TitledBorder)component, args, true);
    167         }
    168         args = null;
    169         component = null;
    170     }
    171     }
     139    // !! TO FINISH !!
     140    Gatherer.println("Updating components...");
     141//      ArrayList temp_list = new ArrayList();
     142//      Iterator components = keySet().iterator();
     143//      while (components.hasNext()) {
     144//          Component component = (Component) components.next();
     145//          temp_list.add(component);
     146//      }
     147
     148//      for (int i = 0; i < temp_list.size(); i++) {
     149//          Component component = (Component) temp_list.get(i);
     150//          ComponentDetails details = (ComponentDetails) get(component);
     151//          oldSetBoth(component, details.text_key, details.text_args, details.tooltip_key);
     152//      }
     153
     154//      for (Iterator keys = keySet().iterator(); keys.hasNext(); ) {
     155//          Component component = (Component) keys.next();
     156//          ComponentDetails details = (ComponentDetails) get(component);
     157//          oldSetBoth(component, details.text_key, details.text_args, details.tooltip_key);
     158//      }
     159    }
     160
     161
     162    /** Change the currently loaded dictionary and update registered (ie dynamic) components as possible. */
     163//      public void oldChangeDictionary(Locale locale) {
     164//      this.locale = locale;
     165//      // Load new dictionary
     166//      dictionary = ResourceBundle.getBundle(Utility.DICTIONARY, locale);
     167//      language = dictionary.getString("Language");
     168//      Gatherer.println("Having loaded new dictionary: " + language);
     169//      // Refresh all registered component
     170//      Gatherer.println("Updating components");
     171//      for(Iterator keys = keySet().iterator(); keys.hasNext(); ) {
     172//          Object component = keys.next();
     173//          String[] args = (String[]) get(component);
     174//          if(component instanceof AbstractButton) {
     175//          register((AbstractButton)component, args, true);
     176//          }
     177//          else if(component instanceof JComboBox) {
     178//          register((JComboBox)component, args, true);
     179//          }
     180//          else if(component instanceof JDialog) {
     181//          register((JDialog)component, args, true);
     182//          }
     183//          else if(component instanceof JFrame) {
     184//          register((JFrame)component, args, true);
     185//          }
     186//          else if(component instanceof JLabel) {
     187//          register((JLabel)component, args, true);
     188//          }
     189//          else if(component instanceof JTabbedPane) {
     190//          register((JTabbedPane)component, args, true);
     191//          }
     192//          else if(component instanceof JTextComponent) {
     193//          register((JTextComponent)component, args, true);
     194//          }
     195//          else if(component instanceof JTree) {
     196//          register((JTree)component, args, true);
     197//          }
     198//          else if(component instanceof TitledBorder) {
     199//          register((TitledBorder)component, args, true);
     200//          }
     201//          args = null;
     202//          component = null;
     203//      }
     204//      }
     205
    172206    /** Remove the component from our registered components list. */
    173207    public void deregister(Object component) {
     
    207241
    208242
    209     /** Overloaded to call get with both a key and an empty argument array.
     243    /**
     244     * @deprecated
     245     * Overloaded to call get with both a key and an empty argument array.
    210246     * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    211247     * @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.
     
    214250    return get(key, (String[])null);
    215251    }
    216     /** Convienence method with transforms the second string argument into a string array. */
     252    /**
     253     * @deprecated
     254     * Convienence method with transforms the second string argument into a string array. */
    217255    public String get(String key, String arg) {
    218256    String[] args = new String[1];
     
    220258    return get(key, args);
    221259    }
     260
    222261    /** 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>
    223       * 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>.
    224       * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    225       * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.
    226       * @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.
    227       */
     262     * 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>.
     263     * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
     264     * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.
     265     * @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.
     266     */
    228267    public String get(String key, String args[]) {
    229268    if(key_list != null) {
     
    269308    }
    270309    catch (Exception e) {
    271         // if(!key.endsWith("_Tooltip")) {
    272         System.err.println("Missing value for key: " + key);
    273         // }
    274         //e.printStackTrace();
     310        System.err.println("Missing value for key: " + key);
    275311        return key;
    276312    }
     
    287323    static public void setBoth(Component component, String text_key, String tooltip_key)
    288324    {
    289     self.oldSetBoth(component, text_key, null, tooltip_key);
     325    setText(component, text_key);
     326    setTooltip(component, tooltip_key);
    290327    }
    291328
     
    293330    static public void setText(Component component, String text_key)
    294331    {
    295     self.oldSetText(component, text_key, null);
     332    setText(component, text_key, null);
    296333    }
    297334
     
    299336    static public void setText(Component component, String text_key, String[] args)
    300337    {
    301     self.oldSetText(component, text_key, args);
     338    if (component != null) {
     339        // Update the component using the AWTEvent queue
     340        ComponentDetails details = new ComponentDetails(true, text_key, args, false, null);
     341        ComponentUpdateTask task = new ComponentUpdateTask(component, details);
     342        SwingUtilities.invokeLater(task);
     343    }
    302344    }
    303345
     
    305347    static public void setTooltip(Component component, String tooltip_key)
    306348    {
    307     self.oldSetTooltip(component, tooltip_key);
    308     }
    309 
    310 
    311     private void oldSetBoth(Component component, String text_key, String[] args, String tooltip_key)
    312     {
    313     oldSetText(component, text_key, args);
    314     oldSetTooltip(component, tooltip_key);
    315     }
    316 
    317 
    318     private void oldSetText(Component component, String text_key, String[] args)
     349    if (component != null) {
     350        // Update the component using the AWTEvent queue
     351        ComponentDetails details = new ComponentDetails(false, null, null, true, tooltip_key);
     352        ComponentUpdateTask task = new ComponentUpdateTask(component, details);
     353        SwingUtilities.invokeLater(task);
     354    }
     355    }
     356
     357
     358    static public void registerBoth(Component component, String text_key, String tooltip_key)
     359    {
     360    registerText(component, text_key, null);
     361    registerTooltip(component, tooltip_key);
     362    }
     363
     364
     365    static public void registerText(Component component, String text_key)
     366    {
     367    registerText(component, text_key, null);
     368    }
     369
     370
     371    static public void registerText(Component component, String text_key, String[] args)
    319372    {
    320373    if (component != null) {
    321374        // Update the component's details
    322         ComponentDetails details = (ComponentDetails) remove(component);
     375        ComponentDetails details = (ComponentDetails) self.remove(component);
    323376        if (details == null) {
    324377        details = new ComponentDetails(true, text_key, args, false, null);
     
    329382        details.text_args = args;
    330383        }
    331         put(component, details);
     384        self.put(component, details);
    332385
    333386        // Update the component using the AWTEvent queue
    334         RegisteredComponentUpdateTask task = new RegisteredComponentUpdateTask(component);
     387        ComponentUpdateTask task = new ComponentUpdateTask(component, details);
    335388        SwingUtilities.invokeLater(task);
    336389    }
     
    338391
    339392
    340     private void oldSetTooltip(Component component, String tooltip_key)
     393    static public void registerTooltip(Component component, String tooltip_key)
    341394    {
    342395    if (component != null) {
    343396        // Update the component's details
    344         ComponentDetails details = (ComponentDetails) remove(component);
     397        ComponentDetails details = (ComponentDetails) self.remove(component);
    345398        if (details == null) {
    346399        details = new ComponentDetails(false, null, null, true, tooltip_key);
     
    350403        details.tooltip_key = tooltip_key;
    351404        }
    352         put(component, details);
     405        self.put(component, details);
    353406
    354407        // Update the component using the AWTEvent queue
    355         RegisteredComponentUpdateTask task = new RegisteredComponentUpdateTask(component);
     408        ComponentUpdateTask task = new ComponentUpdateTask(component, details);
    356409        SwingUtilities.invokeLater(task);
    357410    }
     
    359412
    360413
    361     private class ComponentDetails
     414    static private class ComponentDetails
    362415    {
    363416    public boolean has_text;
     
    379432
    380433
    381     private class RegisteredComponentUpdateTask
     434    static private class ComponentUpdateTask
    382435    implements Runnable {
    383436
    384437    private Component component;
    385     private ComponentDetails details;
    386438    private String text = null;
    387439    private String tooltip = null;
    388440
    389     public RegisteredComponentUpdateTask(Component component)
     441    public ComponentUpdateTask(Component component, ComponentDetails details)
    390442    {
    391443        this.component = component;
    392         this.details = (ComponentDetails) get(component);
    393444
    394445        if (details.has_text) {
    395         text = get(details.text_key, details.text_args);
     446        text = self.get(details.text_key, details.text_args);
    396447        }
    397448        if (details.has_tooltip) {
    398         tooltip = get(details.tooltip_key, (String[]) null);
     449        tooltip = self.get(details.tooltip_key, (String[]) null);
    399450        }
    400451    }
     
    416467        else if (component instanceof JTextComponent) {
    417468            ((JTextComponent) component).setText(text);
     469            ((JTextComponent) component).setCaretPosition(0);
    418470        }
    419471        else {
     
    434486    /**
    435487     * @deprecated
    436      * Register an abstract button component */
    437     public void register(AbstractButton component, String[] args, boolean already_registered)
     488     * Register a tab pane component. */
     489    static public void register(JTabbedPane component)
    438490    {
    439491    if(component != null) {
    440         // Determine the key
    441         String key = "";
    442         if(!already_registered) {
    443         key = component.getText();
    444         }
    445         else {
    446         key = args[args.length - 1];
    447         }
    448         // Update the component using the AWTEvent queue
    449         String value = get(key, args);
    450         String tooltip = get(key + "_Tooltip", (String[])null);
    451         ChangeTask task = new AbstractButtonChangeTask(component, key, value, tooltip);
    452         SwingUtilities.invokeLater(task);
    453         // Register as necessary
    454         if(!already_registered) {
    455         args = ArrayTools.add(args, key);
    456         put(component, args);
    457         }
    458     }
    459     }
    460 
    461     /**
    462      * @deprecated
    463      * Register a JCheckBox component */
    464     public void register(JCheckBox component, String[] args, boolean already_registered)
    465     {
    466     }
    467 
    468     /**
    469      * @deprecated
    470      * Register a combobox component. */
    471     public void register(JComboBox component, String[] args, boolean already_registered) {
    472     if(component != null) {
    473         // If not already registered then args will be null.
    474         if(!already_registered) {
    475         args = new String[component.getItemCount()];
    476         }
    477         // Retrieve the tooltip. The key is mostly derived from the comboboxes name.
    478         String key = component.getName();
    479         String tooltip = get(key + "_Tooltip", (String[])null);
    480         ChangeTask task = new JComboBoxChangeTask(component, key, -1, tooltip);
    481         SwingUtilities.invokeLater(task);
    482         // Iterate through the combobox, updating values and recording the original key of each item in args.
    483         for(int i = 0; i < args.length; i++) {
    484         if(args[i] == null) {
    485             args[i] = component.getItemAt(i).toString();
    486         }
    487         String value = get(args[i], (String[])null);
    488         task = new JComboBoxChangeTask(component, key, i, value);
    489         SwingUtilities.invokeLater(task);
    490         }
    491         // Register if necessary
    492         if(!already_registered) {
    493         put(component, args);
    494         }
    495     }
    496     }
    497 
    498     /**
    499      * @deprecated
    500      * Register a dialog component. */
    501     public void register(JDialog component, String[] args, boolean already_registered) {
    502     if(component != null) {
    503         // Determine the key
    504         String key = "";
    505         if(!already_registered) {
    506         key = component.getTitle();
    507         }
    508         else {
    509         key = args[args.length - 1];
    510         }
    511         // Update the component using the AWTEvent queue
    512         String value = get(key, args);
    513         ChangeTask task = new JDialogChangeTask(component, key, value);
    514         SwingUtilities.invokeLater(task);
    515         // Register as necessary
    516         if(!already_registered) {
    517         args = ArrayTools.add(args, key);
    518         put(component, args);
    519         }
    520     }
    521     }
    522 
    523     /**
    524      * @deprecated
    525      * Register a frame component. */
    526     public void register(JFrame component, String[] args, boolean already_registered) {
    527     if(component != null) {
    528         // Determine the key
    529         String key = "";
    530         if(!already_registered) {
    531         key = component.getTitle();
    532         }
    533         else {
    534         key = args[args.length - 1];
    535         }
    536         // Update the component using the AWTEvent queue
    537         String value = get(key, args);
    538         ChangeTask task = new JFrameChangeTask(component, key, value);
    539         SwingUtilities.invokeLater(task);
    540         // Register as necessary
    541         if(!already_registered) {
    542         args = ArrayTools.add(args, key);
    543         put(component, args);
    544         }
    545     }
    546     }
    547 
    548     /**
    549      * @deprecated
    550      * Register a label component. */
    551     public void register(JLabel component, String[] args, boolean already_registered) {
    552     if(component != null) {
    553         // Determine the key
    554         String key = "";
    555         if(!already_registered) {
    556         key = component.getText();
    557         }
    558         else {
    559         key = args[args.length - 1];
    560         }
    561         // Update the component using the AWTEvent queue
    562         String value = get(key, args);
    563         ChangeTask task = new JLabelChangeTask(component, key, value);
    564         SwingUtilities.invokeLater(task);
    565         // Register as necessary
    566         if(!already_registered) {
    567         args = ArrayTools.add(args, key);
    568         put(component, args);
    569         }
    570     }
    571     }
    572 
    573     /**
    574      * @deprecated
    575      * Register a tab pane component. */
    576     public void register(JTabbedPane component, String[] args, boolean already_registered) {
    577     if(component != null) {
    578         // If not already registered then args will be null.
    579         if(!already_registered) {
    580         args = new String[component.getTabCount()];
    581         }
     492        String[] args = new String[component.getTabCount()];
     493
    582494        // Iterate through the tabbed panes tabs, updating values and recording the original key of each item in args.
    583495        for(int i = 0; i < args.length; i++) {
     
    585497            args[i] = component.getTitleAt(i);
    586498        }
    587         String value = get(args[i], (String[])null);
    588         String tooltip = get(args[i] + "_Tooltip", (String[])null);
    589         ChangeTask task = new JTabbedPaneChangeTask(component, args[i], i, value, tooltip);
     499        String value = self.get(args[i], (String[])null);
     500        String tooltip = self.get(args[i] + "_Tooltip", (String[])null);
     501        JTabbedPaneChangeTask task = new JTabbedPaneChangeTask(component, args[i], i, value, tooltip);
    590502        SwingUtilities.invokeLater(task);
    591503        }
    592         // Register if necessary
    593         if(!already_registered) {
    594         put(component, args);
    595         }
    596     }
    597     }
    598 
    599     /**
    600      * @deprecated
    601      * Register a text component. */
    602     public void register(JTextComponent component, String[] args, boolean already_registered)
    603     {
    604     if (component != null) {
    605         // Determine the key
    606         String key = "";
    607         if (!already_registered) {
    608         key = component.getText();
    609         }
    610         else {
    611         key = args[args.length - 1];
    612         }
    613 
    614         // Update the component using the AWTEvent queue
    615         String value = get(key, args);
    616         String tooltip = get(key + "_Tooltip", (String[])null);
    617         ChangeTask task = new JTextComponentChangeTask(component, key, value, tooltip);
    618         SwingUtilities.invokeLater(task);
    619         // Register as necessary
    620         if (!already_registered) {
    621         args = ArrayTools.add(args, key);
    622         put(component, args);
    623         }
    624     }
    625     }
    626 
    627     /**
    628      * @deprecated
    629      * Register a tree component. */
    630     public void register(JTree component, String[] args, boolean already_registered) {
    631     if(component != null) {
    632         // Retrieve the tooltip using the components name
    633         String key = component.getName();
    634         String tooltip = get(key + "_Tooltip", (String[])null);
    635         ChangeTask task = new JTreeChangeTask(component, key, tooltip);
    636         SwingUtilities.invokeLater(task);
    637         // A tree can never be previously registered. In otherwords the keys are harvested each time. Thus for a tree to remain consistant its up to the implementer to implement DictionaryTreeNode for the tree nodes!
    638         ArrayList nodes = new ArrayList();
    639         nodes.add(component.getModel().getRoot());
    640         while(nodes.size() > 0) {
    641         DictionaryTreeNode node = (DictionaryTreeNode) nodes.remove(0);
    642         // Update
    643         String value = get(node.getKey(), (String[])null);
    644         task = new JTreeChangeTask(component, node.getKey(), node, value);
    645         SwingUtilities.invokeLater(task);
    646         // Add children to nodes
    647         for(int i = 0; i < node.getChildCount(); i++) {
    648             nodes.add(node.getChildAt(i));
    649         }
    650         }
    651     }
    652     }
    653 
    654     /**
    655      * @deprecated
    656      * Register a titled border component. */
    657     public void register(TitledBorder component, String[] args, boolean already_registered) {
    658     if(component != null) {
    659         // Determine the key
    660         String key = "";
    661         if(!already_registered) {
    662         key = component.getTitle();
    663         }
    664         else {
    665         key = args[args.length - 1];
    666         }
    667         // Update the component using the AWTEvent queue
    668         String value = get(key, args);
    669         ChangeTask task = new TitledBorderChangeTask(component, key, value);
    670         SwingUtilities.invokeLater(task);
    671         // Register as necessary
    672         if(!already_registered) {
    673         args = ArrayTools.add(args, key);
    674         put(component, args);
    675         }
    676     }
    677     }
    678 
    679     /** A get method called internally by components that have been previously been registered, which means that arg[index] is the original key value. Index is usually the last entry in the array, however this is not true for comboboxes, tabbed panes and trees. */
    680     private String get(String[] args, int index) {
    681     return get(args[index], args);
    682     }
    683 
    684 
    685     private abstract class ChangeTask
    686     implements Runnable {
    687     protected String key;
    688     protected String value;
    689     public ChangeTask(String key, String value) {
    690         this.key = key;
     504    }
     505    }
     506
     507
     508    /** Updates a tabbed panes tab title and tooltip. */
     509    static private class JTabbedPaneChangeTask
     510    implements Runnable {
     511    protected String key;
     512    protected String value;
     513    private int index;
     514    private JTabbedPane component;
     515    private String tooltip;
     516
     517    public JTabbedPaneChangeTask(JTabbedPane component, String key, int index, String value, String tooltip) {
     518        this.key = key;
    691519        this.value = value;
    692     }
    693     public void run() {
    694     }
    695     }
    696 
    697     /** Update the text and tooltip for this button. */
    698     private class AbstractButtonChangeTask
    699     extends ChangeTask {
    700     private AbstractButton component;
    701     private String tooltip;
    702     public AbstractButtonChangeTask(AbstractButton component, String key, String value, String tooltip) {
    703         super(key, value);
    704         this.component = component;
    705         this.tooltip = tooltip;
    706     }
    707     public void run() {
    708         component.setText(value);
    709         // if(!tooltip.equals(key+"_Tooltip")) {
    710         component.setToolTipText(tooltip);
    711         // }
    712         // else {
    713         // component.setToolTipText(null);
    714         // }
    715     }
    716     }
    717     /** Update the text associated with a combobox. If the index used is -1 then we are setting the tooltip for this combobox. */
    718     private class JComboBoxChangeTask
    719     extends ChangeTask {
    720     private int index;
    721     private JComboBox component;
    722     public JComboBoxChangeTask(JComboBox component, String key, int index, String value) {
    723         super(key, value);
    724         this.component = component;
    725         this.index = index;
    726     }
    727     public void run() {
    728         if(index != -1) {
    729         try {
    730             MutableComboBoxEntry entry = (MutableComboBoxEntry)component.getItemAt(index);
    731             entry.setText(value);
    732         }
    733         catch (Exception error) {
    734         }
    735         }
    736         else {
    737         if(!value.equals(key+"_Tooltip")) {
    738             component.setToolTipText(value);
    739         }
    740         else {
    741             component.setToolTipText(null);
    742         }
    743         }
    744     }
    745     }
    746     /** Update the title of this dialog. */
    747     private class JDialogChangeTask
    748     extends ChangeTask {
    749     private JDialog component;
    750     public JDialogChangeTask(JDialog component, String key, String value) {
    751         super(key, value);
    752         this.component = component;
    753     }
    754     public void run() {
    755         component.setTitle(value);
    756     }
    757     }
    758     /** Update the title of this frame. */
    759     private class JFrameChangeTask
    760     extends ChangeTask {
    761     private JFrame component;
    762     public JFrameChangeTask(JFrame component, String key, String value) {
    763         super(key, value);
    764         this.component = component;
    765     }
    766     public void run() {
    767         component.setTitle(value);
    768     }
    769     }
    770 
    771     /** Update the text of this label. */
    772     private class JLabelChangeTask
    773     extends ChangeTask {
    774     private JLabel component;
    775 
    776     public JLabelChangeTask(JLabel component, String key, String value) {
    777         super(key, value);
    778         this.component = component;
    779     }
    780 
    781     public void run() {
    782         component.setText(value);
    783     }
    784     }
    785 
    786     /** Updates a tabbed panes tab title and tooltip. */
    787     private class JTabbedPaneChangeTask
    788     extends ChangeTask {
    789     private int index;
    790     private JTabbedPane component;
    791     private String tooltip;
    792     public JTabbedPaneChangeTask(JTabbedPane component, String key, int index, String value, String tooltip) {
    793         super(key, value);
    794         this.component = component;
    795         this.index = index;
    796         this.tooltip = tooltip;
    797     }
    798     public void run() {
    799         component.setTitleAt(index, value);
    800         if(!tooltip.equals(key+"_Tooltip")) {
    801         component.setToolTipTextAt(index, tooltip);
    802         }
    803         else {
    804         component.setToolTipTextAt(index, null);
    805         }
    806     }
    807     }
    808     /** Update the text and tooltip of this text component. */
    809     private class JTextComponentChangeTask
    810     extends ChangeTask {
    811     private JTextComponent component;
    812     private String tooltip;
    813     public JTextComponentChangeTask(JTextComponent component, String key, String value, String tooltip) {
    814         super(key, value);
    815         this.component = component;
    816         this.tooltip = tooltip;
    817     }
    818     public void run() {
    819         component.setText(value);
    820         if(!tooltip.equals(key+"_Tooltip")) {
    821         component.setToolTipText(tooltip);
    822         }
    823         else {
    824         component.setToolTipText(null);
    825         }
    826     }
    827     }
    828     /** Update the tooltip of a tree and its tree node's labels. Shouldn't really ever be used on a dynamic tree, but is quite useful for a 'contents' tree type control. */
    829     private class JTreeChangeTask
    830     extends ChangeTask {
    831     private DictionaryTreeNode node;
    832     private JTree component;
    833     public JTreeChangeTask(JTree component, String key, String value) {
    834         super(key, value);
    835         this.component = component;
    836     }
    837     public JTreeChangeTask(JTree component, String key, DictionaryTreeNode node, String value) {
    838         super(key, value);
    839         this.component = component;
    840         this.node = node;
    841     }
    842     public void run() {
    843         if(value != null) {
    844         node.setText(value);
    845         ((DefaultTreeModel)component.getModel()).nodeChanged((TreeNode)node);
    846         }
    847                 // Set the tool tip
    848         else {
    849         if(!value.equals(key+"_Tooltip")) {
    850             component.setToolTipText(value);
    851         }
    852         else {
    853             component.setToolTipText(null);
    854         }
    855         }
    856     }
    857     }
    858     /** Update the title of this titled border. */
    859     private class TitledBorderChangeTask
    860     extends ChangeTask {
    861     private TitledBorder component;
    862     public TitledBorderChangeTask(TitledBorder component, String key, String value) {
    863         super(key, value);
    864         this.component = component;
    865     }
    866     public void run() {
    867         component.setTitle(value);
    868         component.getParent().repaint();
    869     }
     520        this.component = component;
     521        this.index = index;
     522        this.tooltip = tooltip;
     523    }
     524    public void run() {
     525        component.setTitleAt(index, value);
     526        if(!tooltip.equals(key+"_Tooltip")) {
     527        component.setToolTipTextAt(index, tooltip);
     528        }
     529        else {
     530        component.setToolTipTextAt(index, null);
     531        }
     532    }
    870533    }
    871534}
  • trunk/gli/src/org/greenstone/gatherer/GAuthenticator.java

    r5349 r5536  
    1 package org.greenstone.gatherer;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
    38 import java.awt.Color;
    39 import java.awt.Component;
    40 import java.awt.Dimension;
    41 import java.awt.GridLayout;
    42 import java.awt.Point;
    43 import java.awt.Toolkit;
    44 import java.awt.event.ActionEvent;
    45 import java.awt.event.ActionListener;
    46 import java.net.Authenticator;
    47 import java.net.PasswordAuthentication;
    48 import javax.swing.BorderFactory;
    49 import javax.swing.JButton;
    50 import javax.swing.JDialog;
    51 import javax.swing.JFrame;
    52 import javax.swing.JLabel;
    53 import javax.swing.JTextField;
    54 import javax.swing.JPanel;
    55 import javax.swing.JPasswordField;
     37package org.greenstone.gatherer;
     38
     39import java.awt.*;
     40import java.awt.event.*;
     41import java.net.*;
     42import javax.swing.*;
     43
    5644/** Provides a graphic authenticator for network password requests.
    5745 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    7260    /** The default size of this dialog. */
    7361    static final private Dimension SIZE = new Dimension(410,140);
     62
    7463    /** Constructor. */
    7564    public GAuthenticator() {
    7665    }
     66
    7767    /** Prompt the user for authentication using a pretty dialog box.
    78       * @return A <strong>PasswordAuthentication</strong> object containing the login and password valuees the user has submitted.
    79       * @see org.greenstone.gatherer.GAuthenticator.AuthenticationActionListener
    80       * @see org.greenstone.gatherer.GAuthenticator.RequestFocusListener
    81       */
     68     * @return A <strong>PasswordAuthentication</strong> object containing the login and password valuees the user has submitted.
     69     * @see org.greenstone.gatherer.GAuthenticator.AuthenticationActionListener
     70     * @see org.greenstone.gatherer.GAuthenticator.RequestFocusListener
     71     */
    8272    protected PasswordAuthentication getPasswordAuthentication() {
    8373    // Component definition.
    84     dialog = new JDialog (Gatherer.g_man, get("GAuthenticator.Title"), true);
     74    dialog = new JDialog (Gatherer.g_man, Dictionary.newget("GAuthenticator.Title"), true);
    8575    dialog.setModal(true);
    8676    dialog.setSize(SIZE);
    87     JPanel content_pane = (JPanel)dialog.getContentPane();
     77    JPanel content_pane = (JPanel) dialog.getContentPane();
    8878    JLabel title_label = new JLabel(getRequestingPrompt());
    8979    JPanel user_panel = new JPanel();
    90     JLabel username_label = new JLabel(get("GAuthenticator.Username"));
     80    JLabel username_label = new JLabel();
     81    Dictionary.setText(username_label, "GAuthenticator.Username");
    9182    JTextField username = new JTextField();
     83    Dictionary.setTooltip(username, "GAuthenticator.Username_Tooltip");
    9284    JPanel password_panel = new JPanel();
    93     JLabel password_label = new JLabel(get("GAuthenticator.Password"));
     85    JLabel password_label = new JLabel();
     86    Dictionary.setText(password_label, "GAuthenticator.Password");
    9487    password = new JPasswordField();
    95     password.setEchoChar ('*');
     88    password.setEchoChar('*');
     89    Dictionary.setTooltip(password, "GAuthenticator.Password_Tooltip");
    9690    JPanel button_panel = new JPanel();
    97     ok_button = new JButton(get("General.OK"));
    98     cancel_button = new JButton(get("General.Cancel"));
    99     // Connect listeners.
     91    ok_button = new JButton();
     92    Dictionary.setBoth(ok_button, "General.OK", "General.OK_Tooltip");
     93    cancel_button = new JButton();
     94    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip");
     95
     96    // Connection
    10097    cancel_button.addActionListener(new AuthenticationActionListener(true));
    10198    ok_button.addActionListener(new AuthenticationActionListener(false));
    10299    password.addActionListener(new AuthenticationActionListener(false));
    103100    username.addActionListener(new RequestFocusListener(password));
    104     // Layout the components.
     101
     102    // Layout
    105103    user_panel.setLayout(new GridLayout(1,2));
    106104    user_panel.add(username_label);
     
    121119    content_pane.add(password_panel);
    122120    content_pane.add(button_panel);
    123     // Position the window.
     121
     122    // Position the window
    124123    Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
    125124    dialog.setLocation((screen_size.width - SIZE.width) / 2, (screen_size.height - SIZE.height) / 2);
     
    134133    }
    135134
    136     /** Retrieve a phrase from the dictionary.
    137       * @param key A <strong>String</strong> used to determine what phrase to retrieve.
    138       * @return The required phrase as a <strong>String</strong>, or at least some meaningful error message.
    139       * @see org.greenstone.gatherer.Dictionary
    140       * @see org.greenstone.gatherer.Gatherer
    141       */
    142     private String get(String key) {
    143     if(key.indexOf(".") == -1) {
    144         key = "GAuthenticator." + key;
    145     }
    146     return Gatherer.dictionary.get(key);
    147     }
     135
    148136    /** Detects actions upon any control that attempt to submit the current details for authentication. */
    149137    private class AuthenticationActionListener
     
    153141    /** Constructor.
    154142     * @param cancel_action <i>true</i> if this authentication action cancels the authentication, <i>false</i> otherwise.
    155             */
     143     */
    156144    public AuthenticationActionListener(boolean cancel_action) {
    157145        this.cancel_action = cancel_action;
    158146    }
    159147    /** Any implementation of an ActionListener must include this method so that we can be informed when an action has been performed on our registered controls, allowing us to dispose of the authentication dialog after determining if this is a submit action or a cancel one.
    160             * @param event An <strong>ActionEvent</strong> with information about the event that fired this method.
    161             */
     148     * @param event An <strong>ActionEvent</strong> with information about the event that fired this method.
     149     */
    162150    public void actionPerformed(ActionEvent event) {
    163151        authentication_cancelled = cancel_action;
     
    165153    }
    166154    }
     155
    167156    /** This listener detects actions on registered controls, and when they occur ensures the focus is moved to some targetted component. */
    168157    private class RequestFocusListener
     
    172161    /** Constructor.
    173162     * @param target The <strong>Component</strong> you wish to gain focus when an action is performed on a registered control.
    174             */
     163     */
    175164    public RequestFocusListener(Component target) {
    176165        this.target = target;
    177166    }
    178167    /** Any implementation of an ActionListener must include this method so that we can be informed when an action has been performed on our registered controls, allowing us to request focus in the target control.
    179             * @param event An <strong>ActionEvent</strong> with information about the event that fired this method.
    180             */
     168     * @param event An <strong>ActionEvent</strong> with information about the event that fired this method.
     169     */
    181170    public void actionPerformed(ActionEvent event) {
    182171        target.requestFocus();
     
    184173    }
    185174}
    186 
    187 
    188 
    189 
    190 
    191 
    192 
  • trunk/gli/src/org/greenstone/gatherer/cdm/GeneralManager.java

    r5529 r5536  
    2525 *########################################################################
    2626 */
    27 
    2827package org.greenstone.gatherer.cdm;
    2928
     
    3231import javax.swing.*;
    3332import javax.swing.event.*;
    34 import javax.swing.text.JTextComponent;
    3533import javax.swing.tree.*;
    3634import org.greenstone.gatherer.Configuration;
     
    4139import org.greenstone.gatherer.cdm.Control;
    4240import org.greenstone.gatherer.gui.EmailField;
    43 import org.greenstone.gatherer.msm.MSMUtils;
    4441import org.greenstone.gatherer.util.Utility;
     42
    4543/** This class is responsible for generating the necessary GUI components. It does this by calling the getEditControls() method of the appropriate class (i.e. IndexManager for index related edits). It also is in charge of correctly adding (and removing) listeners, using phrases from the <strong>Dictionary</strong> rather than the text keys inserted in the component classes, and several other aspects of the design page, including the config file section tree.
    4644* @author John Thompson, Greenstone Digital Library, University of Waikato
     
    7371    JPanel tree_pane = new JPanel();
    7472    JLabel title = new JLabel();
    75     Gatherer.dictionary.setText(title, "CDM.GUI.Design_Topics", null);
     73    Dictionary.registerText(title, "CDM.GUI.Design_Topics");
    7674    tree = new DesignTree();
    7775    view = controls;
     
    176174        title_label = new JLabel();
    177175        title_label.setHorizontalAlignment(JLabel.CENTER);
    178         Gatherer.dictionary.setText(title_label, "CDM.General.Title", null);
     176        Dictionary.registerText(title_label, "CDM.General.Title");
    179177
    180178        instructions_textarea = new JTextArea();
     
    184182        instructions_textarea.setRows(6);
    185183        instructions_textarea.setWrapStyleWord(true);
    186         Gatherer.dictionary.setText(instructions_textarea, "CDM.General.Instructions", null);
     184        Dictionary.registerText(instructions_textarea, "CDM.General.Instructions");
    187185
    188186        JPanel all_details_panel = new JPanel();
     
    191189        creator_label = new JLabel();
    192190        creator_label.setPreferredSize(LABEL_SIZE);
    193         Gatherer.dictionary.setText(creator_label, "CDM.General.Email.Creator", null);
     191        Dictionary.registerText(creator_label, "CDM.General.Email.Creator");
    194192
    195193        creator_emailfield = new EmailField(Gatherer.config.getColor("coloring.error_background", false));
    196         Gatherer.dictionary.setTooltip(creator_emailfield, "CDM.General.Email.Creator_Tooltip");
     194        Dictionary.registerTooltip(creator_emailfield, "CDM.General.Email.Creator_Tooltip");
    197195
    198196        JPanel maintainer_panel = new JPanel();
    199197        maintainer_label = new JLabel();
    200198        maintainer_label.setPreferredSize(LABEL_SIZE);
    201         Gatherer.dictionary.setText(maintainer_label, "CDM.General.Email.Maintainer", null);
     199        Dictionary.registerText(maintainer_label, "CDM.General.Email.Maintainer");
    202200
    203201        maintainer_emailfield = new EmailField(Gatherer.config.getColor("coloring.error_background", false));
    204         Gatherer.dictionary.setTooltip(maintainer_emailfield, "CDM.General.Email.Maintainer_Tooltip");
     202        Dictionary.registerTooltip(maintainer_emailfield, "CDM.General.Email.Maintainer_Tooltip");
    205203        public_checkbox = new JCheckBox("", public_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR));
    206         Gatherer.dictionary.setText(public_checkbox, "CDM.General.Access", null);
     204        Dictionary.registerText(public_checkbox, "CDM.General.Access");
    207205        beta_checkbox = new JCheckBox("", beta_collectionmeta.getValue(CollectionMeta.TEXT).equals(CollectionConfiguration.TRUE_STR));
    208         Gatherer.dictionary.setText(beta_checkbox, "CDM.General.Beta", null);
     206        Dictionary.registerText(beta_checkbox, "CDM.General.Beta");
    209207        JPanel name_panel = new JPanel();
    210208        name_label = new JLabel();
    211209        name_label.setPreferredSize(LABEL_SIZE);
    212         Gatherer.dictionary.setText(name_label, "CDM.General.Collection_Name", null);
     210        Dictionary.registerText(name_label, "CDM.General.Collection_Name");
    213211        name_textfield = new JTextField("CDM.General.Collection_Name");
    214         Gatherer.dictionary.setTooltip(name_textfield, "CDM.General.Collection_Name_Tooltip");
     212        Dictionary.registerTooltip(name_textfield, "CDM.General.Collection_Name_Tooltip");
    215213        JPanel icon_panel = new JPanel();
    216214        icon_label = new JLabel();
    217215        icon_label.setPreferredSize(LABEL_SIZE);
    218         Gatherer.dictionary.setText(icon_label, "CDM.General.Icon_Collection", null);
     216        Dictionary.registerText(icon_label, "CDM.General.Icon_Collection");
    219217        icon_textfield = new JTextField("CDM.General.Icon_Collection");
    220         Gatherer.dictionary.setTooltip(icon_textfield, "CDM.General.Icon_Collection_Tooltip");
     218        Dictionary.registerTooltip(icon_textfield, "CDM.General.Icon_Collection_Tooltip");
    221219        JPanel small_icon_panel = new JPanel();
    222220        small_icon_label = new JLabel("CDM.General.Icon_Collection_Small");
    223221        small_icon_label.setPreferredSize(LABEL_SIZE);
    224         Gatherer.dictionary.setText(small_icon_label, "CDM.General.Icon_Collection_Small", null);
     222        Dictionary.registerText(small_icon_label, "CDM.General.Icon_Collection_Small");
    225223        small_icon_textfield = new JTextField("CDM.General.Icon_Collection_Small");
    226         Gatherer.dictionary.setTooltip(small_icon_textfield, "CDM.General.Icon_Collection_Small_Tooltip");
     224        Dictionary.registerTooltip(small_icon_textfield, "CDM.General.Icon_Collection_Small_Tooltip");
    227225        JPanel description_panel = new JPanel();
    228226        description_label = new JLabel();
    229227        description_label.setPreferredSize(LABEL_SIZE);
    230         Gatherer.dictionary.setText(description_label, "CDM.General.Collection_Extra", null);
     228        Dictionary.registerText(description_label, "CDM.General.Collection_Extra");
    231229        description_textarea = new JTextArea();
    232230        description_textarea.setBackground(Gatherer.config.getColor("coloring.editable_background", false));
    233         Gatherer.dictionary.setTooltip(description_textarea, "CDM.General.Collection_Extra_Tooltip");
     231        Dictionary.registerTooltip(description_textarea, "CDM.General.Collection_Extra_Tooltip");
    234232        // Connection
    235233        beta_checkbox.addActionListener(CollectionDesignManager.change_listener);
     
    358356     */
    359357    public void setSelectedView(String type) {
    360         type = Gatherer.dictionary.get(type);
     358        type = Dictionary.newget(type);
    361359        for(int i = 0; i < root.getChildCount(); i++) {
    362360        DesignNode child = (DesignNode) root.getChildAt(i);
     
    381379     */
    382380    public String toString() {
    383         return Gatherer.dictionary.get("CDM.GUI." + (String)getUserObject());
     381        return Dictionary.newget("CDM.GUI." + (String)getUserObject());
    384382    }
    385383    }
  • trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java

    r5375 r5536  
    2626 */
    2727package org.greenstone.gatherer.cdm;
     28
    2829import java.awt.*;
    2930import java.awt.event.*;
     
    3132import javax.swing.*;
    3233import javax.swing.event.*;
     34import org.greenstone.gatherer.Dictionary;
    3335import org.greenstone.gatherer.Gatherer;
    3436import org.greenstone.gatherer.cdm.CollectionMeta;
     
    104106    }
    105107    else {
    106         JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.IndexManager.Index_Exists"), get("General.Warning"), JOptionPane.WARNING_MESSAGE);
     108        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.IndexManager.Index_Exists"), Dictionary.newget("General.Warning"), JOptionPane.WARNING_MESSAGE);
    107109    }
    108110    }
     
    122124    }
    123125    else {
    124         JOptionPane.showMessageDialog(Gatherer.g_man, get("CDM.IndexManager.Level_Exists"), get("General.Warning"), JOptionPane.WARNING_MESSAGE);
     126        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.IndexManager.Level_Exists"), Dictionary.newget("General.Warning"), JOptionPane.WARNING_MESSAGE);
    125127    }
    126128    }
     
    481483    }
    482484
    483     /** Overloaded to call get with both a key and an empty argument array.
    484      * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    485      * @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.
    486      */
    487     private String get(String key) {
    488     return get(key, null);
    489     }
    490 
    491     /** 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>
    492      * 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>.
    493      * @param key A <strong>String</strong> which is mapped to a initial String within the ResourceBundle.
    494      * @param args A <strong>String[]</strong> used to populate argument fields within the complete String.
    495      * @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.
    496      * @see org.greenstone.gatherer.Gatherer
    497      * @see org.greenstone.gatherer.Dictionary
    498      */
    499     private String get(String key, String args[]) {
    500     if(key.indexOf('.') == -1) {
    501         key = "CDM.IndexManager." + key;
    502     }
    503     return Gatherer.dictionary.get(key, args);
    504     }
    505485
    506486    /** This class creates a set of controls for editing the indexes. */
     
    552532
    553533        JPanel instruction_pane = new JPanel();
    554         JLabel title_label = new JLabel(get("CDM.IndexManager.Title"));
     534        JLabel title_label = new JLabel();
    555535        title_label.setHorizontalAlignment(JLabel.CENTER);
    556         instruction_textarea = new JTextArea(get("CDM.IndexManager.Instructions"));
     536        Dictionary.registerText(title_label, "CDM.IndexManager.Title");
     537
     538        instruction_textarea = new JTextArea();
    557539        instruction_textarea.setEditable(false);
    558540        instruction_textarea.setLineWrap(true);
    559541        instruction_textarea.setRows(6);
    560542        instruction_textarea.setWrapStyleWord(true);
     543        Dictionary.registerText(instruction_textarea, "CDM.IndexManager.Instructions");
    561544
    562545        JPanel assigned_indexes_pane = new JPanel();
    563         JLabel index_label = new JLabel(get("CDM.IndexManager.Indexes"));
     546        JLabel index_label = new JLabel();
     547        Dictionary.registerText(index_label, "CDM.IndexManager.Indexes");
    564548        index_list = new JList(model);
    565549        index_list.setCellRenderer(new IndexListRenderer());
     
    567551        JPanel movement_pane = new JPanel();
    568552
    569         move_up_button = new DoubleImageButton(get("CDM.Move.Move_Up"), Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
     553        move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
    570554        move_up_button.setEnabled(false);
    571555        move_up_button.setMnemonic(KeyEvent.VK_U);
    572556        move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
    573 
    574         move_down_button = new DoubleImageButton(get("CDM.Move.Move_Down"), Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
     557        Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
     558
     559        move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
    575560        move_down_button.setEnabled(false);
    576561        move_down_button.setMnemonic(KeyEvent.VK_D);
    577562        move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
     563        Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
    578564
    579565        JPanel index_pane = new JPanel();
     
    582568
    583569        JPanel name_pane = new JPanel();
    584         JLabel name_label = new JLabel(get("CDM.IndexManager.Name"));
     570        JLabel name_label = new JLabel();
    585571        name_label.setPreferredSize(Utility.LABEL_SIZE);
     572        Dictionary.registerText(name_label, "CDM.IndexManager.Name");
    586573        name_textfield = new JTextField();
    587574
    588575        JPanel source_pane = new JPanel();
    589         JLabel source_label = new JLabel(get("CDM.IndexManager.Source"));
     576        JLabel source_label = new JLabel();
    590577        source_label.setPreferredSize(Utility.LABEL_SIZE);
     578        Dictionary.registerText(source_label, "CDM.IndexManager.Source");
    591579        source_list = new CheckList(new_data, false);
    592580
    593581        JPanel level_pane = new JPanel();
    594         JLabel level_label = new JLabel(get("CDM.IndexManager.Level"));
     582        JLabel level_label = new JLabel();
    595583        level_label.setPreferredSize(Utility.LABEL_SIZE);
     584        Dictionary.registerText(level_label, "CDM.IndexManager.Level");
    596585        level_combobox = new JComboBox();
    597         level_combobox.addItem(get("CDM.IndexManager.Document"));
    598         level_combobox.addItem(get("CDM.IndexManager.Paragraph"));
    599         level_combobox.addItem(get("CDM.IndexManager.Section"));
     586        level_combobox.addItem(Dictionary.newget("CDM.IndexManager.Document"));
     587        level_combobox.addItem(Dictionary.newget("CDM.IndexManager.Paragraph"));
     588        level_combobox.addItem(Dictionary.newget("CDM.IndexManager.Section"));
    600589        level_combobox.setEditable(false);
    601590
    602591        JPanel button_pane = new JPanel();
    603         add_button = new JButton(get("CDM.IndexManager.Add"));
     592        add_button = new JButton();
    604593        add_button.setEnabled(false);
    605594        add_button.setMnemonic(KeyEvent.VK_A);
    606         set_default_button = new JButton(get("CDM.IndexManager.Set_Default"));
     595        Dictionary.registerBoth(add_button, "CDM.IndexManager.Add", "CDM.IndexManager.Add_Tooltip");
     596        set_default_button = new JButton();
    607597        set_default_button.setEnabled(false);
    608598        set_default_button.setMnemonic(KeyEvent.VK_S);
    609         remove_button = new JButton(get("CDM.IndexManager.Remove"));
     599        Dictionary.registerBoth(set_default_button, "CDM.IndexManager.Set_Default", "CDM.IndexManager.Set_Default_Tooltip");
     600        remove_button = new JButton();
    610601        remove_button.setEnabled(false);
    611602        remove_button.setMnemonic(KeyEvent.VK_R);
     603        Dictionary.registerBoth(remove_button, "CDM.IndexManager.Remove", "CDM.IndexManager.Remove_Tooltip");
    612604
    613605        // This class is getting a little crowded, so I'll generate the many mgpp controls in a inner class.
     
    684676        add(mgppindexes_control, MGPPINDEXES);
    685677    }
     678
    686679    /* Destructor, removes persistant listeners from the Dictionary.
    687680     */
     
    803796        JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    804797        if(default_index != null && default_index.equals(value)) {
    805             component.setText(component.getText() + " " + get("CDM.IndexManager.Default_Index_Indicator"));
     798            component.setText(component.getText() + " " + Dictionary.newget("CDM.IndexManager.Default_Index_Indicator"));
    806799        }
    807800        return component;
     
    932925        JPanel current_indexes_panel = new JPanel();
    933926
    934         current_indexes_label = new JLabel("CDM.IndexManager.MGPP.Current_Indexes");
    935 
     927        current_indexes_label = new JLabel();
     928        Dictionary.registerText(current_indexes_label, "CDM.IndexManager.MGPP.Current_Indexes");
    936929        current_indexes_list = new JList(model);
    937930        current_indexes_list.setVisibleRowCount(5);
     
    939932        JPanel index_movement_panel = new JPanel();
    940933
    941         ImageIcon move_index_up_icon = Utility.getImage("arrow-up.gif");
    942         move_index_up_button = new JButton();
    943         move_index_up_label = new JLabel("CDM.Move.Move_Up");
    944         move_index_up_label.setHorizontalAlignment(JLabel.CENTER);
    945         move_index_up_label.setPreferredSize(LABEL_SIZE);
    946         move_index_up_button.setLayout(new BorderLayout());
    947         move_index_up_button.add(new JLabel(move_index_up_icon), BorderLayout.WEST);
    948         move_index_up_button.add(move_index_up_label, BorderLayout.CENTER);
    949         move_index_up_button.add(new JLabel(move_index_up_icon), BorderLayout.EAST);
     934        move_index_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
     935        move_index_up_button.setEnabled(false);
    950936        move_index_up_button.setMnemonic(KeyEvent.VK_U);
    951 
    952         ImageIcon move_index_down_icon = Utility.getImage("arrow-down.gif");
    953         move_index_down_button = new JButton();
    954         move_index_down_label = new JLabel("CDM.Move.Move_Down");
    955         move_index_down_label.setHorizontalAlignment(JLabel.CENTER);
    956         move_index_down_label.setPreferredSize(LABEL_SIZE);
    957         move_index_down_button.setLayout(new BorderLayout());
    958         move_index_down_button.add(new JLabel(move_index_down_icon), BorderLayout.WEST);
    959         move_index_down_button.add(move_index_down_label, BorderLayout.CENTER);
    960         move_index_down_button.add(new JLabel(move_index_down_icon), BorderLayout.EAST);
     937        move_index_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
     938        Dictionary.registerBoth(move_index_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
     939
     940        move_index_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
     941        move_index_down_button.setEnabled(false);
    961942        move_index_down_button.setMnemonic(KeyEvent.VK_D);
     943        move_index_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
     944        Dictionary.registerBoth(move_index_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
    962945
    963946        JPanel index_spacer_panel = new JPanel();
     
    969952        JPanel index_name_panel = new JPanel();
    970953
    971         index_name_label = new JLabel("CDM.IndexManager.MGPP.Index_Name");
     954        index_name_label = new JLabel();
    972955        index_name_label.setPreferredSize(LABEL_SIZE);
     956        Dictionary.registerText(index_name_label, "CDM.IndexManager.MGPP.Index_Name");
    973957
    974958        index_name_field = new JTextField();
     959        Dictionary.registerTooltip(index_name_field, "CDM.IndexManager.MGPP.Index_Name_Tooltip");
    975960
    976961        JPanel index_panel = new JPanel();
     
    978963        index_label = new JLabel("CDM.IndexManager.MGPP.Index");
    979964        index_label.setPreferredSize(LABEL_SIZE);
     965        Dictionary.registerText(index_label, "CDM.IndexManager.MGPP.Index");
    980966
    981967        index_combobox = new GComboBox();
     
    985971        index_combobox.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false));
    986972        index_combobox.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
     973        Dictionary.registerTooltip(index_combobox, "CDM.IndexManager.MGPP.Index_Tooltip");
    987974
    988975        JPanel index_button_panel = new JPanel();
    989976
    990         add_index_button = new JButton("CDM.IndexManager.MGPP.Add_Index");
     977        add_index_button = new JButton();
    991978        add_index_button.setEnabled(false);
    992979        add_index_button.setMnemonic(KeyEvent.VK_A);
    993        
    994         add_all_button = new JButton("CDM.IndexManager.MGPP.Add_All_Metadata");
     980        Dictionary.registerBoth(add_index_button, "CDM.IndexManager.MGPP.Add_Index", "CDM.IndexManager.MGPP.Add_Index_Tooltip");
     981
     982        add_all_button = new JButton();
    995983        add_all_button.setEnabled(true);
    996984        add_all_button.setMnemonic(KeyEvent.VK_L);
    997 
    998         replace_button = new JButton("CDM.IndexManager.MGPP.Replace_Index");
     985        Dictionary.registerBoth(add_all_button, "CDM.IndexManager.MGPP.Add_All_Metadata", "CDM.IndexManager.MGPP.Add_All_Metadata_Tooltip");
     986
     987        replace_button = new JButton();
    999988        replace_button.setEnabled(false);
    1000989        replace_button.setMnemonic(KeyEvent.VK_C);
    1001 
    1002         remove_index_button = new JButton("CDM.IndexManager.MGPP.Remove_Index");
     990        Dictionary.registerBoth(replace_button, "CDM.IndexManager.MGPP.Replace_Index", "CDM.IndexManager.MGPP.Replace_Index_Tooltip");
     991
     992        remove_index_button = new JButton();
    1003993        remove_index_button.setEnabled(false);
    1004994        remove_index_button.setMnemonic(KeyEvent.VK_A);
     995        Dictionary.registerBoth(remove_index_button, "CDM.IndexManager.MGPP.Remove_Index", "CDM.IndexManager.MGPP.Remove_Index_Tooltip");
    1005996
    1006997        JPanel index_empty_panel = new JPanel();
     
    10111002        add_all_button.addActionListener(new AddAllActionListener());
    10121003        current_indexes_list.addListSelectionListener(new CurrentIndexesListSelectionListener());
    1013         Gatherer.dictionary.register(add_index_button, null, false);
    1014         Gatherer.dictionary.register(add_all_button, null, false);
    1015         Gatherer.dictionary.register(current_indexes_label, null, false);
    1016         Gatherer.dictionary.register(index_label, null, false);
    1017         Gatherer.dictionary.register(index_name_label, null, false);
    1018         Gatherer.dictionary.register(move_index_down_label, null, false);
    1019         Gatherer.dictionary.register(move_index_up_label, null, false);
    1020         Gatherer.dictionary.register(replace_button, null, false);
    1021         Gatherer.dictionary.register(remove_index_button, null, false);
    10221004        index_combobox.addActionListener(index_eal);
    10231005        ((JTextField)index_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(index_eal);
     
    10271009        replace_button.addActionListener(new ReplaceIndexActionListener());
    10281010        remove_index_button.addActionListener(new RemoveIndexActionListener(index_eal));
     1011
    10291012        // Layout Indexes
    10301013        index_movement_panel.setLayout(new GridLayout(2,1));
     
    10751058        JPanel current_levels_panel = new JPanel();
    10761059
    1077         current_levels_label = new JLabel("CDM.IndexManager.MGPP.Current_Levels");
     1060        current_levels_label = new JLabel();
     1061        Dictionary.registerText(current_levels_label, "CDM.IndexManager.MGPP.Current_Levels");
    10781062
    10791063        current_levels_list = new JList(levels_model);
     
    10821066        JPanel level_movement_panel = new JPanel();
    10831067
    1084         ImageIcon move_level_up_icon = Utility.getImage("arrow-up.gif");
    1085         move_level_up_button = new JButton();
    1086         move_level_up_label = new JLabel("CDM.Move.Move_Up");
    1087         move_level_up_label.setHorizontalAlignment(JLabel.CENTER);
    1088         move_level_up_label.setPreferredSize(LABEL_SIZE);
    1089         move_level_up_button.setLayout(new BorderLayout());
    1090         move_level_up_button.add(new JLabel(move_level_up_icon), BorderLayout.WEST);
    1091         move_level_up_button.add(move_level_up_label, BorderLayout.CENTER);
    1092         move_level_up_button.add(new JLabel(move_level_up_icon), BorderLayout.EAST);
     1068        move_level_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
     1069        move_level_up_button.setEnabled(false);
    10931070        move_level_up_button.setMnemonic(KeyEvent.VK_U);
    1094 
    1095         ImageIcon move_level_down_icon = Utility.getImage("arrow-down.gif");
    1096         move_level_down_button = new JButton();
    1097         move_level_down_label = new JLabel("CDM.Move.Move_Down");
    1098         move_level_down_label.setHorizontalAlignment(JLabel.CENTER);
    1099         move_level_down_label.setPreferredSize(LABEL_SIZE);
    1100         move_level_down_button.setLayout(new BorderLayout());
    1101         move_level_down_button.add(new JLabel(move_level_down_icon), BorderLayout.WEST);
    1102         move_level_down_button.add(move_level_down_label, BorderLayout.CENTER);
    1103         move_level_down_button.add(new JLabel(move_level_down_icon), BorderLayout.EAST);
     1071        move_level_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
     1072        Dictionary.registerBoth(move_level_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
     1073
     1074        move_level_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
     1075        move_level_down_button.setEnabled(false);
    11041076        move_level_down_button.setMnemonic(KeyEvent.VK_D);
     1077        move_level_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
     1078        Dictionary.registerBoth(move_level_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
    11051079
    11061080        JPanel level_spacer_panel = new JPanel();
     
    11121086        JPanel level_name_panel = new JPanel();
    11131087
    1114         level_name_label = new JLabel("CDM.IndexManager.MGPP.Level_Name");
     1088        level_name_label = new JLabel();
    11151089        level_name_label.setPreferredSize(LABEL_SIZE);
     1090        Dictionary.registerText(level_name_label, "CDM.IndexManager.MGPP.Level_Name");
    11161091
    11171092        level_name_field = new JTextField();
     1093        Dictionary.registerTooltip(level_name_field, "CDM.IndexManager.MGPP.Level_Name_Tooltip");
    11181094
    11191095        JPanel level_panel = new JPanel();
     
    11211097        level_label = new JLabel("CDM.IndexManager.MGPP.Level");
    11221098        level_label.setPreferredSize(LABEL_SIZE);
     1099        Dictionary.registerText(level_label, "CDM.IndexManager.MGPP.Level");
    11231100
    11241101        level_combobox = new GComboBox(Index.LEVEL);
     
    11281105        level_combobox.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false));
    11291106        level_combobox.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
     1107        Dictionary.registerTooltip(level_combobox, "CDM.IndexManager.MGPP.Level_Tooltip");
    11301108
    11311109        JPanel level_button_panel = new JPanel();
     
    11341112        add_level_button.setEnabled(false);
    11351113        add_level_button.setMnemonic(KeyEvent.VK_A);
     1114        Dictionary.registerBoth(add_level_button, "CDM.IndexManager.MGPP.Add_Level", "CDM.IndexManager.MGPP.Add_Level_Tooltip");
    11361115       
    11371116        remove_level_button = new JButton("CDM.IndexManager.MGPP.Remove_Level");
    11381117        remove_level_button.setEnabled(false);
    11391118        remove_level_button.setMnemonic(KeyEvent.VK_A);
     1119        Dictionary.registerBoth(remove_level_button, "CDM.IndexManager.MGPP.Remove_Level", "CDM.IndexManager.MGPP.Remove_Level_Tooltip");
    11401120
    11411121        JPanel level_empty_panel = new JPanel();
     
    11451125        add_level_button.addActionListener(new AddLevelActionListener());
    11461126        current_levels_list.addListSelectionListener(new CurrentLevelsListSelectionListener());
    1147         Gatherer.dictionary.register(add_level_button, null, false);
    1148         Gatherer.dictionary.register(current_levels_label, null, false);
    1149         Gatherer.dictionary.register(level_label, null, false);
    1150         Gatherer.dictionary.register(level_name_label, null, false);
    1151         Gatherer.dictionary.register(move_level_down_label, null, false);
    1152         Gatherer.dictionary.register(move_level_up_label, null, false);
    1153         Gatherer.dictionary.register(remove_level_button, null, false);
    11541127        level_combobox.addActionListener(level_eal);
    11551128        ((JTextField)level_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(level_eal);
     
    12031176        JPanel header_panel = new JPanel();
    12041177       
    1205         title_label = new JLabel("CDM.IndexManager.MGPP.Title");
    1206 
    1207         instructions_textarea = new JTextArea("CDM.IndexManager.MGPP.Instructions");
     1178        title_label = new JLabel();
     1179        title_label.setHorizontalAlignment(JLabel.CENTER);
     1180        Dictionary.registerText(title_label, "CDM.IndexManager.MGPP.Title");
     1181
     1182        instructions_textarea = new JTextArea();
    12081183        instructions_textarea.setEditable(false);
    12091184        instructions_textarea.setLineWrap(true);
    12101185        instructions_textarea.setRows(6);
    12111186        instructions_textarea.setWrapStyleWord(true);
     1187        Dictionary.registerText(instructions_textarea, "CDM.IndexManager.MGPP.Instructions");
    12121188
    12131189        tabbed_pane = new JTabbedPane();
     
    12191195        header_panel.add(new JScrollPane(instructions_textarea), BorderLayout.CENTER);
    12201196
    1221         tabbed_pane.add("CDM.IndexManager.MGPP.Indexes", indexes_panel);
    1222         tabbed_pane.add("CDM.IndexManager.MGPP.Levels", levels_panel);
     1197        tabbed_pane.add(Dictionary.newget("CDM.IndexManager.MGPP.Indexes"), indexes_panel);
     1198        tabbed_pane.add(Dictionary.newget("CDM.IndexManager.MGPP.Levels"), levels_panel);
    12231199
    12241200        setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     
    12261202        add(header_panel, BorderLayout.NORTH);
    12271203        add(tabbed_pane, BorderLayout.CENTER);
    1228 
    1229         // Connect General
    1230         Gatherer.dictionary.register(instructions_textarea, null, false);
    1231         Gatherer.dictionary.register(tabbed_pane, null, false);
    1232         Gatherer.dictionary.register(title_label, null, false);
    12331204    }
    12341205
    12351206    public void destroy() {
    1236         Gatherer.dictionary.deregister(add_index_button);
    1237         Gatherer.dictionary.deregister(add_all_button);
    1238         Gatherer.dictionary.deregister(current_indexes_label);
    1239         Gatherer.dictionary.deregister(index_label);
    1240         Gatherer.dictionary.deregister(index_name_label);
    1241         Gatherer.dictionary.deregister(move_index_down_label);
    1242         Gatherer.dictionary.deregister(move_index_up_label);
    1243         Gatherer.dictionary.deregister(replace_button);
    1244         Gatherer.dictionary.deregister(remove_index_button);
    1245 
    1246         Gatherer.dictionary.deregister(instructions_textarea);
    1247         Gatherer.dictionary.deregister(tabbed_pane);
    1248         Gatherer.dictionary.deregister(title_label);
    12491207    }
    12501208
  • trunk/gli/src/org/greenstone/gatherer/cdm/PlugInManager.java

    r5529 r5536  
    3535import javax.swing.plaf.basic.*;
    3636import org.apache.xerces.parsers.*;
     37import org.greenstone.gatherer.Dictionary;
    3738import org.greenstone.gatherer.Gatherer;
    3839import org.greenstone.gatherer.cdm.Argument;
     
    145146    }
    146147    if(plugin.getName().equals(StaticStrings.ARCPLUG_STR) || plugin.getName().equals(StaticStrings.RECPLUG_STR)) {
    147         JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.Fixed"), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
     148        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.Move.Fixed"), Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
    148149        return;
    149150    }
     
    182183        if(index < 0) {
    183184            String args[] = new String[2];
    184             args[0] = Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_Str");
     185            args[0] = Dictionary.newget("CDM.PlugInManager.PlugIn_Str");
    185186            args[1] = plugin.getName();
    186             JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.At_Top", args), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
     187            JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.Move.At_Top", args), Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
    187188            return;
    188189        }
     
    197198            String args[] = new String[1];
    198199            args[0] = plugin.getName();
    199             JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.Move.Cannot", args), Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
     200            JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.Move.Cannot", args), Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
    200201            // Still not going to move RecPlug or ArcPlug.
    201202            return;
     
    373374        String plugin_name = getPlugInName(plugin);
    374375        //Gatherer.println("Zero length argument xml detected for: " + plugin_name);
    375         JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_XML_Parse_Failed", plugin_name), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     376        String[] margs = new String[1];
     377        margs[0] = plugin_name;
     378        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.PlugInManager.PlugIn_XML_Parse_Failed", margs), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    376379        }
    377380    }
     
    410413    if(files != null) {
    411414        // Create a progress indicator.
    412         ParsingProgress progress = new ParsingProgress(Gatherer.dictionary.get("CDM.PlugInManager.Parsing.Title"), Gatherer.dictionary.get("CDM.PlugInManager.Parsing.Message"), files.length);
     415        ParsingProgress progress = new ParsingProgress(Dictionary.newget("CDM.PlugInManager.Parsing.Title"), Dictionary.newget("CDM.PlugInManager.Parsing.Message"), files.length);
    413416        for(int i = 0; i < files.length; i++) {
    414417        // We only want to check Perl Modules.
     
    559562        add = new JButton();
    560563        add.setMnemonic(KeyEvent.VK_A);
    561         Gatherer.dictionary.setBoth(add, "CDM.PlugInManager.Add", "CDM.PlugInManager.Add_Tooltip");
     564        Dictionary.registerBoth(add, "CDM.PlugInManager.Add", "CDM.PlugInManager.Add_Tooltip");
    562565
    563566        button_pane = new JPanel();
     
    567570        configure.setEnabled(false);
    568571        configure.setMnemonic(KeyEvent.VK_C);
    569         Gatherer.dictionary.setBoth(configure, "CDM.PlugInManager.Configure", "CDM.PlugInManager.Configure_Tooltip");
     572        Dictionary.registerBoth(configure, "CDM.PlugInManager.Configure", "CDM.PlugInManager.Configure_Tooltip");
    570573
    571574        header_pane = new JPanel();
     
    577580        instructions.setRows(6);
    578581        instructions.setWrapStyleWord(true);
    579         Gatherer.dictionary.setText(instructions, "CDM.PlugInManager.Instructions", null);
     582        Dictionary.registerText(instructions, "CDM.PlugInManager.Instructions");
    580583
    581584        move_top_button = new DoubleImageButton("", Utility.getImage("arrow-top.gif"), Utility.getImage("arrow-top-disabled.gif"));
     
    584587        // move_top_button.setDisplayedMnemonicIndex(8);  // !! English-centric hack
    585588        move_top_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
    586         Gatherer.dictionary.setBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip");
     589        Dictionary.registerBoth(move_top_button, "CDM.Move.Move_Top", "CDM.Move.Move_Top_Tooltip");
    587590
    588591        move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
     
    590593        move_up_button.setMnemonic(KeyEvent.VK_U);
    591594        move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
    592         Gatherer.dictionary.setBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
     595        Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
    593596
    594597        move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
     
    596599        move_down_button.setMnemonic(KeyEvent.VK_D);
    597600        move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
    598         Gatherer.dictionary.setBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
     601        Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
    599602
    600603        move_bottom_button = new DoubleImageButton("", Utility.getImage("arrow-bottom.gif"), Utility.getImage("arrow-bottom-disabled.gif"));
     
    602605        move_bottom_button.setMnemonic(KeyEvent.VK_B);
    603606        move_bottom_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
    604         Gatherer.dictionary.setBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip");
     607        Dictionary.registerBoth(move_bottom_button, "CDM.Move.Move_Bottom", "CDM.Move.Move_Bottom_Tooltip");
    605608
    606609        movement_pane = new JPanel();
     
    613616        plugin.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false));
    614617        plugin.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
    615         Gatherer.dictionary.setTooltip(plugin, "CDM.PlugInManager.PlugIn_Tooltip");
     618        Dictionary.registerTooltip(plugin, "CDM.PlugInManager.PlugIn_Tooltip");
    616619
    617620        plugin_label = new JLabel();
    618         Gatherer.dictionary.setText(plugin_label, "CDM.PlugInManager.PlugIn", null);
     621        Dictionary.registerText(plugin_label, "CDM.PlugInManager.PlugIn");
    619622
    620623        plugin_list = new JList(model);
     
    624627        plugin_list_label.setHorizontalAlignment(JLabel.CENTER);
    625628        plugin_list_label.setOpaque(true);
    626         Gatherer.dictionary.setText(plugin_list_label, "CDM.PlugInManager.Assigned", null);
     629        Dictionary.registerText(plugin_list_label, "CDM.PlugInManager.Assigned");
    627630
    628631        plugin_list_pane = new JPanel();
     
    632635        remove.setEnabled(false);
    633636        remove.setMnemonic(KeyEvent.VK_R);
    634         Gatherer.dictionary.setBoth(remove, "CDM.PlugInManager.Remove", "CDM.PlugInManager.Remove_Tooltip");
     637        Dictionary.registerBoth(remove, "CDM.PlugInManager.Remove", "CDM.PlugInManager.Remove_Tooltip");
    635638
    636639        title = new JLabel();
    637640        title.setHorizontalAlignment(JLabel.CENTER);
    638641        title.setOpaque(true);
    639         Gatherer.dictionary.setText(title, "CDM.PlugInManager.Title", null);
     642        Dictionary.registerText(title, "CDM.PlugInManager.Title");
    640643
    641644        // Listeners
     
    693696         (BorderFactory.createEmptyBorder(5,0,5,0),
    694697          BorderFactory.createCompoundBorder
    695           (BorderFactory.createTitledBorder(Gatherer.dictionary.get("CDM.PlugInManager.Controls")),
     698          (BorderFactory.createTitledBorder(Dictionary.newget("CDM.PlugInManager.Controls")),
    696699           BorderFactory.createEmptyBorder(2,2,2,2))));
    697700
     
    768771            }
    769772            else {
    770             JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("CDM.PlugInManager.PlugIn_Exists"), Gatherer.dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     773            JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("CDM.PlugInManager.PlugIn_Exists"), Dictionary.newget("General.Error"), JOptionPane.ERROR_MESSAGE);
    771774            }
    772775            base_plugin = null;
  • trunk/gli/src/org/greenstone/gatherer/cdm/SearchTypeManager.java

    r5318 r5536  
    3535import javax.swing.*;
    3636import javax.swing.event.*;
     37import org.greenstone.gatherer.Dictionary;
    3738import org.greenstone.gatherer.Gatherer;
    3839import org.greenstone.gatherer.cdm.CollectionConfiguration;
     
    100101    if((direction && index < 0) || (!direction && index >= getSize())) {
    101102        String args[] = new String[2];
    102         args[0] = Gatherer.dictionary.get("CDM.SearchTypeManager.SearchType");
     103        args[0] = Dictionary.newget("CDM.SearchTypeManager.SearchType");
    103104        args[1] = search_type.toString();
    104105        String message = null;
    105         if(direction) {
    106         message = Gatherer.dictionary.get("CDM.Move.At_Top", args);
     106        if (direction) {
     107        message = Dictionary.newget("CDM.Move.At_Top", args);
    107108        }
    108109        else {
    109         message = Gatherer.dictionary.get("CDM.Move.At_Bottom", args);
    110         }
    111         JOptionPane.showMessageDialog(Gatherer.g_man, message, Gatherer.dictionary.get("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
     110        message = Dictionary.newget("CDM.Move.At_Bottom", args);
     111        }
     112        JOptionPane.showMessageDialog(Gatherer.g_man, message, Dictionary.newget("CDM.Move.Title"), JOptionPane.ERROR_MESSAGE);
    112113        return;
    113114    }
     
    147148    public SearchTypeControl() {
    148149        // Creation
     150        title_label = new JLabel();
     151        title_label.setHorizontalAlignment(JLabel.CENTER);
     152        Dictionary.registerText(title_label, "CDM.SearchTypeManager.Title");
     153
    149154        JPanel instructions_panel = new JPanel();
    150         title_label = new JLabel("CDM.SearchTypeManager.Title");
    151         title_label.setHorizontalAlignment(JLabel.CENTER);
    152         instructions_textarea = new JTextArea(Gatherer.dictionary.get("CDM.SearchTypeManager.Instructions"));
     155        instructions_textarea = new JTextArea();
    153156        instructions_textarea.setCaretPosition(0);
    154157        instructions_textarea.setEditable(false);
     
    156159        instructions_textarea.setRows(6);
    157160        instructions_textarea.setWrapStyleWord(true);
     161        Dictionary.registerText(instructions_textarea, "CDM.SearchTypeManager.Instructions");
    158162
    159163        JPanel spacer_panel = new JPanel();
     
    162166
    163167        JPanel inner_panel = new JPanel();
    164        
    165         enable_advanced_searches_checkbox = new JCheckBox("CDM.SearchTypeManager.Enable");
     168
     169        enable_advanced_searches_checkbox = new JCheckBox();
     170        Dictionary.registerText(enable_advanced_searches_checkbox, "CDM.SearchTypeManager.Enable");
    166171
    167172        JPanel current_search_types_panel = new JPanel();
    168         current_search_types_label = new JLabel("CDM.SearchTypeManager.Assigned");
     173        current_search_types_label = new JLabel();
     174        Dictionary.registerText(current_search_types_label, "CDM.SearchTypeManager.Assigned");
    169175        current_search_types_list = new JList(model);
    170176        current_search_types_list.setVisibleRowCount(3);
     
    172178        JPanel movement_panel = new JPanel();
    173179
    174         move_up_button = new DoubleImageButton("CDM.Move.Move_Up", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
     180        move_up_button = new DoubleImageButton("", Utility.getImage("arrow-up.gif"), Utility.getImage("arrow-up-disabled.gif"));
    175181        move_up_button.setEnabled(false);
    176182        move_up_button.setMnemonic(KeyEvent.VK_U);
    177183        move_up_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
    178 
    179         move_down_button = new DoubleImageButton("CDM.Move.Move_Down", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
     184        Dictionary.registerBoth(move_up_button, "CDM.Move.Move_Up", "CDM.Move.Move_Up_Tooltip");
     185
     186        move_down_button = new DoubleImageButton("", Utility.getImage("arrow-down.gif"), Utility.getImage("arrow-down-disabled.gif"));
    180187        move_down_button.setEnabled(false);
    181188        move_down_button.setMnemonic(KeyEvent.VK_D);
    182189        move_down_button.setPreferredSize(Utility.DOUBLE_IMAGE_BUTTON_SIZE);
     190        Dictionary.registerBoth(move_down_button, "CDM.Move.Move_Down", "CDM.Move.Move_Down_Tooltip");
    183191
    184192        JPanel search_type_panel = new JPanel();
    185         search_type_label = new JLabel("CDM.SearchTypeManager.SearchType_Selection");
     193        search_type_label = new JLabel();
     194        Dictionary.registerText(search_type_label, "CDM.SearchTypeManager.SearchType_Selection");
    186195        search_type_combobox = new GComboBox(SEARCH_TYPES);
    187196        search_type_combobox.setBackgroundNonSelectionColor(Gatherer.config.getColor("coloring.editable_background", false));
     
    191200        search_type_combobox.setTextNonSelectionColor(Gatherer.config.getColor("coloring.workspace_tree_foreground", false));
    192201        search_type_combobox.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
     202        Dictionary.registerTooltip(search_type_combobox, "CDM.SearchTypeManager.SearchType_Selection_Tooltip");
    193203
    194204        JPanel button_panel = new JPanel();
    195         add_button = new JButton("CDM.SearchTypeManager.Add");
     205        add_button = new JButton();
    196206        add_button.setEnabled(false);
    197207        add_button.setMnemonic(KeyEvent.VK_A);
    198 
    199         remove_button = new JButton("CDM.SearchTypeManager.Remove");
     208        Dictionary.registerBoth(add_button, "CDM.SearchTypeManager.Add", "CDM.SearchTypeManager.Add_Tooltip");
     209
     210        remove_button = new JButton();
    200211        remove_button.setEnabled(false);
    201212        remove_button.setMnemonic(KeyEvent.VK_R);
     213        Dictionary.registerBoth(remove_button, "CDM.SearchTypeManager.Remove", "CDM.SearchTypeManager.Remove_Tooltip");
    202214
    203215        // Connection
     
    207219        move_up_button.addActionListener(new MoveListener(true));
    208220        move_down_button.addActionListener(new MoveListener(false));
    209         Gatherer.dictionary.register(add_button, null, false);
    210         Gatherer.dictionary.register(current_search_types_label, null, false);
    211         Gatherer.dictionary.register(enable_advanced_searches_checkbox, null, false);
    212         //Gatherer.dictionary.register(instructions_textarea, null, false);
    213         Gatherer.dictionary.register(move_up_button, null, false);
    214         Gatherer.dictionary.register(move_down_button, null, false);
    215         Gatherer.dictionary.register(remove_button, null, false);
    216         Gatherer.dictionary.register(search_type_label, null, false);
    217         Gatherer.dictionary.register(title_label, null, false);
    218221        remove_button.addActionListener(new RemoveActionListener());
    219222        SearchTypesActionDocumentListener stadl = new SearchTypesActionDocumentListener();
    220223        search_type_combobox.addActionListener(stadl);
    221224        ((JTextField)search_type_combobox.getEditor().getEditorComponent()).getDocument().addDocumentListener(stadl);
     225
    222226        // Layout
    223227        instructions_panel.setBorder(BorderFactory.createEmptyBorder(0,0,2,0));
     
    263267
    264268    public void destroy() {
    265         Gatherer.dictionary.deregister(add_button);
    266         Gatherer.dictionary.deregister(current_search_types_label);
    267         Gatherer.dictionary.deregister(enable_advanced_searches_checkbox);
    268         //Gatherer.dictionary.deregister(instructions_textarea);
    269         Gatherer.dictionary.deregister(move_up_button);
    270         Gatherer.dictionary.deregister(move_down_button);
    271         Gatherer.dictionary.deregister(remove_button);
    272         Gatherer.dictionary.deregister(search_type_label);
    273         Gatherer.dictionary.deregister(title_label);
    274269    }
    275270   
  • trunk/gli/src/org/greenstone/gatherer/collection/DeleteCollectionPrompt.java

    r5347 r5536  
    1 package org.greenstone.gatherer.collection;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.collection;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4142import javax.swing.*;
    4243import javax.swing.event.*;
     44import org.greenstone.gatherer.Dictionary;
    4345import org.greenstone.gatherer.Gatherer;
    4446import org.greenstone.gatherer.collection.Collection;
    45 import org.greenstone.gatherer.collection.CollectionManager;
    4647import org.greenstone.gatherer.gui.ModalDialog;
    4748import org.greenstone.gatherer.gui.SimpleMenuBar;
     
    5051import org.greenstone.gatherer.util.StaticStrings;
    5152import org.greenstone.gatherer.util.Utility;
     53
    5254/** This class provides the functionality to delete current collections from the GSDLHOME/collect/ directory. The user chooses the collection from a list, where each entry also displays details about itself, confirms the delete of a collection by checking a checkbox then presses the ok button to actually delete the collection.
    5355 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    6062    /** The model behind the list. */
    6163    private DefaultListModel list_model = null;
    62     /** A reference to ourself so any inner-classes get dispose of us. */
     64    /** A reference to ourself so any inner-classes can dispose of us. */
    6365    private DeleteCollectionPrompt prompt = null;
    6466    /** The close button, which exits the prompt without deleting anything. */
     
    8284    /** The size of the delete prompt screen. */
    8385    public static final Dimension SIZE = new Dimension(500, 500);
     86
    8487    /** Constructor.
    8588     * @see org.greenstone.gatherer.collection.DeleteCollectionPrompt.CloseButtonListener
     
    9093    public DeleteCollectionPrompt() {
    9194    super(Gatherer.g_man);
    92     this.close_button = new JButton(get("General.Close", null));
    93     this.confirmation = new JCheckBox(get("DeleteCollectionPrompt.Confirm_Delete", null));
    94     this.details = new JTextArea();
    95     this.details_label = new JLabel(get("DeleteCollectionPrompt.Collection_Details", null));
    96     this.list = new JList();
    97     this.list_label = new JLabel(get("DeleteCollectionPrompt.Collection_List", null));
    98     this.list_model = new DefaultListModel();
    99     this.ok_button = new JButton(get("General.OK", null));
    100     this.prompt = this;
    101     this.setModal(true);
    102     this.setSize(SIZE);
    103     this.setTitle(get("DeleteCollectionPrompt.Title", null));
    104     this.setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
     95    close_button = new JButton();
     96    Dictionary.setText(close_button, "General.Close");
     97    confirmation = new JCheckBox();
     98    Dictionary.setText(confirmation, "DeleteCollectionPrompt.Confirm_Delete");
     99    details = new JTextArea();
     100    details.setFont(Gatherer.config.getFont("general.tooltip_font", false));
     101    Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection");
     102    details_label = new JLabel();
     103    Dictionary.setText(details_label, "DeleteCollectionPrompt.Collection_Details");
     104    list = new JList();
     105    list_label = new JLabel();
     106    Dictionary.setText(list_label, "DeleteCollectionPrompt.Collection_List");
     107    list_model = new DefaultListModel();
     108    ok_button = new JButton();
     109    Dictionary.setText(ok_button, "General.OK");
     110    prompt = this;
     111    setModal(true);
     112    setSize(SIZE);
     113    // setTitle();
     114    Dictionary.setText(this, "DeleteCollectionPrompt.Title");
     115
     116    setJMenuBar(new SimpleMenuBar("0")); // need to find an appropriate help page to open at
    105117    close_button.addActionListener(new CloseButtonListener());
    106118    confirmation.addActionListener(new ConfirmationCheckBoxListener());
    107119    confirmation.setEnabled(false);
    108120    confirmation.setSelected(false);
    109     details.setFont(Gatherer.config.getFont("general.tooltip_font", false));
    110     details.setText(get("DeleteCollectionPrompt.No_Collection", null));
    111121    list.addListSelectionListener(new CollectionListListener());
    112122    list.clearSelection();
     
    117127    scanForCollections();
    118128    }
     129
    119130    /** Destructor. */
    120131    public void destroy() {
     
    129140    prompt = null;
    130141    }
     142
    131143    /** This method causes the modal prompt to be displayed.
    132      * returns true if it has deleted the collection that is currently open*/
     144     * returns true if it has deleted the collection that is currently open */
    133145    public boolean display() {
    134146    // Central pane
     
    176188   
    177189    }
     190
    178191    /** Shows a delete complete prompt.
    179       * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
    180       * @see org.greenstone.gatherer.collection.Collection
    181       */
     192     * @param success A <strong>boolean</strong> indicating if the collection was successfully deleted.
     193     * @see org.greenstone.gatherer.collection.Collection
     194     */
    182195    public void resultPrompt(boolean success) {
    183196    args = new String[1];
    184197    args[0] = collection.getName();
    185     if(success) {
    186         JOptionPane.showMessageDialog(prompt,get("DeleteCollectionPrompt.Successful_Delete", args),get("DeleteCollectionPrompt.Successful_Title", null),JOptionPane.INFORMATION_MESSAGE);
     198    if (success) {
     199        JOptionPane.showMessageDialog(prompt,Dictionary.newget("DeleteCollectionPrompt.Successful_Delete", args),Dictionary.newget("DeleteCollectionPrompt.Successful_Title"),JOptionPane.INFORMATION_MESSAGE);
    187200    }
    188201    else {
    189         JOptionPane.showMessageDialog(prompt,get("DeleteCollectionPrompt.Failed_Delete", args),get("DeleteCollectionPrompt.Failed_Title", null),JOptionPane.WARNING_MESSAGE);
    190     }
    191     }
    192     /** Retrieves a phrase from the <strong>Dictionary</strong> in <strong>Gatherer</strong>.
    193       * @param key A <strong>String</strong> used to match against a specific phrase in the dictionary.
    194       * @see org.greenstone.gatherer.Dictionary
    195       * @see org.greenstone.gatherer.Gatherer
    196       */
    197     private String get(String key, String args[]) {
    198     if(key.indexOf(".") == -1) {
    199         key = "DeleteCollectionPrompt." + key;
    200     }
    201     return Gatherer.dictionary.get(key, args);
    202     }
     202        JOptionPane.showMessageDialog(prompt,Dictionary.newget("DeleteCollectionPrompt.Failed_Delete", args),Dictionary.newget("DeleteCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE);
     203    }
     204    }
     205
    203206
    204207    /** Method to scan the collect directory retrieving and reloading each collection it finds, while building the list of known collections.
    205       * @see org.greenstone.gatherer.Configuration
    206       * @see org.greenstone.gatherer.Gatherer
    207       * @see org.greenstone.gatherer.util.ArrayTools
    208       * @see org.greenstone.gatherer.util.Utility
    209       */
     208     * @see org.greenstone.gatherer.Configuration
     209     * @see org.greenstone.gatherer.Gatherer
     210     * @see org.greenstone.gatherer.util.ArrayTools
     211     * @see org.greenstone.gatherer.util.Utility
     212     */
    210213    private void scanForCollections() {
    211214    // Start at the collect dir.
     
    232235    // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
    233236    }
     237
    234238    /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
    235239    private class CloseButtonListener
     
    237241    /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
    238242     * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
    239             */
     243     */
    240244    public void actionPerformed(ActionEvent event) {
    241245        // Ask the collection manager to refresh the 'Greenstone Collections' folder
     
    245249    }
    246250    }
     251
    247252    /** This private class listens for selection events in from the list and then displays the appropriate details for that collection.
    248       */
     253     */
    249254    private class CollectionListListener
    250255    implements ListSelectionListener {
     
    264269        args[3] = collection.getMaintainer();
    265270        args[4] = collection.getDescription();
    266         details.setText(get("DeleteCollectionPrompt.Details", args));
     271        Dictionary.setText(details, "DeleteCollectionPrompt.Details", args);
    267272        details.setCaretPosition(0);
    268273        }
    269274        else {
    270275        confirmation.setEnabled(false);
    271         details.setText(get("DeleteCollectionPrompt.No_Collection", null));
    272         }
    273     }
    274     }
    275     /** A check box listener so we can tell if the users selected confirm. */
     276        Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection");
     277        }
     278    }
     279    }
     280
     281    /** A check box listener so we can tell if the user has confirmed the deletion */
    276282    private class ConfirmationCheckBoxListener
    277283    implements ActionListener {
    278284    /** Any implementation of ActionListener must include this method so we can be informed when the button is actioned.
    279285     * @param event An <strong>ActionEvent</strong> containing all the relevant information garnered from the event itself.
    280             */
     286     */
    281287    public void actionPerformed(ActionEvent event) {
    282         if(confirmation.isSelected()) {
    283         ok_button.setEnabled(true);
    284         }
    285         else {
    286         ok_button.setEnabled(false);
    287         }
     288        // OK button is only enabled if the confirmation check box is ticked
     289        ok_button.setEnabled(confirmation.isSelected());
    288290    }
    289291    }         
     292
    290293    /** The OK button listener implementation. */
    291294    private class OKButtonListener
     
    314317        resultPrompt(true);
    315318        list_model.removeElement(collection);
    316         details.setText(get("DeleteCollectionPrompt.No_Collection", null));
     319        Dictionary.setText(details, "DeleteCollectionPrompt.No_Collection");
    317320        confirmation.setEnabled(false);
    318321        confirmation.setSelected(false);
     
    355358        return config.getMaintainer();
    356359    }
     360
    357361    public String toString() {
    358         return config.getName();
    359        
     362        return config.getName();       
    360363    }
    361364    }
  • trunk/gli/src/org/greenstone/gatherer/collection/SaveCollectionBox.java

    r5355 r5536  
    9494    }
    9595    /** Displays the prompt by first building the controls, then waits for a user selection.
    96       * @param name The name of the current collection as a <strong>String</strong>.
    97       */
     96     * @param name The name of the current collection as a <strong>String</strong>.
     97     */
    9898    public int getUserOption(String name) {
    9999    JPanel content_pane = (JPanel) this.getContentPane();
     
    145145    }
    146146    /** 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       */
     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     */
    150150    private String get(String key) {
    151151    return get(key, null);
    152152    }
    153153    /** 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       */
     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     */
    158158    private String get(String key, String args[]) {
    159159    if(key.indexOf('.') == -1) {
     
    167167    /** Any extension of KeyAdapter can override this method so that we can be informed whenever a key is released (ie after a keyTyped event). In this case we map the key press to an appropriate click on one of the buttons (not necessarily the one the key release was detected on).
    168168     * @param event A <strong>KeyEvent</strong> containing details about the key release event.
    169             */
     169     */
    170170    public void keyReleased(KeyEvent event) {
    171171        if(event.getKeyCode() == KeyEvent.VK_Y) {
  • trunk/gli/src/org/greenstone/gatherer/file/FileQueue.java

    r5353 r5536  
    281281                }
    282282                args = null;
    283                 //file_status.setToolTipText(Utility.formatHTMLWidth(file_status.getText(), 80));
     283
    284284                // If source is a file
    285285                if(source_file.isFile()) {
     
    461461                file_status.setText(get("FileActions.Deleting", args));
    462462                args = null;
    463                 //file_status.setToolTipText(Utility.formatHTMLWidth(file_status.getText(), 80));
     463
    464464                // Remove its metadata
    465465                ArrayList metadatum = null;
  • trunk/gli/src/org/greenstone/gatherer/gui/BrowsingPane.java

    r5529 r5536  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import calpa.html.*;
    3940import java.awt.*;
     
    8889    back_button = new JButton(Utility.getImage("back.gif"));
    8990    back_button.setEnabled(false);
    90     Dictionary.setTooltip(back_button, "Browser.Back");
     91    Dictionary.registerTooltip(back_button, "Browser.Back");
    9192
    9293    // refresh_button = new JButton(Utility.getImage("reload.gif"));
    9394    // refresh_button.setEnabled(false);
    94     // Dictionary.setTooltip(refresh_button, "Browser.Reload");
     95    // Dictionary.registerTooltip(refresh_button, "Browser.Reload");
    9596
    9697    bookmarks_button = new JButton(Utility.getImage("bookmark.gif"));
    9798    bookmarks_button.setEnabled(false);
    98     Dictionary.setTooltip(bookmarks_button, "Browser.Bookmarks");
     99    Dictionary.registerTooltip(bookmarks_button, "Browser.Bookmarks");
    99100
    100101    home_button = new JButton(Utility.getImage("home.gif"));
    101     Dictionary.setTooltip(home_button, "Browser.Home");
     102    Dictionary.registerTooltip(home_button, "Browser.Home");
    102103
    103104    JPanel address_pane = new JPanel();
    104105    address_field = new JTextField(Gatherer.config.getString("general.home_page", false));
    105     Dictionary.setTooltip(address_field, "Browser.Address_Tooltip");
     106    Dictionary.registerTooltip(address_field, "Browser.Address_Tooltip");
    106107
    107108    JPanel right_button_pane = new JPanel();
    108109    go_button = new JButton(Utility.getImage("go.gif"));
    109     Dictionary.setTooltip(go_button, "Browser.Go");
     110    Dictionary.registerTooltip(go_button, "Browser.Go");
    110111
    111112    stop_button = new JButton(Utility.getImage("stop.gif"));
    112113    stop_button.setEnabled(false);
    113     Dictionary.setTooltip(stop_button, "Browser.Stop");
     114    Dictionary.registerTooltip(stop_button, "Browser.Stop");
    114115
    115116    forward_button = new JButton(Utility.getImage("forward.gif"));
    116117    forward_button.setEnabled(false);
    117     Dictionary.setTooltip(forward_button, "Browser.Forward");
     118    Dictionary.registerTooltip(forward_button, "Browser.Forward");
    118119
    119120    // Calpa Pane stuff
     
    122123    // Status bar
    123124    status_label = new JLabel();
    124     Dictionary.setText(status_label, "Browser.Ready");
     125    Dictionary.registerText(status_label, "Browser.Ready");
    125126
    126127    // Connection
     
    238239    public void clear() {
    239240        data.removeAllElements();
    240                 // Re-add the "Add Bookmark" entry.
    241                 //add
     241        // Re-add the "Add Bookmark" entry.
     242        //add
    242243    }
    243244
    244245    public void load() {
    245                 // Clear existing
     246        // Clear existing
    246247        data.removeAllElements();
    247                 // Determine the file to load from...
     248        // Determine the file to load from...
    248249        File bookmarks = new File(Gatherer.c_man.getCollectionDirectory() + BOOKMARKS_FILE);
    249250        if(bookmarks.exists()) {
     
    290291    }
    291292    }
    292      
     293
    293294    private class GoButtonListener
    294295    implements ActionListener {
    295296    public void actionPerformed(ActionEvent event) {
    296                 // Attempt to create a GURL
     297        // Attempt to create a GURL
    297298        GURL url = new GURL(address_field.getText());
    298299        address_field.setText(url.getURL().toString());
     
    355356        args = new String[1];
    356357        args[0] = url.toString();
    357         Dictionary.setText(status_label, "Browser.Follow");
     358        Dictionary.registerText(status_label, "Browser.Follow");
    358359        args = null;
    359360    }
     
    375376        args = new String[1];
    376377        args[0] = url.toString();
    377         Dictionary.setText(status_label, "Browser.Loading", args);
     378        Dictionary.registerText(status_label, "Browser.Loading", args);
    378379        args = null;
    379380        break;
     
    396397        stop_button.setEnabled(false);
    397398        // Rendering complete.
    398         Dictionary.setText(status_label, "Browser.Ready");
     399        Dictionary.registerText(status_label, "Browser.Ready");
    399400        go_button.setEnabled(true);
    400401        stop_button.setEnabled(false);
  • trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java

    r5529 r5536  
    123123    /** The initial size of the trees. */
    124124    static private Dimension TREE_SIZE   = new Dimension(400, 430);
     125
    125126    /* Constructor.
    126127     * @param tree_sync Ensures that expansion events between like trees are synchronized.
     
    138139    stop_action.addActionListener(this);
    139140    stop_action.setEnabled(false);
    140     Dictionary.setBoth(stop_action, "Collection.Stop", "Collection.Stop_Tooltip");
     141    Dictionary.registerBoth(stop_action, "Collection.Stop", "Collection.Stop_Tooltip");
    141142
    142143    new_folder = new JButton(Utility.getImage("folder.gif"));
     
    145146    new_folder.setMinimumSize(MIN_SIZE);
    146147    new_folder.setPreferredSize(MIN_SIZE);
    147     Dictionary.setTooltip(new_folder, "Collection.New_Folder_Tooltip");
     148    Dictionary.registerTooltip(new_folder, "Collection.New_Folder_Tooltip");
    148149    }
    149150
     
    219220        args = new String[1];
    220221        args[0] = Gatherer.c_man.getCollection().getName();
    221         Dictionary.setText(collection_label, "Collection.Collection", args);
     222        Dictionary.registerText(collection_label, "Collection.Collection", args);
    222223        collection_tree.setModel(collection);
    223224        collection_tree.repaint();
     
    227228        String args[] = new String[1];
    228229        args[0] = Dictionary.newget("Collection.No_Collection");
    229         Dictionary.setText(collection_label, "Collection.Collection", args);
     230        Dictionary.registerText(collection_label, "Collection.Collection", args);
    230231        args = null;
    231232        collection_tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("Error")));
     
    234235    collection_tree.setEnabled(ready);
    235236    collection_filter.setEnabled(ready);
    236     Dictionary.setTooltip(collection_filter.getComboBox(), "Collection.Filter_Tooltip");
     237    Dictionary.registerTooltip(collection_filter.getComboBox(), "Collection.Filter_Tooltip");
    237238
    238239    // Change the label at the top of collection tree.
     
    265266    workspace_label.setBackground(Gatherer.config.getColor("coloring.workspace_heading_background", false));
    266267    workspace_label.setForeground(Gatherer.config.getColor("coloring.workspace_heading_foreground", false));
    267     Dictionary.setText(workspace_label, "Collection.Workspace");
     268    Dictionary.registerText(workspace_label, "Collection.Workspace");
    268269
    269270    workspace = Gatherer.c_man.getWorkspace();
     
    293294    fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false));
    294295    fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
    295     Dictionary.setTooltip(fcb, "Collection.Filter_Tooltip");
     296    Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip");
    296297    fcb = null;
    297298
     
    306307    collection_label = new JLabel();
    307308    collection_label.setOpaque(true);
    308     Dictionary.setText(collection_label, "Collection.Collection", args);
     309    Dictionary.registerText(collection_label, "Collection.Collection", args);
    309310
    310311    collection = Gatherer.c_man.getRecordSet();
     
    375376    bin_button.setMinimumSize(MIN_SIZE);
    376377    bin_button.setPreferredSize(MIN_SIZE);
    377     Dictionary.setTooltip(bin_button, "Collection.Delete_Tooltip");
     378    Dictionary.registerTooltip(bin_button, "Collection.Delete_Tooltip");
    378379    group.add(bin_button);
    379380
     
    506507
    507508    /** Used to set the enabled state, and hence the colouring, of the two tree labels.
    508       * @param label The <strong>JLabel</strong> to be affected.
    509       * @param state <i>true</i> for enabled, i.e. when a collection is ready, <i>false</i> otherwise.
    510       * @param foreground The <strong>Color</strong> to make the foreground text of the label when enabled.
    511       * @param background The <strong>Color</strong> to make the background of the label when enabled.
    512       */
     509     * @param label The <strong>JLabel</strong> to be affected.
     510     * @param state <i>true</i> for enabled, i.e. when a collection is ready, <i>false</i> otherwise.
     511     * @param foreground The <strong>Color</strong> to make the foreground text of the label when enabled.
     512     * @param background The <strong>Color</strong> to make the background of the label when enabled.
     513     */
    513514    private void setEnabled(JLabel label, boolean state, Color foreground, Color background) {
    514515    ///ystem.err.println("Setting the label color to state " + state);
     
    524525    ///ystem.err.println("Color is now " + label.getBackground());
    525526    }
     527
    526528    /** When a user right-clicks within the trees on the collection pane view they are presented with a small popup menu of context based options. This class provides such functionality.
    527       */
     529     */
    528530    private class GPopupMenu
    529531    extends JPopupMenu
  • trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java

    r5451 r5536  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4344import javax.swing.text.*;
    4445import javax.swing.tree.*;
     46import org.greenstone.gatherer.Dictionary;
    4547import org.greenstone.gatherer.Gatherer;
    4648import org.greenstone.gatherer.collection.BuildOptions;
     
    193195    Gatherer.c_man.registerBuildMonitor(build_monitor);
    194196
    195     // Buttons.
    196     build_button = new JButton(get("CreatePane.Build_Collection"));
     197    // Buttons
     198    build_button = new JButton();
    197199    build_button.addActionListener(new BuildButtonListener());
    198200    build_button.setPreferredSize(BUTTON_SIZE);
    199     build_button.setToolTipText(get("CreatePane.Build_Collection_Tooltip"));
    200     cancel_button = new JButton(get("CreatePane.Cancel_Build"));
     201    Dictionary.registerBoth(build_button, "CreatePane.Build_Collection", "CreatePane.Build_Collection_Tooltip");
     202
     203    cancel_button = new JButton();
    201204    cancel_button.addActionListener(new CancelButtonListener());
    202205    cancel_button.setEnabled(false);
    203206    cancel_button.setPreferredSize(BUTTON_SIZE);
    204     cancel_button.setToolTipText(get("CreatePane.Cancel_Build_Tooltip"));
    205     }
     207    Dictionary.registerBoth(cancel_button, "CreatePane.Cancel_Build", "CreatePane.Cancel_Build_Tooltip");
     208    }
     209
    206210    /** This method is invoked at any time there has been a significant change in the collection, such as saving, loading or creating.
    207       * @param ready A <strong>boolean</strong> indicating if a collection is currently available.
    208       * @see org.greenstone.gatherer.Gatherer
    209       * @see org.greenstone.gatherer.collection.CollectionManager
    210       * @see org.greenstone.gatherer.gui.BuildOptions
    211       * @see org.greenstone.gatherer.gui.OptionsPane
    212       */
     211     * @param ready A <strong>boolean</strong> indicating if a collection is currently available.
     212     * @see org.greenstone.gatherer.Gatherer
     213     * @see org.greenstone.gatherer.collection.CollectionManager
     214     * @see org.greenstone.gatherer.gui.BuildOptions
     215     * @see org.greenstone.gatherer.gui.OptionsPane
     216     */
    213217    public void collectionChanged(boolean ready) {
    214218    ///ystem.err.println("Collection changed... ");
     
    223227    }
    224228    /** This method is called to actually layout the components.
    225       * @see org.greenstone.gatherer.Configuration
    226       * @see org.greenstone.gatherer.Gatherer
    227       */
     229     * @see org.greenstone.gatherer.Configuration
     230     * @see org.greenstone.gatherer.Gatherer
     231     */
    228232    public void display() {
    229233
     
    297301    }
    298302    /** This method is called whenever the 'Create' tab is selected from the view bar. It allows this view to perform any preactions required prior to display. In this case this entails gathering up to date information about the status of the collection including number of documents etc.
    299       * @see org.greenstone.gatherer.Gatherer
    300       * @see org.greenstone.gatherer.collection.CollectionManager
    301       * @see org.greenstone.gatherer.gui.CreatePane.OptionTree
    302       */
     303     * @see org.greenstone.gatherer.Gatherer
     304     * @see org.greenstone.gatherer.collection.CollectionManager
     305     * @see org.greenstone.gatherer.gui.CreatePane.OptionTree
     306     */
    303307    public void gainFocus() {
    304308    if(!processing) {
     
    311315    }
    312316    /** Method to acquire the progress monitor associated with builds.
    313       * @return The build <strong>GShellProgressMonitor</strong>.
    314       */
     317     * @return The build <strong>GShellProgressMonitor</strong>.
     318     */
    315319    public GShellProgressMonitor getBuildProgress() {
    316320    return build_monitor;
    317321    }
    318322    /** Method to acquire the progress monitor associated with copying.
    319       * @return The copying <strong>GShellProgressMonitor</strong>.
    320       */
     323     * @return The copying <strong>GShellProgressMonitor</strong>.
     324     */
    321325    public GShellProgressMonitor getCopyProgress() {
    322326    return copy_monitor;
    323327    }
    324328    /** Method to acquire the progress monitor associated with import.
    325       * @return The import <strong>GShellProgressMonitor</strong>.
    326       */
     329     * @return The import <strong>GShellProgressMonitor</strong>.
     330     */
    327331    public GShellProgressMonitor getImportProgress() {
    328332    return import_monitor;
     
    347351
    348352    /** All implementation of GShellListener must include this method so the listener can be informed when a GShell begins its task. Implementation side-effect, not actually used.
    349       * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement.
    350       */
     353     * @param event A <strong>GShellEvent</strong> that contains details of the initial state of the <strong>GShell</strong> before task comencement.
     354     */
    351355    public synchronized void processBegun(GShellEvent event) {
    352356    // We don't care. We'll get a more acurate start from the progress monitors.
    353357    }
    354358    /** All implementation of GShellListener must include this method so the listener can be informed when a GShell completes its task.
    355       * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion.
    356       */
     359     * @param event A <strong>GShellEvent</strong> that contains details of the final state of the <strong>GShell</strong> after task completion.
     360     */
    357361    public synchronized void processComplete(GShellEvent event) {
    358362    if(event.getStatus() == GShell.OK) {
     
    378382    }
    379383    /** This method retrieves a phrase from the dictionary based apon the key.
    380       * @param key A <strong>String</strong> used as a reference to the correct phrase.
    381       * @return A phrase, matching the key, as a <strong>String</strong>.
    382       */
     384     * @param key A <strong>String</strong> used as a reference to the correct phrase.
     385     * @return A phrase, matching the key, as a <strong>String</strong>.
     386     */
    383387    private String get(String key) {
    384388    return get(key, null);
    385389    }
    386390    /** This method retrieves a phrase from the dictionary based apon the key and arguments.
    387       * @param key A <strong>String</strong> used as a reference to the correct phrase.
    388       * @param args A <strong>String[]</strong> whose contents are often substituted into the phrase before it is returned.
    389       * @return A phrase, matching the key and constructed using the arguments, as a <strong>String</strong>.
    390       * @see org.greenstone.gatherer.Dictionary
    391       * @see org.greenstone.gatherer.Gatherer
    392       */
     391     * @param key A <strong>String</strong> used as a reference to the correct phrase.
     392     * @param args A <strong>String[]</strong> whose contents are often substituted into the phrase before it is returned.
     393     * @return A phrase, matching the key and constructed using the arguments, as a <strong>String</strong>.
     394     * @see org.greenstone.gatherer.Dictionary
     395     * @see org.greenstone.gatherer.Gatherer
     396     */
    393397    private String get(String key, String args[]) {
    394398    if(key.indexOf(".") == -1) {
     
    397401    return Gatherer.dictionary.get(key, args);
    398402    }
     403
    399404    /** This class serves as the listener for actions on the build button. */
    400405    private class BuildButtonListener
     
    502507    }
    503508    /** Any implementation of TreeSelectionListener must include this method to allow this listener to know when the selection has changed. Here we swap the options view depending on the selected OptionTreeNode.
    504             * @param event A <Strong>TreeSelectionEvent</strong> which contains all the information garnered when the event occured.
    505             * @see org.greenstone.gatherer.gui.CreatePane.OptionTreeNode
    506             */
     509     * @param event A <Strong>TreeSelectionEvent</strong> which contains all the information garnered when the event occured.
     510     * @see org.greenstone.gatherer.gui.CreatePane.OptionTreeNode
     511     */
    507512    public void valueChanged(TreeSelectionEvent event) {
    508513        TreePath path = null;
     
    561566    /** Constructor.
    562567     * @param title The <strong>String</strong> which serves as this nodes title.
    563             */
     568     */
    564569    public OptionTreeNode(String title) {
    565570        super();
     
    567572    }
    568573    /** This method compares two nodes for ordering.
    569             * @param obj The <strong>Object</strong> to compare to.
    570             * @return An <strong>int</strong> of one of the possible values -1, 0 or 1 indicating if this node is less than, equal to or greater than the target node respectively.
    571             */
     574     * @param obj The <strong>Object</strong> to compare to.
     575     * @return An <strong>int</strong> of one of the possible values -1, 0 or 1 indicating if this node is less than, equal to or greater than the target node respectively.
     576     */
    572577    public int compareTo(Object obj) {
    573578        return title.compareTo(obj.toString());
    574579    }
    575580    /** This method checks if two nodes are equivelent.
    576             * @param obj The <strong>Object</strong> to be tested against.
    577             * @return A <strong>boolean</strong> which is <i>true</i> if the objects are equal, <i>false</i> otherwise.
    578             */
     581     * @param obj The <strong>Object</strong> to be tested against.
     582     * @return A <strong>boolean</strong> which is <i>true</i> if the objects are equal, <i>false</i> otherwise.
     583     */
    579584    public boolean equals(Object obj) {
    580585        if(compareTo(obj) == 0) {
     
    596601   
    597602    /** Method to translate this node into a textual representation.
    598             * @return A <strong>String</strong> which in this case is the title.
    599             */
     603     * @return A <strong>String</strong> which in this case is the title.
     604     */
    600605    public String toString() {
    601606        return title;
     
    614619                              int row,
    615620                              boolean hasFocus) {
    616         
     621   
    617622        super.getTreeCellRendererComponent(tree, value, sel,
    618623                           expanded, leaf, row,
     
    626631        return this;
    627632    }
    628    
    629     }
    630 
     633    }
    631634}
  • trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java

    r5529 r5536  
    4848import javax.swing.text.*;
    4949import org.greenstone.gatherer.Configuration;
     50import org.greenstone.gatherer.Dictionary;
    5051import org.greenstone.gatherer.Gatherer;
    5152import org.greenstone.gatherer.collection.Collection;
     
    381382    System.gc();
    382383    }
     384
    383385    /** Enabled events on the window to be trapped, creates all the visual components, then builds the tab and other layouts.
    384       */
     386     */
    385387    public void display() {
    386388    content_pane = (JPanel) this.getContentPane();
     
    472474        }
    473475
    474         Gatherer.dictionary.register(tab_pane, null, false);
     476        Dictionary.register(tab_pane);
    475477        content_pane.add(tab_pane, BorderLayout.CENTER);
    476478        // Drive a sessionReady event to update all controls to reflect current collection status.
  • trunk/gli/src/org/greenstone/gatherer/gui/LockFileDialog.java

    r5527 r5536  
    77import org.greenstone.gatherer.Dictionary;
    88import org.greenstone.gatherer.Gatherer;
    9 import org.greenstone.gatherer.gui.TextFieldLabel;
    109import org.greenstone.gatherer.msm.MSMUtils;
    1110import org.greenstone.gatherer.util.Utility;
     
    5150    JLabel name_label = new JLabel(get("LockFileDialog.Name"));
    5251    name_label.setPreferredSize(LABEL_SIZE);
    53     TextFieldLabel name_field = new TextFieldLabel(name);
     52    JTextField name_field = new JTextField(name);
     53    name_field.setEditable(false);
    5454    name_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    5555    JPanel person_pane = new JPanel();
    5656    JLabel person_label = new JLabel(get("LockFileDialog.User"));
    5757    person_label.setPreferredSize(LABEL_SIZE);
    58     TextFieldLabel person_field = new TextFieldLabel(getValue("User"));
     58    JTextField person_field = new JTextField(getValue("User"));
     59    person_field.setEditable(false);
    5960    person_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    6061    JPanel machine_pane = new JPanel();
    6162    JLabel machine_label = new JLabel(get("LockFileDialog.Machine"));
    6263    machine_label.setPreferredSize(LABEL_SIZE);
    63     TextFieldLabel machine_field = new TextFieldLabel(getValue("Machine"));
     64    JTextField machine_field = new JTextField(getValue("Machine"));
     65    machine_field.setEditable(false);
    6466    machine_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    6567    JPanel created_pane = new JPanel();
    6668    JLabel created_label = new JLabel(get("LockFileDialog.Date"));
    6769    created_label.setPreferredSize(LABEL_SIZE);
    68     TextFieldLabel created_field = new TextFieldLabel(getValue("Date"));
     70    JTextField created_field = new JTextField(getValue("Date"));
     71    created_field.setEditable(false);
    6972    created_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    7073    JLabel central_label = new JLabel(get("LockFileDialog.Lockfile_Message_Two"));
  • trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java

    r5529 r5536  
    144144    add.setMnemonic(KeyEvent.VK_A);
    145145    add.setPreferredSize(BUTTON_SIZE);
    146     Dictionary.setBoth(add, "MetaEdit.Accumulate", "MetaEdit.Accumulate_Tooltip");
     146    Dictionary.registerBoth(add, "MetaEdit.Accumulate", "MetaEdit.Accumulate_Tooltip");
    147147
    148148    update = new JButton();
     
    151151    update.setMnemonic(KeyEvent.VK_P);
    152152    update.setPreferredSize(BUTTON_SIZE);
    153     Dictionary.setBoth(update, "MetaEdit.Overwrite", "MetaEdit.Overwrite_Tooltip");
     153    Dictionary.registerBoth(update, "MetaEdit.Overwrite", "MetaEdit.Overwrite_Tooltip");
    154154
    155155    remove = new JButton();
     
    158158    remove.setMnemonic(KeyEvent.VK_R);
    159159    remove.setPreferredSize(BUTTON_SIZE);
    160     Dictionary.setBoth(remove, "MetaEdit.Remove", "MetaEdit.Remove_Tooltip");
     160    Dictionary.registerBoth(remove, "MetaEdit.Remove", "MetaEdit.Remove_Tooltip");
    161161
    162162    expand = new JButton();
     
    165165    expand.setMnemonic(KeyEvent.VK_E);
    166166    expand.setPreferredSize(new Dimension(25, 25));
    167     Dictionary.setBoth(expand, "MetaEdit.Expand", "MetaEdit.Expand_Tooltip");
     167    Dictionary.registerBoth(expand, "MetaEdit.Expand", "MetaEdit.Expand_Tooltip");
    168168
    169169    tree = new GValueTree(CONTROL_SIZE.width, CONTROL_SIZE.height);
     
    301301        String[] args = new String[1];
    302302        args[0] = Gatherer.c_man.getCollection().getName();
    303         Dictionary.setText(collection_label, "Collection.Collection", args);
     303        Dictionary.registerText(collection_label, "Collection.Collection", args);
    304304        // Update label coloring.
    305305        collection_label.setBackground(Gatherer.config.getColor("coloring.collection_heading_background", false));
     
    320320    }
    321321    else {
    322         Dictionary.setText(collection_label, "Collection.No_Collection");
     322        Dictionary.registerText(collection_label, "Collection.No_Collection");
    323323        collection_label.setBackground(Color.lightGray);
    324324        collection_label.setForeground(Color.black);
     
    353353    ///atherer.println("\tCreating collection_label");
    354354    collection_label = new JLabel();
    355     Dictionary.setText(collection_label, "Collection.Collection");
     355    Dictionary.registerText(collection_label, "Collection.Collection");
    356356    collection_label.setOpaque(true);
    357357
     
    384384    fcb.setBackgroundSelectionColor(Gatherer.config.getColor("coloring.collection_selection_background", false));
    385385    fcb.setTextSelectionColor(Gatherer.config.getColor("coloring.collection_selection_foreground", false));
    386     Dictionary.setTooltip(fcb, "Collection.Filter_Tooltip");
     386    Dictionary.registerTooltip(fcb, "Collection.Filter_Tooltip");
    387387    fcb = null;
    388388
     
    419419    table_label.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    420420    table_label.setEditable(false);
    421     Dictionary.setText(table_label, "MetaEdit.No_File");
     421    Dictionary.registerText(table_label, "MetaEdit.No_File");
    422422
    423423    card_layout = new CardLayout();
     
    435435    no_file_message.setOpaque(false);
    436436    no_file_message.setVerticalAlignment(JLabel.CENTER);
    437     Dictionary.setText(no_file_message, "MetaEdit.No_File");
     437    Dictionary.registerText(no_file_message, "MetaEdit.No_File");
    438438
    439439    JLabel no_metadata_message = new JLabel();
     
    441441    no_metadata_message.setOpaque(false);
    442442    no_metadata_message.setVerticalAlignment(JLabel.CENTER);
    443     Dictionary.setText(no_metadata_message, "MetaEdit.No_Metadata");
     443    Dictionary.registerText(no_metadata_message, "MetaEdit.No_Metadata");
    444444
    445445    JPanel table_pane_one = new JPanel();
     
    490490    tools_off_label.setOpaque(false);
    491491    tools_off_label.setVerticalAlignment(JLabel.CENTER);
    492     Dictionary.setText(tools_off_label, "MetaEdit.No_Metadata_Element");
     492    Dictionary.registerText(tools_off_label, "MetaEdit.No_Metadata_Element");
    493493
    494494    JPanel tools_on_pane = new JPanel();
     
    740740    else {
    741741        records = null;
    742         Dictionary.setText(table_label, "MetaEdit.No_File");
     742        Dictionary.registerText(table_label, "MetaEdit.No_File");
    743743
    744744        // Remove old model from msm
     
    11281128        String[] args = new String[1];
    11291129        args[0] = selected_metadata_element.toString();
    1130         Dictionary.setText(extracted_message, "MetaEdit.AutoMessage", args);
     1130        Dictionary.registerText(extracted_message, "MetaEdit.AutoMessage", args);
    11311131        card_layout.show(this, NONE);
    11321132        card_showing = NONE;
  • trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPrompt.java

    r5529 r5536  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    2625 *########################################################################
    2726 */
     27package org.greenstone.gatherer.gui;
     28
    2829import java.awt.*;
    2930import java.awt.event.*;
    3031import java.io.File;
    3132import javax.swing.*;
     33import org.greenstone.gatherer.Dictionary;
    3234import org.greenstone.gatherer.Gatherer;
    33 import org.greenstone.gatherer.gui.TextFieldLabel;
    3435import org.greenstone.gatherer.gui.SimpleMenuBar;
    3536import org.greenstone.gatherer.gui.ModalDialog;
     
    7879    // Setup
    7980    this.setSize(SIZE);
    80     this.setTitle("MetaEditPrompt.Title");
     81    Dictionary.setText(this, "MetaEditPrompt.Title");
    8182
    8283    if (type.equals(ADD_PROMPT)) {
     
    9293    // Creation
    9394    JPanel content_pane = (JPanel)this.getContentPane();
    94     JLabel title_label = new JLabel(type);
     95    JLabel title_label = new JLabel();
     96    Dictionary.setText(title_label, type);
    9597
    9698    JPanel details_pane = new JPanel();
    9799    JPanel filename_panel = new JPanel();
    98     JLabel filename_label = new JLabel("MetaEditPrompt.File");
     100    JLabel filename_label = new JLabel();
    99101    filename_label.setPreferredSize(LABEL_SIZE);
    100     TextFieldLabel filename_field = new TextFieldLabel(Utility.trimCenter(file.getAbsolutePath(), 120));
     102    Dictionary.setText(filename_label, "MetaEditPrompt.File");
     103    JTextField filename_field = new JTextField(Utility.trimCenter(file.getAbsolutePath(), 120));
     104    filename_field.setEditable(false);
    101105    filename_field.setFont(Gatherer.config.getFont("general.tooltip_font", false));
    102106    filename_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    103107    JPanel element_panel = new JPanel();
    104     JLabel element_label = new JLabel("MetaEditPrompt.Element");
     108    JLabel element_label = new JLabel();
    105109    element_label.setPreferredSize(LABEL_SIZE);
    106     TextFieldLabel element_field = new TextFieldLabel(element);
     110    Dictionary.setText(element_label, "MetaEditPrompt.Element");
     111    JTextField element_field = new JTextField(element);
     112    element_field.setEditable(false);
    107113    element_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    108114    JPanel current_value_panel = new JPanel();
    109     JLabel current_value_label = new JLabel("MetaEditPrompt.Current_Value");
     115    JLabel current_value_label = new JLabel();
    110116    current_value_label.setPreferredSize(LABEL_SIZE);
    111     TextFieldLabel current_value_field = new TextFieldLabel(current_value);
     117    Dictionary.setText(current_value_label, "MetaEditPrompt.Current_Value");
     118    JTextField current_value_field = new JTextField(current_value);
     119    current_value_field.setEditable(false);
    112120    current_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    113121    JPanel new_value_panel = new JPanel();
    114     JLabel new_value_label = new JLabel("MetaEditPrompt.New_Value");
     122    JLabel new_value_label = new JLabel();
    115123    new_value_label.setPreferredSize(LABEL_SIZE);
    116     TextFieldLabel new_value_field = new TextFieldLabel(new_value, (type == ADD_PROMPT || type == UPDATE_PROMPT));
     124    Dictionary.setText(new_value_label, "MetaEditPrompt.New_Value");
     125    JTextField new_value_field = new JTextField(new_value); // , (type == ADD_PROMPT || type == UPDATE_PROMPT));
     126    new_value_field.setEditable(false);
    117127    new_value_field.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    118128    JPanel buttons_pane = new JPanel();
    119129
    120     accumulate = new JButton("MetaEdit.Accumulate");
     130    accumulate = new JButton();
    121131    accumulate.setEnabled(type == ADD_PROMPT);
    122132    accumulate.setMnemonic(KeyEvent.VK_A);
    123 
    124     accumulate_all = new JButton("MetaEditPrompt.Accumulate_All");
     133    Dictionary.setBoth(accumulate, "MetaEdit.Accumulate", "MetaEdit.Accumulate_Tooltip");
     134
     135    accumulate_all = new JButton();
    125136    accumulate_all.setEnabled(type == ADD_PROMPT && multiple_selection);
    126137    accumulate_all.setMnemonic(KeyEvent.VK_L);
    127 
    128     overwrite = new JButton("MetaEdit.Overwrite");
     138    Dictionary.setBoth(accumulate_all, "MetaEditPrompt.Accumulate_All", "MetaEditPrompt.Accumulate_All_Tooltip");
     139
     140    overwrite = new JButton();
    129141    overwrite.setEnabled(type == UPDATE_PROMPT);
    130142    overwrite.setMnemonic(KeyEvent.VK_R);
    131 
    132     overwrite_all = new JButton("MetaEditPrompt.Overwrite_All");
     143    Dictionary.setBoth(overwrite, "MetaEdit.Overwrite", "MetaEdit.Overwrite_Tooltip");
     144
     145    overwrite_all = new JButton();
    133146    overwrite_all.setEnabled(type == UPDATE_PROMPT && multiple_selection);
    134147    overwrite_all.setMnemonic(KeyEvent.VK_P);
    135 
    136     remove = new JButton("MetaEdit.Remove");
     148    Dictionary.setBoth(overwrite_all, "MetaEditPrompt.Overwrite_All", "MetaEditPrompt.Overwrite_All_Tooltip");
     149
     150    remove = new JButton();
    137151    remove.setEnabled(type == REMOVE_PROMPT);
    138152    remove.setMnemonic(KeyEvent.VK_R);
    139 
    140     remove_all = new JButton("MetaEditPrompt.Remove_All");
     153    Dictionary.setBoth(remove, "MetaEdit.Remove", "MetaEdit.Remove_Tooltip");
     154
     155    remove_all = new JButton();
    141156    remove_all.setEnabled(type == REMOVE_PROMPT && multiple_selection);
    142157    remove_all.setMnemonic(KeyEvent.VK_A);
    143 
    144     skip = new JButton("MetaEditPrompt.Skip");
     158    Dictionary.setBoth(remove_all, "MetaEditPrompt.Remove_All", "MetaEditPrompt.Remove_All_Tooltip");
     159
     160    skip = new JButton();
    145161    skip.setEnabled(multiple_selection);
    146162    skip.setMnemonic(KeyEvent.VK_S);
    147 
    148     cancel = new JButton("General.Cancel");
     163    Dictionary.setBoth(skip, "MetaEditPrompt.Skip", "MetaEditPrompt.Skip_Tooltip");
     164
     165    cancel = new JButton();
    149166    cancel.setMnemonic(KeyEvent.VK_C);
     167    Dictionary.setBoth(cancel, "General.Cancel", "General.Cancel_Tooltip");
    150168
    151169    // Connection
     
    212230    Rectangle frame_bounds = Gatherer.g_man.getBounds();
    213231    this.setLocation(frame_bounds.x + ((frame_bounds.width - SIZE.width) / 2), frame_bounds.y + ((frame_bounds.height - SIZE.height) / 2));
    214 
    215     // Dictionary registration
    216     Gatherer.dictionary.register(title_label, null, false);
    217     Gatherer.dictionary.register(filename_label, null, false);
    218     Gatherer.dictionary.register(element_label, null, false);
    219     Gatherer.dictionary.register(current_value_label, null, false);
    220     Gatherer.dictionary.register(new_value_label, null, false);
    221 
    222     Gatherer.dictionary.register(accumulate, null, false);
    223     Gatherer.dictionary.register(accumulate_all, null, false);
    224     Gatherer.dictionary.register(cancel, null, false);
    225     Gatherer.dictionary.register(skip, null, false);
    226     Gatherer.dictionary.register(overwrite, null, false);
    227     Gatherer.dictionary.register(overwrite_all, null, false);
    228     Gatherer.dictionary.register(remove, null, false);
    229     Gatherer.dictionary.register(remove_all, null, false);
    230232    }
    231233
  • trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java

    r5529 r5536  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4748import org.greenstone.gatherer.WGet;
    4849import org.greenstone.gatherer.util.Utility;
     50
    4951/**
    5052 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    8183    JLabel url_label = new JLabel();
    8284    url_label.setPreferredSize(Utility.LABEL_SIZE);
    83     Dictionary.setText(url_label, "Mirroring.Source_URL");
     85    Dictionary.registerText(url_label, "Mirroring.Source_URL");
    8486    url_textfield = new JTextField();
    85     Dictionary.setTooltip(url_textfield, "Mirroring.Source_URL_Tooltip");
     87    Dictionary.registerTooltip(url_textfield, "Mirroring.Source_URL_Tooltip");
    8688
    8789    JPanel depth_pane = new JPanel();
    8890    JLabel depth_label = new JLabel();
    89     Dictionary.setText(depth_label, "Mirroring.Download_Depth");
     91    Dictionary.registerText(depth_label, "Mirroring.Download_Depth");
    9092    depth_spinner = new JSpinner();
    91     Dictionary.setTooltip(depth_spinner, "Mirroring.Download_Depth_Tooltip");
     93    Dictionary.registerTooltip(depth_spinner, "Mirroring.Download_Depth_Tooltip");
    9294
    9395    JPanel destination_pane = new JPanel();
    9496    JLabel destination_label = new JLabel();
    95     Dictionary.setText(destination_label, "Mirroring.Destination_Folder");
     97    Dictionary.registerText(destination_label, "Mirroring.Destination_Folder");
    9698    ButtonGroup group = new ButtonGroup();
    9799    public_radiobutton = new JRadioButton();
    98100    public_radiobutton.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    99101    public_radiobutton.setOpaque(false);
    100     Dictionary.setText(public_radiobutton, "Tree.Public");
     102    Dictionary.registerText(public_radiobutton, "Tree.Public");
    101103    private_radiobutton = new JRadioButton();
    102104    private_radiobutton.setBackground(Gatherer.config.getColor("coloring.collection_tree_background", false));
    103105    private_radiobutton.setOpaque(false);
    104     Dictionary.setText(private_radiobutton, "Tree.Private");
     106    Dictionary.registerText(private_radiobutton, "Tree.Private");
    105107    group.add(public_radiobutton);
    106108    group.add(private_radiobutton);
     
    109111    JPanel first_pane = new JPanel();
    110112    automatic_checkbox = new JCheckBox();
    111     Dictionary.setText(automatic_checkbox, "Mirroring.Download_Hidden");
     113    Dictionary.registerText(automatic_checkbox, "Mirroring.Download_Hidden");
    112114    overwrite_checkbox = new JCheckBox();
    113     Dictionary.setText(overwrite_checkbox, "Mirroring.Overwrite_Existing");
     115    Dictionary.registerText(overwrite_checkbox, "Mirroring.Overwrite_Existing");
    114116
    115117    JPanel second_pane = new JPanel();
    116118    higher_checkbox = new JCheckBox();
    117     Dictionary.setText(higher_checkbox, "Mirroring.Higher_Directories");
     119    Dictionary.registerText(higher_checkbox, "Mirroring.Higher_Directories");
    118120    same_host_checkbox = new JCheckBox();
    119     Dictionary.setText(same_host_checkbox, "Mirroring.Same_Host");
     121    Dictionary.registerText(same_host_checkbox, "Mirroring.Same_Host");
    120122
    121123    remove_failed_checkbox = new JCheckBox();
    122     Dictionary.setText(remove_failed_checkbox, "Mirroring.Remove_Failed");
     124    Dictionary.registerText(remove_failed_checkbox, "Mirroring.Remove_Failed");
    123125
    124126    JLabel further_label = new JLabel();
    125     Dictionary.setText(further_label, "Mirroring.Further_Options");
     127    Dictionary.registerText(further_label, "Mirroring.Further_Options");
    126128
    127129    JPanel button_pane = new JPanel();
    128130    download_button = new JButton();
    129     Dictionary.setBoth(download_button, "Mirroring.Download", "Mirroring.Download_Tooltip");
     131    Dictionary.registerBoth(download_button, "Mirroring.Download", "Mirroring.Download_Tooltip");
    130132
    131133    // Connect
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r5527 r5536  
    88import javax.swing.event.*;
    99import javax.swing.text.*;
     10import org.greenstone.gatherer.Dictionary;
    1011import org.greenstone.gatherer.Gatherer;
    1112import org.greenstone.gatherer.collection.CollectionConfiguration;
     
    4546    setJMenuBar(new SimpleMenuBar("creatingacollection"));
    4647    setSize(size);
    47     setTitle(get("NewCollectionPrompt.Title"));
     48    Dictionary.setText(this, "NewCollectionPrompt.Title");
     49
    4850    // Model building. Build a model of all of the collections in the gsdl collect directory with the appropriate directories and hardcode the big five.
    4951    Vector base_collection_model = new Vector();
     
    5254    File[] possible_collections = gsdl_collection_directory.listFiles();
    5355    for(int i = 0; possible_collections != null && i < possible_collections.length; i++) {
    54                 // The simpliest case is if the directory etc/collect.cfg file and a metadata/ in it. Thus it can easily be built upon.
     56        // The simpliest case is if the directory etc/collect.cfg file and a metadata/ in it. Thus it can easily be built upon.
    5557        File collect_cfg_file = new File(possible_collections[i], Utility.CONFIG_DIR);
    5658        File metadata_directory = new File(possible_collections[i], Utility.META_DIR);
     
    6870        // Else not a collection we know how to retrieve the metadata set for.
    6971        }
    70                 // Else not a collection at all. Someones pulling a fast one.
     72        // Else not a collection at all. Someones pulling a fast one.
    7173    }
    7274    // Sort the result.
    7375    Collections.sort(base_collection_model);
    74     base_collection_model.add(0, new Item(null, get("NewCollectionPrompt.NewCollection")));
    75     // Creation.
     76    base_collection_model.add(0, new Item(null, Dictionary.newget("NewCollectionPrompt.NewCollection")));
     77
     78    // Creation
    7679    JPanel content_pane = (JPanel) getContentPane();
    7780    content_pane.setOpaque(true);
    7881    JPanel upper_pane = new JPanel();
    79     upper_pane.setOpaque(false);
    80     JLabel instructions_label = new JLabel(get("NewCollectionPrompt.Instructions"));
    81     instructions_label.setOpaque(false);
     82    JLabel instructions_label = new JLabel();
     83    Dictionary.setText(instructions_label, "NewCollectionPrompt.Instructions");
    8284    JPanel title_pane = new JPanel();
    83     title_pane.setOpaque(false);
    84     JLabel title_label = new JLabel(get("NewCollectionPrompt.Collection_Title"));
    85     title_label.setOpaque(false);
     85    JLabel title_label = new JLabel();
     86    Dictionary.setText(title_label, "CDM.General.Collection_Name");
    8687    title = new JTextField();
     88    Dictionary.setTooltip(title, "CDM.General.Collection_Name_Tooltip");
    8789    JPanel name_pane = new JPanel();
    88     name_pane.setOpaque(false);
    89     JLabel name_label = new JLabel(get("NewCollectionPrompt.Collection_Name"));
    90     name_label.setOpaque(false);
     90    JLabel name_label = new JLabel();
     91    Dictionary.setText(name_label, "NewCollectionPrompt.Collection_Name");
    9192    JPanel file_pane = new JPanel();
    92     file_pane.setOpaque(false);
    9393    file = new RestrictedTextField(new RestrictedTextDocument(FILENAME_SIZE), "", FILENAME_SIZE);
     94    Dictionary.setTooltip(file, "NewCollectionPrompt.Collection_Name_Tooltip");
    9495    JLabel file_label = new JLabel(".col");
    95     file_label.setOpaque(false);
    9696    JPanel email_pane = new JPanel();
    97     email_pane.setOpaque(false);
    98     JLabel email_label = new JLabel(get("NewCollectionPrompt.Collection_Email"));
    99     email_label.setOpaque(false);
     97    JLabel email_label = new JLabel();
     98    Dictionary.setText(email_label, "NewCollectionPrompt.Collection_Email");
    10099    JPanel host_pane = new JPanel();
    101     host_pane.setOpaque(false);
    102100    JPanel address_pane = new JPanel();
    103     address_pane.setOpaque(false);
    104101    address = new JTextField();
     102    Dictionary.setTooltip(address, "CDM.General.Email.Creator_Tooltip");
    105103    JLabel at_label = new JLabel("@");
    106104    host = new JTextField();
     105    Dictionary.setTooltip(host, "CDM.General.Email.Creator_Tooltip");
     106
    107107    JPanel center_pane = new JPanel();
    108     center_pane.setOpaque(false);
    109108    JPanel description_pane = new JPanel();
    110     description_pane.setOpaque(false);
    111     JLabel description_label = new JLabel(get("NewCollectionPrompt.Collection_Description"));
    112     description_label.setOpaque(false);
     109    JLabel description_label = new JLabel();
     110    Dictionary.setText(description_label, "NewCollectionPrompt.Collection_Description");
    113111    description = new JTextArea();
    114112    description.setBackground(Gatherer.config.getColor("coloring.editable_background", false));
    115113    description.setForeground(Gatherer.config.getColor("coloring.editable_foreground", false));
    116114    description.setRows(5);
     115    Dictionary.setTooltip(description, "CDM.General.Collection_Extra_Tooltip");
    117116
    118117    JPanel bottom_pane = new JPanel();
    119118    // Base Collection
    120119    JPanel base_collection_pane = new JPanel();
    121     JLabel base_collection_label = new JLabel(get("NewCollectionPrompt.Base_Collection"));
     120    JLabel base_collection_label = new JLabel();
     121    Dictionary.setText(base_collection_label, "NewCollectionPrompt.Base_Collection");
    122122    base_collection = new JComboBox(base_collection_model);
    123     // JButton base_collection_browse = new JButton(get("General.Browse"));
     123    Dictionary.setTooltip(base_collection, "NewCollectionPrompt.Base_Collection_Tooltip");
    124124
    125125    JPanel button_pane = new JPanel();
    126     button_pane.setOpaque(false);
    127     create_button = new JButton(get("General.OK"));
     126    create_button = new JButton();
    128127    create_button.setMnemonic(KeyEvent.VK_O);
    129     JButton cancel_button = new JButton(get("General.Cancel"));
     128    Dictionary.setBoth(create_button, "General.OK", "General.OK_Tooltip");
     129    JButton cancel_button = new JButton();
    130130    cancel_button.setMnemonic(KeyEvent.VK_C);
     131    Dictionary.setBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip");
    131132    ColorListener email_color_listener = new ColorListener(address, host);
     133
    132134    // Connection
    133     // base_collection_browse.addActionListener(new BrowseListener());
    134135    cancel_button.addActionListener(new CancelListener());
    135136    create_button.addActionListener(new CreateListener());
     
    237238    }
    238239
    239     // public boolean viewExtractedMetadata() {
    240     // return view_extracted_metadata_radio_button.isSelected();
    241     // }
    242 
    243     /** Gets a phrase from the dictionary based on key.
    244      * @param key A <strong>String</strong> which serves as the unique identifier of a phrase.
    245      * @return The desired phrase as a <strong>String</strong> or at least a meaningful error message.
    246      */
    247     private String get(String key) {
    248     if(key.indexOf(".") == -1) {
    249         key = "NewCollectionPrompt." + key;
    250     }
    251     return Gatherer.dictionary.get(key);
    252     }
    253240
    254241    private class BrowseListener
     
    262249        file = new File(Utility.BASE_DIR);
    263250        }
    264                 // Show OpenCollectionPrompt.
     251        // Show OpenCollectionPrompt.
    265252        OpenCollectionDialog chooser = new OpenCollectionDialog(file);
    266253        file = chooser.getSelectedFile();
     
    311298        title_final = title.getText();
    312299        if(title_final.length() == 0) {
    313         GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"), get("NewCollectionPrompt.Title_Error"), "error.gif", null);
     300        GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Title_Error"), "error.gif", null);
    314301        err_msg.display();
    315302        err_msg.destroy();
     
    326313        for(int i = 0; children != null && i < children.length; i++) {
    327314            if(children[i].getName().equals(name_final)) {
    328             GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"), get("NewCollectionPrompt.Name_Error"), "error.gif", null);
     315            GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Name_Error"), "error.gif", null);
    329316            err_msg.display();
    330317            err_msg.destroy();
     
    337324        }
    338325        else {
    339         GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"), get("NewCollectionPrompt.Name_Error"), "error.gif", null);
     326        GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Name_Error"), "error.gif", null);
    340327        err_msg.display();
    341328        err_msg.destroy();
     
    347334        email_final = address.getText() + "@" + host.getText();
    348335        if(email_final.length() == 0 || email_final.startsWith("@") || email_final.endsWith("@")) {
    349         GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"), get("NewCollectionPrompt.Email_Error"), "error.gif", null);
     336        GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Email_Error"), "error.gif", null);
    350337        err_msg.display();
    351338        err_msg.destroy();
     
    359346        description_final = description.getText();
    360347        if(description_final.length() == 0) {
    361         GPrompt err_msg = new GPrompt(self, get("NewCollectionPrompt.Error"), get("NewCollectionPrompt.Description_Error"), "error.gif", null);
     348        GPrompt err_msg = new GPrompt(self, Dictionary.newget("NewCollectionPrompt.Error"), Dictionary.newget("NewCollectionPrompt.Description_Error"), "error.gif", null);
    362349        err_msg.display();
    363350        err_msg.destroy();
     
    444431    public void insertString(int offs, String str, AttributeSet a)
    445432        throws BadLocationException {
    446                 // Remove any blocked characters.
     433        // Remove any blocked characters.
    447434        StringBuffer temp = new StringBuffer(str);
    448435        for(int i = 0; block != null && i < block.length; i++) {
     
    472459        updateFilename();
    473460    }
    474          
     461
    475462    /** Gives notification that there was an insert into the document. */
    476463    public void insertUpdate(DocumentEvent e) {
  • trunk/gli/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java

    r5302 r5536  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4344import java.text.*;
    4445import java.util.*;
    45 import javax.accessibility.*;
    4646import javax.swing.*;
    4747import javax.swing.filechooser.*;
     
    5151import org.greenstone.gatherer.collection.CollectionManager;
    5252import org.greenstone.gatherer.util.Utility;
    53 import org.outerj.pollo.util.*;
    5453
    5554public class OpenCollectionDialog
     
    5958    /** The name of the mouse listener that initiates editing on a double click. */
    6059    static final private String SINGLE_CLICK_LISTENER = "SingleClickListener";
     60
    6161    /** Constructor */
    6262    public OpenCollectionDialog(File file) {
     
    6565    // Other initialization
    6666    setAcceptAllFileFilterUsed(false);
    67     setDialogTitle(Gatherer.dictionary.get("OpenCollectionDialog.Title"));
     67    setDialogTitle(Dictionary.newget("OpenCollectionDialog.Title"));
    6868    setFileFilter(new GathererFilter());
    6969    setFileSystemView(new GathererFileSystemView());
     
    7979    JPanel center_pane = (JPanel) accessory_pane.getParent();
    8080    center_pane.add(accessory_pane, BorderLayout.SOUTH);
    81     // Done.
    8281    }
    8382
     
    125124    }
    126125
    127     static public void main(String args[]) {
    128     JFrame frame = new JFrame();
    129     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    130     frame.setSize(800,640);
    131     OpenCollectionDialog chooser = new OpenCollectionDialog(new File("/research/jmt12/gsdl/collect/"));
    132     // Show dialog
    133     int result = chooser.showOpenDialog(frame);
    134     }
    135126
    136127    /* The DescriptionPreview accessory is adapted from the ImagePreview.java (an example used by FileChooserDemo2.java). */
     
    140131    private File file = null;
    141132    private JTextArea text;
    142     //private JEditorPane text;
     133
    143134    public DescriptionPreview(JFileChooser fc) {
    144135        setName("Description Preview");
    145136        setPreferredSize(new Dimension(100, 75)); // About three rows.
    146137
    147         text = new JTextArea(Gatherer.dictionary.get("OpenCollectionDialog.No_Description"));
    148                 //text.setLineWrap(true);
    149                 //text.setWrapStyleWord(true);
    150                 //text = new JEditorPane();
    151                 //text.setText(Gatherer.dictionary.get("OpenCollectionDialog.No_Description"));
     138        text = new JTextArea();
     139        Dictionary.setText(text, "OpenCollectionDialog.No_Description");
    152140
    153141        setBorder(BorderFactory.createEmptyBorder(5,0,0,0));
     
    157145        fc.addPropertyChangeListener(this);
    158146    }
     147
    159148    /** Whenever a new file or folder is selected we determine what description should be displayed. */
    160149    public void propertyChange(PropertyChangeEvent e) {
    161150        boolean update = false;
    162151        String prop = e.getPropertyName();
    163                 //If the directory changed, don't show an image.
     152        // If the directory changed, don't show an image.
    164153        if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
    165154        file = null;
    166         update = true;
    167                      
    168         //If a file became selected, find out which one.
    169         } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
     155        update = true;           
     156        }
     157        // If a file became selected, find out which one.
     158        else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
    170159        file = (File) e.getNewValue();
    171160        update = true;
    172161        }
    173                 //Update the description accordingly.
     162
     163        // Update the description accordingly.
    174164        if (update) {
    175165        if(file == null) {
    176             text.setText(Gatherer.dictionary.get("OpenCollectionDialog.No_Description"));
     166            Dictionary.setText(text, "OpenCollectionDialog.No_Description");
    177167        }
    178168        else {
     
    186176        }
    187177        }
    188     } 
     178    }
    189179    }
    190180
     
    192182    private class GathererFilter
    193183    extends FileFilter {
    194  
    195     //Accept all directories and all gif, jpg, tiff, or png files.
     184
     185    // Accept all directories and all .col files
    196186    public boolean accept(File f) {
    197187        return (f.isDirectory() || f.getName().toLowerCase().endsWith(".col"));
    198188    }
    199          
    200     //The description of this filter
     189
     190    // The description of this filter
    201191    public String getDescription() {
    202         return Gatherer.dictionary.get("OpenCollectionDialog.Collection");
     192        return Dictionary.newget("OpenCollectionDialog.Collection");
    203193    }
    204194    }
     
    217207    /** Gets the list of shown (i.e. */
    218208    public File[] getFiles(File dir, boolean useFileHiding) {
    219                 // Retrieve the files usually returned by the platform specific file system view.
     209        // Retrieve the files usually returned by the platform specific file system view.
    220210        File[] files = default_system_view.getFiles(dir, useFileHiding);
    221                 // Determine if the current dir actually contains a valid greenstone collection. To do this we check for the presence of the file <dir>/etc/collect.cfg and a directory named import.
     211        // Determine if the current dir actually contains a valid greenstone collection. To do this we check for the presence of the file <dir>/etc/collect.cfg and a directory named import.
    222212        File collect_cfg_file = new File(dir, Utility.CONFIG_DIR);
    223213        File import_dir_file = new File(dir, Utility.IMPORT_DIR);
     
    246236    private class GathererFileView
    247237    extends FileView {
     238
    248239    public String getDescription(File file) {
    249240        String description = null;
    250         if(file.getName().endsWith(".col")) {
    251         if(!lockExists(file)) {
    252             Gatherer.dictionary.get("OpenCollectionDialog.Normal_Collection");
     241        if (file.getName().endsWith(".col")) {
     242        if (!lockExists(file)) {
     243            description = Dictionary.newget("OpenCollectionDialog.Normal_Collection");
    253244        }
    254245        else {
    255             Gatherer.dictionary.get("OpenCollectionDialog.Locked_Collection");
     246            description = Dictionary.newget("OpenCollectionDialog.Locked_Collection");
    256247        }
    257248        }
    258249        return description;
    259250    }
     251
    260252    public Icon getIcon(File file) {
    261253        Icon icon = null;
    262         if(file.getName().endsWith(".col")) {
    263         if(!lockExists(file)) {
     254        if (file.getName().endsWith(".col")) {
     255        if (!lockExists(file)) {
    264256            icon = NORMAL_COLLECTION_ICON;
    265257        }
     
    270262        return icon;
    271263    }
     264
    272265    /** Determine if a lock file exists. */
    273266    private boolean lockExists(File file) {
  • trunk/gli/src/org/greenstone/gatherer/gui/OptionsPane.java

    r5350 r5536  
    1 package org.greenstone.gatherer.gui;
    21/**
    32 *#########################################################################
     
    3635 *########################################################################
    3736 */
     37package org.greenstone.gatherer.gui;
     38
    3839import java.awt.*;
    3940import java.awt.event.*;
     
    4344import javax.swing.event.*;
    4445import javax.swing.text.*;
     46import org.greenstone.gatherer.Dictionary;
    4547import org.greenstone.gatherer.Gatherer;
    4648import org.greenstone.gatherer.cdm.Argument;
     
    5355import org.greenstone.gatherer.util.AppendLineOnlyFileDocumentOwner;
    5456import org.greenstone.gatherer.util.Utility;
    55 //import org.w3c.dom.*;
     57
    5658/** This class serves as the data holder for all subclasses of option panes, such as Import options or All options. It also contains methods for creating each of the option lines as they would appear in the subpane. Futhermore it has a method for considering all the arguments and generating a <strong>String[]</strong> to allow you to pass them to the <strong>GShell</strong>.
    5759 * @author John Thompson, Greenstone Digital Library, University of Waikato
     
    9193
    9294
    93     /** The default constructor creates the few session length options, but either retrieves the rest from the current collection, or creates a default set of options. */
     95    /** The default constructor creates the few session length options, but either retrieves the rest from the current collection, or creates a default set of options. */
    9496    public OptionsPane(BuildOptions build_options) {
    9597    this.build_options = build_options;
     
    102104
    103105    /** This method creates the panel with all the build only options on it.
    104       * @return A <strong>JPanel</strong> which can be used to display all the build only options.
    105       */
     106     * @return A <strong>JPanel</strong> which can be used to display all the build only options.
     107     */
    106108    public JPanel buildBuild() {
    107109    JPanel pane = new JPanel();
     
    122124    }
    123125    /** This method creates the panel with all the import only options on it.
    124       * @return A <strong>JPanel</strong> which can be used to display all the import only options.
    125       */
     126     * @return A <strong>JPanel</strong> which can be used to display all the import only options.
     127     */
    126128    public JPanel buildImport() {
    127129    JPanel pane = new JPanel();
     
    142144    }
    143145    /** This method is used to build a panel based on the message log, which is nothing like any of the other panels.
    144       * @return A <strong>JPanel</strong> containing a scrollable text area which represents the shell process message log.
    145       */
     146     * @return A <strong>JPanel</strong> containing a scrollable text area which represents the shell process message log.
     147     */
    146148    public JPanel buildLog() {
    147149    // we now save the log pane
     
    179181        log_list.addListSelectionListener(new LogListListener());
    180182
    181         JLabel log_history_label = new JLabel(get("OptionsPane.LogHistory"));
     183        JLabel log_history_label = new JLabel();
     184        Dictionary.registerText(log_history_label, "OptionsPane.LogHistory");
    182185        JPanel log_history_pane = new JPanel();
    183186        log_history_pane.setPreferredSize(new Dimension(600, 100));
     
    211214    }
    212215
    213     /** This method retrieves a phrase from the dictionary based apon the key.
    214       * @param key A <strong>String</strong> used as a reference to the correct phrase.
    215       * @return A phrase, matching the key, as a <strong>String</strong>.
    216       */
    217     private String get(String key) {
    218     return get(key, null);
    219     }
    220     /** This method retrieves a phrase from the dictionary based apon the key and arguments.
    221       * @param key A <strong>String</strong> used as a reference to the correct phrase.
    222       * @param args A <strong>String[]</strong> whose contents are often substituted into the phrase before it is returned.
    223       * @return A phrase, matching the key and constructed using the arguments, as a <strong>String</strong>.
    224       * @see org.greenstone.gatherer.Dictionary
    225       * @see org.greenstone.gatherer.Gatherer
    226       */
    227     private String get(String key, String args[]) {
    228     if(key.indexOf(".") == -1) {
    229         key = "OptionsPane." + key;
    230     }
    231     return Gatherer.dictionary.get(key, args);
    232     }
     216
    233217    /** Attempts to discover the latest document count.
    234218     * @return An <strong>int</strong> detailing the number of documents in this collection.
     
    285269        setLayout(new BorderLayout());
    286270        setPreferredSize(ROW_SIZE);
    287 
    288         /*
    289           JPanel inner_pane = new JPanel();
    290           inner_pane.setOpaque(false);
    291         */
    292271
    293272        // Try to determine what the value_controls value should be.
     
    389368        }
    390369
    391                 // If the argument is required, then you don't get a choice of whether it is enabled.
     370        // If the argument is required, then you don't get a choice of whether it is enabled.
    392371        if(argument.isRequired()) {
    393372        JLabel label = new JLabel(argument.getName());
     
    460439    }
    461440    /** Any implementation of ActionListener must include this method so that we can be informed when an action has been performed on or registered check box, prompting us to change the state of the other controls as per the users request.
    462             * @param event An <strong>ActionEvent</strong> containing information about the click.
    463             */
     441     * @param event An <strong>ActionEvent</strong> containing information about the click.
     442     */
    464443    public void actionPerformed(ActionEvent event) {
    465444        JCheckBox source = (JCheckBox)event.getSource();
     
    562541        switch (success) {
    563542        case SUCCESSFUL:
    564             d.append(get("OptionsPane.Successful"));
     543            d.append(Dictionary.newget("OptionsPane.Successful"));
    565544            break;
    566545        case UNSUCCESSFUL:
    567             d.append(get("OptionsPane.Unsuccessful"));
     546            d.append(Dictionary.newget("OptionsPane.Unsuccessful"));
    568547            break;
    569548        case CANCELLED:
    570             d.append(get("OptionsPane.Cancelled"));
     549            d.append(Dictionary.newget("OptionsPane.Cancelled"));
    571550            break;
    572551        default:
    573             d.append(get("OptionsPane.Unknown"));
     552            d.append(Dictionary.newget("OptionsPane.Unknown"));
    574553        }
    575554        display = d.toString();
  • trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java

    r5527 r5536  
    99import javax.swing.event.*;
    1010import org.greenstone.gatherer.Configuration;
     11import org.greenstone.gatherer.Dictionary;
    1112import org.greenstone.gatherer.Gatherer;
    1213import org.greenstone.gatherer.checklist.CheckList;
     
    6162    this.self = this;
    6263    setSize(SIZE);
    63     setTitle("Preferences");
     64    Dictionary.registerText(this, "Preferences");
    6465    setJMenuBar(new SimpleMenuBar("preferences"));
     66
    6567    // Creation
    6668    JPanel content_pane = (JPanel) getContentPane();
    6769    tab_pane = new JTabbedPane();
    68     tab_pane.add("Preferences.General", createGeneralPreferences());
     70    JPanel general_preferences = createGeneralPreferences();
     71    tab_pane.add("Preferences.General", general_preferences);
    6972    tab_pane.add("Preferences.Workflow", createWorkflowPreferences());
    7073    tab_pane.add("Preferences.Connection", createConnectionPreferences());
    7174    tab_pane.add("Preferences.Warnings", createWarningPreferences());
     75    Dictionary.register(tab_pane);
    7276
    7377    JPanel button_pane = new JPanel();
    74     ok_button = new JButton("General.OK");
    75     apply_button = new JButton("General.Apply");
    76     cancel_button = new JButton("General.Cancel");
     78    ok_button = new JButton();
     79    Dictionary.registerBoth(ok_button, "General.OK", "General.OK_Tooltip");
     80    apply_button = new JButton();
     81    Dictionary.registerBoth(apply_button, "General.Apply", "General.Apply_Tooltip");
     82    cancel_button = new JButton();
     83    Dictionary.registerBoth(cancel_button, "General.Cancel", "General.Cancel_Tooltip");
     84
    7785    // Connection
    78     Gatherer.dictionary.register(this, null, false);
    79     Gatherer.dictionary.register(tab_pane, null, false);
    80     Gatherer.dictionary.register(ok_button, null, false);
    81     Gatherer.dictionary.register(apply_button, null, false);
    82     Gatherer.dictionary.register(cancel_button, null, false);
    8386    ok_button.addActionListener(new OKButtonListener(true));
    8487    apply_button.addActionListener(new OKButtonListener(false));
    8588    cancel_button.addActionListener(new CancelButtonListener());
     89
    8690    // Layout
    8791    button_pane.setBorder(BorderFactory.createEmptyBorder(5,2,2,2));
     
    114118    JPanel library_path_pane = new JPanel();
    115119    library_path_pane.setPreferredSize(ROW_SIZE);
    116     library_path_label = new JLabel("Preferences.Connection.Library_Path");
     120    library_path_label = new JLabel();
    117121    library_path_label.setPreferredSize(LABEL_SIZE);
     122    Dictionary.registerText(library_path_label, "Preferences.Connection.Library_Path");
    118123    library_path_field = new JTextField(Gatherer.config.getString("general.exec_address", true));
    119124    library_path_field.setCaretPosition(0);
     125    Dictionary.registerTooltip(library_path_field, "Preferences.Connection.Library_Path_Tooltip");
    120126
    121127    boolean currently_enabled = Gatherer.config.get("general.use_proxy", true);
    122128    // Creation
    123129    JPanel connection_pane = new JPanel();
    124     use_proxy_checkbox = new JCheckBox("Preferences.Connection.Use_Proxy", currently_enabled);
     130    use_proxy_checkbox = new JCheckBox();
     131    use_proxy_checkbox.setSelected(currently_enabled);
     132    Dictionary.registerText(use_proxy_checkbox, "Preferences.Connection.Use_Proxy");
     133
    125134    use_proxy_checkbox.setPreferredSize(ROW_SIZE);
    126135    JPanel proxy_host_pane = new JPanel();
    127136    proxy_host_pane.setPreferredSize(ROW_SIZE);
    128     proxy_host_label = new JLabel("Preferences.Connection.Proxy_Host");
     137    proxy_host_label = new JLabel();
    129138    proxy_host_label.setPreferredSize(LABEL_SIZE);
     139    Dictionary.registerText(proxy_host_label, "Preferences.Connection.Proxy_Host");
    130140    proxy_host_field = new JTextField(Gatherer.config.getString("general.proxy_host", true));
    131141    proxy_host_field.setEnabled(currently_enabled);
     142    Dictionary.registerTooltip(proxy_host_field, "Preferences.Connection.Proxy_Host_Tooltip");
    132143    JPanel proxy_port_pane = new JPanel();
    133144    proxy_port_pane.setPreferredSize(ROW_SIZE);
    134     proxy_port_label = new JLabel("Preferences.Connection.Proxy_Port");
     145    proxy_port_label = new JLabel();
    135146    proxy_port_label.setPreferredSize(LABEL_SIZE);
     147    Dictionary.registerText(proxy_port_label, "Preferences.Connection.Proxy_Port");
    136148    proxy_port_field = new NumberField(Gatherer.config.getString("general.proxy_port", true));
    137149    proxy_port_field.setEnabled(currently_enabled);
     150    Dictionary.registerTooltip(proxy_port_field, "Preferences.Connection.Proxy_Port_Tooltip");
    138151
    139152    // Connection
    140     Gatherer.dictionary.register(library_path_label, null, false);
    141     Gatherer.dictionary.register(use_proxy_checkbox, null, false);
    142     Gatherer.dictionary.register(proxy_host_label, null, false);
    143     Gatherer.dictionary.register(proxy_port_label, null, false);
    144153    use_proxy_checkbox.addActionListener(new UseProxyListener());
    145154
     
    214223
    215224    // Extracted metadata
    216     view_extracted_metadata_checkbox = new JCheckBox("Preferences.General.View_Extracted_Metadata", false);
     225    view_extracted_metadata_checkbox = new JCheckBox();
     226    view_extracted_metadata_checkbox.setSelected(false);
     227    Dictionary.registerText(view_extracted_metadata_checkbox, "Preferences.General.View_Extracted_Metadata");
    217228    if (Gatherer.config.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) {
    218229        view_extracted_metadata_checkbox.setSelected(true);
     
    220231
    221232    // Show file sizes
    222     show_file_size_checkbox = new JCheckBox("Preferences.General.Show_File_Size", false);
     233    show_file_size_checkbox = new JCheckBox();
     234    show_file_size_checkbox.setSelected(false);
     235    Dictionary.registerText(show_file_size_checkbox, "Preferences.General.Show_File_Size");
    223236    if (Gatherer.config.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) {
    224237        show_file_size_checkbox.setSelected(true);
     
    227240    // Language
    228241    JPanel language_pane = new JPanel();
    229     language_label = new JLabel("Preferences.General.Interface_Language");
     242    language_label = new JLabel();
    230243    language_label.setPreferredSize(LABEL_SIZE);
     244    Dictionary.registerText(language_label, "Preferences.General.Interface_Language");
    231245    language_combobox = new JComboBox(dictionary_model.toArray());
    232246
    233247    // Connect
    234     Gatherer.dictionary.register(view_extracted_metadata_checkbox, null, false);
    235     Gatherer.dictionary.register(show_file_size_checkbox, null, false);
    236     Gatherer.dictionary.register(language_label, null, false);
    237248    language_combobox.addActionListener(new LanguageComboboxListener());
    238249
     
    260271        String value = (String) warning_preferences.get(property);
    261272        // Remove 'warning.'
    262         String title = Gatherer.dictionary.get(property.substring(8) + ".Title");
     273        String title = Dictionary.newget(property.substring(8) + ".Title");
    263274        Entry entry = new Entry(title, value.equalsIgnoreCase(TRUE));
    264275        entry.setProperty(property);
     
    277288
    278289    private JPanel createWorkflowPreferences() {
    279     // Read in the predefined configurations file.
     290    // Read in the predefined configurations file
    280291    Vector predefined = new Vector();
    281292    Document predefined_document = Utility.parse("xml/workflows.xml", true);
     
    285296        predefined.add(new WorkflowElementWrapper((Element)workflow_elements.item(i)));
    286297    }
     298
    287299    // Creation
    288300    JPanel workflow_preferences_pane = new JPanel();
    289301    JPanel checklist_pane = new JPanel();
    290     title_label = new JLabel("Preferences.Workflow.Title");
     302    title_label = new JLabel();
    291303    title_label.setPreferredSize(ROW_SIZE);
    292     workflow_browse  = new JCheckBox("Preferences.Workflow.Browse",  Gatherer.config.get("workflow.browse", false));
     304    Dictionary.registerText(title_label, "Preferences.Workflow.Title");
     305
     306    workflow_browse = new JCheckBox();
     307    workflow_browse.setSelected(Gatherer.config.get("workflow.browse", false));
    293308    workflow_browse.setPreferredSize(ROW_SIZE);
    294     workflow_mirror  = new JCheckBox("Preferences.Workflow.Mirror",  Gatherer.config.get("workflow.mirror", false));
     309    Dictionary.registerText(workflow_browse, "Preferences.Workflow.Browse");
     310
     311    workflow_mirror = new JCheckBox();
     312    workflow_mirror.setSelected(Gatherer.config.get("workflow.mirror", false));
    295313    workflow_mirror.setPreferredSize(ROW_SIZE);
    296     workflow_gather  = new JCheckBox("Preferences.Workflow.Gather",  Gatherer.config.get("workflow.gather", false));
     314    Dictionary.registerText(workflow_mirror, "Preferences.Workflow.Mirror");
     315
     316    workflow_gather = new JCheckBox();
     317    workflow_gather.setSelected(Gatherer.config.get("workflow.gather", false));
    297318    workflow_gather.setPreferredSize(ROW_SIZE);
    298     workflow_enrich  = new JCheckBox("Preferences.Workflow.Enrich",  Gatherer.config.get("workflow.enrich", false));
     319    Dictionary.registerText(workflow_gather, "Preferences.Workflow.Gather");
     320
     321    workflow_enrich = new JCheckBox();
     322    workflow_enrich.setSelected(Gatherer.config.get("workflow.enrich", false));
    299323    workflow_enrich.setPreferredSize(ROW_SIZE);
    300     workflow_design  = new JCheckBox("Preferences.Workflow.Design",  Gatherer.config.get("workflow.design", false));
     324    Dictionary.registerText(workflow_enrich, "Preferences.Workflow.Enrich");
     325
     326    workflow_design = new JCheckBox();
     327    workflow_design.setSelected(Gatherer.config.get("workflow.design", false));
    301328    workflow_design.setPreferredSize(ROW_SIZE);
    302     workflow_export  = new JCheckBox("Preferences.Workflow.Export",  Gatherer.config.get("workflow.export", false));
     329    Dictionary.registerText(workflow_design, "Preferences.Workflow.Design");
     330
     331    workflow_export = new JCheckBox();
     332    workflow_export.setSelected(Gatherer.config.get("workflow.export", false));
    303333    workflow_export.setPreferredSize(ROW_SIZE);
    304     workflow_create  = new JCheckBox("Preferences.Workflow.Create",  Gatherer.config.get("workflow.create", false));
     334    Dictionary.registerText(workflow_export, "Preferences.Workflow.Export");
     335
     336    workflow_create = new JCheckBox();
     337    workflow_create.setSelected(Gatherer.config.get("workflow.create", false));
    305338    workflow_create.setPreferredSize(ROW_SIZE);
    306     workflow_preview = new JCheckBox("Preferences.Workflow.Preview", Gatherer.config.get("workflow.preview", false));
     339    Dictionary.registerText(workflow_create, "Preferences.Workflow.Create");
     340
     341    workflow_preview = new JCheckBox();
     342    workflow_preview.setSelected(Gatherer.config.get("workflow.preview", false));
    307343    workflow_preview.setPreferredSize(ROW_SIZE);
     344    Dictionary.registerText(workflow_preview, "Preferences.Workflow.Preview");
     345
    308346    JPanel predefined_pane = new JPanel();
    309     predefined_label = new JLabel("Preferences.Workflow.Predefined.Label");
     347    predefined_label = new JLabel();
    310348    predefined_label.setPreferredSize(new Dimension(150,25));
     349    Dictionary.registerText(predefined_label, "Preferences.Workflow.Predefined.Label");
    311350    JComboBox predefined_combobox = new JComboBox(predefined);
     351
    312352    // Connection
    313     Gatherer.dictionary.register(title_label, null, false);
    314     Gatherer.dictionary.register(workflow_browse, null, false);
    315     Gatherer.dictionary.register(workflow_mirror, null, false);
    316     Gatherer.dictionary.register(workflow_gather, null, false);
    317     Gatherer.dictionary.register(workflow_enrich, null, false);
    318     Gatherer.dictionary.register(workflow_design, null, false);
    319     Gatherer.dictionary.register(workflow_export, null, false);
    320     Gatherer.dictionary.register(workflow_create, null, false);
    321     Gatherer.dictionary.register(workflow_preview, null, false);
    322     Gatherer.dictionary.register(predefined_label, null, false);
    323353    predefined_combobox.addActionListener(new PredefinedActionListener());
     354
    324355    // Layout
    325356    checklist_pane.setLayout(new BoxLayout(checklist_pane, BoxLayout.Y_AXIS));
    326357    checklist_pane.add(title_label);
    327     if(Gatherer.config.get("workflow.browse", true)) {
     358    if (Gatherer.config.get("workflow.browse", true)) {
    328359        checklist_pane.add(workflow_browse);
    329360    }
    330     if(Gatherer.config.get("workflow.mirror", true)) {
     361    if (Gatherer.config.get("workflow.mirror", true)) {
    331362        checklist_pane.add(workflow_mirror);
    332363    }
    333     if(Gatherer.config.get("workflow.gather", true)) {
     364    if (Gatherer.config.get("workflow.gather", true)) {
    334365        checklist_pane.add(workflow_gather);
    335366    }
    336     if(Gatherer.config.get("workflow.enrich", true)) {
     367    if (Gatherer.config.get("workflow.enrich", true)) {
    337368        checklist_pane.add(workflow_enrich);
    338369    }
    339     if(Gatherer.config.get("workflow.design", true)) {
     370    if (Gatherer.config.get("workflow.design", true)) {
    340371        checklist_pane.add(workflow_design);
    341372    }
    342     if(Gatherer.config.get("workflow.export", true)) {
     373    if (Gatherer.config.get("workflow.export", true)) {
    343374        checklist_pane.add(workflow_export);
    344375    }
    345     if(Gatherer.config.get("workflow.create", true)) {
     376    if (Gatherer.config.get("workflow.create", true)) {
    346377        checklist_pane.add(workflow_create);
    347378    }
    348     if(Gatherer.config.get("workflow.preview", true)) {
     379    if (Gatherer.config.get("workflow.preview", true)) {
    349380        checklist_pane.add(workflow_preview);
    350381    }
     
    362393
    363394    public void dispose() {
    364     // Deregister dictionary components
    365 
    366     // Connection
    367     Gatherer.dictionary.deregister(library_path_label);
    368     Gatherer.dictionary.deregister(use_proxy_checkbox);
    369     Gatherer.dictionary.deregister(proxy_host_label);
    370     Gatherer.dictionary.deregister(proxy_port_label);
    371 
    372     // General
    373     Gatherer.dictionary.deregister(view_extracted_metadata_checkbox);
    374     Gatherer.dictionary.deregister(show_file_size_checkbox);
    375     Gatherer.dictionary.deregister(language_label);
    376 
    377     // Workflow
    378     Gatherer.dictionary.deregister(title_label);
    379     Gatherer.dictionary.deregister(workflow_browse);
    380     Gatherer.dictionary.deregister(workflow_mirror);
    381     Gatherer.dictionary.deregister(workflow_gather);
    382     Gatherer.dictionary.deregister(workflow_enrich);
    383     Gatherer.dictionary.deregister(workflow_design);
    384     Gatherer.dictionary.deregister(workflow_export);
    385     Gatherer.dictionary.deregister(workflow_create);
    386     Gatherer.dictionary.deregister(workflow_preview);
    387     Gatherer.dictionary.deregister(predefined_label);
    388 
    389     // Dialog
    390     Gatherer.dictionary.deregister(this);
    391     Gatherer.dictionary.deregister(tab_pane);
    392     Gatherer.dictionary.deregister(ok_button);
    393     Gatherer.dictionary.deregister(apply_button);
    394     Gatherer.dictionary.deregister(cancel_button);
    395395    // Dispose
    396396    super.dispose();
     
    534534        Gatherer.dictionary.changeDictionary(entry.getLocale());
    535535        // Display message
    536         JOptionPane.showMessageDialog(Gatherer.g_man, Gatherer.dictionary.get("Preferences.General.Restart_Required"), Gatherer.dictionary.get("Preferences.General.Restart_Required"), JOptionPane.WARNING_MESSAGE);
     536        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.newget("Preferences.General.Restart_Required"), Dictionary.newget("Preferences.General.Restart_Required"), JOptionPane.WARNING_MESSAGE);
    537537        }
    538538    }
Note: See TracChangeset for help on using the changeset viewer.