A dialog that presents the user with a sequence of steps for completing a task. The dialog
contains "Next" and "Previous" buttons, allowing the user to navigate through the task.
When the user backs up by one or more steps, the dialog keeps the completed steps so that
they can be reused if the user doesn't change anything - this handles the cases where the user
backs up a few steps just to review what has been completed.
But if the user changes some options in an earlier step, then the dialog may have to discard
the later steps and have them repeated.
THIS CLASS IS NOT WORKING CORRECTLY YET.
| Methods from java.awt.Component: |
|---|
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
| Method from org.jfree.ui.WizardDialog Detail: |
public void actionPerformed(ActionEvent event) {
final String command = event.getActionCommand();
if (command.equals("nextButton")) {
next();
}
else if (command.equals("previousButton")) {
previous();
}
else if (command.equals("finishButton")) {
finish();
}
}
|
public boolean canDoNextPanel() {
return this.currentPanel.hasNextPanel();
}
Returns true if there is a 'next' panel, and false otherwise. |
public boolean canDoPreviousPanel() {
return (this.step > 0);
}
Returns true if it is possible to back up to the previous panel, and false otherwise. |
public boolean canFinish() {
return this.currentPanel.canFinish();
}
Returns true if it is possible to finish the sequence at this point (possibly with defaults
for the remaining entries). |
public JPanel createContent() {
final JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
content.add((JPanel) this.panels.get(0));
final L1R3ButtonPanel buttons = new L1R3ButtonPanel("Help", "Previous", "Next", "Finish");
this.helpButton = buttons.getLeftButton();
this.helpButton.setEnabled(false);
this.previousButton = buttons.getRightButton1();
this.previousButton.setActionCommand("previousButton");
this.previousButton.addActionListener(this);
this.previousButton.setEnabled(false);
this.nextButton = buttons.getRightButton2();
this.nextButton.setActionCommand("nextButton");
this.nextButton.addActionListener(this);
this.nextButton.setEnabled(true);
this.finishButton = buttons.getRightButton3();
this.finishButton.setActionCommand("finishButton");
this.finishButton.addActionListener(this);
this.finishButton.setEnabled(false);
buttons.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
content.add(buttons, BorderLayout.SOUTH);
return content;
}
Creates a panel containing the user interface for the dialog. |
public void finish() {
this.result = this.currentPanel.getResult();
setVisible(false);
}
|
public Object getResult() {
return this.result;
}
Returns the result of the wizard sequence. |
public int getStepCount() {
return 0;
}
Returns the total number of steps in the wizard sequence, if this number is known. Otherwise
this method returns zero. Subclasses should override this method unless the number of steps
is not known. |
public WizardPanel getWizardPanel(int step) {
if (step < this.panels.size()) {
return (WizardPanel) this.panels.get(step);
}
else {
return null;
}
}
Returns the panel for the specified step (steps are numbered from zero). |
public boolean isCancelled() {
return false;
}
Checks, whether the user cancelled the dialog. |
public void next() {
WizardPanel nextPanel = getWizardPanel(this.step + 1);
if (nextPanel != null) {
if (!this.currentPanel.canRedisplayNextPanel()) {
nextPanel = this.currentPanel.getNextPanel();
}
}
else {
nextPanel = this.currentPanel.getNextPanel();
}
this.step = this.step + 1;
if (this.step < this.panels.size()) {
this.panels.set(this.step, nextPanel);
}
else {
this.panels.add(nextPanel);
}
final Container content = getContentPane();
content.remove(this.currentPanel);
content.add(nextPanel);
this.currentPanel = nextPanel;
setTitle("Step " + (this.step + 1));
enableButtons();
pack();
}
Displays the next step in the wizard sequence. |
public void previous() {
if (this.step > 0) {
final WizardPanel previousPanel = getWizardPanel(this.step - 1);
// tell the panel that we are returning
previousPanel.returnFromLaterStep();
final Container content = getContentPane();
content.remove(this.currentPanel);
content.add(previousPanel);
this.step = this.step - 1;
this.currentPanel = previousPanel;
setTitle("Step " + (this.step + 1));
enableButtons();
pack();
}
}
Handles a click on the "previous" button, by displaying the previous panel in the sequence. |