public class UiUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
UiUtils.Thrunnable
Functional interface for a Runnable that can throw an Exception but returns no value.
|
Constructor and Description |
---|
UiUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
confirmMoveToLocationAndAct(java.awt.Component parentComponent,
java.lang.String moveBeforeActionDescription,
boolean allowWithoutMove,
UiUtils.Thrunnable motionThrunnable,
UiUtils.Thrunnable actionThrunnable) |
static void |
confirmMoveToLocationAndAct(java.awt.Component parentComponent,
java.lang.String moveBeforeActionDescription,
HeadMountable movable,
Location location,
boolean allowWithoutMove,
UiUtils.Thrunnable actionThrunnable)
Some UI actions require the machine to move to a certain location as a prerequisite (e.g.
|
static void |
messageBoxOnException(UiUtils.Thrunnable thrunnable)
Functional wrapper for actions that may throw an Exception.
|
static void |
messageBoxOnExceptionLater(UiUtils.Thrunnable thrunnable)
Functional wrapper for actions that may throw an Exception.
|
static void |
showError(java.lang.Throwable t)
Show an error using a message box, if the GUI is present, otherwise just log the error.
|
static <T> java.util.concurrent.Future<T> |
submitUiMachineTask(java.util.concurrent.Callable<T> callable)
Wrapper for submitMachineTask(Callable, Consumer, Consumer) which ignores the return value in
onSuccess and shows a MessageBox when an Exception is thrown.
|
static <T> java.util.concurrent.Future<T> |
submitUiMachineTask(java.util.concurrent.Callable<T> callable,
java.util.function.Consumer<T> onSuccess,
java.util.function.Consumer<java.lang.Throwable> onFailure)
Functional version of Machine.submit which guarantees that the the onSuccess and onFailure
handlers will be run on the Swing event thread.
|
static <T> java.util.concurrent.Future<T> |
submitUiMachineTask(java.util.concurrent.Callable<T> callable,
java.util.function.Consumer<T> onSuccess,
java.util.function.Consumer<java.lang.Throwable> onFailure,
boolean ignoreEnabled)
Functional version of Machine.submit which guarantees that the the onSuccess and onFailure
handlers will be run on the Swing event thread.
|
static java.util.concurrent.Future<java.lang.Void> |
submitUiMachineTask(UiUtils.Thrunnable thrunnable)
Shortcut for submitMachineTask(Callable) which uses a Thrunnable instead.
|
public static java.util.concurrent.Future<java.lang.Void> submitUiMachineTask(UiUtils.Thrunnable thrunnable)
thrunnable
- public static <T> java.util.concurrent.Future<T> submitUiMachineTask(java.util.concurrent.Callable<T> callable)
callable
- public static void showError(java.lang.Throwable t)
t
- public static <T> java.util.concurrent.Future<T> submitUiMachineTask(java.util.concurrent.Callable<T> callable, java.util.function.Consumer<T> onSuccess, java.util.function.Consumer<java.lang.Throwable> onFailure)
callable
- onSuccess
- onFailure
- public static <T> java.util.concurrent.Future<T> submitUiMachineTask(java.util.concurrent.Callable<T> callable, java.util.function.Consumer<T> onSuccess, java.util.function.Consumer<java.lang.Throwable> onFailure, boolean ignoreEnabled)
callable
- onSuccess
- onFailure
- ignoreEnabled
- public static void messageBoxOnException(UiUtils.Thrunnable thrunnable)
thrunnable
- public static void messageBoxOnExceptionLater(UiUtils.Thrunnable thrunnable)
thrunnable
- public static void confirmMoveToLocationAndAct(java.awt.Component parentComponent, java.lang.String moveBeforeActionDescription, HeadMountable movable, Location location, boolean allowWithoutMove, UiUtils.Thrunnable actionThrunnable)
parentComponent
- moveBeforeActionDescription
- movable
- location
- allowWithoutMove
- actionThrunnable
- public static void confirmMoveToLocationAndAct(java.awt.Component parentComponent, java.lang.String moveBeforeActionDescription, boolean allowWithoutMove, UiUtils.Thrunnable motionThrunnable, UiUtils.Thrunnable actionThrunnable)