kawigi.cmd
Class SettingAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by kawigi.cmd.DefaultAction
          extended by kawigi.cmd.SettingAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
BooleanSettingAction, ColorSettingAction, FontSettingAction, NumberSettingAction, TextSettingAction

public class SettingAction
extends DefaultAction

Action implementation for setting actions. This class really serves two purposes. The first is to implement actions that are related to settings but aren't settings themselves (for instance, launching the config dialog and the OK and Cancel buttons on the config dialog). The other purpose is that it's the base class of all setting actions. As part of this, there are a set of static variables and methods that are shared by all setting instances. The intended behavior is that if the settings dialog is up, all settings are set on a temporary prefs object, and committed when the "OK" button is pushed. Otherwise, the setting is applied immediately. Therefore, if buttons bound to setting actions are put on the main UI somewhere, they will be effective immediately on being used, but settings done on the dialog are cancellable.

See Also:
Serialized Form

Field Summary
protected static javax.swing.JDialog dialog
          Reference to the config dialog.
protected static PrefProxy tempPrefs
          Temporary storage for settings until the settings dialog is committed.
 
Fields inherited from class kawigi.cmd.DefaultAction
cmdid, COLOR, enableSet, FONT, LARGE_ICON, SELECTED, SPINNER_MODEL, SPINNER_VALUE, TEXT, visible, VISIBLE, visibleSet
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
SettingAction(ActID cmdid)
          Constructs a new SettingAction for the given ActID.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Executes the non-setting setting commands.
protected static boolean delayNotify()
          Returns true if settings shouldn't be committed yet.
 void doUpdates()
          Does all the commital actions that need to happen assuming all settings were changed at once.
protected static PrefProxy getCurrentPrefs()
          Returns the temporary prefs if there is one, otherwise the real KawigiEdit prefs.
 boolean isEnabled()
          Returns true if this action is available.
 
Methods inherited from class kawigi.cmd.DefaultAction
equals, getID, isNeedTrackEnabled, isVisible, reportError, setVisible, UIRefresh
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tempPrefs

protected static PrefProxy tempPrefs
Temporary storage for settings until the settings dialog is committed.


dialog

protected static javax.swing.JDialog dialog
Reference to the config dialog.

Constructor Detail

SettingAction

public SettingAction(ActID cmdid)
Constructs a new SettingAction for the given ActID.

Method Detail

getCurrentPrefs

protected static PrefProxy getCurrentPrefs()
Returns the temporary prefs if there is one, otherwise the real KawigiEdit prefs.


delayNotify

protected static boolean delayNotify()
Returns true if settings shouldn't be committed yet. Even though things set to the temporary prefs won't be committed par se, in order to immediately be effective, some settings need to notify other objects (for instance, syntax highlighting settings require a repopulation of some structures in the View classes), but they should only do that if delayNotify() returns false.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Executes the non-setting setting commands.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Specified by:
actionPerformed in class DefaultAction

isEnabled

public boolean isEnabled()
Returns true if this action is available.

Specified by:
isEnabled in interface javax.swing.Action
Overrides:
isEnabled in class javax.swing.AbstractAction

doUpdates

public void doUpdates()
Does all the commital actions that need to happen assuming all settings were changed at once.