Ignore:
Timestamp:
2004-01-21T11:18:33+13:00 (20 years ago)
Author:
jmt12
Message:

HelpFrame now looks in the appropriate language code named folder for help files. It also wants help_index.xml rather than the full help.xml.

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

Legend:

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

    r6549 r6565  
    119119    static final public String HTTP_PROTOCOL_STR                          = "http://";
    120120    static final public String HELP_ARGUMENT                              = "-help";
     121    static final public String HELP_INDEX_FILENAME                        = "help_index.xml";
     122    static final public String HTM_FILE_EXTENSION                         = ".htm";
    121123    static final public String IDENTIFIER_VALUE                           = "identifier";
    122124    static final public String IMAGES_FOLDER                              = "images";
     
    152154    static final public String MAPPING_ELEMENT                            = "Mapping";
    153155    static final public String MARC_EXTENSION                             = ".marc";
     156    static final public String MDS_ATTRIBUTE                              = "mds";
    154157    static final public String METADATA_ARGUMENT                          = "-metadata";
    155158    static final public String METADATA_BAK                               = "~metadata.xml";
     
    190193    static final public String SEARCHTYPE_ELEMENT                         = "SearchType";
    191194    static final public String SEARCHTYPE_STR                             = "searchtype";
     195    static final public String SECTION_ELEMENT                            = "Section";
    192196    static final public String SECTION_STR                                = "section";
    193197    static final public String SEPARATOR_ATTRIBUTE                        = "separator";
     
    216220    static final public String TEXT_STR                                   = "text";
    217221    static final public String TIMESTAMP_ARGUMENT                         = "&uq=";
     222    static final public String TITLE_ELEMENT                              = "Title";
    218223    static final public String TRUE_STR                                   = "true";
    219     static final public String TRUNCATED_STRING                            = "...";
     224    static final public String TRUNCATED_STRING                           = "...";
    220225    static final public String TYPE_ATTRIBUTE                             = "type";
    221226    static final public String UNDERSCORE_CHARACTER                       = "_";
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r6539 r6565  
    370370            // If the token is bigger than two thirds width, before we've even started break it down.
    371371            if(current_width + 1 + token.length() > width && token.length() > threshold) {
    372             String prefix = token.substring(0, width - 1 - current_width);
    373             token = token.substring(prefix.length());
    374             if(current_width == 0) {
    375                 line = line + prefix;
     372            if(width == current_width) {
     373                lines.push(line);
     374                line = token;
     375                current_width = token.length();
    376376            }
    377377            else {
    378                 line = line + " " + prefix;
     378                String prefix = token.substring(0, width - 1 - current_width);
     379                token = token.substring(prefix.length());
     380                if(current_width == 0) {
     381                line = line + prefix;
     382                }
     383                else {
     384                line = line + " " + prefix;
     385                }
     386                lines.push(line);
     387                line = "";
     388                current_width = 0;
    379389            }
    380             lines.push(line);
    381             line = "";
    382             current_width = 0;
    383390            }
    384391            // If adding the next token would push us over the maximum line width.
     
    547554    return col_dir + ETC_DIR;
    548555    }
     556
     557    /** Retrieve the full file path to the help index xml file.
     558     * @return the full path as a String
     559     */
     560    static public String getHelpIndex() {
     561    String help_index = HELP_DIR + Gatherer.config.getLanguage() + File.separator + StaticStrings.HELP_INDEX_FILENAME;
     562    File help_index_file = new File(help_index);
     563    // If that file can't be found, default to english
     564    if(!help_index_file.exists()) {
     565        help_index = HELP_DIR + StaticStrings.ENGLISH_LANGUAGE_STR  + File.separator + StaticStrings.HELP_INDEX_FILENAME;
     566    }
     567    return help_index;
     568    }
     569
     570
    549571    /** Method to retrieve an image icon with the given filename found in classpath or the resouces directory.
    550572     *  @return The specified <strong>ImageIcon</strong>, or an error image replacement if no such images exists.
Note: See TracChangeset for help on using the changeset viewer.