projectviewer.vpt
Class VPTFile

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byprojectviewer.vpt.VPTNode
          extended byprojectviewer.vpt.VPTFile
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, javax.swing.tree.MutableTreeNode, java.io.Serializable, javax.swing.tree.TreeNode

public class VPTFile
extends VPTNode

Models a file that is part of a project.

Version:
$Id: VPTFile.java 8932 2007-02-09 05:29:17Z vanza $
Author:
Marcelo Vanzin
See Also:
Serialized Form

Field Summary
 
Fields inherited from class projectviewer.vpt.VPTNode
name, treeNoSelectionBackground, treeNoSelectionForeground, treeSelectionBackground, treeSelectionForeground
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
VPTFile(java.io.File file)
           
VPTFile(java.lang.String path)
           
 
Method Summary
 boolean canOpen()
          File nodes can be opened, so return true.
 boolean canWrite()
          Returns is the underlying file is writable.
 void close()
          "Closes" the jEdit buffer that contains the file.
 int compareToNode(VPTNode node)
          Files are at the same level of every leaf node.
 boolean delete()
          Deletes the file from disk.
 java.io.File getFile()
          Return the file associated with this node.
 java.awt.Color getForegroundColor(boolean sel)
          Returns the node's foreground color.
 javax.swing.Icon getIcon(boolean expanded)
          Returns the icon to be shown on the tree next to the node name.
 java.lang.String getNodePath()
          Returns the path to the file represented by this node.
 boolean isOpened()
          Returns "true" if the node is a file and is currently opened in jEdit.
 void open()
          Opens a new buffer in jEdit with the file pointed by this node.
 void setFile(java.io.File f)
          Sets the file associated with this node.
 java.lang.String toString()
          Returns a string representation of the current node.
 
Methods inherited from class projectviewer.vpt.VPTNode
compareName, compareTo, findIndexForChild, findProjectFor, getBackgroundColor, getChildWithName, getClipType, getName, isDirectory, isFile, isGroup, isProject, isRoot, persistChildren, setName, setParent, sortChildren, sortChildren
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VPTFile

public VPTFile(java.lang.String path)

VPTFile

public VPTFile(java.io.File file)
Method Detail

canWrite

public boolean canWrite()
Returns is the underlying file is writable.

Overrides:
canWrite in class VPTNode

delete

public boolean delete()
Deletes the file from disk. Before deleting, try to close the file.

Overrides:
delete in class VPTNode
Returns:
Whether the deletion was successful or not.

getFile

public java.io.File getFile()
Return the file associated with this node.


setFile

public void setFile(java.io.File f)
Sets the file associated with this node.


isOpened

public boolean isOpened()
Returns "true" if the node is a file and is currently opened in jEdit.

Overrides:
isOpened in class VPTNode

getIcon

public javax.swing.Icon getIcon(boolean expanded)
Returns the icon to be shown on the tree next to the node name.

Specified by:
getIcon in class VPTNode
Parameters:
expanded - If the node is currently expanded or not.

getForegroundColor

public java.awt.Color getForegroundColor(boolean sel)
Returns the node's foreground color.

Overrides:
getForegroundColor in class VPTNode
Parameters:
sel - If the node is currently selected.

toString

public java.lang.String toString()
Returns a string representation of the current node.

Overrides:
toString in class VPTNode

canOpen

public boolean canOpen()
File nodes can be opened, so return true.

Overrides:
canOpen in class VPTNode

open

public void open()
Opens a new buffer in jEdit with the file pointed by this node. The buffer is loaded in the currently active view.

Overrides:
open in class VPTNode

close

public void close()
"Closes" the jEdit buffer that contains the file.

Overrides:
close in class VPTNode

getNodePath

public java.lang.String getNodePath()
Returns the path to the file represented by this node.

Specified by:
getNodePath in class VPTNode

compareToNode

public int compareToNode(VPTNode node)
Files are at the same level of every leaf node.

Overrides:
compareToNode in class VPTNode