com.ibm.commons.iloader.node.lookups
Class FilteredLookup

java.lang.Object
  extended by com.ibm.commons.iloader.node.lookups.api.AbstractLookup
      extended by com.ibm.commons.iloader.node.lookups.FilteredLookup
All Implemented Interfaces:
ILookup

public class FilteredLookup
extends com.ibm.commons.iloader.node.lookups.api.AbstractLookup

This lookup provides a mechanism for providing a filter on the lookup. The lookup items are filtered based on an input. The indices are modified to reflect the items filtered out.


Nested Class Summary
static interface FilteredLookup.Filter
          A filter interface that determines whether an item at a certain index should be accepted or not.
static class FilteredLookup.PrefixFilter
           
 
Constructor Summary
FilteredLookup(ILookup wrapped, FilteredLookup.Filter filter)
          Creates a new instance of this class with an associated Filter.
 
Method Summary
 java.lang.String getCode(int index)
          Return the code or model value for this index.
 FilteredLookup.Filter getFilter()
          Returns the filter in use by lookup.
 org.eclipse.swt.graphics.Image getImage(int index)
          Return the image for the given index.
 java.lang.String getLabel(int index)
          Return the label displayed to the user for this index.
 java.lang.String getLabelFromCode(java.lang.String code)
          Return the label for the given model value code.
 void refresh()
          Refresh the content of the lookup.
 void setFilter(FilteredLookup.Filter filter)
          Set a filter to filter the lookup with.
 int size()
          Return the number of items in this lookup.
 
Methods inherited from class com.ibm.commons.iloader.node.lookups.api.AbstractLookup
addLookupListener, addNotify, getLabelFromCodeIgnoreCase, notifyLookupChanged, removeLookupListener, removeNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredLookup

public FilteredLookup(ILookup wrapped,
                      FilteredLookup.Filter filter)
Creates a new instance of this class with an associated Filter.

Parameters:
wrapped - the lookup that we would filter
filter - the filter to apply to the lookup
Method Detail

getFilter

public FilteredLookup.Filter getFilter()
Returns the filter in use by lookup.

Returns:

setFilter

public void setFilter(FilteredLookup.Filter filter)
Set a filter to filter the lookup with.

Parameters:
filter -

refresh

public void refresh()
Refresh the content of the lookup.


size

public int size()
Description copied from interface: ILookup
Return the number of items in this lookup.


getCode

public java.lang.String getCode(int index)
Description copied from interface: ILookup
Return the code or model value for this index.


getLabel

public java.lang.String getLabel(int index)
Description copied from interface: ILookup
Return the label displayed to the user for this index.


getLabelFromCode

public java.lang.String getLabelFromCode(java.lang.String code)
Description copied from interface: ILookup
Return the label for the given model value code.

Specified by:
getLabelFromCode in interface ILookup
Overrides:
getLabelFromCode in class com.ibm.commons.iloader.node.lookups.api.AbstractLookup

getImage

public org.eclipse.swt.graphics.Image getImage(int index)
Description copied from interface: ILookup
Return the image for the given index.

Specified by:
getImage in interface ILookup
Overrides:
getImage in class com.ibm.commons.iloader.node.lookups.api.AbstractLookup