org.geotools.swing.action
Class SafeAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.geotools.swing.action.SafeAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public abstract class SafeAction
extends javax.swing.AbstractAction

A safe version of AbstractAction that will log any problems encountered.

This is not generally a good practice - we are just using it as an excuse to not mess up code examples with exception handling code (gasp!).

TODO: provide a background Runnable...

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
SafeAction(java.lang.String name)
          Constructor
 
Method Summary
abstract  void action(java.awt.event.ActionEvent e)
          Sub-classes (usually anonymous) must override this method instead of the usual ActionListener.actionPerformed(java.awt.event.ActionEvent)
 void actionPerformed(java.awt.event.ActionEvent e)
          Calls the action(java.awt.event.ActionEvent) method
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafeAction

public SafeAction(java.lang.String name)
Constructor

Parameters:
name - name for the associated control
Method Detail

action

public abstract void action(java.awt.event.ActionEvent e)
                     throws java.lang.Throwable
Sub-classes (usually anonymous) must override this method instead of the usual ActionListener.actionPerformed(java.awt.event.ActionEvent)

Parameters:
e - the action event
Throws:
java.lang.Throwable - on error

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Calls the action(java.awt.event.ActionEvent) method

Parameters:
e - the action event


Copyright © 1996-2010 Geotools. All Rights Reserved.