Class TreeItem.TreeModificationEvent<T>
java.lang.Object
java.util.EventObject
javafx.event.Event
javafx.scene.control.TreeItem.TreeModificationEvent<T>
- Type Parameters:
T
- The TreeModificationEvent
- All Implemented Interfaces:
Serializable
,Cloneable
An
Event
that contains relevant information for all forms of
TreeItem modifications.- Since:
- JavaFX 2.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final EventType
<?> Common supertype for all tree modification event types.Fields declared in class javafx.event.Event
consumed, eventType, NULL_SOURCE_TARGET, target
Fields declared in class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionTreeModificationEvent
(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.Constructs a TreeModificationEvent for when the TreeItem has had itsTreeItem.valueProperty()
changed. -
Method Summary
Modifier and TypeMethodDescriptionReturns the children added to the TreeItem in this event, or an empty list if no children were added.int
Returns the number of children items that were added in this event, or zero if no children were added.If the value of the TreeItem changed, this method will return the new value.Returns the children removed from the TreeItem in this event, or an empty list if no children were added.int
Returns the number of children items that were removed in this event, or zero if no children were removed.Returns the TreeItem upon which this event occurred.Returns the TreeItem that this event occurred upon.boolean
wasAdded()
Returns true if this event represents a TreeItem event where children TreeItems were added.boolean
Returns true if this event represents a TreeItem collapse event, and false if the TreeItem was not collapsed.boolean
Returns true if this event represents a TreeItem expansion event, and false if the TreeItem was not expanded.boolean
Returns true if the order of the TreeItem children list has changed, but that there have been no additions or removals.boolean
Returns true if this event represents a TreeItem event where children TreeItems were removed.Methods declared in class javafx.event.Event
clone, consume, copyFor, fireEvent, getEventType, getTarget, isConsumed
Methods declared in class java.util.EventObject
toString
-
Field Details
-
ANY
Common supertype for all tree modification event types.- Since:
- JavaFX 8.0
-
-
Constructor Details
-
TreeModificationEvent
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.treeItem
- The TreeItem on which this event 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.treeItem
- The TreeItem on which this event occurred.newValue
- The new value that has been put into theTreeItem.valueProperty()
.
-
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.treeItem
- The TreeItem on which this event occurred.expanded
- A boolean to represent the current expanded state of the TreeItem.
-
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.treeItem
- The TreeItem on which this event occurred.added
- A list of the items added to the children list of the given TreeItem.removed
- A list of the items removed from the children list of the given TreeItem.
-
-
Method Details
-
getSource
Returns the TreeItem upon which this event occurred.- Overrides:
getSource
in classEventObject
- Since:
- JavaFX 2.1
-
getTreeItem
-
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
-
getRemovedChildren
-
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.- 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.- 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.- 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.- 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.- Returns:
- true if the order of the TreeItem children list has changed, but that there have been no additions or removals
-