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

java.lang.Object
  extended by org.openbp.common.generic.description.DescriptionObjectImpl
      extended by org.openbp.common.generic.description.DisplayObjectImpl
          extended by org.openbp.guiclient.model.item.itemfilter.AbstractItemFilter
              extended by org.openbp.guiclient.model.item.itemfilter.ItemTextFilter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, Copyable, DescriptionObject, Displayable, DisplayObject, Validatable, ItemFilter

public class ItemTextFilter
extends AbstractItemFilter

Item text filter. The item type filter filters items according to a full text search in the item name, item display text and item description.
The user may enter the text to search in a text field of the configuration component of the filter. Each identifier separated by space will be considered a text filter criterium. All criterias will be related by an 'and' condition, i.e. given the search string "array sort" will match all item that have the words "array" and "sort" appear in their description, display text or name. The comparison is case-insensitive.

Author:
Heiko Erhardt
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.openbp.common.generic.Copyable
COPY_DEEP, COPY_FIRST_LEVEL, COPY_SHALLOW
 
Constructor Summary
ItemTextFilter()
          Default constructor.
 
Method Summary
 boolean acceptsItem(Item item)
          Determines if an item is accepted by this filter.
 javax.swing.JComponent getConfigurationComponent()
          Gets the configuration component that can be used to configure the installed item filters.
 boolean isActive()
          Checks if the filter is active.
 boolean match(java.lang.String text, java.lang.String pattern)
          Checks if the text matches the pattern.
 void setActive(boolean active)
          Activates or deactivates the filter.
 
Methods inherited from class org.openbp.guiclient.model.item.itemfilter.AbstractItemFilter
apply, getFilterManager, getIcon, getItemFilterResource, getPlugin, setFilterHolder, setPlugin
 
Methods inherited from class org.openbp.common.generic.description.DisplayObjectImpl
copyFrom, getDisplayName, getDisplayText, setDisplayName
 
Methods inherited from class org.openbp.common.generic.description.DescriptionObjectImpl
clone, compareTo, getDescription, getDescriptionEscape, getDescriptionText, getName, setDescription, setDescriptionEscape, setName, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openbp.common.generic.description.DisplayObject
getDisplayName, setDisplayName
 
Methods inherited from interface org.openbp.common.generic.description.DescriptionObject
clone, getDescription, getDescriptionText, getDisplayText, getName, setDescription, setName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

ItemTextFilter

public ItemTextFilter()
Default constructor.

Method Detail

acceptsItem

public boolean acceptsItem(Item item)
Determines if an item is accepted by this filter.

Parameters:
item - Item to check
Returns:
true: The item is accepted by the filter
false: The filter rejects this item

getConfigurationComponent

public javax.swing.JComponent getConfigurationComponent()
Gets the configuration component that can be used to configure the installed item filters.

Specified by:
getConfigurationComponent in interface ItemFilter
Overrides:
getConfigurationComponent in class AbstractItemFilter
Returns:
The component or null if the item filter does not provide one

isActive

public boolean isActive()
Checks if the filter is active. The filter is active if it contains at least one filtered item type.

Specified by:
isActive in interface ItemFilter
Overrides:
isActive in class AbstractItemFilter

setActive

public void setActive(boolean active)
Activates or deactivates the filter.

Specified by:
setActive in interface ItemFilter
Overrides:
setActive in class AbstractItemFilter

match

public boolean match(java.lang.String text,
                     java.lang.String pattern)
Checks if the text matches the pattern.

Parameters:
text - Text
pattern - Pattern
Returns:
true: The pattern appears at some position in the text (lowercase comparison)
false: The text does not match the pattern


Copyright © 2011. All Rights Reserved.