|
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.Wizard
public class Wizard
The controller which manages all elements a wizard usually needs. It is designed to be simple to understand, simple to use and just in case simple to debug. Also it is designed to provide a maximum of flexibility, to avoid the usual boiler plate code, and to provide language support. Furthermore it tries to guide the user to make the wizard as thread-safe as possible since especially since Nimbus aka Synth-Look&Feel appearance it is also more important than before, to create the UIs within the EventDispatchThread (EDT).
The wizard manages one main panel (getContentPane()
, which consists
of:
getBanner()
) on the top, which is used to display
the task's title, description and optiinally an image for decorationgetButtons()
) at the bottom with all
available navigation buttonsgetSidebar()
) aka overview on the left side,
which is per default used to display the names of the task, which need to be
done, and an optional background imagewizardPage
) at the center, which contains all the
UI elements needed to collect the user information required to finish the
current task in action (see TaskControl.get()
)All components except the wizard page are created per default automatically and get an update as soon as a switch to the next task has been made, using the appropriate getter methods of the correpsonding task.
The wizard uses a mediator called TaskControl
to:
ButtonPanel
to:
get
ter methods of the currently active task to:
TaskControl.getPage(HashMap, EnumSet)
,
TaskControl.showHelp(HashMap, JComponent)
Field Summary | |
---|---|
protected JComponent |
wizardPage
the current wizard page in action |
Constructor Summary | |
---|---|
|
Wizard(Task main,
boolean sidebar,
boolean help)
Create a new wizard and initialize its main UI elements. |
|
Wizard(TaskControl control,
boolean sidebar,
boolean help)
Create a new wizard and initialize its main UI elements. |
protected |
Wizard(Task main,
TaskControl control,
boolean sidebar,
boolean help)
Create a new wizard, its default task control and initialize its main UI elements. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
Listens to the navigation buttons. |
void |
attachTo(JDialog dlg)
Attaches the main wizard panel to the given dialog. |
Boolean |
cancelled()
Check, whether the wizard has been cancelled. |
protected void |
close()
Cleanup, i.e. per default dispose the task controler. |
static JDialog |
createDialog(Task main,
boolean sidebar,
boolean help,
JFrame owner)
Create a new modal, resizable wizard dialog. |
static JDialog |
createDialog(TaskControl control,
boolean sidebar,
boolean help,
JFrame owner)
Create a new modal, resizable wizard dialog. |
protected void |
ctrlBusy()
Handles task controller notifications the busy state change of the currently executing task. |
protected void |
ctrlLocale()
Handles task controller notifications about the preferred locale to use. |
protected void |
ctrlNavMode(EnumSet<NavMode> modes)
Handles task controller notifications about requested navigation button state changes. |
protected void |
ctrlTaskFinshed(NavMode next)
Handles task controller notifications about an active task has finished its work, i.e. switching to another task is allowed, if the corresponding navigation buttons are enabled. |
protected void |
ctrlTasklist()
Handles task controller notifications about tasklist structure changes. |
protected void |
ctrlTaskPrepared()
Handles task controller notifications about the currently active task: it has finished its preparation and is ready to execute. |
protected void |
ctrlTaskSwitched()
Handles task controller notifications about an active task change. |
protected void |
enableUI(boolean enable)
[un]block all input events and show a wait/normal cursor. |
BannerPanel |
getBanner()
Get the banner panel currently in use. |
ButtonPanel |
getButtons()
Get the navigation button pannel currently in use. |
AbstractAction |
getCloseAction()
Get the action, which should be used to programatically shutdown the wizard, by calling its actionPerformed(null) method. |
JPanel |
getContentPane()
Get the panel, which contains all wizard elements. |
HashMap<Task,HashMap<? extends Object,? extends Object>> |
getSettings()
Get a reference to all the settings gathered in the wizard pages so far. |
Sidebar |
getSidebar()
Get the sidebar currently in use. |
void |
setBanner(BannerPanel banner)
Set the banner panel to be used. |
void |
setButtons(ButtonPanel buttons)
Set the navigation button panel to be used. |
void |
setSidebar(Sidebar sidebar)
Set the sidebar to be used. |
void |
stateChanged(TaskControlEvent e)
Invoked when the state of the task controller has been changed. |
protected void |
updateBanner(Task t)
update banner image, title and description. |
protected void |
updateSidebar(Task t)
update sidebar background image . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JComponent wizardPage
Constructor Detail |
---|
public Wizard(TaskControl control, boolean sidebar, boolean help) throws Exception
UI components are automatically and immediately created within the EDT.
control
- the task controller to use.sidebar
- if true
, enable the sidebar.help
- if true
show the help button as well (otherwise
it is hidden).
Exception
public Wizard(Task main, boolean sidebar, boolean help) throws Exception
UI components are automatically and immediately created within the EDT.
main
- the top level task of all tasks to executesidebar
- if true
, enable the sidebar.help
- if true
show the help button as well (otherwise
it is hidden).
Exception
protected Wizard(Task main, TaskControl control, boolean sidebar, boolean help) throws Exception
UI components are automatically and immediately created within the EDT.
main
- the top level task of all tasks to execute. Use null
,
if control is not null
.control
- the task controller to use. Use null
to use
the default implementation.sidebar
- if true
, enable the sidebar.help
- if true
show the help button as well (otherwise
it is hidden).
Exception
Method Detail |
---|
public static JDialog createDialog(Task main, boolean sidebar, boolean help, JFrame owner) throws Exception
main
- the main task.help
- if true
, show the help button as well.sidebar
- if true
, enable the sidebar.owner
- where to anchor the new dialog.
Exception
- if the given task is null
public static JDialog createDialog(TaskControl control, boolean sidebar, boolean help, JFrame owner) throws Exception
control
- the task controller to use.help
- if true
, show the help button as well.sidebar
- if true
, enable the sidebar.owner
- where to anchor the new dialog.
Exception
- if the given control is null
public void attachTo(JDialog dlg)
WindowConstants.DISPOSE_ON_CLOSE
.
dlg
- where to attach the main wizard panel
IllegalArgumentException
- if the given dialog is null
public JPanel getContentPane()
public Sidebar getSidebar()
null
if none is used.public void setSidebar(Sidebar sidebar)
SwingUtilities2.invokeLater(Runnable)
), so calling outside the EDT
is ok.
sidebar
- sidebar to set. If null
, it removes the current
sidebar in from the main panel.public BannerPanel getBanner()
null
.public void setBanner(BannerPanel banner)
SwingUtilities2.invokeLater(Runnable)
), so calling outside the EDT
is ok.
banner
- banner panel to set.
IllegalArgumentException
- if the argument is null
.public ButtonPanel getButtons()
null
.public void setButtons(ButtonPanel buttons)
SwingUtilities2.invokeLater(Runnable)
), so calling outside
the EDT is ok.
buttons
- ther navigation button panel to set.
IllegalArgumentException
- if the argument is null
.public Boolean cancelled()
null
if the final result was not yet determined (wizard
is still running), Boolean.TRUE
if the wizard was not finished
using the finish button.public HashMap<Task,HashMap<? extends Object,? extends Object>> getSettings()
null
.protected void close()
public AbstractAction getCloseAction()
actionPerformed(null)
method.
null
if the wizard is not yet attached to a dialog, the
close action otherwise.protected void enableUI(boolean enable)
enable
- if true
block, otherwise unblock.protected void ctrlBusy()
protected void ctrlNavMode(EnumSet<NavMode> modes)
modes
- buttons to enable.protected void ctrlTaskFinshed(NavMode next)
next
- the intention, what to do next.protected void updateSidebar(Task t)
t
- the current task in actionprotected void updateBanner(Task t)
t
- the current task in actionprotected void ctrlTaskSwitched()
protected void ctrlTaskPrepared()
protected void ctrlLocale()
protected void ctrlTasklist()
public void stateChanged(TaskControlEvent e)
stateChanged
in interface TaskControlListener
e
- the triggering event.public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
TaskControl.setNavMode(Task, java.util.EnumSet)
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |