dsto.dfc.swt.commands
Class BasicToggleCommand

java.lang.Object
  extended by dsto.dfc.util.BasicPropertyEventSource
      extended by dsto.dfc.swt.commands.AbstractCommand
          extended by dsto.dfc.swt.commands.BasicToggleCommand
All Implemented Interfaces:
Command, CustomMenuCommand, CustomToolbarCommand, Copyable, JavaBean, PropertyEventSource, Serializable, Cloneable
Direct Known Subclasses:
CmdSetBeanProperty, CmdToggleWindowStyle

public class BasicToggleCommand
extends AbstractCommand
implements CustomMenuCommand, CustomToolbarCommand

Base class for commands that can be "on" or "off". Provides custom checkbox menu and toolbar items.

Version:
$Revision: 1.5 $
See Also:
Serialized Form

Field Summary
protected  boolean value
           
 
Fields inherited from class dsto.dfc.swt.commands.AbstractCommand
NO_ICON
 
Constructor Summary
BasicToggleCommand(String name, Icon icon, String group, String description, boolean interactive, char mnemonic, int accelerator)
           
BasicToggleCommand(String name, String iconName, String group, String description, boolean interactive, char mnemonic, int accelerator)
           
 
Method Summary
 CommandMenuItemProvider createMenuProvider(CommandView commandView, org.eclipse.swt.widgets.Menu menu, int index)
          Create a menu UI provider for the command.
 CommandToolbarItemProvider createToolbarProvider(CommandView commandView, org.eclipse.swt.widgets.ToolBar toolbar, int index)
          Create a toolbarUI provider for the command.
protected  void doSetValue(boolean newValue)
          Actually sets the value and fires an event.
 void execute()
          Execute the command.
 boolean getValue()
           
 void setValue(boolean newValue)
           
 
Methods inherited from class dsto.dfc.swt.commands.AbstractCommand
addCommandListener, clone, createDefaultDisplayName, fireCommandExecuted, fireCommandExecuted, getAccelerator, getContextMenuGroup, getDescription, getDisplayName, getGroupInView, getIcon, getLogString, getMainMenuGroup, getMnemonic, getName, getToolbarGroup, isEnabled, isInteractive, removeCommandListener, setAccelerator, setContextMenuGroup, setDescription, setDisplayName, setEnabled, setIcon, setInteractive, setMainMenuGroup, setMnemonic, setName, setToolbarGroup
 
Methods inherited from class dsto.dfc.util.BasicPropertyEventSource
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener, setPropertyChangeSource
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dsto.dfc.swt.commands.Command
addCommandListener, getAccelerator, getDescription, getDisplayName, getGroupInView, getIcon, getLogString, getMnemonic, getName, isEnabled, isInteractive, removeCommandListener, setAccelerator, setContextMenuGroup, setDescription, setDisplayName, setEnabled, setIcon, setMainMenuGroup, setMnemonic, setToolbarGroup
 
Methods inherited from interface dsto.dfc.util.PropertyEventSource
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

value

protected boolean value
Constructor Detail

BasicToggleCommand

public BasicToggleCommand(String name,
                          String iconName,
                          String group,
                          String description,
                          boolean interactive,
                          char mnemonic,
                          int accelerator)

BasicToggleCommand

public BasicToggleCommand(String name,
                          Icon icon,
                          String group,
                          String description,
                          boolean interactive,
                          char mnemonic,
                          int accelerator)
Method Detail

execute

public void execute()
Description copied from interface: Command
Execute the command. Commands should fire CommandListener.commandExecuted(CommandEvent) when executed.

Specified by:
execute in interface Command
Specified by:
execute in class AbstractCommand

getValue

public boolean getValue()

setValue

public void setValue(boolean newValue)

doSetValue

protected void doSetValue(boolean newValue)
Actually sets the value and fires an event. Subclasses may call this to update the checked state without executing the check change logic implied in setValue ().


createMenuProvider

public CommandMenuItemProvider createMenuProvider(CommandView commandView,
                                                  org.eclipse.swt.widgets.Menu menu,
                                                  int index)
Description copied from interface: CustomMenuCommand
Create a menu UI provider for the command.

Specified by:
createMenuProvider in interface CustomMenuCommand
Parameters:
commandView - The command view.
menu - The host menu for the UI.
index - The index for the UI item(s).
Returns:
A CommandMenuItemProvider that provides the UI.

createToolbarProvider

public CommandToolbarItemProvider createToolbarProvider(CommandView commandView,
                                                        org.eclipse.swt.widgets.ToolBar toolbar,
                                                        int index)
Description copied from interface: CustomToolbarCommand
Create a toolbarUI provider for the command.

Specified by:
createToolbarProvider in interface CustomToolbarCommand
Parameters:
commandView - The command view.
toolbar - The host toolbar for the UI.
index - The index for the UI item(s).
Returns:
A CommandMenuItemProvider that provides the UI.


Copyright © 2008 Commonwealth of Australia