bibliothek.gui.dock.action
Class AbstractDockActionSource

java.lang.Object
  extended by bibliothek.gui.dock.action.AbstractDockActionSource
All Implemented Interfaces:
DockActionSource, java.lang.Iterable<DockAction>
Direct Known Subclasses:
CActionSource, CloseActionSource, DefaultDockActionSource, FilteredDockActionSource, HierarchyDockActionSource, KeyedActionSource, ModeForwardingActionSource, MultiDockActionSource, StationChildrenActionSource

public abstract class AbstractDockActionSource
extends java.lang.Object
implements DockActionSource

A simple implementation of DockActionSource that just handles the listeners for sources.

Author:
Benjamin Sigg

Field Summary
protected  java.util.List<DockActionSourceListener> listeners
          The listeners which are registered on this source
 
Constructor Summary
AbstractDockActionSource()
           
 
Method Summary
 void addDockActionSourceListener(DockActionSourceListener listener)
          Adds a listener to this source.
protected  void fireAdded(int firstIndex, int lastIndex)
          Invokes the actionsAdded-method on all registered DockActionSourceListeners.
protected  void fireRemoved(int firstIndex, int lastIndex)
          Invokes the actionRemoved-method on all registered DockActionSourceListeners.
 int indexOf(DockAction action)
          Gets the index of the given action
 void removeDockActionSourceListener(DockActionSourceListener listener)
          Removes an earlier added listener.
 
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.DockActionSource
getDockAction, getDockActionCount, getLocationHint
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

listeners

protected java.util.List<DockActionSourceListener> listeners
The listeners which are registered on this source

Constructor Detail

AbstractDockActionSource

public AbstractDockActionSource()
Method Detail

addDockActionSourceListener

public void addDockActionSourceListener(DockActionSourceListener listener)
Description copied from interface: DockActionSource
Adds a listener to this source. The DockActionSourceListener should be informed whenever some DockActions are added or removed from this source.

Specified by:
addDockActionSourceListener in interface DockActionSource
Parameters:
listener - The listener

removeDockActionSourceListener

public void removeDockActionSourceListener(DockActionSourceListener listener)
Description copied from interface: DockActionSource
Removes an earlier added listener.

Specified by:
removeDockActionSourceListener in interface DockActionSource
Parameters:
listener - The listener to remove
See Also:
DockActionSource.addDockActionSourceListener(DockActionSourceListener)

fireAdded

protected void fireAdded(int firstIndex,
                         int lastIndex)
Invokes the actionsAdded-method on all registered DockActionSourceListeners.

Parameters:
firstIndex - The index of the first action that was added
lastIndex - The index of the last action that was added

fireRemoved

protected void fireRemoved(int firstIndex,
                           int lastIndex)
Invokes the actionRemoved-method on all registered DockActionSourceListeners.

Parameters:
firstIndex - The old index of the first action that was removed
lastIndex - The old index of the last action that was removed

indexOf

public int indexOf(DockAction action)
Gets the index of the given action

Parameters:
action - The action to search in this source
Returns:
The index of the action, -1 if the action was not found