bibliothek.gui.dock.action.actions
Class ReplaceAction

java.lang.Object
  extended by bibliothek.gui.dock.action.actions.AbstractStandardDockAction
      extended by bibliothek.gui.dock.action.actions.GroupedDockAction<K,D>
          extended by bibliothek.gui.dock.action.actions.GroupedDropDownItemAction<K,SimpleButtonAction>
              extended by bibliothek.gui.dock.action.actions.GroupedButtonDockAction<java.lang.Boolean>
                  extended by bibliothek.gui.dock.action.actions.ReplaceAction
All Implemented Interfaces:
ButtonDockAction, DockAction, DropDownItemAction, ListeningDockAction, StandardDockAction, StandardDropDownItemAction

public class ReplaceAction
extends GroupedButtonDockAction<java.lang.Boolean>
implements ListeningDockAction

A DockAction that can replace a DockStation by it's only child. This action is only enabled, if the associated DockStation has exactly one or zero children. This action can handle only the one station that was provided through the constructor.

Author:
Benjamin Sigg

Nested Class Summary
private  class ReplaceAction.Listener
          A listener changing the icon of this action
 
Field Summary
private  DockController controller
           
private  DockStationListener dockStationListener
          A listener to the stations known to this action
private  ReplaceAction.Listener listener
           
 
Fields inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction
listeners
 
Constructor Summary
ReplaceAction(DockController controller)
          Sets up this action.
 
Method Summary
 void action(Dockable dockable)
          Invoked when this action is triggered by the user.
 void binded(Dockable dockable)
          Invoked by this AbstractStandardDockAction when a Dockable was binded to this action the first time.
protected  java.lang.Boolean createGroupKey(Dockable dockable)
          Calculates the name of the group to which the dockable should be added.
Every Dockable is member of one group.
 void setController(DockController controller)
          Called when a new controller has been set.
 void unbinded(Dockable dockable)
          Called by this AbstractStandardDockAction when the Dockable dockable will not be used in any means by this action.
 
Methods inherited from class bibliothek.gui.dock.action.actions.GroupedButtonDockAction
createGroup, createView
 
Methods inherited from class bibliothek.gui.dock.action.actions.GroupedDropDownItemAction
isDropDownSelectable, isDropDownSelectable, isDropDownTriggerable, isDropDownTriggerable, setDropDownSelectable, setDropDownTriggerableNotSelected, setDropDownTriggerableSelected
 
Methods inherited from class bibliothek.gui.dock.action.actions.GroupedDockAction
ensureGroup, getDisabledIcon, getDisabledIcon, getGenerator, getGroup, getGroup, getIcon, getIcon, getText, getText, getTooltipText, getTooltipText, groupExists, isEnabled, isEnabled, isKnown, isRemoveEmptyGroups, removeGroup, setDisabledIcon, setEnabled, setGenerator, setGroup, setIcon, setRemoveEmptyGroups, setText, setTooltipText
 
Methods inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction
addDockActionListener, bind, fireActionDisabledIconChanged, fireActionEnabledChanged, fireActionIconChanged, fireActionTextChanged, fireActionTooltipTextChanged, getBindeds, isBinded, removeDockActionListener, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.action.DockAction
bind, createView, unbind
 
Methods inherited from interface bibliothek.gui.dock.action.dropdown.DropDownItemAction
isDropDownSelectable, isDropDownTriggerable
 

Field Detail

dockStationListener

private DockStationListener dockStationListener
A listener to the stations known to this action


controller

private DockController controller

listener

private ReplaceAction.Listener listener
Constructor Detail

ReplaceAction

public ReplaceAction(DockController controller)
Sets up this action.

Parameters:
controller - The controller for which this action is used. This action will add some listeners to the controller. To remove those listeners, call setController(DockController) with a null argument.
Method Detail

createGroupKey

protected java.lang.Boolean createGroupKey(Dockable dockable)
Description copied from class: GroupedDockAction
Calculates the name of the group to which the dockable should be added.
Every Dockable is member of one group. The membership determines text, icon, etc. for the dockable. Whenever a dockable is binded to this action, the group will be determined by this method. Later on, the group can be changed by the method setGroup.
The default implementation uses the generator of this action.

Overrides:
createGroupKey in class GroupedDockAction<java.lang.Boolean,SimpleButtonAction>
Parameters:
dockable - The Dockable whose group has to be found
Returns:
the name of the dockable's group. That can be an existing or a non existing group. null is not a valid result.

action

public void action(Dockable dockable)
Description copied from interface: ButtonDockAction
Invoked when this action is triggered by the user.

Specified by:
action in interface ButtonDockAction
Parameters:
dockable - The Dockable which is associated with this DockAction, and which shall be used for the current action.

binded

public void binded(Dockable dockable)
Description copied from class: AbstractStandardDockAction
Invoked by this AbstractStandardDockAction when a Dockable was binded to this action the first time.

Overrides:
binded in class GroupedDockAction<java.lang.Boolean,SimpleButtonAction>
Parameters:
dockable - The Dockable that was not known to this action before the method was invoked

unbinded

public void unbinded(Dockable dockable)
Description copied from class: AbstractStandardDockAction
Called by this AbstractStandardDockAction when the Dockable dockable will not be used in any means by this action. Note that the AbstractStandardDockAction.binded(Dockable)-method can be invoked again with the dockable.

Overrides:
unbinded in class GroupedDockAction<java.lang.Boolean,SimpleButtonAction>
Parameters:
dockable - The Dockable which will not by used in any way.

setController

public void setController(DockController controller)
Description copied from interface: ListeningDockAction
Called when a new controller has been set.

Specified by:
setController in interface ListeningDockAction
Parameters:
controller - the new controller