Package org.jdesktop.application
Class Task.InputBlocker
- java.lang.Object
-
- org.jdesktop.application.AbstractBean
-
- org.jdesktop.application.Task.InputBlocker
-
public abstract static class Task.InputBlocker extends AbstractBean
Specifies to what extent input to the Application's GUI should be blocked while this Task is being executed and provides a pair of methods,blockandunblockthat do the work of blocking the GUI. For the sake of input blocking, a Task begins executing when it'ssubmittedto aTaskService, and it finishes executing after the Task's completion methods have been called.The InputBlocker's
BlockingScopeand the blockingtargetobject define what part of the GUI's input will be blocked:Task.BlockingScope.NONE- Don't block input. The blocking target is ignored in this case.
Task.BlockingScope.ACTION- Disable the target
Actionwhile the Task is executing.Task.BlockingScope.COMPONENT- Disable the target
ComponentComponent while the Task is executing.Task.BlockingScope.WINDOW- Block the Window ancestor of the target Component while the Task is executing.
Task.BlockingScope.Application- Block the entire Application while the Task is executing. The blocking target is ignored in this case.
- Don't block input. The blocking target is ignored in this case.
Input blocking begins when the
blockmethod is called and ends whenunblockis called. Each method is only called once, typically by theTaskService.
-
-
Constructor Summary
Constructors Constructor Description InputBlocker(Task task, Task.BlockingScope scope, java.lang.Object target)Construct an InputBlocker.InputBlocker(Task task, Task.BlockingScope scope, java.lang.Object target, ApplicationAction action)Construct an InputBlocker with four immutable properties.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidblock()Block input to the GUI per thescopeandtargetproperties.ApplicationActiongetAction()The ApplicationAction (@Action) that caused the task to be executed.Task.BlockingScopegetScope()Defines the extent to which the GUI is blocked while the task is being executed.java.lang.ObjectgetTarget()Specifies the GUI element that will be blocked while the task is being executed.TaskgetTask()Theblockmethod will block input while this Task is being executed by a TaskService.protected abstract voidunblock()Unblock input to the GUI by undoing whatever theblockmethod did.-
Methods inherited from class org.jdesktop.application.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
InputBlocker
public InputBlocker(Task task, Task.BlockingScope scope, java.lang.Object target, ApplicationAction action)
Construct an InputBlocker with four immutable properties. If the Task is null or if the Task has already been executed by a TaskService, then an exception is thrown. If scope isBlockingScope.ACTIONthen target must be aAction. If scope isBlockingScope.WINDOWorBlockingScope.COMPONENTthen target must be a Component.- Parameters:
task- block input while this Task is executingscope- how much of the GUI will be blockedtarget- the GUI element that will be blockedaction- the@Actionthat triggered running the task, or null- See Also:
TaskService.execute(org.jdesktop.application.Task)
-
InputBlocker
public InputBlocker(Task task, Task.BlockingScope scope, java.lang.Object target)
Construct an InputBlocker. Iftargetis anApplicationAction, it becomes the InputBlocker'saction. If the Task is null or if the Task has already been executed by a TaskService, then an exception is thrown.- Parameters:
task- block input while this Task is executingscope- how much of the GUI will be blockedtarget- the GUI element that will be blocked- See Also:
TaskService.execute(org.jdesktop.application.Task)
-
-
Method Detail
-
getTask
public final Task getTask()
Theblockmethod will block input while this Task is being executed by a TaskService.
-
getScope
public final Task.BlockingScope getScope()
Defines the extent to which the GUI is blocked while the task is being executed.
-
getTarget
public final java.lang.Object getTarget()
Specifies the GUI element that will be blocked while the task is being executed.This property may be null.
- Returns:
- the value of the read-only target property
- See Also:
getScope(),block(),unblock()
-
getAction
public final ApplicationAction getAction()
The ApplicationAction (@Action) that caused the task to be executed. The DefaultInputBlocker uses the action'snameandresourceMapto configure its blocking dialog ifscopeisBlockingScope.WINDOW.This property may be null.
- Returns:
- the value of the read-only action property
- See Also:
getScope(),block(),unblock(),ApplicationAction.getName(),ApplicationAction.getResourceMap()
-
block
protected abstract void block()
Block input to the GUI per thescopeandtargetproperties. This method will only be called once.
-
unblock
protected abstract void unblock()
Unblock input to the GUI by undoing whatever theblockmethod did. This method will only be called once.
-
-