Class JarTreeModel

java.lang.Object
org.opensourcephysics.tools.JarTreeModel
All Implemented Interfaces:
TreeModel

public class JarTreeModel extends Object implements TreeModel
A tree model to display files and jar/zip contents.
Version:
1.0
Author:
Doug Brown
  • Field Details

    • root

      protected File root
    • topLevelNodeArrays

      protected Map<File,org.opensourcephysics.tools.JarTreeModel.JarNode[]> topLevelNodeArrays
    • pathMaps

      protected Map<File,Map<String,org.opensourcephysics.tools.JarTreeModel.JarNode>> pathMaps
  • Constructor Details

    • JarTreeModel

      public JarTreeModel(File root)
      Constructor.
      Parameters:
      root - a directory file
  • Method Details

    • getRoot

      public Object getRoot()
      Gets the root of this tree model.
      Specified by:
      getRoot in interface TreeModel
      Returns:
      the root file
    • isLeaf

      public boolean isLeaf(Object node)
      Returns true if the specified node is a leaf.
      Specified by:
      isLeaf in interface TreeModel
      Parameters:
      node - the tree node
      Returns:
      true if node is a leaf
    • getChildCount

      public int getChildCount(Object parent)
      Determines the number of child nodes for the specified node.
      Specified by:
      getChildCount in interface TreeModel
      Parameters:
      parent - the parent node
      Returns:
      the number of child nodes
    • getChild

      public Object getChild(Object parent, int index)
      Gets the child node at a specified index. Parent and child may be a File or JarNode.
      Specified by:
      getChild in interface TreeModel
      Parameters:
      parent - the parent node
      index - the index
      Returns:
      the child node
    • getIndexOfChild

      public int getIndexOfChild(Object parent, Object child)
      Gets the index of the specified child node.
      Specified by:
      getIndexOfChild in interface TreeModel
      Parameters:
      parent - the parent node
      child - the child node
      Returns:
      the index of the child
    • valueForPathChanged

      public void valueForPathChanged(TreePath path, Object newvalue)
      Specified by:
      valueForPathChanged in interface TreeModel
    • addTreeModelListener

      public void addTreeModelListener(TreeModelListener l)
      Specified by:
      addTreeModelListener in interface TreeModel
    • removeTreeModelListener

      public void removeTreeModelListener(TreeModelListener l)
      Specified by:
      removeTreeModelListener in interface TreeModel
    • getChild

      public Object getChild(Object parent, String name)
      Gets a child node with a given name. Parent and child may be a File or JarNode.
      Parameters:
      parent - the parent node
      name - the name
      Returns:
      the child node
    • getDescendantPaths

      protected Collection<Object[]> getDescendantPaths(Object[] parentPath)
      Returns all descendant paths for a parent path. Descendants include the parent path itself.
      Parameters:
      parentPath - the parent Object[] path
      Returns:
      a collection of descendant Object[] paths
    • getJarNode

      public org.opensourcephysics.tools.JarTreeModel.JarNode getJarNode(File jarFile, String path)
    • getJarNodes

      public org.opensourcephysics.tools.JarTreeModel.JarNode[] getJarNodes(File jarFile)