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 StringACTION_CANCELthe action for cancelling the wizard.static StringACTION_FINISHthe action for finishing the wizard.protected HashSet<ActionListener>m_ActionListenersthe action listeners (ie hitting cancel/finish).protected BaseButtonm_ButtonBackthe button for the previous page.protected BaseButtonm_ButtonCancelFinishthe button for the cancelling/finishing.protected BaseButtonm_ButtonLoadthe load props button.protected BaseButtonm_ButtonNextthe button for the next page.protected BaseButtonm_ButtonSavethe save props button.protected Stringm_CustomFinishTextthe custom text for the "finish" button.protected BaseFileChooserm_FileChooserthe filechooser for loading/saving properties.protected Stringm_IDthe ID of the wizard.protected Loggerm_Loggerthe logger to use.protected Map<String,AbstractWizardPage>m_PageLookupthe pages lookup.protected JPanelm_PanelButtonsthe panel for the buttons.protected JPanelm_PanelButtonsPropertiesthe 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 voidaddActionListener(ActionListener l)Adds the specified listener.voidaddPage(AbstractWizardPage page)Adds the page under the given name.protected voidcancelFinish()Gets called when the cancel/finish button gets clicked.protected voidfinishInit()Finishes the initialization.StringgetCustomFinishText()Returns the custom text to use for the "finish" button, if any.protected BaseFileChoosergetFileChooser()Returns the file chooser to use for loading/saving of props files.StringgetID()Returns the ID of the wizard, if any.LoggergetLogger()Returns the logger in use.PropertiesgetProperties(boolean usePrefix)Returns the properties from all the pages.abstract AbstractWizardPagegetSelectedPage()Returns the currently active page.protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.booleanisLoggingEnabled()Returns whether logging is enabled.protected voidloadProperties()Loads properties from a file, prompts the user to select props file.protected abstract voidnextPage()Goes to the next page.protected voidnotifyActionListeners(ActionEvent e)Notifies all change listeners with the specified event.protected abstract voidpreviousPage()Goes to the previous page.voidremoveActionListener(ActionListener l)Removes the specified listener.voidremoveAllPages()Removes all pages.protected voidsaveProperties()Saves properties to a file, prompts the user to select props file.voidsetCustomFinishText(String value)Sets custom text to use for the "finish" button.voidsetProperties(Properties props, boolean usePrefix)Sets the properties of all the pages.voidupdate()Updates all the pages.abstract voidupdateButtons()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:
initializein classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInitin 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:
getLoggerin interfaceLoggingSupporter- Returns:
- the logger
-
isLoggingEnabled
public boolean isLoggingEnabled()
Returns whether logging is enabled.- Specified by:
isLoggingEnabledin interfaceLoggingSupporter- Returns:
- always true
-
update
public void update()
Updates all the pages.- See Also:
AbstractWizardPage.update()
-
-