public class BlockingExample1 extends SingleFrameApplication
@Action block options for background
task. It's an example of three of the Action.Block types:
@Action(block = Task.BlockingScope.ACTION)
public Task blockAction() { ... }
@Action(block = Task.BlockingScope.COMPONENT)
public Task blockComponent() { ... }
@Action(block = Task.BlockingScope.WINDOW)
public Task blockWindow() { ... }
@Action(block = Task.BlockingScope.APPLICATION)
public Task blockApplication() { ... }
The first BlockingScope.ACTION @Action disables the
corresponding Action while blockAction method runs.
When you press the blockAction button or toolbar-button or menu
item you'll observe that all of the components are disabled. The
BlockingScope.COMPONENT version only disables the component
that triggered the action. The Block.WINDOW method
uses a custom inputBlocker to
temporarily block input to the by making the window's
glass pane visible. And the Task.BlockingScope.APPLICATION
version pops up a modal dialog for the action's duration.
The blocking dialog's title/message/icon are defined by resources
from the ResourceBundle named BlockingExample1:
BlockingDialog.title = Blocking Application BlockingDialog.message = Please wait patiently ... Action.BlockingDialog.icon = wait.png
All of the actions in this example just sleep for about 2 seconds, while periodically updating their Task's message/progress properties.
This class loads resources from the ResourceBundle called
BlockingExample1. It depends on the example StatusBar class.
ApplicationContext,
Application,
Action,
Task,
TaskMonitor,
StatusBarApplication.ExitListener| Constructor | Description |
|---|---|
BlockingExample1() |
| Modifier and Type | Method | Description |
|---|---|---|
Task |
blockAction() |
|
Task |
blockApplication() |
|
Task |
blockComponent() |
|
Task |
blockWindow() |
|
static void |
main(java.lang.String[] args) |
|
protected void |
startup() |
Responsible for starting the application; for creating and showing
the initial GUI.
|
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListeneraddExitListener, end, exit, exit, getContext, getExitListeners, getInstance, getInstance, hide, initialize, launch, quit, ready, removeExitListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconfigureWindow, getMainFrame, getMainView, setMainFrame, show, show, show, show, shutdownprotected void startup()
Application
This method is called by the static launch method,
subclasses must override it. It runs on the event dispatching
thread.
startup in class ApplicationApplication.launch(java.lang.Class<T>, java.lang.String[]),
Application.initialize(java.lang.String[]),
Application.shutdown()@Action(block=APPLICATION) public Task blockApplication()
public static void main(java.lang.String[] args)