public interface NodeUtils
Utility class for working with nodes.
- Author:
- Besmir Beqiri, Indrit Beqiri
-
Field Summary
Fields -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T extends javafx.event.Event>
voidaddEventHandler(javafx.scene.Node node, javafx.event.EventType<T> eventType, javafx.event.EventHandler<? super T> eventHandler) Adds (or replaces) an event handler on the specified node for the given event type.static <K,V> V getPropertyValue(javafx.scene.Node node, K key, V defaultValue) Retrieves the value of a property associated with the given key from a node.
-
Field Details
-
MULTI_FILE_UPLOADER_KEY
-
EVENT_HANDLER_KEY
-
-
Method Details
-
getPropertyValue
static <K,V> V getPropertyValue(javafx.scene.Node node, K key, V defaultValue) Retrieves the value of a property associated with the given key from a node.- Type Parameters:
K- the type of the keyV- the type of the value- Parameters:
node- the node to retrieve the property value fromkey- the key of the property to retrievedefaultValue- the default value to return if the property does not exist- Returns:
- the value of the property associated with the given key, or the default value if the property does not exist
-
addEventHandler
static <T extends javafx.event.Event> void addEventHandler(javafx.scene.Node node, javafx.event.EventType<T> eventType, javafx.event.EventHandler<? super T> eventHandler) Adds (or replaces) an event handler on the specified node for the given event type. If an event handler for this event type was previously added via this method, it is first removed before adding the new handler. Only one handler per event type is maintained through this utility.- Type Parameters:
T- the specific subclass ofEventbeing handled- Parameters:
node- the node to which the event handler will be addedeventType- the event type to handleeventHandler- the event handler to be added
-