public class KMLFeatureTreeNode extends BasicTreeNode
TreeNode
that represents a KML feature defined by a KMLAbstractFeature
.
The node's selection state is synchronized with its KML feature's visibility state. isSelected()
returns whether the node's feature is visible. Calling setSelected(boolean)
specifies both the the node's selection state, and whether its feature should be
enabled for rendering and selection.Modifier and Type | Field and Description |
---|---|
protected KMLAbstractFeature |
feature
Indicates the KML feature this node represents.
|
children, description, enabled, imageSource, parent, selected, text, texture, treeSelected, visible
NOT_SELECTED, PARTIALLY_SELECTED, SELECTED
Constructor and Description |
---|
KMLFeatureTreeNode(KMLAbstractFeature feature)
Creates a new
KMLFeatureTreeNode from the specified feature . |
Modifier and Type | Method and Description |
---|---|
void |
expandOpenContainers(Tree tree)
Expands paths in the specified
tree corresponding to open KML container elements. |
static KMLFeatureTreeNode |
fromKMLFeature(KMLAbstractFeature feature)
Creates a new
KMLFeatureTreeNode from the specified feature . |
java.lang.String |
getDescription()
Get extra text associated with this node.
|
KMLAbstractFeature |
getFeature()
Indicates the KML feature this node represents.
|
java.lang.String |
getText()
Get the text of this node.
|
protected void |
initialize()
Places the KML feature in the node's
AVKey.CONTEXT field. |
boolean |
isSelected()
Indicates whether this node's KML feature is enabled for rendering.
|
protected java.lang.String |
makeFeatureDescription()
Makes this node's description text from its KML feature.
|
protected boolean |
mustExpandNode()
Indicates whether the tree path for this node must expanded.
|
void |
setSelected(boolean selected)
Specifies whether this node's feature is enabled for rendering and selection.
|
protected java.lang.String |
stripHtmlTags(java.lang.String input)
Remove HTML tags and extra whitespace from a string.
|
addChild, addChild, computeTreeSelected, getChildren, getImageSource, getParent, getPath, getTexture, hasImage, initializeTexture, isEnabled, isLeaf, isTreeSelected, isVisible, propertyChange, removeAllChildren, removeChild, setDescription, setEnabled, setImageSource, setParent, setVisible
onMessage
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected KMLAbstractFeature feature
public KMLFeatureTreeNode(KMLAbstractFeature feature)
KMLFeatureTreeNode
from the specified feature
. The node's name is set to
the feature's name.feature
- the KML feature this node represents.java.lang.IllegalArgumentException
- if the feature
is null
.public void expandOpenContainers(Tree tree)
tree
corresponding to open KML container elements. This assumes that
the tree
's model contains this node.
This node's path is expanded if the feature's open
property is true
.
This calls expandOpenContainers
on all children which are instances of
KMLFeatureTreeNode
.tree
- the Tree
who's paths should be expanded.java.lang.IllegalArgumentException
- if the tree
is null.public static KMLFeatureTreeNode fromKMLFeature(KMLAbstractFeature feature)
KMLFeatureTreeNode
from the specified feature
. This maps the feature type
to a node type as follows: KMLContainerTreeNode
.KMLNetworkLink
.KMLFeatureTreeNode
.feature
- the KML feature to create a new KMLFeatureTreeNode
for.KMLFeatureTreeNode
.java.lang.IllegalArgumentException
- if the feature
is null
.public java.lang.String getDescription()
TreeNode
getDescription
in interface TreeNode
getDescription
in class BasicTreeNode
public KMLAbstractFeature getFeature()
public java.lang.String getText()
BasicTreeNode
getText
in interface TreeNode
getText
in class BasicTreeNode
protected void initialize()
AVKey.CONTEXT
field.public boolean isSelected()
isSelected
in interface TreeNode
isSelected
in class BasicTreeNode
true
if the KML feature is enabled for rendering, otherwise false
.TreeNode.setSelected(boolean)
,
TreeNode.isTreeSelected()
protected java.lang.String makeFeatureDescription()
KMLSnippet
if
present, or the feature's description
if there is no snippet.protected boolean mustExpandNode()
true
if the KML feature's
open
property is true
, and false
otherwise.true
if the tree path for this node must be expanded, otherwise false
.public void setSelected(boolean selected)
setSelected
in interface TreeNode
setSelected
in class BasicTreeNode
selected
- true
to enable the KML feature, otherwise false
.TreeNode.isSelected()
protected java.lang.String stripHtmlTags(java.lang.String input)
input
- Text to strip of HTML tags and extra whitespace.null
if input
is null
.