Sweet Home 3D 3.4

com.eteks.sweethome3d.swing
Class ControllerAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.eteks.sweethome3d.swing.ResourceAction
          extended by com.eteks.sweethome3d.swing.ControllerAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class ControllerAction
extends ResourceAction

An action which actionPerformed method will call a parametrizable method.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.eteks.sweethome3d.swing.ResourceAction
ResourceAction.ButtonAction, ResourceAction.MenuItemAction, ResourceAction.PopupMenuItemAction, ResourceAction.ToolBarAction
 
Field Summary
 
Fields inherited from class com.eteks.sweethome3d.swing.ResourceAction
POPUP
 
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
ControllerAction(UserPreferences preferences, java.lang.Class<?> resourceClass, java.lang.String actionPrefix, boolean enabled, java.lang.Object controller, java.lang.String method, java.lang.Object... parameters)
          Creates an action with properties retrieved from a resource bundle in which key starts with actionPrefix.
ControllerAction(UserPreferences preferences, java.lang.Class<?> resourceClass, java.lang.String actionPrefix, java.lang.Object controller, java.lang.String method, java.lang.Object... parameters)
          Creates a disabled action with properties retrieved from a resource bundle in which key starts with actionPrefix.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          Calls the method on controller given in constructor.
 
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

ControllerAction

public ControllerAction(UserPreferences preferences,
                        java.lang.Class<?> resourceClass,
                        java.lang.String actionPrefix,
                        java.lang.Object controller,
                        java.lang.String method,
                        java.lang.Object... parameters)
                 throws java.lang.NoSuchMethodException
Creates a disabled action with properties retrieved from a resource bundle in which key starts with actionPrefix.

Parameters:
preferences - user preferences used to retrieve localized description of the action
resourceClass - the class used as a context to retrieve localized properties of the action
actionPrefix - prefix used in resource bundle to search action properties
controller - the controller on which the method will be called
method - the name of the controller method that will be invoked in actionPerfomed
parameters - list of parameters to be used with method
Throws:
java.lang.NoSuchMethodException - if method with a matching parameters list doesn't exist

ControllerAction

public ControllerAction(UserPreferences preferences,
                        java.lang.Class<?> resourceClass,
                        java.lang.String actionPrefix,
                        boolean enabled,
                        java.lang.Object controller,
                        java.lang.String method,
                        java.lang.Object... parameters)
                 throws java.lang.NoSuchMethodException
Creates an action with properties retrieved from a resource bundle in which key starts with actionPrefix.

Parameters:
preferences - user preferences used to retrieve localized description of the action
resourceClass - the class used as a context to retrieve localized properties of the action
actionPrefix - prefix used in resource bundle to search action properties
enabled - true if the action should be enabled at creation.
controller - the controller on which the method will be called
method - the name of the controller method that will be invoked in actionPerfomed
parameters - list of parameters to be used with method
Throws:
java.lang.NoSuchMethodException - if method with a matching parameters list doesn't exist
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Calls the method on controller given in constructor.

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

Sweet Home 3D 3.4

? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License