Package gov.nasa.worldwind.util.tree
Class BasicTree
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.util.tree.BasicTree
-
- All Implemented Interfaces:
AVList,MessageListener,OrderedRenderable,PreRenderable,Renderable,Tree,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
LayerTree
public class BasicTree extends WWObjectImpl implements Tree, PreRenderable
Basic implementation of aTreecontrol.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<TreePath>expandedNodesprotected TreeLayoutlayoutprotected TreeModelmodel
-
Constructor Summary
Constructors Constructor Description BasicTree()Create an empty tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollapsePath(TreePath path)Collapse a path in the tree.voidexpandPath(TreePath path)Expand a path in the tree.doublegetDistanceFromEye()Returns the ordered renderable's distance from the current view's eye point.TreeLayoutgetLayout()Get the tree layout.TreeModelgetModel()Get the tree model.TreeNodegetNode(TreePath path)Locate a node in the tree.booleanisNodeExpanded(TreeNode node)Is a node expanded?booleanisPathExpanded(TreePath path)Is a path expanded in the tree?voidmakeVisible(TreePath path)Make a node in the tree visible in the rendered tree.voidpick(DrawContext dc, java.awt.Point pickPoint)Executes a pick of the ordered renderable.voidpreRender(DrawContext dc)voidrender(DrawContext dc)Causes thisRenderableto render itself using the provided draw context.voidsetLayout(TreeLayout layout)Set the tree layout.voidsetModel(TreeModel model)Set the tree model.voidtogglePath(TreePath path)Expand a collapsed path, or collapse an expanded path.-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
layout
protected TreeLayout layout
-
model
protected TreeModel model
-
expandedNodes
protected java.util.Set<TreePath> expandedNodes
-
-
Method Detail
-
makeVisible
public void makeVisible(TreePath path)
Make a node in the tree visible in the rendered tree. For example, scroll the tree viewport so that a path is visible.- Specified by:
makeVisiblein interfaceTree- Parameters:
path- Path to make visible.
-
expandPath
public void expandPath(TreePath path)
Expand a path in the tree. Has no effect on leaf nodes.- Specified by:
expandPathin interfaceTree- Parameters:
path- Path to expand.
-
collapsePath
public void collapsePath(TreePath path)
Collapse a path in the tree. Has no effect on leaf nodes.- Specified by:
collapsePathin interfaceTree- Parameters:
path- Path to collapse.
-
togglePath
public void togglePath(TreePath path)
Expand a collapsed path, or collapse an expanded path. Has no effect on leaf nodes.- Specified by:
togglePathin interfaceTree- Parameters:
path- Path to operate on. If the node defined bypathis expanded, it will be collapsed. If it is collapsed it will be expanded.
-
isPathExpanded
public boolean isPathExpanded(TreePath path)
Is a path expanded in the tree?- Specified by:
isPathExpandedin interfaceTree- Parameters:
path- Path to test.- Returns:
- true if the path is expanded, false if collapsed. Always returns false for leaf nodes.
-
isNodeExpanded
public boolean isNodeExpanded(TreeNode node)
Is a node expanded?- Specified by:
isNodeExpandedin interfaceTree- Parameters:
node- Node to test.- Returns:
- true if the node is expanded, false if collapsed. Always returns false for leaf nodes.
-
preRender
public void preRender(DrawContext dc)
- Specified by:
preRenderin interfacePreRenderable
-
render
public void render(DrawContext dc)
Causes thisRenderableto render itself using the provided draw context.- Specified by:
renderin interfaceRenderable- Parameters:
dc- theDrawContextto be used- See Also:
DrawContext
-
pick
public void pick(DrawContext dc, java.awt.Point pickPoint)
Executes a pick of the ordered renderable.- Specified by:
pickin interfaceOrderedRenderable- Parameters:
dc- the current draw context.pickPoint- the pick point.
-
getDistanceFromEye
public double getDistanceFromEye()
Returns the ordered renderable's distance from the current view's eye point. Intended to be used only to sort a list of ordered renderables according to eye distance, and only during frame generation when a view is active.- Specified by:
getDistanceFromEyein interfaceOrderedRenderable- Returns:
- the distance of the ordered renderable from the current view's eye point.
-
getLayout
public TreeLayout getLayout()
Get the tree layout. The layout determines how the tree will be rendered.- Specified by:
getLayoutin interfaceTree- Returns:
- The tree layout.
- See Also:
Tree.setLayout(TreeLayout)
-
setLayout
public void setLayout(TreeLayout layout)
Set the tree layout. The layout determines how the tree will be rendered.- Specified by:
setLayoutin interfaceTree- Parameters:
layout- New layout.- See Also:
Tree.getLayout()
-
getModel
public TreeModel getModel()
Get the tree model. The model determines the contents of the tree.- Specified by:
getModelin interfaceTree- Returns:
- the tree model.
- See Also:
Tree.setModel(TreeModel)
-
setModel
public void setModel(TreeModel model)
Set the tree model. The model determines the contents of the tree.- Specified by:
setModelin interfaceTree- Parameters:
model- New tree model.- See Also:
Tree.getModel()
-
-