org.openbp.guiclient.model.item.itemfilter
Class ItemFilterMgr

java.lang.Object
  extended by org.openbp.guiclient.model.item.itemfilter.ItemFilterMgr
All Implemented Interfaces:
ItemFilterHolder

public class ItemFilterMgr
extends java.lang.Object
implements ItemFilterHolder

The item filter manager enables the filtering of items according to a variety of filters (ItemFilter) that have been installed for this manager. It provides methods to check if an item is accepted by the filters and may return components that can be used to affect the mode of operation of the filters. An item is declined by the manager if one of the installed filters rejects the item (i. e. logical and conjunction of the filters).

Author:
Heiko Erhardt

Field Summary
protected  java.util.List filterList
          Filter list (contains ItemFilter objects)
 
Constructor Summary
ItemFilterMgr()
          Default constructor.
ItemFilterMgr(Plugin plugin)
          Constructor.
 
Method Summary
 boolean acceptsItem(Item item)
          Determines if an item is accepted by the installed filters.
 void addFilter(ItemFilter filter)
          Adds a filter.
 void apply(ItemFilter filter)
          (Re-)applies the filter.
 javax.swing.JComponent getConfigurationPane()
          Gets the panel that contains the various filter configuration components.
 java.util.List getFilterList()
          Gets the filter list.
 JaspiraToolbar getFilterToolbar()
          Gets the filter toolbar.
 Plugin getPlugin()
          Gets the plugin the item filter manager is associated with (to be used as event source).
protected  void initializeComponents()
          Initializes the filter configuration components and the filter toolbar.
 void setFilterListener(ItemFilterListener filterListener)
          Sets the filter listener.
 void setPlugin(Plugin plugin)
          Sets the plugin the item filter manager is associated with (to be used as event source).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterList

protected java.util.List filterList
Filter list (contains ItemFilter objects)

Constructor Detail

ItemFilterMgr

public ItemFilterMgr()
Default constructor.


ItemFilterMgr

public ItemFilterMgr(Plugin plugin)
Constructor.

Parameters:
plugin - Plugin the item filter manager is associated with (to be used as event source)
Method Detail

initializeComponents

protected void initializeComponents()
Initializes the filter configuration components and the filter toolbar.


getPlugin

public Plugin getPlugin()
Gets the plugin the item filter manager is associated with (to be used as event source).

Specified by:
getPlugin in interface ItemFilterHolder

setPlugin

public void setPlugin(Plugin plugin)
Sets the plugin the item filter manager is associated with (to be used as event source).


acceptsItem

public boolean acceptsItem(Item item)
Determines if an item is accepted by the installed filters.

Parameters:
item - Item to check
Returns:
true: The item is accepted by all installed filters or no filters have been installed.
false: At least one of the installed filters has rejected the item.

apply

public void apply(ItemFilter filter)
(Re-)applies the filter. This method will be called after the status of a filter has changed.

Specified by:
apply in interface ItemFilterHolder
Parameters:
filter - Filter that wishes to be applied or null

setFilterListener

public void setFilterListener(ItemFilterListener filterListener)
Sets the filter listener.


getFilterToolbar

public JaspiraToolbar getFilterToolbar()
Gets the filter toolbar. The toolbar contains a button for each installed filter, in the order they have been added to the manager. The function of each button is as follows:
If the filter is inactive, a click on the button will show the filter customization component if the filter provides one or otherwise simply activate the filter.
If the filter is active, it will be deactivated without showing any component.
The buttons are toggle buttons, so their state will indicate if a filter is active.

Returns:
The toolbar or null if no filters have been installed

getConfigurationPane

public javax.swing.JComponent getConfigurationPane()
Gets the panel that contains the various filter configuration components.

Returns:
The configuration pane or null if there are no filter configuration components

addFilter

public void addFilter(ItemFilter filter)
Adds a filter.

Parameters:
filter - The filter to add

getFilterList

public java.util.List getFilterList()
Gets the filter list.

Returns:
A list of ItemFilter objects


Copyright © 2011. All Rights Reserved.