ncsa.hdf.view
Interface TreeView

All Known Implementing Classes:
DefaultTreeView

public interface TreeView

Title: TreeView

TreeView defines APIs for open a file and display the file structure in tree structure.

TreeView uses folders and leaf nodes to represent groups and data objects in the file. You can expand or collapse folders to navigate data objects in the file.

From the TreeView, you can open data content or metadata of selected object. You can selet object(s) to delete or add new object to the file.

Company: NCSA, University of Illinois at Urbana-Champaign


Method Summary
 void addObject(HObject newObject, Group parentGroup)
          Adds a new data object to the file.
 void closeFile(FileFormat file)
          close a file
 javax.swing.tree.TreeNode findTreeNode(HObject obj)
          Returns the tree node that contains the given data object.
 java.util.List getCurrentFiles()
          Returns the list of current open files..
 HObject getCurrentObject()
           
 FileFormat getSelectedFile()
          Gets the selected the file.
 java.util.List getSelectedObjects()
          Gets a list of selected objects in the tree.
 javax.swing.JTree getTree()
          Returns the JTree which holds the file structure.
 FileFormat openFile(java.lang.String filename, int accessID)
          Opens a file and retrieves the file structure of the file.
 void saveFile(FileFormat file)
          save a file
 DataView showDataContent(HObject dataObject)
          Dispaly the content of a data object.
 MetaDataView showMetaData(HObject dataObject)
          Displays the meta data of a data object.
 

Method Detail

openFile

public FileFormat openFile(java.lang.String filename,
                           int accessID)
                    throws java.lang.Exception
Opens a file and retrieves the file structure of the file. It also can be used to create a new file by setting the accessID to FileFormat.CREATE.

Subclasses must implement this function to take appropriate steps to open a file.

Parameters:
filename - the name of the file to open.
accessID - identifier for the file access. Valid value of accessID is:
  • FileFormat.READ --- allow read-only access to file.
  • FileFormat.WRITE --- allow read and write access to file.
  • FileFormat.CREATE --- create a new file.
Returns:
the FileFormat of this file if successful; otherwise returns null.
Throws:
java.lang.Exception

closeFile

public void closeFile(FileFormat file)
               throws java.lang.Exception
close a file

Parameters:
file - the file to close
Throws:
java.lang.Exception

saveFile

public void saveFile(FileFormat file)
              throws java.lang.Exception
save a file

Parameters:
file - the file to save
Throws:
java.lang.Exception

getSelectedFile

public FileFormat getSelectedFile()
Gets the selected the file. When multiple files are open, we need to know which file is currently selected.

Returns:
the FileFormat of the selected file.

getSelectedObjects

public java.util.List getSelectedObjects()
Gets a list of selected objects in the tree. Obtaining a list of current selected objects is necessary for copy/paste/delete objects.

Returns:
a list of selected object in the tree.

getCurrentObject

public HObject getCurrentObject()
Returns:
the current selected object in the tree.

showDataContent

public DataView showDataContent(HObject dataObject)
                         throws java.lang.Exception
Dispaly the content of a data object.

Parameters:
dataObject - the data object
Returns:
the dataview that displays the data content
Throws:
java.lang.Exception

showMetaData

public MetaDataView showMetaData(HObject dataObject)
                          throws java.lang.Exception
Displays the meta data of a data object.

Parameters:
dataObject - teh data object
Returns:
the MetaDataView that displays the MetaData of the data object
Throws:
java.lang.Exception

addObject

public void addObject(HObject newObject,
                      Group parentGroup)
               throws java.lang.Exception
Adds a new data object to the file.

Parameters:
newObject - the new object to add.
parentGroup - the parent group the object is to add to.
Throws:
java.lang.Exception

getTree

public javax.swing.JTree getTree()
Returns the JTree which holds the file structure.

Returns:
the JTree which holds the file structure.

getCurrentFiles

public java.util.List getCurrentFiles()
Returns the list of current open files..


findTreeNode

public javax.swing.tree.TreeNode findTreeNode(HObject obj)
Returns the tree node that contains the given data object.