Top Description Inners Fields Constructors Methods
com.sun.jfx.incubator.scene.control.input

public Class PHList

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, .Set, javafx.event.Event, .EventHandler

Priority Handler List. Arranges event handlers according to their EventHandlerPriority.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PHList.Client<
the event type
T extends Event
>

A client interface for the forEach(Client) method.

Field Summary

Modifier and TypeField and Description
private final ArrayList<Object>
items

items is a list of EventHandlers ordered from high priority to low, with each block of same priority prefixed with the priority value.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(EventHandlerPriority
the priority
priority
,
EventHandler<?>
the handler to add
handler
)

Adds the specified priority (always), and the specified handler if not null.

private int

Returns:

the insertion index (positive), or -(insertionIndex + 1) (negative)
findInsertionIndex
(EventHandlerPriority
the priority
priority
)

Returns the index into items.

public <
the event type
T extends Event
>
void
forEach(PHList.Client<T>
the client reference
client
)

Invokes the client for each handler in the order of priority.

private void
insert(int ix, Object item)

private boolean
public <
the event type
T extends Event
>
boolean

Returns:

true when the list becomes empty as a result
remove
(EventHandler<T>
the handler to remove
handler
)

Removes all the instances of the specified handler.

public boolean

Returns:

true if list is empty as a result
removeHandlers
(Set<EventHandlerPriority> priorities)

Removes all the entries with the specified priorities.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
validateInternalState(Object...
the expected internal structure
expected
)

An internal testing method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

itemsback to summary
private final ArrayList<Object> items

items is a list of EventHandlers ordered from high priority to low, with each block of same priority prefixed with the priority value. Also, USER_KB and SKIN_KB require no handler pointer, so none is added.

Example: [ USER_HIGH, handler1, handler2, SKIN_KB, SKIN_LOW, handler3 ]

Constructor Detail

PHListback to summary
public PHList()

Method Detail

addback to summary
public void add(EventHandlerPriority priority, EventHandler<?> handler)

Adds the specified priority (always), and the specified handler if not null. A newly added handler will be inserted after previously added handlers with the same priority.

Parameters
priority:EventHandlerPriority

the priority

handler:EventHandler<?>

the handler to add

findInsertionIndexback to summary
private int findInsertionIndex(EventHandlerPriority priority)

Returns the index into items. When the list contains no elements of the given priority, the return value is negative, equals to -(insertionIndex + 1), and the caller must insert the priority value in addition to the handler.

Parameters
priority:EventHandlerPriority

the priority

Returns:int

the insertion index (positive), or -(insertionIndex + 1) (negative)

forEachback to summary
public <T extends Event> void forEach(PHList.Client<T> client)

Invokes the client for each handler in the order of priority.

Parameters
<T>
the event type
client:PHList.Client<T>

the client reference

insertback to summary
private void insert(int ix, Object item)
isNullOrPriorityback to summary
private boolean isNullOrPriority(int ix)
removeback to summary
public <T extends Event> boolean remove(EventHandler<T> handler)

Removes all the instances of the specified handler. Returns true if the list becomes empty as a result. Returns true if the list becomes empty as a result of the removal.

Parameters
<T>
the event type
handler:EventHandler<T>

the handler to remove

Returns:boolean

true when the list becomes empty as a result

removeHandlersback to summary
public boolean removeHandlers(Set<EventHandlerPriority> priorities)

Removes all the entries with the specified priorities.

Returns:boolean

true if list is empty as a result

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
validateInternalStateback to summary
public void validateInternalState(Object... expected)

An internal testing method.

Parameters
expected:Object[]

the expected internal structure

com.sun.jfx.incubator.scene.control.input back to summary

public Interface PHList.Client<T extends Event>

Annotations
@FunctionalInterface
Type Parameters
<T>
the event type

A client interface for the forEach(Client) method.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true to continue the process, false to stop
accept
(EventHandlerPriority
the priority
pri
,
EventHandler<T>
the handler (can be null)
h
)

This method gets called for each handler in the order of priority.

Method Detail

acceptback to summary
public boolean accept(EventHandlerPriority pri, EventHandler<T> h)

This method gets called for each handler in the order of priority. The client may signal to stop iterating by returning false from this method.

Parameters
pri:EventHandlerPriority

the priority

h:EventHandler<T>

the handler (can be null)

Returns:boolean

true to continue the process, false to stop