All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.vfsjfilechooser2.filechooser.AbstractVFSFileView Maven / Gradle / Ivy

/*
 *
 * Copyright (C) 2005-2008 Yves Zoundi
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * under the License.
 */
package com.googlecode.vfsjfilechooser2.filechooser;

import com.googlecode.vfsjfilechooser2.utils.VFSUtils;
import javax.swing.Icon;
import org.apache.commons.vfs2.FileObject;

/**
 * The fileview implementation using commons-vfs based on Swing FileView
 * @author Yves Zoundi 
 * @version 0.0.1
 */
public abstract class AbstractVFSFileView {

    /**
     * The name of the file. Normally this would be simply
     * f.getName().
     * @param f
     * @return
     */
    public String getName(FileObject f) {
        return VFSUtils.getFriendlyName(f.getName().toString());
    }

    /**
     * A human readable description of the file. For example,
     * a file named jag.jpg might have a description that read:
     * "A JPEG image file of James Gosling's face".
     * @param f
     * @return
     */
    public String getDescription(FileObject f) {
        return getName(f);
    }

    /**
     * A human readable description of the type of the file. For
     * example, a jpg file might have a type description of:
     * "A JPEG Compressed Image File"
     * @param f
     * @return
     */
    public String getTypeDescription(FileObject f) {
        return getName(f);
    }

    /**
     * The icon that represents this file in the JFileChooser.
     * @param f
     * @return
     */
    public Icon getIcon(FileObject f) {
        return null;
    }

    /**
     * Whether the directory is traversable or not. This might be
     * useful, for example, if you want a directory to represent
     * a compound document and don't want the user to descend into it.
     * @param f
     * @return
     */
    public Boolean isTraversable(FileObject f) {
        return null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy