Package adams.gui.wizard
Class AbstractWizardPane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.wizard.AbstractWizardPane
-
- All Implemented Interfaces:
LoggingSupporter
,ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
WizardPane
,WizardPaneWithBranches
public abstract class AbstractWizardPane extends BasePanel implements LoggingSupporter
Ancestor for wizard panes.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTION_CANCEL
the action for cancelling the wizard.static String
ACTION_FINISH
the action for finishing the wizard.protected HashSet<ActionListener>
m_ActionListeners
the action listeners (ie hitting cancel/finish).protected BaseButton
m_ButtonBack
the button for the previous page.protected BaseButton
m_ButtonCancelFinish
the button for the cancelling/finishing.protected BaseButton
m_ButtonLoad
the load props button.protected BaseButton
m_ButtonNext
the button for the next page.protected BaseButton
m_ButtonSave
the save props button.protected String
m_CustomFinishText
the custom text for the "finish" button.protected BaseFileChooser
m_FileChooser
the filechooser for loading/saving properties.protected String
m_ID
the ID of the wizard.protected Logger
m_Logger
the logger to use.protected Map<String,AbstractWizardPage>
m_PageLookup
the pages lookup.protected JPanel
m_PanelButtons
the panel for the buttons.protected JPanel
m_PanelButtonsProperties
the panel for the properties buttons.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description AbstractWizardPane()
Initializes the wizard with no ID.AbstractWizardPane(String id)
Initializes the wizard.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addActionListener(ActionListener l)
Adds the specified listener.void
addPage(AbstractWizardPage page)
Adds the page under the given name.protected void
cancelFinish()
Gets called when the cancel/finish button gets clicked.protected void
finishInit()
Finishes the initialization.String
getCustomFinishText()
Returns the custom text to use for the "finish" button, if any.protected BaseFileChooser
getFileChooser()
Returns the file chooser to use for loading/saving of props files.String
getID()
Returns the ID of the wizard, if any.Logger
getLogger()
Returns the logger in use.Properties
getProperties(boolean usePrefix)
Returns the properties from all the pages.abstract AbstractWizardPage
getSelectedPage()
Returns the currently active page.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.boolean
isLoggingEnabled()
Returns whether logging is enabled.protected void
loadProperties()
Loads properties from a file, prompts the user to select props file.protected abstract void
nextPage()
Goes to the next page.protected void
notifyActionListeners(ActionEvent e)
Notifies all change listeners with the specified event.protected abstract void
previousPage()
Goes to the previous page.void
removeActionListener(ActionListener l)
Removes the specified listener.void
removeAllPages()
Removes all pages.protected void
saveProperties()
Saves properties to a file, prompts the user to select props file.void
setCustomFinishText(String value)
Sets custom text to use for the "finish" button.void
setProperties(Properties props, boolean usePrefix)
Sets the properties of all the pages.void
update()
Updates all the pages.abstract void
updateButtons()
Updates the status of the buttons.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
ACTION_CANCEL
public static final String ACTION_CANCEL
the action for cancelling the wizard.- See Also:
- Constant Field Values
-
ACTION_FINISH
public static final String ACTION_FINISH
the action for finishing the wizard.- See Also:
- Constant Field Values
-
m_Logger
protected Logger m_Logger
the logger to use.
-
m_ID
protected String m_ID
the ID of the wizard.
-
m_PageLookup
protected Map<String,AbstractWizardPage> m_PageLookup
the pages lookup.
-
m_PanelButtons
protected JPanel m_PanelButtons
the panel for the buttons.
-
m_ButtonBack
protected BaseButton m_ButtonBack
the button for the previous page.
-
m_ButtonNext
protected BaseButton m_ButtonNext
the button for the next page.
-
m_ButtonCancelFinish
protected BaseButton m_ButtonCancelFinish
the button for the cancelling/finishing.
-
m_ActionListeners
protected HashSet<ActionListener> m_ActionListeners
the action listeners (ie hitting cancel/finish).
-
m_CustomFinishText
protected String m_CustomFinishText
the custom text for the "finish" button.
-
m_PanelButtonsProperties
protected JPanel m_PanelButtonsProperties
the panel for the properties buttons.
-
m_ButtonLoad
protected BaseButton m_ButtonLoad
the load props button.
-
m_ButtonSave
protected BaseButton m_ButtonSave
the save props button.
-
m_FileChooser
protected BaseFileChooser m_FileChooser
the filechooser for loading/saving properties.
-
-
Constructor Detail
-
AbstractWizardPane
public AbstractWizardPane()
Initializes the wizard with no ID.
-
AbstractWizardPane
public AbstractWizardPane(String id)
Initializes the wizard.- Parameters:
id
- the ID of the wizard, used for logging purposes
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
previousPage
protected abstract void previousPage()
Goes to the previous page.
-
nextPage
protected abstract void nextPage()
Goes to the next page.
-
cancelFinish
protected void cancelFinish()
Gets called when the cancel/finish button gets clicked.
-
getID
public String getID()
Returns the ID of the wizard, if any.- Returns:
- the ID
-
removeAllPages
public void removeAllPages()
Removes all pages.
-
addPage
public void addPage(AbstractWizardPage page)
Adds the page under the given name.- Parameters:
page
- the page
-
getSelectedPage
public abstract AbstractWizardPage getSelectedPage()
Returns the currently active page.- Returns:
- the page, null if not available
-
setProperties
public void setProperties(Properties props, boolean usePrefix)
Sets the properties of all the pages.- Parameters:
props
- the combined propertiesusePrefix
- whether to use the page name as prefix
-
getProperties
public Properties getProperties(boolean usePrefix)
Returns the properties from all the pages.- Parameters:
usePrefix
- whether to use the page name as prefix- Returns:
- the combined properties
-
updateButtons
public abstract void updateButtons()
Updates the status of the buttons.
-
getFileChooser
protected BaseFileChooser getFileChooser()
Returns the file chooser to use for loading/saving of props files.- Returns:
- the file chooser
-
loadProperties
protected void loadProperties()
Loads properties from a file, prompts the user to select props file.
-
saveProperties
protected void saveProperties()
Saves properties to a file, prompts the user to select props file.
-
addActionListener
public void addActionListener(ActionListener l)
Adds the specified listener.- Parameters:
l
- the listener to add
-
removeActionListener
public void removeActionListener(ActionListener l)
Removes the specified listener.- Parameters:
l
- the listener to remove
-
notifyActionListeners
protected void notifyActionListeners(ActionEvent e)
Notifies all change listeners with the specified event.- Parameters:
e
- the event to send
-
setCustomFinishText
public void setCustomFinishText(String value)
Sets custom text to use for the "finish" button.- Parameters:
value
- the text, null or empty string to use default
-
getCustomFinishText
public String getCustomFinishText()
Returns the custom text to use for the "finish" button, if any.- Returns:
- the text, null if not used
-
getLogger
public Logger getLogger()
Returns the logger in use.- Specified by:
getLogger
in interfaceLoggingSupporter
- Returns:
- the logger
-
isLoggingEnabled
public boolean isLoggingEnabled()
Returns whether logging is enabled.- Specified by:
isLoggingEnabled
in interfaceLoggingSupporter
- Returns:
- always true
-
update
public void update()
Updates all the pages.- See Also:
AbstractWizardPage.update()
-
-