edu.cmu.sun.model
Class FileNodeModel

java.lang.Object
  extended by edu.cmu.sun.model.FileNodeModel

public class FileNodeModel
extends java.lang.Object

Abstracted model of the underlying filesystem. We wanted to hide away Java's view of the filesystem becasue we often had to make changes on our own (such as hiding files that start with a dot). This class hides any filesystem exception, so it gives our protoype a little more robustness. It also models the filesystem more as a clener tree structure than before. Finally, it helps to pull out the displayable file names from the type information (which could be the file extension, or some other metatdata)

Author:
Braden Kowitz, Jake Pierson

Nested Class Summary
static class FileNodeModel.Filetype
           
 
Field Summary
(package private)  java.io.File file
           
(package private)  FileNodeModel parent
           
 
Constructor Summary
FileNodeModel(java.io.File file)
           
FileNodeModel(java.io.File file, FileNodeModel parent)
           
 
Method Summary
 java.util.List<FileNodeModel> getChildren()
          If this node is a folder, it returns a list of visible children to this node.
 java.lang.String getExtension()
          returns the extension of the file, or an empty string if the file has no extension.
 java.lang.String getName()
          returns the name of the file.
 FileNodeModel getParent()
          returns the parent of this node, or null if this node has no parent
 FileNodeModel.Filetype getType()
           
 boolean isFolder()
          A container node is a dirrectory (a folder).
 boolean isVisible()
          returns true if this filesystem node is visible to the user.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

file

java.io.File file

parent

FileNodeModel parent
Constructor Detail

FileNodeModel

public FileNodeModel(java.io.File file)

FileNodeModel

public FileNodeModel(java.io.File file,
                     FileNodeModel parent)
Method Detail

isFolder

public boolean isFolder()
A container node is a dirrectory (a folder). A container node has other nodes as children

Returns:

isVisible

public boolean isVisible()
returns true if this filesystem node is visible to the user.

Returns:

getParent

public FileNodeModel getParent()
returns the parent of this node, or null if this node has no parent

Returns:

getName

public java.lang.String getName()
returns the name of the file.

Returns:

getExtension

public java.lang.String getExtension()
returns the extension of the file, or an empty string if the file has no extension.

Returns:

getType

public FileNodeModel.Filetype getType()

getChildren

public java.util.List<FileNodeModel> getChildren()
If this node is a folder, it returns a list of visible children to this node. If this node is not a folder, it returns null.

Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object