public class FxUtilities
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> javafx.collections.ObservableList<T> |
asList(javafx.collections.ObservableSet<T> component)
Create an observable list view of an observable set.
|
static <T> javafx.collections.ObservableSet<T> |
asSet(javafx.collections.ObservableList<T> component)
Create an observable set view of an observable list.
|
static java.net.URL |
getResource(java.lang.Class<?> controllerClass)
Find the
.fxml resource associated with a given controller class by
location and naming conventions. |
static java.net.URL |
getResource(java.lang.Class<?> controllerClass,
java.lang.String resourceName)
Find the
.fxml resource for a given controller class by location
conventions. |
static java.lang.String |
getResourceName(java.lang.Class<?> controllerClass)
Find the name of the
.fxml resource associated with a given
controller class by convention. |
static <T,U> javafx.collections.ObservableList<T> |
map(javafx.collections.ObservableList<U> component,
java.util.function.Function<U,T> mapper)
Create a new observable list as a transformation of a component observable
list.
|
static <T,U> javafx.collections.ObservableSet<T> |
map(javafx.collections.ObservableSet<U> component,
java.util.function.Function<U,T> mapper)
Create a new observable set as a transformation of a component observable
set.
|
static void |
runNow(java.lang.Runnable runnable)
Perform the given action on the JavaFX event thread as soon as possible,
returning upon completion.
|
static <T> T |
runNow(java.util.function.Supplier<T> runnable)
Perform the given action on the JavaFX event thread as soon as possible,
returning the result upon completion.
|
static <T> javafx.beans.value.ObservableValue<T> |
wrap(Observable<T> observable,
T initial)
Wrap an
Observable with a JavaFX
equivalent ObservableValue . |
static <T> javafx.beans.value.ObservableValue<T> |
wrap(ObservableValue<T> observable)
Wrap an
ObservableValue with a JavaFX
equivalent ObservableValue . |
public static void runNow(java.lang.Runnable runnable)
runnable
- The action to executepublic static <T> T runNow(java.util.function.Supplier<T> runnable)
T
- The type of value to result from the actionrunnable
- The action to executepublic static <T,U> javafx.collections.ObservableList<T> map(javafx.collections.ObservableList<U> component, java.util.function.Function<U,T> mapper)
T
- the type of the elements of the new listU
- the type of the elements of the component listcomponent
- the component listmapper
- a mapping from the type of the elements of the component list to the
type of the elements of the new listpublic static <T,U> javafx.collections.ObservableSet<T> map(javafx.collections.ObservableSet<U> component, java.util.function.Function<U,T> mapper)
T
- the type of the elements of the new setU
- the type of the elements of the component setcomponent
- the component setmapper
- a mapping from the type of the elements of the component set to the
type of the elements of the new setpublic static <T> javafx.collections.ObservableList<T> asList(javafx.collections.ObservableSet<T> component)
T
- the type of the elements of the setcomponent
- the set to wrap as a listpublic static <T> javafx.collections.ObservableSet<T> asSet(javafx.collections.ObservableList<T> component)
T
- the type of the elements of the listcomponent
- the list to wrap as a setpublic static <T> javafx.beans.value.ObservableValue<T> wrap(Observable<T> observable, T initial)
Observable
with a JavaFX
equivalent ObservableValue
.T
- the type of the valueobservable
- the observable value to wrapinitial
- the initial value of the wrapping observable valuepublic static <T> javafx.beans.value.ObservableValue<T> wrap(ObservableValue<T> observable)
ObservableValue
with a JavaFX
equivalent ObservableValue
.T
- the type of the valueobservable
- the observable value to wrappublic static java.net.URL getResource(java.lang.Class<?> controllerClass)
.fxml
resource associated with a given controller class by
location and naming conventions. The location of the file is assumed to be
the same package as the controller class. The name of the file is determined
according to the convention described by getResourceName(Class)
.controllerClass
- The controller class whose resource we wish to locatepublic static java.lang.String getResourceName(java.lang.Class<?> controllerClass)
.fxml
resource associated with a given
controller class by convention. The name of the file is assumed to be
[classname].fxml
, or if [classname]
takes the form
[classnameprefix]Controller
, the name of the file is assumed to be
[classnameprefix].fxml
.controllerClass
- The controller class whose resource we wish to locatepublic static java.net.URL getResource(java.lang.Class<?> controllerClass, java.lang.String resourceName)
.fxml
resource for a given controller class by location
conventions. The location of the file is assumed to be the same package as
the controller class.controllerClass
- The controller class whose resource we wish to locateresourceName
- The name of the resource file