Object
hdf.view.TreeView.DefaultTreeView
- All Implemented Interfaces:
TreeView
TreeView defines APIs for opening files and displaying the file structure in
a tree structure.
TreeView uses folders and leaf items 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 the selected object.
You can select object(s) to delete or add new objects to the file.
- Version:
- 2.4 12//2015
- Author:
- Jordan T. Henderson
-
Constructor Summary
ConstructorDescriptionDefaultTreeView
(org.eclipse.swt.widgets.Composite parent, DataViewManager theView) Create a visual component for opening files and displaying the file structure in a tree structure. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.swt.widgets.TreeItem
Adds an already created HObject to the tree under the TreeItem containing the specified parent group.void
closeFile
(FileFormat file) Close a fileorg.eclipse.swt.widgets.TreeItem
findTreeItem
(HObject obj) Returns the tree item that contains the given data object.Get the list of currently open filesGet the current selected object in the treeGets the selected file.org.eclipse.swt.widgets.Tree
getTree()
Get the Tree which holds the file structureOpens a file and retrieves the file structure of the file.reopenFile
(FileFormat fileFormat, int newFileAccessMode) Reopens a file and retrieves the file structure of the file.void
saveFile
(FileFormat file) Save a filevoid
setDefaultDisplayMode
(boolean displaymode) change the display option.showDataContent
(HObject dataObject) Display the content of a data object.void
updateFont
(org.eclipse.swt.graphics.Font font) Updates the current font.void
updateItemIcon
(HObject obj) Updates the icon for the TreeItem representing the given HObject.
-
Constructor Details
-
DefaultTreeView
Create a visual component for opening files and displaying the file structure in a tree structure.- Parameters:
parent
- the parent componenttheView
- the associated data view manager
-
-
Method Details
-
addObject
Adds an already created HObject to the tree under the TreeItem containing the specified parent group. -
openFile
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.- Specified by:
openFile
in interfaceTreeView
- 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:
Exception
- if a failure occurred
-
reopenFile
Description copied from interface:TreeView
Reopens a file and retrieves the file structure of the file. Subclasses must implement this function to take appropriate steps to re-open a file.- Specified by:
reopenFile
in interfaceTreeView
- Parameters:
fileFormat
- the file to re-open.newFileAccessMode
- identifier for the new file access. Valid value of newFileAccessMode 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:
Exception
- if a failure occurred
-
closeFile
-
saveFile
-
findTreeItem
Returns the tree item that contains the given data object.- Specified by:
findTreeItem
in interfaceTreeView
- Parameters:
obj
- the object to find- Returns:
- the tree item that contains the given data object.
-
setDefaultDisplayMode
change the display option.- Specified by:
setDefaultDisplayMode
in interfaceTreeView
- Parameters:
displaymode
- the default displaymode
-
getSelectedFile
Gets the selected file. When multiple files are open, we need to know which file is currently selected.- Specified by:
getSelectedFile
in interfaceTreeView
- Returns:
- the FileFormat of the currently selected file.
-
getCurrentObject
Description copied from interface:TreeView
Get the current selected object in the tree- Specified by:
getCurrentObject
in interfaceTreeView
- Returns:
- the currently selected object in the tree.
-
getTree
-
getCurrentFiles
Description copied from interface:TreeView
Get the list of currently open files- Specified by:
getCurrentFiles
in interfaceTreeView
- Returns:
- the list of currently open files.
-
showDataContent
Display the content of a data object.- Specified by:
showDataContent
in interfaceTreeView
- Parameters:
dataObject
- the data object- Returns:
- the DataView that displays the data content
- Throws:
Exception
- if a failure occurred
-
updateFont
Updates the current font.- Parameters:
font
- the new font
-
updateItemIcon
Updates the icon for the TreeItem representing the given HObject. Used to change the icon after a status update, such as adding an attribute to an object.- Parameters:
obj
- the object to update the icon for
-