|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.globalmentor.beans.BoundPropertyObject
com.guiseframework.model.AbstractModel
com.guiseframework.model.AbstractValueModel<V>
com.guiseframework.model.DefaultValueModel<V>
com.guiseframework.model.DefaultTreeNodeModel<V>
V - The type of value contained in the tree node.public class DefaultTreeNodeModel<V>
A default node in a tree model.
Property change events and action events on one tree node will be bubbled up the hierarchy, with the tree node initiating the event accessible via TargetedEvent.getTarget().
| Field Summary |
|---|
| Fields inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS |
| Fields inherited from interface com.guiseframework.model.TreeNodeModel |
|---|
EXPANDED_PROPERTY |
| Fields inherited from interface com.guiseframework.model.ValueModel |
|---|
VALIDATOR_PROPERTY, VALUE_PROPERTY |
| Fields inherited from interface com.guiseframework.model.Model |
|---|
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE |
| Fields inherited from interface com.guiseframework.model.Selectable |
|---|
SELECTED_PROPERTY |
| Constructor Summary | |
|---|---|
DefaultTreeNodeModel(java.lang.Class<V> valueClass)
Constructs a tree node model indicating the type of value it can hold. |
|
DefaultTreeNodeModel(java.lang.Class<V> valueClass,
V initialValue)
Constructs a tree node model indicating the type of value it can hold, along with an initial value. |
|
| Method Summary | |
|---|---|
void |
add(TreeNodeModel<?> treeNode)
Adds a child tree node to this tree node. |
void |
addActionListener(ActionListener actionListener)
Adds an action listener. |
void |
clear()
Removes all of the child tree nodes from this tree node. |
protected void |
fireActionPerformed(ActionEvent actionEvent)
Fires a given action event to all registered action listeners. |
protected void |
fireActionPerformed(int force,
int option)
Fires an action event to all registered action listeners. |
java.lang.Iterable<ActionListener> |
getActionListeners()
|
java.util.List<TreeNodeModel<?>> |
getChildren()
Returns a list of children. |
int |
getDepth()
Returns the zero-based depth of the node within in its tree. |
TreeNodeModel<?> |
getParent()
|
protected java.util.List<TreeNodeModel<?>> |
getTreeNodeList()
|
boolean |
hasChild(TreeNodeModel<?> treeNode)
Determines whether this tree node contains the given child tree node. |
boolean |
hasChildren()
|
boolean |
isExpanded()
|
boolean |
isLeaf()
Determines whether this node could be considered a leaf node. |
boolean |
isSelected()
|
java.util.Iterator<TreeNodeModel<?>> |
iterator()
|
void |
performAction()
Performs the action with default force and default option. |
void |
performAction(int force,
int option)
Performs the action with the given force and option. |
void |
remove(TreeNodeModel<?> treeNode)
Removes a child tree node from this tree node. |
void |
removeActionListener(ActionListener actionListener)
Removes an action listener. |
void |
setAllExpanded(boolean newAllExpanded)
Sets whether all tree nodes, including this node, are expanded in this subtree. |
void |
setChildren(java.util.List<TreeNodeModel<?>> treeNodes)
Sets the children in this container. |
void |
setExpanded(boolean newExpanded)
Sets whether the node is expanded, showing its children, if any. |
void |
setParent(TreeNodeModel<?> newParent)
Sets the parent of this tree node. |
void |
setSelected(boolean newSelected)
Sets whether the tree node is selected. |
| Methods inherited from class com.guiseframework.model.DefaultValueModel |
|---|
clearValue, getDefaultValue, getValue, resetValue, setValue |
| Methods inherited from class com.guiseframework.model.AbstractValueModel |
|---|
createPropertyVetoException, getValidator, getValueClass, isValidValue, setValidator, validateValue |
| Methods inherited from class com.guiseframework.model.AbstractModel |
|---|
getEventListenerManager, getPlainText |
| Methods inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.guiseframework.model.ValueModel |
|---|
clearValue, getDefaultValue, getValidator, getValue, getValueClass, isValidValue, resetValue, setValidator, setValue, validateValue |
| Methods inherited from interface com.globalmentor.beans.PropertyBindable |
|---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from interface com.globalmentor.beans.PropertyConstrainable |
|---|
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener |
| Constructor Detail |
|---|
public DefaultTreeNodeModel(java.lang.Class<V> valueClass)
valueClass - The class indicating the type of value held in the model.
java.lang.NullPointerException - if the given value class is null.
public DefaultTreeNodeModel(java.lang.Class<V> valueClass,
V initialValue)
valueClass - The class indicating the type of value held in the model.initialValue - The initial value, which will not be validated.
java.lang.NullPointerException - if the given value class is null.| Method Detail |
|---|
public boolean isExpanded()
isExpanded in interface TreeNodeModel<V>public void setExpanded(boolean newExpanded)
Boolean.
setExpanded in interface TreeNodeModel<V>newExpanded - true if the node is expanded.TreeNodeModel.EXPANDED_PROPERTYpublic void setAllExpanded(boolean newAllExpanded)
setAllExpanded in interface TreeNodeModel<V>newAllExpanded - true if all the nodes in this tree should be expanded, or false if they should be collapsed.setExpanded(boolean)public boolean isSelected()
isSelected in interface Selectablepublic void setSelected(boolean newSelected)
Boolean.
setSelected in interface SelectablenewSelected - true if the tree node should be selected, else false.Selectable.SELECTED_PROPERTYprotected java.util.List<TreeNodeModel<?>> getTreeNodeList()
public java.util.Iterator<TreeNodeModel<?>> iterator()
iterator in interface java.lang.Iterable<TreeNodeModel<?>>public boolean isLeaf()
false even if it currently has no children, if it intends to load them later and there is no way to know ahead of time if there will be children.
This implementation returns the opposite value of hasChildren().
isLeaf in interface TreeNodeModel<V>true if this is a leaf node, else false if this node should not be considered a leaf.public boolean hasChildren()
hasChildren in interface TreeNodeModel<V>public boolean hasChild(TreeNodeModel<?> treeNode)
hasChild in interface TreeNodeModel<V>treeNode - The tree node to check.
true if this tree node contains the given tree node.public void add(TreeNodeModel<?> treeNode)
add in interface TreeNodeModel<V>treeNode - The tree node to add.
java.lang.IllegalArgumentException - if the tree node already has a parent.public void remove(TreeNodeModel<?> treeNode)
remove in interface TreeNodeModel<V>treeNode - The child tree node to remove.
java.lang.IllegalArgumentException - if the tree node is not a child of this tree node.public void clear()
clear in interface TreeNodeModel<V>public TreeNodeModel<?> getParent()
getParent in interface TreeNodeModel<V>null if this node has no parent.public void setParent(TreeNodeModel<?> newParent)
setParent in interface TreeNodeModel<V>newParent - The new parent for this tree node, or null if this tree node is being removed from a parent.
java.lang.IllegalStateException - if a parent is provided and this tree node already has a parent.
java.lang.IllegalStateException - if no parent is provided and this tree node's old parent still recognizes this tree node as its child.
java.lang.IllegalArgumentException - if a parent is provided and the given parent does not already recognize this tree node as its child.add(TreeNodeModel),
remove(TreeNodeModel)public java.util.List<TreeNodeModel<?>> getChildren()
#setChildren() provides a children property for alternate children access.
iterator()public void setChildren(java.util.List<TreeNodeModel<?>> treeNodes)
getChildren() provides a children property for alternate children access.
treeNodes - The new children of this tree node in order.clear(),
add(TreeNodeModel)public int getDepth()
getDepth in interface TreeNodeModel<V>public void addActionListener(ActionListener actionListener)
addActionListener in interface ActionListenableactionListener - The action listener to add.public void removeActionListener(ActionListener actionListener)
removeActionListener in interface ActionListenableactionListener - The action listener to remove.public java.lang.Iterable<ActionListener> getActionListeners()
getActionListeners in interface ActionModelpublic void performAction()
ActionEvent is fired to all registered ActionListeners.
This method delegates to performAction(int, int).
performAction in interface ActionModel
public void performAction(int force,
int option)
ActionEvent is fired to all registered ActionListeners.
performAction in interface ActionModelforce - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.
protected void fireActionPerformed(int force,
int option)
fireActionPerformed(ActionEvent).
force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.ActionListener,
ActionEventprotected void fireActionPerformed(ActionEvent actionEvent)
actionEvent - The action event to fire.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||