|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ehsbe.commons.gui.wizard.ExecServiceAdapter
public class ExecServiceAdapter
General purpose wrapper for a task execution service.
Constructor Summary | |
---|---|
ExecServiceAdapter()
Creates a new service which returns always the same empty page. |
|
ExecServiceAdapter(JComponent page)
Creates a new service which returns always the same page. |
Method Summary | |
---|---|
JComponent |
execute(HashMap<Task,HashMap<? extends Object,? extends Object>> settings,
TaskControl control,
EnumSet<NavMode> initalMode)
Create the UI aka wizard page, which should be displayed and do the work described by the task. |
void |
finish(HashMap<Task,HashMap<? extends Object,? extends Object>> settings,
TaskControl control,
NavMode mode)
Calculate final results for this task, cleanup resources and notify the controller, when all work has been done. |
protected JComponent |
getEmptyPanel(Task task)
Just in case we have no page to display. |
boolean |
hasHelp()
Check, whether this task may provide any help UI. |
void |
prepare(HashMap<Task,HashMap<? extends Object,? extends Object>> settings,
TaskControl control)
Prepare all data required to setup the UI aka wizard page for a task. |
void |
showHelp(HashMap<Task,HashMap<? extends Object,? extends Object>> settings,
TaskControl control,
JComponent parent)
Show the help for this task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExecServiceAdapter()
ExecServiceAdapter(JComponent)
public ExecServiceAdapter(JComponent page)
page
- the page, which gets returned per default via
execute(HashMap, TaskControl, EnumSet)
. Might be null
.Method Detail |
---|
public void prepare(HashMap<Task,HashMap<? extends Object,? extends Object>> settings, TaskControl control)
The controller makes sure, that this method gets always called before
ExecService.execute(HashMap, TaskControl, EnumSet)
.
Setting navigation modes here has usually no effect and gets ignored,
since per default all navigation buttons are disabled until
ExecService.execute(HashMap, TaskControl, EnumSet)
returns.
Per default it does nothing.
prepare
in interface ExecService
settings
- all settings and collected data so far.control
- the controller, which is in charge aka manages this task
and needs to be notified on completion/businessprotected JComponent getEmptyPanel(Task task)
task
- current task in action
public JComponent execute(HashMap<Task,HashMap<? extends Object,? extends Object>> settings, TaskControl control, EnumSet<NavMode> initalMode)
Before this method gets called, the controller makes sure, that
ExecService.prepare(HashMap, TaskControl)
has been called before. Thats why
all none-UI related preparations should be made there, so that this method
is able to return fast.
Implementations should create the UI required for user input here, add required listeners to it and return the UI. After that, the controller notifies appropriate listeners, what usually results into adding the returned component to the wizard dialog and thus it gets visible.
When the controller decides to change the current task in action, theExecService.finish(HashMap, TaskControl, NavMode)
method gets called.
Per default it just enables all possible modes and returns the page
passed in the contructor. If it is null
, an empty JPanel, whose
name is set to EMPTY_PANEL
will be used instead.
execute
in interface ExecService
settings
- all settings and collected data so far.control
- the controller, which is in charge aka manages this task
and needs to be notified at least on completion/busyness.initalMode
- container, where to set initial navigation modes, when
the UI for this wizard gets displayed.
null
if the task does not require an UI to be executed,
the component, which is not visible, to display otherwise.Component.isVisible()
,
JComponent.setVisible(boolean)
,
TaskControl.setBusy(Task, boolean)
,
TaskControl.setLocale(Locale)
,
TaskControl.setNavMode(Task, EnumSet)
public void finish(HashMap<Task,HashMap<? extends Object,? extends Object>> settings, TaskControl control, NavMode mode)
Invoked by the controller after ExecService.prepare(HashMap, TaskControl)
or
ExecService.execute(HashMap, TaskControl, EnumSet)
to let the task cleanup
its resources (e.g. populatated during the prepare and execute phase) and
let it calculate its final results.
Usually this method gets invoked in a none-EDT in preparation to switch to the next or previous task or to finally finish the wizard. So if some UI modifications are done, one should invoke [and wait] appropriate work in the EDT.
The task is required to call its controller's
TaskControl.finished(Task)
method, to let it know, that it may
[not] continue with the next step indicated by mode. To veto
that the controller should not continue with the intended action,
one should call its TaskControl.setNavMode(Task, EnumSet)
before
returning from this method to indicate, what is ok. However, the final
decision about what to do next will be made by the controller.
So if this task denies the intended action, this method might be called several times.
Per default it just calls TaskControl.finished(Task)
.
finish
in interface ExecService
settings
- all settings and collected data so far.control
- the controller, which is in charge aka manages this task
and needs to be notified at least on completion/busyness.mode
- what the controller intends to do next.EventQueue.isDispatchThread()
,
EventQueue.invokeAndWait(Runnable)
public boolean hasHelp()
Per default it returns false
.
hasHelp
in interface ExecService
false
if calling ExecService.showHelp(HashMap, TaskControl, JComponent)
is useless, i.e. does nothing.public void showHelp(HashMap<Task,HashMap<? extends Object,? extends Object>> settings, TaskControl control, JComponent parent)
This method gets usually called twice: First with parent set to
null
, i.e. none-UI work required for displaying help should be
made. Per default, it gets called outside of the EDT.
When it gets called with a none-null
parent, one may
actually do all UI related work and show the help UI. The controller
ensures, that this call gets made within the EDT.
Per default it does nothing.
showHelp
in interface ExecService
settings
- all settings and collected data so far.control
- the controller, which is in charge aka manages this task
and needs to be notified at least on completion/busyness.parent
- where to anchor the help frame to show. null
indicates, that none-UI preparations should be made - i.e. prepare
help set, images etc.
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |