jdk/src/share/classes/com/sun/tools/example/debug/gui/JDBFileFilter.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 51 6fe31bc95bbc
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 51
diff changeset
     2
 * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.example.debug.gui;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.filechooser.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
//### Renamed from 'ExampleFileFilter.java' provided with Swing demos.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * A convenience implementation of FileFilter that filters out
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * all files except for those type extensions that it knows about.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Extensions are of the type ".foo", which is typically found on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Windows and Unix boxes, but not on Macinthosh. Case is ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * Example - create a new filter that filerts out all files
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * but gif and jpg image files:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *     JFileChooser chooser = new JFileChooser();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *     ExampleFileFilter filter = new ExampleFileFilter(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *                   new String{"gif", "jpg"}, "JPEG & GIF Images")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *     chooser.addChoosableFileFilter(filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *     chooser.showOpenDialog(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @author Jeff Dinkins
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
public class JDBFileFilter extends FileFilter {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private static String TYPE_UNKNOWN = "Type Unknown";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private static String HIDDEN_FILE = "Hidden File";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    private Hashtable<String, JDBFileFilter> filters = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private String description = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private String fullDescription = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private boolean useExtensionsInDescription = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Creates a file filter. If no filters are added, then all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * files are accepted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @see #addExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public JDBFileFilter() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        this.filters = new Hashtable<String, JDBFileFilter>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * Creates a file filter that accepts files with the given extension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * Example: new JDBFileFilter("jpg");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @see #addExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public JDBFileFilter(String extension) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        this(extension,null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * Creates a file filter that accepts the given file type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * Example: new JDBFileFilter("jpg", "JPEG Image Images");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * Note that the "." before the extension is not needed. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * provided, it will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @see #addExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public JDBFileFilter(String extension, String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        this();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        if(extension!=null) addExtension(extension);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        if(description!=null) setDescription(description);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Creates a file filter from the given string array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Example: new JDBFileFilter(String {"gif", "jpg"});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Note that the "." before the extension is not needed adn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @see #addExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public JDBFileFilter(String[] filters) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        this(filters, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * Creates a file filter from the given string array and description.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Example: new JDBFileFilter(String {"gif", "jpg"}, "Gif and JPG Images");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Note that the "." before the extension is not needed and will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @see #addExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public JDBFileFilter(String[] filters, String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        this();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        for (int i = 0; i < filters.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            // add filters one by one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            addExtension(filters[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        if(description!=null) setDescription(description);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Return true if this file should be shown in the directory pane,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * false if it shouldn't.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Files that begin with "." are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @see #getExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @see FileFilter#accepts
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public boolean accept(File f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        if(f != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            if(f.isDirectory()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            String extension = getExtension(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            if(extension != null && filters.get(getExtension(f)) != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * Return the extension portion of the file's name .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @see #getExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @see FileFilter#accept
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     public String getExtension(File f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        if(f != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            String filename = f.getName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            int i = filename.lastIndexOf('.');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            if(i>0 && i<filename.length()-1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                return filename.substring(i+1).toLowerCase();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * Adds a filetype "dot" extension to filter against.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * For example: the following code will create a filter that filters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * out all files except those that end in ".jpg" and ".tif":
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *   JDBFileFilter filter = new JDBFileFilter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *   filter.addExtension("jpg");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *   filter.addExtension("tif");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * Note that the "." before the extension is not needed and will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public void addExtension(String extension) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        if(filters == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            filters = new Hashtable<String, JDBFileFilter>(5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        filters.put(extension.toLowerCase(), this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        fullDescription = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * Returns the human readable description of this filter. For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * example: "JPEG and GIF Image Files (*.jpg, *.gif)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @see setDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @see setExtensionListInDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @see isExtensionListInDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @see FileFilter#getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    public String getDescription() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        if(fullDescription == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            if(description == null || isExtensionListInDescription()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                fullDescription = description==null ? "(" : description + " (";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                // build the description from the extension list
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   204
                Enumeration<String> extensions = filters.keys();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                if(extensions != null) {
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   206
                    fullDescription += "." + extensions.nextElement();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                    while (extensions.hasMoreElements()) {
51
6fe31bc95bbc 6600143: Remove another 450 unnecessary casts
martin
parents: 2
diff changeset
   208
                        fullDescription += ", " + extensions.nextElement();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                fullDescription += ")";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                fullDescription = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return fullDescription;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * Sets the human readable description of this filter. For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * example: filter.setDescription("Gif and JPG Images");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @see setDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @see setExtensionListInDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @see isExtensionListInDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    public void setDescription(String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        this.description = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        fullDescription = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * Determines whether the extension list (.jpg, .gif, etc) should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * show up in the human readable description.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * Only relevent if a description was provided in the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * or using setDescription();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @see getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @see setDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @see isExtensionListInDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    public void setExtensionListInDescription(boolean b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        useExtensionsInDescription = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        fullDescription = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Returns whether the extension list (.jpg, .gif, etc) should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * show up in the human readable description.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * Only relevent if a description was provided in the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * or using setDescription();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * @see getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @see setDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * @see setExtensionListInDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public boolean isExtensionListInDescription() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        return useExtensionsInDescription;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
}