public final class JavaFXUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
JavaFXUtils.Predicate<T>
An unary function that evaluates its input.
|
Modifier and Type | Method and Description |
---|---|
static void |
configure(ButtonBase control,
JavaFXAction action) |
static void |
configure(CheckBox control,
JavaFXAction action) |
static void |
configure(CheckMenuItem control,
JavaFXAction action) |
static void |
configure(MenuItem control,
JavaFXAction action) |
static void |
configure(RadioButton control,
JavaFXAction action) |
static void |
configure(RadioMenuItem control,
JavaFXAction action) |
static void |
configure(ToggleButton control,
JavaFXAction action) |
static void |
connectActions(Object node,
GriffonController controller) |
static void |
connectMessageSource(Object node,
GriffonApplication application) |
static <E> ObservableList<E> |
createJavaFXThreadProxyList(ObservableList<E> source)
Wraps an ObservableList, publishing updates inside the UI thread.
|
static <K,V> ObservableMap<K,V> |
createJavaFXThreadProxyMap(ObservableMap<K,V> source)
Wraps an ObservableMap, publishing updates inside the UI thread.
|
static <E> ObservableSet<E> |
createJavaFXThreadProxySet(ObservableSet<E> source)
Wraps an ObservableSet, publishing updates inside the UI thread.
|
static <B> Property<?> |
extractProperty(B bean,
String propertyName) |
static Object |
findElement(Object root,
JavaFXUtils.Predicate<Object> predicate) |
static Object |
findElement(Object root,
String id) |
static Collection<Object> |
findElements(Object root,
JavaFXUtils.Predicate<Object> predicate) |
static Node |
findNode(Node root,
String id) |
static String |
getGriffonActionId(MenuItem menuItem)
Finds out if an
Action has been registered with the target MenuItem , returning the action id if found. |
static String |
getGriffonActionId(Node node)
Finds out if an
Action has been registered with the target Node , returning the action id if found. |
static String |
getI18nArgs(Labeled node)
Finds out if an
arguments array has been registered with the target Node , returning the array if found. |
static String |
getI18nArgs(MenuItem node)
Finds out if an
arguments array has been registered with the target Node , returning the array if found. |
static String |
getI18nArgs(Tab node)
Finds out if an
arguments array has been registered with the target Node , returning the array if found. |
static String |
getI18nDefaultValue(Labeled node)
Finds out if a
default value has been registered with the target Node , returning the value if found. |
static String |
getI18nDefaultValue(MenuItem node)
Finds out if a
default value has been registered with the target Node , returning the value if found. |
static String |
getI18nDefaultValue(Tab node)
Finds out if a
default value has been registered with the target Node , returning the value if found. |
static String |
getI18nKey(Labeled node)
Finds out if an i18n
key has been registered with the target Node , returning the key if found. |
static String |
getI18nKey(MenuItem node)
Finds out if an i18n
key has been registered with the target Node , returning the key if found. |
static String |
getI18nKey(Tab node)
Finds out if an i18n
key has been registered with the target Node , returning the key if found. |
static Window |
getWindowAncestor(Object node) |
static String |
normalizeStyle(String style,
String key,
String value) |
static Node |
resolveIcon(String iconUrl) |
static void |
setGraphic(Labeled control,
Image graphic) |
static void |
setGraphic(Labeled control,
Node graphic) |
static void |
setGraphic(MenuItem control,
Image graphic) |
static void |
setGraphic(MenuItem control,
Node graphic) |
static void |
setGraphicStyle(ButtonBase node,
String graphicStyle) |
static void |
setGraphicStyle(MenuItem node,
String graphicStyle) |
static void |
setGraphicStyleClass(ButtonBase node,
String graphicStyleClass) |
static void |
setGraphicStyleClass(ButtonBase node,
String graphicStyleClass,
boolean remove) |
static void |
setGraphicStyleClass(MenuItem node,
String graphicStyleClass) |
static void |
setGraphicStyleClass(MenuItem node,
String graphicStyleClass,
boolean remove) |
static void |
setGriffonActionId(MenuItem menuItem,
String actionId)
Associates a
Action with a target MenuItem . |
static void |
setGriffonActionId(Node node,
String actionId)
Associates a
Action with a target Node . |
static void |
setI18nArgs(Labeled node,
String args)
Associates an i18n arrays of arguments to a
node . |
static void |
setI18nArgs(MenuItem node,
String args)
Associates an i18n arrays of arguments to a
node . |
static void |
setI18nArgs(Tab node,
String args)
Associates an i18n arrays of arguments to a
node . |
static void |
setI18nDefaultValue(Labeled node,
String defaultValue)
Associates an default value
node . |
static void |
setI18nDefaultValue(MenuItem node,
String defaultValue)
Associates an default value
node . |
static void |
setI18nDefaultValue(Tab node,
String defaultValue)
Associates an default value
node . |
static void |
setI18nKey(MenuItem node,
String key)
Associates an i18n key to a
node . |
static void |
setI18nKey(Tab node,
String key)
Associates an i18n key to a
node . |
static void |
setIcon(Labeled control,
String iconUrl) |
static void |
setIcon(MenuItem control,
String iconUrl) |
static void |
setStyle(MenuItem node,
String style) |
static void |
setStyle(Node node,
String style) |
static void |
setStyleClass(MenuItem node,
String styleClass) |
static void |
setStyleClass(MenuItem node,
String styleClass,
boolean remove) |
static void |
setStyleClass(Node node,
String styleClass) |
static void |
setStyleClass(Node node,
String styleClass,
boolean remove) |
static void |
setTooltip(Control control,
String text) |
@Nullable public static String getI18nKey(@Nonnull Labeled node)
key
has been registered with the target Node
, returning the key if found.node
- the target node on which the key may have been registered.Node
or null
if not found.public static void setI18nArgs(@Nonnull Labeled node, @Nullable String args)
node
.
These arguments will be used alongside a key to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.args
- the array of arguments to be registered.@Nullable public static String getI18nArgs(@Nonnull Labeled node)
arguments array
has been registered with the target Node
, returning the array if found.node
- the target node on which the arguments may have been registered.Node
or null
if not found.public static void setI18nDefaultValue(@Nonnull Labeled node, @Nullable String defaultValue)
node
.
The value will be used alongside a key to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.defaultValue
- the value to be registered.@Nullable public static String getI18nDefaultValue(@Nonnull Labeled node)
default value
has been registered with the target Node
, returning the value if found.node
- the target node on which the value may have been registered.Node
or null
if not found.public static void setI18nKey(@Nonnull Tab node, @Nonnull String key)
node
. The key is used to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.key
- the message key to be registered.@Nullable public static String getI18nKey(@Nonnull Tab node)
key
has been registered with the target Node
, returning the key if found.node
- the target node on which the key may have been registered.Node
or null
if not found.public static void setI18nArgs(@Nonnull Tab node, @Nullable String args)
node
.
These arguments will be used alongside a key to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.args
- the array of arguments to be registered.@Nullable public static String getI18nArgs(@Nonnull Tab node)
arguments array
has been registered with the target Node
, returning the array if found.node
- the target node on which the arguments may have been registered.Node
or null
if not found.public static void setI18nDefaultValue(@Nonnull Tab node, @Nullable String defaultValue)
node
.
The value will be used alongside a key to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.defaultValue
- the value to be registered.@Nullable public static String getI18nDefaultValue(@Nonnull Tab node)
default value
has been registered with the target Node
, returning the value if found.node
- the target node on which the value may have been registered.Node
or null
if not found.public static void setI18nKey(@Nonnull MenuItem node, @Nonnull String key)
node
. The key is used to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.key
- the message key to be registered.@Nullable public static String getI18nKey(@Nonnull MenuItem node)
key
has been registered with the target Node
, returning the key if found.node
- the target node on which the key may have been registered.Node
or null
if not found.public static void setI18nArgs(@Nonnull MenuItem node, @Nullable String args)
node
.
These arguments will be used alongside a key to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.args
- the array of arguments to be registered.@Nullable public static String getI18nArgs(@Nonnull MenuItem node)
arguments array
has been registered with the target Node
, returning the array if found.node
- the target node on which the arguments may have been registered.Node
or null
if not found.public static void setI18nDefaultValue(@Nonnull MenuItem node, @Nullable String defaultValue)
node
.
The value will be used alongside a key to resolve a message via the application's MessageSource
.node
- the target node on which the key will be registered.defaultValue
- the value to be registered.@Nullable public static String getI18nDefaultValue(@Nonnull MenuItem node)
default value
has been registered with the target Node
, returning the value if found.node
- the target node on which the value may have been registered.Node
or null
if not found.public static void connectMessageSource(@Nonnull Object node, @Nonnull GriffonApplication application)
public static void setGriffonActionId(@Nonnull Node node, @Nonnull String actionId)
Action
with a target Node
.node
- the target node on which the action will be registered.actionId
- the id of the action to be registered.@Nullable public static String getGriffonActionId(@Nonnull Node node)
Action
has been registered with the target Node
, returning the action id if found.node
- the target node on which the action may have been registered.Node
or null
if not found.public static void setGriffonActionId(@Nonnull MenuItem menuItem, @Nonnull String actionId)
Action
with a target MenuItem
.menuItem
- the target menuItem on which the action will be registered.actionId
- the id of the action to be registered.@Nullable public static String getGriffonActionId(@Nonnull MenuItem menuItem)
Action
has been registered with the target MenuItem
, returning the action id if found.menuItem
- the target menuItem on which the action may have been registered.MenuItem
or null
if not found.@Nonnull public static <E> ObservableList<E> createJavaFXThreadProxyList(@Nonnull ObservableList<E> source)
E
- the list's parameter type.source
- the ObservableList to be wrapped@Nonnull public static <E> ObservableSet<E> createJavaFXThreadProxySet(@Nonnull ObservableSet<E> source)
E
- the set's parameter type.source
- the ObservableSet to be wrapped@Nonnull public static <K,V> ObservableMap<K,V> createJavaFXThreadProxyMap(@Nonnull ObservableMap<K,V> source)
K
- the type of keys maintained by the mapV
- the type of mapped valuessource
- the ObservableMap to be wrapped@Nonnull public static <B> Property<?> extractProperty(@Nonnull B bean, @Nonnull String propertyName)
public static void connectActions(@Nonnull Object node, @Nonnull GriffonController controller)
public static String normalizeStyle(@Nonnull String style, @Nonnull String key, @Nonnull String value)
public static void configure(@Nonnull ToggleButton control, @Nonnull JavaFXAction action)
public static void configure(@Nonnull CheckBox control, @Nonnull JavaFXAction action)
public static void configure(@Nonnull RadioButton control, @Nonnull JavaFXAction action)
public static void configure(@Nonnull ButtonBase control, @Nonnull JavaFXAction action)
public static void configure(@Nonnull CheckMenuItem control, @Nonnull JavaFXAction action)
public static void configure(@Nonnull RadioMenuItem control, @Nonnull JavaFXAction action)
public static void configure(@Nonnull MenuItem control, @Nonnull JavaFXAction action)
public static void setGraphicStyle(@Nonnull ButtonBase node, @Nonnull String graphicStyle)
public static void setGraphicStyle(@Nonnull MenuItem node, @Nonnull String graphicStyle)
public static void setStyleClass(@Nonnull Node node, @Nonnull String styleClass, boolean remove)
public static void setStyleClass(@Nonnull MenuItem node, @Nonnull String styleClass, boolean remove)
public static void setGraphicStyleClass(@Nonnull ButtonBase node, @Nonnull String graphicStyleClass)
public static void setGraphicStyleClass(@Nonnull ButtonBase node, @Nonnull String graphicStyleClass, boolean remove)
public static void setGraphicStyleClass(@Nonnull MenuItem node, @Nonnull String graphicStyleClass)
public static void setGraphicStyleClass(@Nonnull MenuItem node, @Nonnull String graphicStyleClass, boolean remove)
@Nullable public static Object findElement(@Nonnull Object root, @Nonnull JavaFXUtils.Predicate<Object> predicate)
@Nonnull public static Collection<Object> findElements(@Nonnull Object root, @Nonnull JavaFXUtils.Predicate<Object> predicate)