alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.vcscore.ui;

import org.openide.loaders.*;
import org.openide.filesystems.*;

public class MyTableObject {
    
    /** Holds value of property name. */
    private String name;
    
    /** Holds value of property packg. */
    private String packg;
    
    /** Holds value of property filesystem. */
    private String filesystem;
    
    private DataObject dataObject = null;
    
    private FileObject fileObject = null;
    
    private static String getPackageNameSlashes(FileObject fo) {
        String path = fo.getPath();
        int i = path.lastIndexOf('.');
        if (i != -1 && i > path.lastIndexOf('/')) {
            path = path.substring(0, i);
        }
        return path;
    }

    public MyTableObject(DataObject dobj) {
        name = dobj.getName();
        packg = getPackageNameSlashes(dobj.getFolder().getPrimaryFile());
        try {
            filesystem = dobj.getPrimaryFile().getFileSystem().getDisplayName();
        } catch (FileStateInvalidException exc) {
            filesystem = "";
        }
        dataObject = dobj;
    }
    
    public MyTableObject(FileObject fo) {
        name = fo.getNameExt();
        packg = getPackageNameSlashes(fo.getParent());
        try {
            filesystem = fo.getFileSystem().getDisplayName();
        } catch (FileStateInvalidException exc) {
            filesystem = "";
        }
        fileObject = fo;
    }
    
    public DataObject getDataObject() {
        return dataObject;
    }
    
    public FileObject getFileObject() {
        return fileObject;
    }
    
    /** Getter for property name.
     * @return Value of property name.
     */
    public String getName() {
        return this.name;
    }
    
    
    /** Getter for property packg.
     * @return Value of property packg.
     */
    public String getPackg() {
        return this.packg;
    }
    
    
    /** Getter for property filesystem.
     * @return Value of property filesystem.
     */
    public String getFilesystem() {
        return this.filesystem;
    }
    
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.