Class TreeItem.TreeModificationEvent<T>
- java.util.EventObject
-
- javafx.event.Event
-
- javafx.scene.control.TreeItem.TreeModificationEvent<T>
All Implemented Interfaces:
public static class TreeItem.TreeModificationEvent<T> extends Event
Event that contains relevant information for all forms of TreeItem modifications.Since:
JavaFX 2.0
See Also:
-
Field Summary
Fields Modifier and Type Field and Description static EventType<?>ANYCommon supertype for all tree modification event types.-
Fields inherited from class javafx.event.Event
consumed, eventType, NULL_SOURCE_TARGET, target
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and Description TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem)Constructs a basic TreeModificationEvent - this is useful in situations where the tree item has not received a new value, has not changed between expanded/collapsed states, and whose children has not changed.TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, boolean expanded)Constructs a TreeModificationEvent for when the TreeItem has had itsTreeItem.expandedProperty()changed.TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, List<? extends TreeItem<T>> added, List<? extends TreeItem<T>> removed)Constructs a TreeModificationEvent for when the TreeItem has had its children list changed.TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, T newValue)Constructs a TreeModificationEvent for when the TreeItem has had itsTreeItem.valueProperty()changed.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description List<? extends TreeItem<T>>getAddedChildren()Returns the children added to the TreeItem in this event, or an empty list if no children were added.intgetAddedSize()Returns the number of children items that were added in this event, or zero if no children were added.TgetNewValue()If the value of the TreeItem changed, this method will return the new value.List<? extends TreeItem<T>>getRemovedChildren()Returns the children removed from the TreeItem in this event, or an empty list if no children were added.intgetRemovedSize()Returns the number of children items that were removed in this event, or zero if no children were removed.TreeItem<T>getSource()Returns the TreeItem upon which this event occurred.TreeItem<T>getTreeItem()Returns the TreeItem that this event occurred upon.booleanwasAdded()Returns true if this event represents a TreeItem event where children TreeItems were added.booleanwasCollapsed()Returns true if this event represents a TreeItem collapse event, and false if the TreeItem was not collapsed.booleanwasExpanded()Returns true if this event represents a TreeItem expansion event, and false if the TreeItem was not expanded.booleanwasPermutated()Returns true if the order of the TreeItem children list has changed, but that there have been no additions or removals.booleanwasRemoved()Returns true if this event represents a TreeItem event where children TreeItems were removed.-
Methods inherited from class javafx.event.Event
clone, consume, copyFor, fireEvent, getEventType, getTarget, isConsumed
-
Methods inherited from class java.util.EventObject
toString
-
-
Field Detail
-
ANY
public static final EventType<?> ANY
Common supertype for all tree modification event types.Since:
JavaFX 8.0
-
-
Constructor Detail
-
TreeModificationEvent
public TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem)Constructs a basic TreeModificationEvent - this is useful in situations where the tree item has not received a new value, has not changed between expanded/collapsed states, and whose children has not changed. An example of when this constructor is used is when the TreeItem graphic property changes.Parameters:
eventType- The type of the event that has occurred.
-
TreeModificationEvent
public TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, T newValue)Constructs a TreeModificationEvent for when the TreeItem has had itsTreeItem.valueProperty()changed.Parameters:
eventType- The type of the event that has occurred.
-
TreeModificationEvent
public TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, boolean expanded)Constructs a TreeModificationEvent for when the TreeItem has had itsTreeItem.expandedProperty()changed.Parameters:
eventType- The type of the event that has occurred.
-
TreeModificationEvent
public TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, List<? extends TreeItem<T>> added, List<? extends TreeItem<T>> removed)Constructs a TreeModificationEvent for when the TreeItem has had its children list changed.Parameters:
eventType- The type of the event that has occurred.
-
-
Method Detail
-
getSource
public TreeItem<T> getSource()
Returns the TreeItem upon which this event occurred.Overrides:
getSourcein classEventObjectSince:
JavaFX 2.1
-
getTreeItem
public TreeItem<T> getTreeItem()
Returns the TreeItem that this event occurred upon.Returns:
The TreeItem that this event occurred upon.
-
getNewValue
public T getNewValue()
If the value of the TreeItem changed, this method will return the new value. If it did not change, this method will return null.Returns:
The new value of the TreeItem if it changed, null otherwise.
-
getAddedChildren
public List<? extends TreeItem<T>> getAddedChildren()
Returns the children added to the TreeItem in this event, or an empty list if no children were added.Returns:
The newly added children, or an empty list if no children were added.
-
getRemovedChildren
public List<? extends TreeItem<T>> getRemovedChildren()
Returns the children removed from the TreeItem in this event, or an empty list if no children were added.Returns:
The removed children, or an empty list if no children were removed.
-
getRemovedSize
public int getRemovedSize()
Returns the number of children items that were removed in this event, or zero if no children were removed.Returns:
The number of removed children items, or zero if no children were removed.
-
getAddedSize
public int getAddedSize()
Returns the number of children items that were added in this event, or zero if no children were added.Returns:
The number of added children items, or zero if no children were added.
-
wasExpanded
public boolean wasExpanded()
Returns true if this event represents a TreeItem expansion event, and false if the TreeItem was not expanded.
-
wasCollapsed
public boolean wasCollapsed()
Returns true if this event represents a TreeItem collapse event, and false if the TreeItem was not collapsed.
-
wasAdded
public boolean wasAdded()
Returns true if this event represents a TreeItem event where children TreeItems were added.
-
wasRemoved
public boolean wasRemoved()
Returns true if this event represents a TreeItem event where children TreeItems were removed.
-
wasPermutated
public boolean wasPermutated()
Returns true if the order of the TreeItem children list has changed, but that there have been no additions or removals.
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.