org.palo.api.subsets.filter
Class PicklistFilter

java.lang.Object
  extended by org.palo.api.subsets.filter.PicklistFilter
All Implemented Interfaces:
RestrictiveFilter, StructuralFilter, SubsetFilter

public class PicklistFilter
extends java.lang.Object
implements RestrictiveFilter, StructuralFilter

PicklistFilter

A picklist filter is a restrictive filter as well as a structural filter. It is restrictive in the sense that elements which go into the subset can be selected. It is structural in the sense that those elements can be sorted if added in front or at the end of current subset elements list.

Version:
$Id: PicklistFilter.html,v 1.5 2009/07/09 11:01:46 ArndHouben Exp $

Field Summary
 
Fields inherited from interface org.palo.api.subsets.SubsetFilter
TYPE_ALIAS, TYPE_ATTRIBUTE, TYPE_DATA, TYPE_HIERARCHICAL, TYPE_PICKLIST, TYPE_SORTING, TYPE_TEXT
 
Constructor Summary
PicklistFilter(Dimension dimension)
          Deprecated. use PicklistFilter(Hierarchy) instead.
PicklistFilter(Dimension dimension, PicklistFilterSetting setting)
          Deprecated. use PicklistFilter(Hierarchy, PicklistFilterSetting) instead.
PicklistFilter(Hierarchy hierarchy)
          Creates a new PicklistFilter instance for the given hierarchy
PicklistFilter(Hierarchy hierarchy, PicklistFilterSetting setting)
          Creates a new PicklistFilter instance for the given hierarchy with the given settings
 
Method Summary
 void adapt(SubsetFilter from)
          Adapts this subset filter from the given one.
 void add(EffectiveFilter filter)
          Adds the given EffectiveFilter to the list of all affective filters which affect this subset filter
 void bind(Subset2 subset)
          Binds this filter instance to the given Subset2 NOTE: PLEASE DON'T USE!
 PicklistFilter copy()
          Creates a deep copy of this subset filter
 void filter(java.util.List<ElementNode> hiers, java.util.Set<Element> elements)
          Inserts picked elements at front or back of the given element hierarchy.
 void filter(java.util.Set<Element> elements)
          Filters the given elements list, i.e. only the picked elements of the list are kept.
 Dimension getDimension()
           
 Hierarchy getHierarchy()
          Convenient method to access the subset hierarchy.
 PicklistFilterSetting getSettings()
          Returns the internal settings of this filter.
 Subset2 getSubset()
          Returns the Subset2 to which this filter belongs or null if this filter isn't bind to a subset yet.
 int getType()
          Returns the filter type which is one of the defined type constants.
 void initialize()
          Initializes this filter.
 void merge(java.util.Set<Element> elements)
          Merges the picked elements into the given element list.
 void remove(EffectiveFilter filter)
          Removes the given EffectiveFilter from the list of all affective filters which affect this subset filter
 void reset()
          Resets this filter, i.e. its internal setting is switched back to its default.
 void resetInternal()
           
 void unbind()
          Releases this filter instance from a previously binded Subset2 NOTE: PLEASE DON'T USE!
 void validateSettings()
          Checks if the internal subset settings are valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.palo.api.subsets.SubsetFilter
adapt, add, bind, getHierarchy, getSubset, remove, reset, unbind
 

Constructor Detail

PicklistFilter

public PicklistFilter(Dimension dimension)
Deprecated. use PicklistFilter(Hierarchy) instead.

Creates a new PicklistFilter instance for the given dimension

Parameters:
dimension - the dimension to create the filter for

PicklistFilter

public PicklistFilter(Hierarchy hierarchy)
Creates a new PicklistFilter instance for the given hierarchy

Parameters:
hierarchy - the hierarchy to create the filter for

PicklistFilter

public PicklistFilter(Dimension dimension,
                      PicklistFilterSetting setting)
Deprecated. use PicklistFilter(Hierarchy, PicklistFilterSetting) instead.

Creates a new PicklistFilter instance for the given dimension with the given settings

Parameters:
dimension - the dimension to create the filter for
setting - the filter settings to use

PicklistFilter

public PicklistFilter(Hierarchy hierarchy,
                      PicklistFilterSetting setting)
Creates a new PicklistFilter instance for the given hierarchy with the given settings

Parameters:
hierarchy - the hierarchy to create the filter for
setting - the filter settings to use
Method Detail

copy

public final PicklistFilter copy()
Description copied from interface: SubsetFilter
Creates a deep copy of this subset filter

Specified by:
copy in interface SubsetFilter
Returns:
a copy of this subset filter

getSettings

public final PicklistFilterSetting getSettings()
Description copied from interface: SubsetFilter
Returns the internal settings of this filter.

Specified by:
getSettings in interface SubsetFilter
Returns:

filter

public final void filter(java.util.List<ElementNode> hiers,
                         java.util.Set<Element> elements)
Inserts picked elements at front or back of the given element hierarchy. Has only effect if filter insert mode is set to either PicklistFilterSetting.INSERT_MODE_BACK or PicklistFilterSetting.INSERT_MODE_FRONT

Specified by:
filter in interface StructuralFilter
Parameters:
hiers - the current subset element hierarchy
elements - the currently used Elements

filter

public final void filter(java.util.Set<Element> elements)
Filters the given elements list, i.e. only the picked elements of the list are kept. Has only effect if filter insert mode is set to PicklistFilterSetting.INSERT_MODE_SUB.

Specified by:
filter in interface RestrictiveFilter
Parameters:
elements - an element list

merge

public final void merge(java.util.Set<Element> elements)
Merges the picked elements into the given element list. Has only effect if filter insert mode is set to PicklistFilterSetting.INSERT_MODE_MERGE.

Parameters:
elements - the element list to merge picked elements into

getType

public final int getType()
Description copied from interface: SubsetFilter
Returns the filter type which is one of the defined type constants.

Specified by:
getType in interface SubsetFilter
Returns:
the filter type

initialize

public final void initialize()
Description copied from interface: SubsetFilter
Initializes this filter.

Specified by:
initialize in interface SubsetFilter

resetInternal

public final void resetInternal()

validateSettings

public final void validateSettings()
                            throws PaloIOException
Description copied from interface: SubsetFilter
Checks if the internal subset settings are valid.

Specified by:
validateSettings in interface SubsetFilter
Throws:
PaloIOException - if internal subset settings are not valid.

add

public final void add(EffectiveFilter filter)
Description copied from interface: SubsetFilter
Adds the given EffectiveFilter to the list of all affective filters which affect this subset filter

Specified by:
add in interface SubsetFilter
Parameters:
filter - a filter which affects this subset filter.

remove

public final void remove(EffectiveFilter filter)
Description copied from interface: SubsetFilter
Removes the given EffectiveFilter from the list of all affective filters which affect this subset filter

Specified by:
remove in interface SubsetFilter
Parameters:
filter - the affective filter to remove

reset

public final void reset()
Description copied from interface: SubsetFilter
Resets this filter, i.e. its internal setting is switched back to its default. Clears all internal used caches too.

Specified by:
reset in interface SubsetFilter

getSubset

public final Subset2 getSubset()
Description copied from interface: SubsetFilter
Returns the Subset2 to which this filter belongs or null if this filter isn't bind to a subset yet.

Specified by:
getSubset in interface SubsetFilter
Returns:
the Subset2 to which this filter belongs or null

bind

public final void bind(Subset2 subset)
Description copied from interface: SubsetFilter

Binds this filter instance to the given Subset2

NOTE: PLEASE DON'T USE! INTERNAL METHOD

Specified by:
bind in interface SubsetFilter

unbind

public final void unbind()
Description copied from interface: SubsetFilter

Releases this filter instance from a previously binded Subset2

NOTE: PLEASE DON'T USE! INTERNAL METHOD

Specified by:
unbind in interface SubsetFilter

getDimension

public final Dimension getDimension()

getHierarchy

public final Hierarchy getHierarchy()
Description copied from interface: SubsetFilter
Convenient method to access the subset hierarchy.

Specified by:
getHierarchy in interface SubsetFilter
Returns:
the subset hierarchy

adapt

public final void adapt(SubsetFilter from)
Description copied from interface: SubsetFilter
Adapts this subset filter from the given one. Both filter must be of same type!

Specified by:
adapt in interface SubsetFilter
Parameters:
from - the subset filter to adapt from