Top Inners Fields Constructors Methods
com.sun.javafx.scene.control

public Class ControlAcceleratorSupport

extends Object
Class Inheritance
Imports
javafx.beans.InvalidationListener, .Observable, javafx.beans.property.ReadOnlyObjectProperty, javafx.beans.value.ChangeListener, javafx.collections.ListChangeListener, .ObservableList, javafx.event.Event, javafx.scene.Node, .Scene, javafx.scene.control.CheckMenuItem, .Control, .Menu, .MenuItem, .RadioMenuItem, .Tab, .TabPane, .TableColumn, .TableColumnBase, .TreeTableColumn, javafx.scene.input.KeyCombination, java.lang.ref.WeakReference, java.util.List, .Map, .WeakHashMap

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ControlAcceleratorSupport.IdentityWrapperListChangeListener

We need to store all the listeners added to each ObservableList so that we can remove them.

Field Summary

Modifier and TypeField and Description
private static Map<MenuItem, WeakReference<ChangeListener<KeyCombination>>>
private static Map<Object, WeakReference<ChangeListener<Scene>>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
public static void
public static void
private static void
private static void
private static void
doAcceleratorInstall(final List<? extends MenuItem> items, final Scene scene)

private static ReadOnlyObjectProperty<? extends Control>
private static ChangeListener<KeyCombination>
getListener(final Scene scene, MenuItem menuItem)

private static ChangeListener<Scene>
public static void
public static void
public static void
public static void
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

changeListenerMapback to summary
private static Map<MenuItem, WeakReference<ChangeListener<KeyCombination>>> changeListenerMap
sceneChangeListenerMapback to summary
private static Map<Object, WeakReference<ChangeListener<Scene>>> sceneChangeListenerMap

Constructor Detail

ControlAcceleratorSupportback to summary
public ControlAcceleratorSupport()

Method Detail

addAcceleratorsIntoSceneback to summary
public static void addAcceleratorsIntoScene(ObservableList<MenuItem> items, Tab anchor)
addAcceleratorsIntoSceneback to summary
public static void addAcceleratorsIntoScene(ObservableList<MenuItem> items, TableColumnBase<?, ?> anchor)
addAcceleratorsIntoSceneback to summary
public static void addAcceleratorsIntoScene(ObservableList<MenuItem> items, Node anchor)
addAcceleratorsIntoSceneback to summary
private static void addAcceleratorsIntoScene(ObservableList<MenuItem> items, Object anchor)
doAcceleratorInstallback to summary
private static void doAcceleratorInstall(final ObservableList<MenuItem> items, final Scene scene)
doAcceleratorInstallback to summary
private static void doAcceleratorInstall(final List<? extends MenuItem> items, final Scene scene)
getControlPropertyback to summary
private static ReadOnlyObjectProperty<? extends Control> getControlProperty(Object obj)
getListenerback to summary
private static ChangeListener<KeyCombination> getListener(final Scene scene, MenuItem menuItem)
getSceneChangeListenerback to summary
private static ChangeListener<Scene> getSceneChangeListener(Object anchor, ObservableList<MenuItem> items)
removeAcceleratorsFromSceneback to summary
public static void removeAcceleratorsFromScene(ObservableList<? extends MenuItem> items, Tab anchor)
removeAcceleratorsFromSceneback to summary
public static void removeAcceleratorsFromScene(ObservableList<? extends MenuItem> items, TableColumnBase<?, ?> anchor)
removeAcceleratorsFromSceneback to summary
public static void removeAcceleratorsFromScene(ObservableList<? extends MenuItem> items, Node anchor)
removeAcceleratorsFromSceneback to summary
public static void removeAcceleratorsFromScene(ObservableList<? extends MenuItem> items, Scene scene)
removeAcceleratorsFromSceneback to summary
private static void removeAcceleratorsFromScene(List<? extends MenuItem> items, Scene scene)
com.sun.javafx.scene.control back to summary

pack-priv Class ControlAcceleratorSupport.IdentityWrapperListChangeListener

extends Object
implements ListChangeListener<MenuItem>
Class Inheritance
  • java.lang.Object
  • com.sun.javafx.scene.control.ControlAcceleratorSupport.IdentityWrapperListChangeListener
All Implemented Interfaces
javafx.collections.ListChangeListener

We need to store all the listeners added to each ObservableList so that we can remove them. For this we need a map mapping ObservableList to various listeners such as ListChangeListeners, but the map needs to be a WeakHashMap. The ideal key to the WeakHashMap would be the ObservableList itself, except for the fact that its equals method compares the list contents. If a WeakIdentityHashMap existed, we could use that instead with the ObservableList as the key. We can't use an IdentityWrapper as the key to the HashMap because we need a strong reference (ideally from the ObservableList itself) to the IdentityWrapper else it'll be garbage collected. Since every ObservableList gets a ListChangeListener, we can use that as an IdentityWrapper and rely on the fact ObservableList has a strong reference to the ListChangeListener.

Field Summary

Modifier and TypeField and Description
pack-priv ObservableList<? extends MenuItem>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public void
onChanged(ListChangeListener.Change<? extends MenuItem> c)

Implements javafx.collections.ListChangeListener.onChanged.

Called after a change has been made to an ObservableList.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

innerListback to summary
pack-priv ObservableList<? extends MenuItem> innerList

Constructor Detail

IdentityWrapperListChangeListenerback to summary
public IdentityWrapperListChangeListener(ObservableList<? extends MenuItem> list)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
onChangedback to summary
public void onChanged(ListChangeListener.Change<? extends MenuItem> c)

Implements javafx.collections.ListChangeListener.onChanged.

Doc from javafx.collections.ListChangeListener.onChanged.

Called after a change has been made to an ObservableList.

Annotations
@Override