ilog.views.diagrammer.application
Class IlvDiagrammerAction.ToggleAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by ilog.views.util.swing.context.ComponentAction
          extended by ilog.views.diagrammer.application.IlvDiagrammerAction
              extended by ilog.views.diagrammer.application.IlvDiagrammerAction.ToggleAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Enclosing class:
IlvDiagrammerAction

public abstract static class IlvDiagrammerAction.ToggleAction
extends IlvDiagrammerAction

This subclass of IlvDiagrammerAction can be used as a base class for custom selectable (or "toggle") actions. It provides an implementation of the perform(java.awt.event.ActionEvent, ilog.views.diagrammer.IlvDiagrammer) method that toggles the "selected" state of the action and calls the abstract isSelected(ilog.views.diagrammer.IlvDiagrammer) and setSelected(ilog.views.diagrammer.IlvDiagrammer,boolean) methods.

To write your own toggle action, you just need to implement the isSelected(ilog.views.diagrammer.IlvDiagrammer) and setSelected(ilog.views.diagrammer.IlvDiagrammer,boolean) methods.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ilog.views.diagrammer.application.IlvDiagrammerAction
IlvDiagrammerAction.ErrorHandler, IlvDiagrammerAction.FileAction, IlvDiagrammerAction.Handler, IlvDiagrammerAction.StatusEvent, IlvDiagrammerAction.StatusListener, IlvDiagrammerAction.ToggleAction
 
Field Summary
 
Fields inherited from class ilog.views.diagrammer.application.IlvDiagrammerAction
_new, about, ABOUT_APPLICATION_NAME, alignBottom, alignHorizontalCenter, alignLeft, alignRight, alignTop, alignVerticalCenter, autoEditLabel, autoLabelLayout, autoLinkLayout, autoNodeLayout, callBuilder, clearPrintArea, close, copy, createLink, createNode, cut, delete, distributeHorizontally, distributeVertically, duplicate, editing, editLabel, exit, fitToContents, grid, gridSpacing, group, help, layoutAllNodes, layoutSelectedNodes, open, openStyleSheet, pageSetup, pan, paste, printPreview, printToBitmap, printWithDialog, printWithoutDialog, read, redo, refresh, resetZoom, resizing, save, saveAs, select, selectAll, setPrintArea, stickyModes, undo, ungroup, zoom, zoomIn, zoomOut
 
Fields inherited from class ilog.views.util.swing.context.ComponentAction
hideToolbarButtonBordersOnOceanTheme
 
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
IlvDiagrammerAction.ToggleAction(String prefix)
          Creates a new toggle action.
IlvDiagrammerAction.ToggleAction(String prefix, ResourceBundle bundle)
          Creates a new toggle action.
 
Method Summary
 boolean isSelectable()
          Returns true.
protected abstract  boolean isSelected(IlvDiagrammer diagrammer)
          This method is called to determine if this action is currently selected.
 void perform(ActionEvent e, IlvDiagrammer diagrammer)
          Toggles the "selected" state of the action and calls the abstract isSelected(ilog.views.diagrammer.IlvDiagrammer) and setSelected(ilog.views.diagrammer.IlvDiagrammer,boolean) methods.
protected abstract  void setSelected(IlvDiagrammer diagrammer, boolean selected)
          This method is called when the selected state of the action changes.
 
Methods inherited from class ilog.views.diagrammer.application.IlvDiagrammerAction
addActionToUpdate, addStatusListener, call, chooseFile, getActionFileChooser, getDefaultResourceBundle, getDefaultSelectedFile, getErrorHandler, getFileChooserDirectory, getString, isEnabled, isEnabled, isSelected, perform, removeActionToUpdate, removeStatusListener, setDefaultSelectedFile, setErrorHandler, setFileChooserDirectory, setHandler, update, update, updateActions
 
Methods inherited from class ilog.views.util.swing.context.ComponentAction
actionPerformed, addActionToUpdate, addPropertyChangeListener, addStatusListener, call, clone, createMenuItem, createToolBarButton, delayedUpdateActions, error, fireActionFinished, fireActionStarted, getActionErrorHandler, getPrefix, getResourceBundle, getSmallIconSize, init, isSelected, removeActions, removeActionToUpdate, removeStatusListener, setActionErrorHandler, setHandler, setSelected, setSmallIconSize, updateActions
 
Methods inherited from class javax.swing.AbstractAction
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

IlvDiagrammerAction.ToggleAction

public IlvDiagrammerAction.ToggleAction(String prefix)
Creates a new toggle action.

Parameters:
prefix - The localization prefix key.

IlvDiagrammerAction.ToggleAction

public IlvDiagrammerAction.ToggleAction(String prefix,
                                        ResourceBundle bundle)
Creates a new toggle action.

Parameters:
prefix - The localization prefix key.
bundle - The resource bundle from which to get the properties of the action.
Method Detail

isSelectable

public boolean isSelectable()
Returns true.

Overrides:
isSelectable in class ilog.views.util.swing.context.ComponentAction

perform

public void perform(ActionEvent e,
                    IlvDiagrammer diagrammer)
             throws Exception
Toggles the "selected" state of the action and calls the abstract isSelected(ilog.views.diagrammer.IlvDiagrammer) and setSelected(ilog.views.diagrammer.IlvDiagrammer,boolean) methods.

Specified by:
perform in class IlvDiagrammerAction
Parameters:
e - The action event that caused this action to be performed.
diagrammer - The IlvDiagrammer on which the action is to be performed (may be null if there is no current diagram component).
Throws:
Exception - When an error occurs while performing the action.

isSelected

protected abstract boolean isSelected(IlvDiagrammer diagrammer)
                               throws Exception
This method is called to determine if this action is currently selected.

Overrides:
isSelected in class IlvDiagrammerAction
Parameters:
diagrammer - The IlvDiagrammer instance on which the action is to be performed (may be null if there is no current diagram component).
Returns:
true if action is selected
Throws:
Exception - When an error occurs while getting the state of the action.

setSelected

protected abstract void setSelected(IlvDiagrammer diagrammer,
                                    boolean selected)
                             throws Exception
This method is called when the selected state of the action changes.

Parameters:
diagrammer - The IlvDiagrammer isntance on which the action is performed (may be null if there is no current diagram component).
selected - The new selected state.
Throws:
Exception - When an error occurs while getting the state of the action.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.