Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.delegate
Class DelegatingToggleCommand

    java.lang.Object
      com.pietschy.command.Command
          com.pietschy.command.ActionCommand
              com.pietschy.command.delegate.DelegatingCommand
                  com.pietschy.command.delegate.DelegatingToggleCommand

All Implemented Interfaces:
  ActionCommandExecutor, Bindable, Identifiable

Direct Known Subclasses:
  DelegatingToggleGroupCommand

    public class DelegatingToggleCommand

extends DelegatingCommand

DelegatingToggleCommands provided equivalent functionality to `DelegatingCommand` for `ToggleCommand`s.

Like `DelegatingCommand`, this class provides static convenience methods for creating and binding a number of delegating commands at once. The following example creates and binds a number of DelegatingToggleCommands

        DelegatingToggleCommand.bindAll(container, "toggle-one", "toggle-two", "toggle-three");

Version:
  $Revision: 1.8 $
Author:
  andrewp
See Also:
  `DelegatingCommand`, `DelegatingToggleGroup`, `FocusTrackingDelegateMediator`

Field Summary
`static java.lang.String` | `PROPERTY_SELECTED`

Fields inherited from class com.pietschy.command.ActionCommand
`PARAMETER_ACTION_EVENT, PARAMETER_INVOKER, PARAMETER_INVOKER_WINDOW, PARAMETER_MODIFIERS`

Fields inherited from class com.pietschy.command.Command
`internalLog, PROPERTY_ENABLED, PROPERTY_VISIBLE`

Constructor Summary
`DelegatingToggleCommand(java.lang.String id)` Creates a new instance with the specified id.

Method Summary
`static void` | `bindAll(CommandContainer container, java.lang.String firstId, java.lang.String... otherIds)` Creates delegating commands for each of the specified id's and binds them to the specified container.
`static void` | `bindAll(java.awt.Component component, java.lang.String firstId, java.lang.String... otherIds)` Creates delegating commands for each of the specified id's and binds them to the specified component.
`static void` | `bindAll(java.lang.String firstId, java.lang.String... otherIds)` Creates delegating commands for each of the specified id's and binds them to the global command container.
`protected void` | `configureButtonStates(javax.swing.AbstractButton button)` Overrides the default `Command.configureButtonStates()` to include the configuration of the buttons `selected` state.
`javax.swing.AbstractButton` | `createButton(ButtonFactory factory, java.lang.String faceContext)` Creates a toggle button for this command.
`javax.swing.AbstractButton` | `createCheckBox()` Creates a checkbox for this command using the default button factory and the button face.
`javax.swing.AbstractButton` | `createCheckBox(ButtonFactory factory)` Creates a checkbox for this command using the specifed button factory and the button face.
`javax.swing.AbstractButton` | `createCheckBox(ButtonFactory factory, java.lang.String faceContext)` Creates a checkbox for this command using the specified `ButtonFactory` and `Face`.
`javax.swing.AbstractButton` | `createCheckBox(java.lang.String faceContext)` Creates a checkbox for this command using the default button factory and the specified face.
`javax.swing.JMenuItem` | `createMenuItem(MenuFactory factory, java.lang.String faceContext)` Creates a new `JCheckBoxMenuItem` that is bound to this command.
`ToggleCommand` | `getDelegate()` Gets this command delegate.
`boolean` | `isSelected()` Checks if the delegate is selected.
`void` | `requestDefaultIn(javax.swing.RootPaneContainer container)` Warning this method throws an `UnsupportedOperationException` as toggle commands are implmented using `JToggleButton`s and default buttons must be instances of `JButton`.
`void` | `setDelegate(ActionCommandExecutor newDelegate)` Sets the delegate for this command to use.
`void` | `setSelected(boolean selected)` Sets the selected state of this command.
`protected void` | `setSelectedInternal(boolean selected)`
`protected void` | `updateDelegate()`
`protected void` | `updateState()`

Methods inherited from class com.pietschy.command.delegate.DelegatingCommand
`getDelegateMediator, handleExecute, nullIfEqualsThis, setDelegateMediator`

Methods inherited from class com.pietschy.command.ActionCommand
`addActionCommandListener, addInterceptor, bindToContainer, createButton, createButton, createButton, createButton, createMenuItem, createMenuItem, createMenuItem, createMenuItem, doButtonAttachments, doButtonDetachments, execute, execute, getActionAdapter, getActionAdapter, getActionEvent, getInvoker, getInvokerWindow, getModifiers, getParameter, getParameter, getParameters, installShortCut, installShortCut, postExecute, preExecute, putParameter, putParameters, removeActionCommandListener, removeInterceptor, unbindFromContainer, uninstallShortCut, uninstallShortCut`

Methods inherited from class com.pietschy.command.Command
`addContainerPropertyListener, addFace, addHoverListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, attach, bind, bind, bind, buttonIterator, configureAppearance, configureAppearances, configureButtonAppearances, configureButtonStates, createButton, createButton, createButton, createComponent, createMenuItem, createMenuItem, createMenuItem, detach, faceExists, findBestFace, fireHoverEnded, fireHoverStarted, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlternativeFaceContexts, getButtonFactory, getButtonIn, getCommandContainer, getContainerProperty, getDefaultFace, getDefaultFace, getFace, getFace, getId, getMenuFactory, getProperty, getProperty, getPropertyNames, getToolbarFactory, isAnonymous, isAttachedTo, isBound, isEnabled, isVisible, loadConfiguration, notifyCommandContainerHierarchyChanged, putProperties, putProperty, rebind, removeContainerPropertyListener, removeHoverListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, requestFocusIn, setButtonFactory, setEnabled, setMenuFactory, setToolbarFactory, setVisible, toString, unbind, validateId`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.pietschy.command.ActionCommandExecutor
`addPropertyChangeListener, addPropertyChangeListener, isEnabled, removePropertyChangeListener, removePropertyChangeListener`

Methods inherited from interface com.pietschy.command.Identifiable
`getId`

Field Detail

### PROPERTY_SELECTED

    public static final java.lang.String PROPERTY_SELECTED

See Also:
  Constant Field Values

Constructor Detail

### DelegatingToggleCommand

    public DelegatingToggleCommand(java.lang.String id)

  Creates a new instance with the specified id. This command will bind to any delegate with the same id.

  Parameters:
    `id` - the id of the delegate this command is to track.

Method Detail

### bindAll

    public static void bindAll(CommandContainer container,
                               java.lang.String firstId,
                               java.lang.String... otherIds)

  Creates delegating commands for each of the specified id's and binds them to the specified container.

  Parameters:
    `container` - the container to bind the delegates to.
    `firstId` - the first delegate id in standard var-args editor.
    `otherIds` - any additional ids.

### bindAll

    public static void bindAll(java.awt.Component component,
                               java.lang.String firstId,
                               java.lang.String... otherIds)

  Creates delegating commands for each of the specified id's and binds them to the specified component.

  Parameters:
    `component` - the component to bind the delegates to.
    `firstId` - the first delegate id in standard var-args editor.
    `otherIds` - any additional ids.

### bindAll

    public static void bindAll(java.lang.String firstId,
                               java.lang.String... otherIds)

  Creates delegating commands for each of the specified id's and binds them to the global command container.

  Parameters:
    `firstId` - the first delegate id in standard var-args editor.
    `otherIds` - any additional ids.

### updateDelegate

    protected void updateDelegate()

### setDelegate

    public void setDelegate(ActionCommandExecutor newDelegate)

  Sets the delegate for this command to use. The command will update its state according to the delegate.

  Overrides:
    `setDelegate` in class `DelegatingCommand`

### getDelegate

    public ToggleCommand getDelegate()

  Gets this command delegate.

  Overrides:
    `getDelegate` in class `DelegatingCommand`
  Returns:
    this commands delegate.

### updateState

    protected void updateState()

  Overrides:
    `updateState` in class `DelegatingCommand`

### setSelected

    public void setSelected(boolean selected)

  Sets the selected state of this command.

  Parameters:
    `selected` - `true` to select the command, `false` otherwise.

### setSelectedInternal

    protected void setSelectedInternal(boolean selected)

### isSelected

    public boolean isSelected()

  Checks if the delegate is selected. This method will return `true` if and only if the delegate is non-null and selected.

  Returns:
    `true` if the delegate is non-null and selected, `false` otherwise.

### configureButtonStates

    protected void configureButtonStates(javax.swing.AbstractButton button)

  Overrides the default `Command.configureButtonStates()` to include the configuration of the buttons `selected` state.

  Overrides:
    `configureButtonStates` in class `Command`
  Parameters:
    `button` - the button to initialize.

### createMenuItem

    public javax.swing.JMenuItem createMenuItem(MenuFactory factory,
                                                java.lang.String faceContext)

  Creates a new `JCheckBoxMenuItem` that is bound to this command.

  Overrides:
    `createMenuItem` in class `Command`
  Parameters:
    `factory` - the menu factory to use.
    `faceContext` - the face context to use.
  Returns:
    a new `JCheckBoxMenuItem` for this command.

### createButton

    public javax.swing.AbstractButton createButton(ButtonFactory factory,
                                                   java.lang.String faceContext)

  Creates a toggle button for this command.

  Overrides:
    `createButton` in class `Command`
  Parameters:
    `factory` - the button factory to use.
    `faceContext` - the face context to use.sing the specified `ButtonFactory` and `Face`.
  Returns:
    a new `JToggleButton` for this command.

### createCheckBox

    public javax.swing.AbstractButton createCheckBox()

  Creates a checkbox for this command using the default button factory and the button face.

  Returns:
    a new `JCheckBox` for this command.

### createCheckBox

    public javax.swing.AbstractButton createCheckBox(java.lang.String faceContext)

  Creates a checkbox for this command using the default button factory and the specified face.

  Returns:
    a new `JCheckBox` for this command.

### createCheckBox

    public javax.swing.AbstractButton createCheckBox(ButtonFactory factory)

  Creates a checkbox for this command using the specifed button factory and the button face.

  Returns:
    a new `JCheckBox` for this command.

### createCheckBox

    public javax.swing.AbstractButton createCheckBox(ButtonFactory factory,
                                                     java.lang.String faceContext)

  Creates a checkbox for this command using the specified `ButtonFactory` and `Face`.

  Returns:
    a new `JCheckBox` for this command.

### requestDefaultIn

    public void requestDefaultIn(javax.swing.RootPaneContainer container)

  Warning this method throws an `UnsupportedOperationException` as toggle commands are implmented using `JToggleButton`s and default buttons must be instances of `JButton`.

  Overrides:
    `requestDefaultIn` in class `ActionCommand`
  Parameters:
    `container` - the root pane container to check.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch