Module javafx.controls
Package javafx.scene.control

# 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`

Enclosing class:
  TreeItem<T>

public static class TreeItem.TreeModificationEvent<T> extends Event
An `Event` that contains relevant information for all forms of TreeItem modifications.

Since:
  JavaFX 2.0
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final EventType<?>`
  `ANY`
  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

  Constructors
  Constructor
  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 its `TreeItem.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 its `TreeItem.valueProperty()` changed.

- ## Method Summary

  Modifier and Type
  Method
  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.
  `int`
  `getAddedSize()`
  Returns the number of children items that were added in this event, or zero if no children were added.
  `T`
  `getNewValue()`
  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.
  `int`
  `getRemovedSize()`
  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.
  `boolean`
  `wasAdded()`
  Returns true if this event represents a TreeItem event where children TreeItems were added.
  `boolean`
  `wasCollapsed()`
  Returns true if this event represents a TreeItem collapse event, and false if the TreeItem was not collapsed.
  `boolean`
  `wasExpanded()`
  Returns true if this event represents a TreeItem expansion event, and false if the TreeItem was not expanded.
  `boolean`
  `wasPermutated()`
  Returns true if the order of the TreeItem children list has changed, but that there have been no additions or removals.
  `boolean`
  `wasRemoved()`
  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`

  ### Methods declared in class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### ANY

    public static final EventType<?> ANY
    Common supertype for all tree modification event types.
    Since:
      JavaFX 8.0

- ## Constructor Details

  - ### 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.
      `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 its `TreeItem.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 the `TreeItem.valueProperty()`.

  - ### TreeModificationEvent

    public TreeModificationEvent(EventType<? extends Event> eventType, TreeItem<T> treeItem, boolean expanded)
    Constructs a TreeModificationEvent for when the TreeItem has had its `TreeItem.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

    public TreeItem<T> getSource()
    Returns the TreeItem upon which this event occurred.
    Overrides:
      `getSource` in class `EventObject`
    Since:
      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.
    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