projectviewer.vpt
Class VPTCompactModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by projectviewer.vpt.ProjectTreeModel
          extended by projectviewer.vpt.ProjectCustomTreeModel
              extended by projectviewer.vpt.VPTCompactModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.tree.TreeModel

public class VPTCompactModel
extends ProjectCustomTreeModel

A tree model that compress the view by displaying packed directories.

A directory is displayed only if it contains at least one (non-hidden) file. The relative path is used to display these directories.

Example:

-MyProject
-src/net/sf/myproject/ui
MyFrame.java
MyDialog.java
-src/net/sf/myproject/actions
MyAction.java
+src/net/sf/myproject/mybigpackage

Since:
PV 2.1.0
Author:
francisdobi
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
VPTCompactModel(VPTNode rootNode)
          Create a new VPTCompactModel.
 
Method Summary
 java.lang.Object getChild(java.lang.Object parent, int index)
          Returns the child at the given index of the given parent.
 int getChildCount(java.lang.Object parent)
          Returns the number of children of the given node, based on the internal cached data.
protected  java.util.List<VPTNode> getChildren(VPTProject project)
          Subclasses should implement this method to populate the list of children of a project node.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Returns the index of the given child in the given parent, according to the information in the internal cache.
protected  java.lang.String getName()
          Returns the name of the tree, to be shown in the tabbed pane GUI.
 javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode)
          Builds the path to the root of the tree up to the given node.
 
Methods inherited from class projectviewer.vpt.ProjectCustomTreeModel
addChild, buildPathToRoot, getCache, getCachedChildren, isCustom, nodeChanged, nodeStructureChanged, projectClosed, removeChild
 
Methods inherited from class projectviewer.vpt.ProjectTreeModel
fileClosed, fileOpened
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getListeners, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodesChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VPTCompactModel

public VPTCompactModel(VPTNode rootNode)
Create a new VPTCompactModel.

Parameters:
rootNode - The root node of the tree.
Method Detail

getChildCount

public int getChildCount(java.lang.Object parent)
Description copied from class: ProjectCustomTreeModel
Returns the number of children of the given node, based on the internal cached data.

Specified by:
getChildCount in interface javax.swing.tree.TreeModel
Overrides:
getChildCount in class ProjectCustomTreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Description copied from class: ProjectCustomTreeModel
Returns the child at the given index of the given parent. If the parent is a project, treats the children in such a way to allow all files in the project to be displayed in a flat list.

Specified by:
getChild in interface javax.swing.tree.TreeModel
Overrides:
getChild in class ProjectCustomTreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Description copied from class: ProjectCustomTreeModel
Returns the index of the given child in the given parent, according to the information in the internal cache.

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel
Overrides:
getIndexOfChild in class ProjectCustomTreeModel

getPathToRoot

public javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode)
Description copied from class: ProjectCustomTreeModel
Builds the path to the root of the tree up to the given node.

Overrides:
getPathToRoot in class ProjectCustomTreeModel

getChildren

protected java.util.List<VPTNode> getChildren(VPTProject project)
Description copied from class: ProjectCustomTreeModel
Subclasses should implement this method to populate the list of children of a project node. Whenever a "cache miss" occurs, this method will be called to return the list of nodes to be added to the internal cache as the "children" of the given project.

Specified by:
getChildren in class ProjectCustomTreeModel
Parameters:
project - The project being queried.

getName

protected java.lang.String getName()
Description copied from class: ProjectTreeModel
Returns the name of the tree, to be shown in the tabbed pane GUI. The name can also be a key for a jEdit property.

Specified by:
getName in class ProjectTreeModel