uic.model
Class UICAction

java.lang.Object
  extended byuic.model.UICSimpleAction
      extended byuic.model.UICAction
All Implemented Interfaces:
ActionListener, EventListener
Direct Known Subclasses:
UICToggleAction

public class UICAction
extends UICSimpleAction
implements ActionListener

This action class contains all the information to provide high quality widgets and an action. The idea behind an action is that one object wraps a certain functionality and provdes various ways to access that functionality. A good example is a print action.

Creating an action and using it with the ActionFactory creates widgets like buttons or menu entries. When your users click the button or select the menu item the action will be informed and a method of your choosing will be invoked. Notice that the default version uses the QueuedPolicy.

Since:
1.2
See Also:
ActionFactory, UICToggleAction

Nested Class Summary
 class UICAction.StatusBarUpdater
          Helper class.
 
Nested classes inherited from class uic.model.UICSimpleAction
UICSimpleAction.DirectPolicy, UICSimpleAction.ExecutePolicy, UICSimpleAction.OnlyLastPolicy, UICSimpleAction.QueuedPolicy, UICSimpleAction.SimpleQueuedPolicy
 
Field Summary
 
Fields inherited from class uic.model.UICSimpleAction
currentPolicy, target, targetObject
 
Constructor Summary
UICAction(String name)
          Base constructor.
UICAction(String name, Object targetObject, String targetMethod, String title)
           
UICAction(String name, Object targetObject, String targetMethod, String title, ActionFactory actions)
           
UICAction(String name, Object targetObject, String targetMethod, String title, String iconBaseName)
           
UICAction(String name, Object targetObject, String targetMethod, String title, String iconBaseName, ActionFactory actions)
           
UICAction(String name, Object targetObject, String targetMethod, String title, String iconBaseName, String keyStroke)
           
UICAction(String name, Object targetObject, String targetMethod, String title, String iconBaseName, String keyStroke, ActionFactory actions)
           
UICAction(String name, Object targetObject, String targetMethod, String title, String iconBaseName, String keyStroke, String toolTipText, String whatIsThis)
           
UICAction(String name, Object targetObject, String targetMethod, String title, String iconBaseName, String keyStroke, String toolTipText, String whatIsThis, ActionFactory actions)
          Create new action.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addComponent(AbstractButton c)
          A button component that represents this action the the users user interface can be registered here.
 Iterator getComponentsIterator()
           
 String getIconBaseName()
          The name of the icon that will be used on buttons.
 KeyStroke getKeyStroke()
           
 String getName()
          Return the name key.
 String getTitle()
          return the title of this action, this is mostly the name on screen.
 String getToolTipText()
           
 String getWhatIsThis()
          The text used in the popup for whatIs help.
 void setEnabled(boolean enabled)
          Enable disable this action and all its registered components.
 void setIconBaseName(String iconBaseName)
          The name of the icon that will be used on buttons.
 void setKeyStroke(KeyStroke keyStroke)
           
 void setName(String name)
          Set the unique key that is the name of this action.
 void setStatuBar(StatusBar statusBar)
          Register a statusbar that will be used to show whatIs texts on on mouseOver of the menuitems.
 void setTitle(String title)
          Set the title of this action, this is mostly the name on screen.
 void setToolTipText(String toolTipText)
           
 void setWhatIsThis(String whatIsThis)
          The text used in the popup for whatIs help.
 String toString()
          returns the title.
 
Methods inherited from class uic.model.UICSimpleAction
doAction, execute, execute, setDirect, setExecutionPolity, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UICAction

public UICAction(String name)
Base constructor.


UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 ActionFactory actions)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 String iconBaseName,
                 ActionFactory actions)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 String iconBaseName,
                 String keyStroke,
                 ActionFactory actions)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 String iconBaseName)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 String iconBaseName,
                 String keyStroke)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 String iconBaseName,
                 String keyStroke,
                 String toolTipText,
                 String whatIsThis)

UICAction

public UICAction(String name,
                 Object targetObject,
                 String targetMethod,
                 String title,
                 String iconBaseName,
                 String keyStroke,
                 String toolTipText,
                 String whatIsThis,
                 ActionFactory actions)
Create new action.

Parameters:
name - The identifying name of the action, must be unique.
targetObject - The object that contains the method we want to connect to.
targetMethod - the name of the method we want to connect to.
title - the name used on buttons or in a menu entry.
iconBaseName - the basename the new widgets can use to fetch the correct icon, or null if none
keyStroke - the keyStroke in the format accepted by javax.swing.KeyStroke.getKeyStroke(String)
toolTipText - the text for tooltips, or null for none
whatIsThis - the text for the statusBar.
actions - the actionFactory this action belongs to.
See Also:
KeyStroke.getKeyStroke(String)
Method Detail

addComponent

public void addComponent(AbstractButton c)
A button component that represents this action the the users user interface can be registered here. Any button that is added to this action will trigger the action to respond on a button 'press' after adding it using the addComponent method. Additionaly en/disabling the action will make the component also en/disable.


getName

public String getName()
Return the name key.


setName

public void setName(String name)
Set the unique key that is the name of this action.


setEnabled

public void setEnabled(boolean enabled)
Enable disable this action and all its registered components. Incoming events will not cause the action to be commited when the action is disabled.

Overrides:
setEnabled in class UICSimpleAction
Parameters:
enabled - the new state of the action.

getTitle

public String getTitle()
return the title of this action, this is mostly the name on screen.


setTitle

public void setTitle(String title)
Set the title of this action, this is mostly the name on screen. Notice that it is wise to first run the title through the Translator before setting the title.

Setting the title on an action will not change created buttons/menu items.


getIconBaseName

public String getIconBaseName()
The name of the icon that will be used on buttons. This name will be searched for in the icon collections, adding resolution information will be done based on context.


setIconBaseName

public void setIconBaseName(String iconBaseName)
The name of the icon that will be used on buttons. This name will be searched for in the icon collections, adding resolution information will be done based on context.


getToolTipText

public String getToolTipText()

setToolTipText

public void setToolTipText(String toolTipText)

getWhatIsThis

public String getWhatIsThis()
The text used in the popup for whatIs help. This is functionality that at the moment is only available when using a MainWindow.

See Also:
MainWindow

setWhatIsThis

public void setWhatIsThis(String whatIsThis)
The text used in the popup for whatIs help. This is functionality that at the moment is only available when using a MainWindow.

See Also:
MainWindow

getComponentsIterator

public Iterator getComponentsIterator()
Returns:
an iterator over all added components.

getKeyStroke

public KeyStroke getKeyStroke()

setKeyStroke

public void setKeyStroke(KeyStroke keyStroke)

setStatuBar

public void setStatuBar(StatusBar statusBar)
Register a statusbar that will be used to show whatIs texts on on mouseOver of the menuitems.


actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

toString

public String toString()
returns the title.



Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence