public class FileDataNode extends DefaultDataNode
DataNode
representing a file or directory in the
Unix file system. If the FileDataNode
represents a
directory, then its children are the files which it contains.Constructor and Description |
---|
FileDataNode(File file)
Initialises a
FileDataNode from a File object. |
FileDataNode(HDSObject hobj)
Initialises a
FileDataNode from a top-level HDSObject. |
Modifier and Type | Method and Description |
---|---|
boolean |
allowsChildren()
The
DefaultDataNode implementation of this method returns
false . |
void |
configureDetail(DetailViewer dv)
No custom configuration is performed.
|
Iterator |
getChildIterator()
The
DefaultDataNode implementation of this method throws
UnsupportedOperationException
(DefaultDataNode.allowsChildren() is false). |
String |
getName()
Gets the name of this object.
|
String |
getNodeTLA()
Returns either "DIR" or "FILE" for a directory or non-directory file
respectively.
|
String |
getNodeType()
Returns a short sentence indicating what kind of node this is.
|
Object |
getParentObject()
Returns an object which is in some sense the parent of the one
this node is based on.
|
String |
getPathElement()
The
DefaultDataNode implementation
returns the label as a default path element. |
String |
getPathSeparator()
Returns a default separator string.
|
static void |
setShowHidden(boolean showHidden)
Determines whether hidden files are included in the list of
children of a directory file node.
|
beep, getChildMaker, getCreator, getDataObject, getDescription, getIcon, getLabel, hasDataObject, makeChild, makeErrorChild, registerDataObject, setChildMaker, setCreator, setDescription, setIconID, setLabel, setName, setParentObject, toString
public FileDataNode(File file) throws NoSuchDataException
FileDataNode
from a File
object.file
- a File
object representing the file from
which the node is to be createdNoSuchDataException
public FileDataNode(HDSObject hobj) throws NoSuchDataException
FileDataNode
from a top-level HDSObject.hobj
- an HDSObject at the top of its container fileNoSuchDataException
- if hobj
is not at top levelpublic boolean allowsChildren()
DefaultDataNode
DefaultDataNode
implementation of this method returns
false
.allowsChildren
in interface DataNode
allowsChildren
in class DefaultDataNode
true
if the node is of a type which can have
child nodes, false
otherwisepublic Iterator getChildIterator()
DefaultDataNode
DefaultDataNode
implementation of this method throws
UnsupportedOperationException
(DefaultDataNode.allowsChildren()
is false).getChildIterator
in interface DataNode
getChildIterator
in class DefaultDataNode
Iterator
over the children. Each object
iterated over should be a DataNode
.
Behaviour is undefined if this method is called on an
object for which allowsChildren
returns
false
.public Object getParentObject()
DataNode
DataNode
,
it is something which may get fed to a DataNodeFactory
to create DataNode
. If no such object exists, which
may well be the case, null
should be returned.getParentObject
in interface DataNode
getParentObject
in class DefaultDataNode
null
public String getName()
DataNode
getName
in interface DataNode
getName
in class DefaultDataNode
public String getPathElement()
DefaultDataNode
DefaultDataNode
implementation
returns the label as a default path element.getPathElement
in interface DataNode
getPathElement
in class DefaultDataNode
public String getPathSeparator()
DefaultDataNode
getPathSeparator
in interface DataNode
getPathSeparator
in class DefaultDataNode
public String getNodeTLA()
getNodeTLA
in interface DataNode
getNodeTLA
in class DefaultDataNode
public String getNodeType()
DataNode
getNodeType
in interface DataNode
getNodeType
in class DefaultDataNode
DataNode
public static void setShowHidden(boolean showHidden)
showHidden
- true
iff you want hidden files to
be included in the child listpublic void configureDetail(DetailViewer dv)
DefaultDataNode
configureDetail
in interface DataNode
configureDetail
in class DefaultDataNode
dv
- the detail viewer which this node is given an opportunity
to configureCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.