Package jadex.base.gui.filetree
Class FileNode
- java.lang.Object
-
- jadex.base.gui.asynctree.AbstractTreeNode
-
- jadex.base.gui.asynctree.AbstractSwingTreeNode
-
- jadex.base.gui.filetree.FileNode
-
- All Implemented Interfaces:
ISwingTreeNode
,ITreeNode
,IFileNode
- Direct Known Subclasses:
DirNode
public class FileNode extends AbstractSwingTreeNode implements IFileNode
Node object representing a service container.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
displayname
The cached display name.protected java.io.File
file
The file.protected IIconCache
iconcache
The icon cache.protected java.util.List
lastsiblings
The last siblings.protected java.lang.String
relative
The relative file name.protected java.lang.String
tostring
-
Fields inherited from class jadex.base.gui.asynctree.AbstractSwingTreeNode
tree
-
Fields inherited from class jadex.base.gui.asynctree.AbstractTreeNode
childrenfuture, dirty, model, parent, recurse, searching
-
-
Constructor Summary
Constructors Constructor Description FileNode(ISwingTreeNode parent, AsyncSwingTreeModel model, javax.swing.JTree tree, java.io.File file, IIconCache iconcache)
Create a new service container node.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.String
convertPathToRelative(java.io.File file)
Get the corresponding relative path for a file.java.lang.String
getDisplayName()
Get the display name.java.io.File
getFile()
Get the file.java.lang.String
getFileName()
Get the file name.java.lang.String
getFilePath()
Get the file path.long
getFileSize()
Get the file size.byte[]
getIcon()
Get the icon as byte[] for a node.java.lang.Object
getId()
Get the id used for lookup.javax.swing.JComponent
getPropertiesComponent()
Get or create a component displaying the node properties.java.lang.String
getRelativePath()
Get the relative path.javax.swing.Icon
getSwingIcon()
Get the icon for a node.java.lang.String
getTooltipText()
Get tooltip text.boolean
hasProperties()
True, if the node has properties that can be displayed.boolean
isDirectory()
Check if the file is a directory.boolean
isLeaf()
Check if the node is a leaf.void
refresh(boolean recurse)
Refresh the node.protected void
searchChildren()
Asynchronously search for children.java.lang.String
toString()
Create a string representation.-
Methods inherited from class jadex.base.gui.asynctree.AbstractSwingTreeNode
addChild, addChild, equals, expandChildren, getCachedChildren, getChild, getChildCount, getChildren, getIndexOfChild, getModel, getParent, getTree, removeChild, setChildren
-
Methods inherited from class jadex.base.gui.asynctree.AbstractTreeNode
checkChildren, dispose, hashCode, removeAllChildren, setParent
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jadex.base.gui.asynctree.ISwingTreeNode
getChild, getChildren, getParent
-
Methods inherited from interface jadex.base.gui.asynctree.ITreeNode
dispose, getCachedChildren, getChildCount, getIndexOfChild
-
-
-
-
Field Detail
-
file
protected java.io.File file
The file.
-
iconcache
protected final IIconCache iconcache
The icon cache.
-
relative
protected java.lang.String relative
The relative file name.
-
displayname
protected java.lang.String displayname
The cached display name.
-
tostring
protected java.lang.String tostring
-
lastsiblings
protected java.util.List lastsiblings
The last siblings.
-
-
Constructor Detail
-
FileNode
public FileNode(ISwingTreeNode parent, AsyncSwingTreeModel model, javax.swing.JTree tree, java.io.File file, IIconCache iconcache)
Create a new service container node.
-
-
Method Detail
-
getId
public java.lang.Object getId()
Get the id used for lookup.
-
getIcon
public byte[] getIcon()
Get the icon as byte[] for a node.- Specified by:
getIcon
in interfaceITreeNode
- Specified by:
getIcon
in classAbstractTreeNode
-
getSwingIcon
public javax.swing.Icon getSwingIcon()
Get the icon for a node.- Specified by:
getSwingIcon
in interfaceISwingTreeNode
- Specified by:
getSwingIcon
in classAbstractSwingTreeNode
-
refresh
public void refresh(boolean recurse)
Refresh the node.- Specified by:
refresh
in interfaceITreeNode
- Overrides:
refresh
in classAbstractSwingTreeNode
- Parameters:
recurse
- Recursively refresh subnodes, if true.
-
searchChildren
protected void searchChildren()
Asynchronously search for children. Should call setChildren() once children are found.- Specified by:
searchChildren
in classAbstractTreeNode
-
toString
public java.lang.String toString()
Create a string representation.- Overrides:
toString
in classjava.lang.Object
-
getDisplayName
public java.lang.String getDisplayName()
Get the display name.
-
getTooltipText
public java.lang.String getTooltipText()
Get tooltip text.- Specified by:
getTooltipText
in interfaceITreeNode
- Specified by:
getTooltipText
in classAbstractTreeNode
-
hasProperties
public boolean hasProperties()
True, if the node has properties that can be displayed.- Specified by:
hasProperties
in interfaceITreeNode
- Overrides:
hasProperties
in classAbstractTreeNode
-
getPropertiesComponent
public javax.swing.JComponent getPropertiesComponent()
Get or create a component displaying the node properties. Only to be called if hasProperties() is true;- Specified by:
getPropertiesComponent
in interfaceISwingTreeNode
- Overrides:
getPropertiesComponent
in classAbstractSwingTreeNode
-
getFile
public java.io.File getFile()
Get the file.- Returns:
- the file.
-
getRelativePath
public java.lang.String getRelativePath()
Get the relative path.
-
convertPathToRelative
protected static java.lang.String convertPathToRelative(java.io.File file)
Get the corresponding relative path for a file. Handles jars specially.
-
isLeaf
public boolean isLeaf()
Check if the node is a leaf.- Specified by:
isLeaf
in interfaceITreeNode
- Overrides:
isLeaf
in classAbstractSwingTreeNode
-
getFileName
public java.lang.String getFileName()
Get the file name.- Specified by:
getFileName
in interfaceIFileNode
-
getFilePath
public java.lang.String getFilePath()
Get the file path.- Specified by:
getFilePath
in interfaceIFileNode
-
isDirectory
public boolean isDirectory()
Check if the file is a directory.- Specified by:
isDirectory
in interfaceIFileNode
-
getFileSize
public long getFileSize()
Get the file size.- Specified by:
getFileSize
in interfaceIFileNode
-
-