Package io.github.jonestimd.swing.action
Class DialogAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- io.github.jonestimd.swing.action.LocalizedAction
-
- io.github.jonestimd.swing.action.DialogAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public abstract class DialogAction extends LocalizedAction
Abstract action for displaying a dialog. The abstract methods are executed as follows:loadDialogData()
- run on a background thread with the parent window disableddisplayDialog(JComponent)
- run on the Swing event dispatch threadsaveDialogData()
- run on a background thread with the parent window disabledsetSaveResultOnUI()
- run on the Swing event dispatch thread
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.github.jonestimd.swing.action.LocalizedAction
LocalizedAction.Factory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DialogAction(java.util.ResourceBundle bundle, java.lang.String resourcePrefix)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
protected abstract boolean
displayDialog(javax.swing.JComponent owner)
Called from the Swing event thread.protected boolean
handleLoadException(java.lang.Throwable th)
protected boolean
handleSaveException(java.lang.Throwable th)
protected abstract void
loadDialogData()
Load data to populate the dialog (called from a background thread).protected abstract void
saveDialogData()
Save changes (called from a background thread).protected abstract void
setSaveResultOnUI()
Update the UI (called from the Swing event thread).-
Methods inherited from class io.github.jonestimd.swing.action.LocalizedAction
create
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Method Detail
-
actionPerformed
public final void actionPerformed(java.awt.event.ActionEvent event)
-
handleLoadException
protected boolean handleLoadException(java.lang.Throwable th)
-
handleSaveException
protected boolean handleSaveException(java.lang.Throwable th)
-
loadDialogData
protected abstract void loadDialogData()
Load data to populate the dialog (called from a background thread).
-
displayDialog
protected abstract boolean displayDialog(javax.swing.JComponent owner)
Called from the Swing event thread.- Parameters:
owner
- the component that invoked the action- Returns:
- true to save changes (i.e. call
saveDialogData()
andsetSaveResultOnUI()
)
-
saveDialogData
protected abstract void saveDialogData()
Save changes (called from a background thread).
-
setSaveResultOnUI
protected abstract void setSaveResultOnUI()
Update the UI (called from the Swing event thread).
-
-