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

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

Location:
trunk/gli/src/org/greenstone/gatherer/shell
Files:
2 edited

Legend:

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

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

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