bibliothek.gui.dock.action.actions
Class AbstractSimpleDropDownAction

java.lang.Object
  extended by bibliothek.gui.dock.action.actions.AbstractStandardDockAction
      extended by bibliothek.gui.dock.action.actions.SimpleDockAction
          extended by bibliothek.gui.dock.action.actions.AbstractSimpleDropDownAction
All Implemented Interfaces:
SharingStandardDockAction, DockAction, DropDownAction, StandardDockAction
Direct Known Subclasses:
SimpleDropDownAction

public abstract class AbstractSimpleDropDownAction
extends SimpleDockAction
implements DropDownAction

A dropdown action based on one DockActionSource which has to be specified by a subclass.

Author:
Benjamin Sigg

Field Summary
 
Fields inherited from interface bibliothek.gui.dock.action.DockAction
BUTTON_CONTENT_FILTER
 
Constructor Summary
AbstractSimpleDropDownAction(boolean monitorDisabling)
          Creates a new action
 
Method Summary
 void addDropDownActionListener(DropDownActionListener listener)
          Adds a listener to this action.
<V> V
createView(ViewTarget<V> target, ActionViewConverter converter, Dockable dockable)
          Creates a view for this action, for the platform target and with help of converter.
protected  void fireSelectionChanged()
          Informs all listeners that the selection has changed.
 DropDownFilterFactory getFilter(Dockable dockable)
          Gets a filter that chooses the values that will be shown for this action and its selection.
protected  DropDownActionListener[] getListeners()
          Gets an array of all listeners that are registered to this action.
 DockAction getSelection()
          Returns the currently selected action.
 DockAction getSelection(Dockable dockable)
          Gets the last selected action, which may be null.
protected abstract  DockActionSource getSubActions()
          Gets the DockActionSource which contains all the actions of this dropdown menu.
 DockActionSource getSubActions(Dockable dockable)
          Gets the actions that should be shown for this action.
 void removeDropDownActionListener(DropDownActionListener listener)
          Removes a listener from this action.
 void setFilter(DropDownFilterFactory filter)
          Sets the filter that will be used to filter text, icon, tooltips, etc.
 void setSelection(Dockable dockable, DockAction selection)
          Sets the current selection.
 void setSelection(DockAction selection)
          Changes the selection of this drop-down-action.
 boolean trigger(Dockable dockable)
          Does the appropriate action that can be done respecting the current state of this action.
 
Methods inherited from class bibliothek.gui.dock.action.actions.SimpleDockAction
bound, getAccelerator, getDisabledIcon, getDockableRepresentation, getDockableRepresentation, getIcon, getIcon, getIcon, getIconContexts, getText, getText, getTooltip, getTooltipText, getTooltipText, isEnabled, isEnabled, setAccelerator, setDisabledIcon, setDockableRepresentation, setEnabled, setIcon, setIcon, setText, setTooltip, trigger, unbound
 
Methods inherited from class bibliothek.gui.dock.action.actions.AbstractStandardDockAction
addDockActionListener, bind, fireActionEnabledChanged, fireActionIconChanged, fireActionRepresentativeChanged, fireActionTextChanged, fireActionTooltipTextChanged, getBoundDockables, isBound, 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.StandardDockAction
addDockActionListener, getDockableRepresentation, getIcon, getIconContexts, getText, getTooltipText, isEnabled, removeDockActionListener
 
Methods inherited from interface bibliothek.gui.dock.action.DockAction
bind, unbind
 

Constructor Detail

AbstractSimpleDropDownAction

public AbstractSimpleDropDownAction(boolean monitorDisabling)
Creates a new action

Parameters:
monitorDisabling - whether the current DisablingStrategy should be monitored
Method Detail

createView

public <V> V createView(ViewTarget<V> target,
                        ActionViewConverter converter,
                        Dockable dockable)
Description copied from interface: DockAction
Creates a view for this action, for the platform target and with help of converter. Clients might use their own code to create a new view, but the preferred way is to call ActionViewConverter.createView(ActionType, DockAction, ViewTarget, Dockable) with an ActionType that fits to this DockAction.

Specified by:
createView in interface DockAction
Type Parameters:
V - the type of view requested
Parameters:
target - The platform on which the view will be used
converter - A set of methods that can be used to create a view
dockable - The Dockable for which the view will be shown. Note that this action may not yet be bound to this action.
Returns:
a new view

getSelection

public DockAction getSelection(Dockable dockable)
Description copied from interface: DropDownAction
Gets the last selected action, which may be null.

Specified by:
getSelection in interface DropDownAction
Parameters:
dockable - the Dockable for which the last action is requested
Returns:
the action, may be null

getSelection

public DockAction getSelection()
Returns the currently selected action.

Returns:
the selected action or null

setSelection

public void setSelection(Dockable dockable,
                         DockAction selection)
Description copied from interface: DropDownAction
Sets the current selection. The item selection should be part of the menu it should be selectable. The behavior of this method is not defined if those two conditions are not fulfilled.

Specified by:
setSelection in interface DropDownAction
Parameters:
dockable - the dockable for which the selection has been changed
selection - the new selection, may be null

setSelection

public void setSelection(DockAction selection)
Changes the selection of this drop-down-action.

Parameters:
selection - the newly selected action

setFilter

public void setFilter(DropDownFilterFactory filter)
Sets the filter that will be used to filter text, icon, tooltips, etc. if a view has to decide, which elements of this action, or its selected action have to be shown.

Parameters:
filter - the filter, not null

getFilter

public DropDownFilterFactory getFilter(Dockable dockable)
Description copied from interface: DropDownAction
Gets a filter that chooses the values that will be shown for this action and its selection.

Specified by:
getFilter in interface DropDownAction
Parameters:
dockable - the dockable for which all values will be used
Returns:
the filter

getSubActions

protected abstract DockActionSource getSubActions()
Gets the DockActionSource which contains all the actions of this dropdown menu.

Returns:
all the actions, not null

getSubActions

public DockActionSource getSubActions(Dockable dockable)
Description copied from interface: DropDownAction
Gets the actions that should be shown for this action.

Specified by:
getSubActions in interface DropDownAction
Parameters:
dockable - the Dockable for which the actions are requested
Returns:
the children

addDropDownActionListener

public void addDropDownActionListener(DropDownActionListener listener)
Description copied from interface: DropDownAction
Adds a listener to this action. The listener will be informed if actions are added or removed, or if the selected action changes.

Specified by:
addDropDownActionListener in interface DropDownAction
Parameters:
listener - the listener

removeDropDownActionListener

public void removeDropDownActionListener(DropDownActionListener listener)
Description copied from interface: DropDownAction
Removes a listener from this action.

Specified by:
removeDropDownActionListener in interface DropDownAction
Parameters:
listener - the listener to remove

getListeners

protected DropDownActionListener[] getListeners()
Gets an array of all listeners that are registered to this action.

Returns:
the array of listeners

fireSelectionChanged

protected void fireSelectionChanged()
Informs all listeners that the selection has changed.


trigger

public boolean trigger(Dockable dockable)
Description copied from interface: DockAction
Does the appropriate action that can be done respecting the current state of this action.

Specified by:
trigger in interface DockAction
Parameters:
dockable - the element for which this action is called
Returns:
true if this action could do anything, false if this action was not able to react in any way to the event.