0N/A/*
2362N/A * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.swing.filechooser;
0N/A
0N/Aimport java.io.File;
0N/Aimport javax.swing.*;
0N/A
0N/A/**
0N/A * <code>FileView</code> defines an abstract class that can be implemented
0N/A * to provide the filechooser with UI information for a <code>File</code>.
0N/A * Each L&F <code>JFileChooserUI</code> object implements this
0N/A * class to pass back the correct icons and type descriptions specific to
0N/A * that L&F. For example, the Microsoft Windows L&F returns the
0N/A * generic Windows icons for directories and generic files.
0N/A * Additionally, you may want to provide your own <code>FileView</code> to
0N/A * <code>JFileChooser</code> to return different icons or additional
0N/A * information using {@link javax.swing.JFileChooser#setFileView}.
0N/A *
0N/A * <p>
0N/A *
0N/A * <code>JFileChooser</code> first looks to see if there is a user defined
0N/A * <code>FileView</code>, if there is, it gets type information from
0N/A * there first. If <code>FileView</code> returns <code>null</code> for
0N/A * any method, <code>JFileChooser</code> then uses the L&F specific
0N/A * view to get the information.
0N/A * So, for example, if you provide a <code>FileView</code> class that
0N/A * returns an <code>Icon</code> for JPG files, and returns <code>null</code>
0N/A * icons for all other files, the UI's <code>FileView</code> will provide
0N/A * default icons for all other files.
0N/A *
0N/A * <p>
0N/A *
0N/A * For an example implementation of a simple file view, see
0N/A * <code><i>yourJDK</i>/demo/jfc/FileChooserDemo/ExampleFileView.java</code>.
0N/A * For more information and examples see
0N/A * <a
0N/A href="http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html">How to Use File Choosers</a>,
0N/A * a section in <em>The Java Tutorial</em>.
0N/A *
0N/A * @see javax.swing.JFileChooser
0N/A *
0N/A * @author Jeff Dinkins
0N/A *
0N/A */
0N/Apublic abstract class FileView {
0N/A /**
0N/A * The name of the file. Normally this would be simply
0N/A * <code>f.getName()</code>.
0N/A */
0N/A public String getName(File f) {
0N/A return null;
0N/A };
0N/A
0N/A /**
0N/A * A human readable description of the file. For example,
0N/A * a file named <i>jag.jpg</i> might have a description that read:
0N/A * "A JPEG image file of James Gosling's face".
0N/A */
0N/A public String getDescription(File f) {
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * A human readable description of the type of the file. For
0N/A * example, a <code>jpg</code> file might have a type description of:
0N/A * "A JPEG Compressed Image File"
0N/A */
0N/A public String getTypeDescription(File f) {
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * The icon that represents this file in the <code>JFileChooser</code>.
0N/A */
0N/A public Icon getIcon(File f) {
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * Whether the directory is traversable or not. This might be
0N/A * useful, for example, if you want a directory to represent
0N/A * a compound document and don't want the user to descend into it.
0N/A */
0N/A public Boolean isTraversable(File f) {
0N/A return null;
0N/A }
0N/A
0N/A}