gov.nih.nlm.mms.filters
Class AbstractFilter

java.lang.Object
  extended bygov.nih.nlm.mms.filters.AbstractFilter
All Implemented Interfaces:
Comparable, Configurable, Filter, GUIConfigurable, SubsetListener
Direct Known Subclasses:
AttributeTypesToRemoveFilter, ContentViewFilter, LanguagesToRemoveFilter, PrecedenceFilter, RelationshipTypesToRemoveFilter, RemoveByTermgroupFilter, RxNormFilter, SemanticTypesToRemoveFilter, SourcesToRemoveFilter, SuppressibleTermgroupsFilter

public abstract class AbstractFilter
extends Object
implements Filter

This is an abstract implementation of the filter class that manages the mechanisms for handling data changes.

Author:
Brian Carlsen

Field Summary
protected  ApplicationConfiguration default_configuration
           
protected  boolean init_cui
           
protected  boolean subset_content
           
protected  UserConfiguration user_configuration
           
 
Constructor Summary
AbstractFilter()
           
 
Method Summary
 void addDataChangeListener(DataChangeListener dcl)
          Method adds a DataChangeListener that will be notified every time a fireDataChanged() call is made from a filter.
 void applyFilter(Concept concept)
          Deprecated. Use one of the sub-interfaces instead
 void beginInitializeCuiList()
          Informs SubsetListener that the Initialize Cui List phase is starting.
 void beginSubsetContent()
          Informs SubsetListener that the Subset Content phase is starting.
 int compareTo(Object o)
          Compares this object with the specified object for order.
 void endInitializeCuiList()
          Informs SubsetListener that the Initialize Cui List phase is ending.
 void endSubsetContent()
          Informs SubsetListener that the Subset Content phase is ending.
protected  void fireDataChanged()
          Enables filters to inform listeners of data changed event.
protected  void fireNotUndoableDataChanged()
          Enables filters to indicate that data has changed without notifying the listeners or making this change undoable.
 Color getColor()
          Returns the Color used to represent this filter.
 GUIConfigurable getGUIConfigurableForValidationFailure()
          Returns the GUIConfigurable whose tab should next be displayed to allow the user to correct an error or warning.
 JPanel getHelpPanel()
          Method provides a JPanel that will be added to the main GUI help menu to allow the user to consult a help window that is particular to this filter.
 String getValidateMessage()
          This method is the default message for filters that don't check for validity.
 String[] getValidationErrors()
          Returns the messages indicating why validation failed.
 String[] getValidationWarnings()
          Returns warnings that were indicated during validation.
 boolean hasAdvancedOptions()
          Indicates whether or not an options menu item should be supplied for advanced configuration options.
 boolean hasDataChanged()
          Method returns a boolean indicating whether or not the values in this filter have changed.
 void removeDataChangeListener(DataChangeListener dcl)
          Method removes a DataChangeListener so that it will no longer be notified every time a fireDataChanged() call is made from a filter.
 void resetDataChanged()
          Method resets the data_changed flag in the filter to indicate that no data has been changed since the last save.
 void setConfiguration(ApplicationConfiguration c)
          Method provides the filter with values from the default configuration file.
 void setConfiguration(UserConfiguration c)
          Method provides the filter with values from the user configuration file.
 void setCuiList(CuiList cui_list)
          Provides filter access to the cui list.
 void setDataChanged(boolean b)
          Method allows the data_changed value to be set from the main gui from the undo/redo mechanism.
 void showOptions()
          Presents an advanced options GUI to the user.
 boolean validate()
          This method is the default method for filters that don't check for validity and it returns true indicating a valid filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nih.nlm.mms.filters.Filter
isEfficientEnabled
 
Methods inherited from interface gov.nih.nlm.mms.GUIConfigurable
getName, getPanel, getTabDescription, setPanelSelections
 
Methods inherited from interface gov.nih.nlm.mms.Configurable
getConfigurationDetails, getProperties, resetToDefaults, setProperties
 

Field Detail

user_configuration

protected UserConfiguration user_configuration

default_configuration

protected ApplicationConfiguration default_configuration

init_cui

protected boolean init_cui

subset_content

protected boolean subset_content
Constructor Detail

AbstractFilter

public AbstractFilter()
Method Detail

getHelpPanel

public JPanel getHelpPanel()
Method provides a JPanel that will be added to the main GUI help menu to allow the user to consult a help window that is particular to this filter.

Specified by:
getHelpPanel in interface GUIConfigurable
Returns:
JPanel to be added to the Help menu

showOptions

public void showOptions()
Presents an advanced options GUI to the user.

Specified by:
showOptions in interface GUIConfigurable

hasAdvancedOptions

public boolean hasAdvancedOptions()
Indicates whether or not an options menu item should be supplied for advanced configuration options.

Specified by:
hasAdvancedOptions in interface GUIConfigurable
Returns:
true if so; false otherwise

fireDataChanged

protected void fireDataChanged()
Enables filters to inform listeners of data changed event.


fireNotUndoableDataChanged

protected void fireNotUndoableDataChanged()
Enables filters to indicate that data has changed without notifying the listeners or making this change undoable.


hasDataChanged

public boolean hasDataChanged()
Method returns a boolean indicating whether or not the values in this filter have changed.

Specified by:
hasDataChanged in interface GUIConfigurable
Returns:
true if data has changed false otherwise

setDataChanged

public void setDataChanged(boolean b)
Method allows the data_changed value to be set from the main gui from the undo/redo mechanism.

Specified by:
setDataChanged in interface GUIConfigurable
Parameters:
b - boolean

resetDataChanged

public void resetDataChanged()
Method resets the data_changed flag in the filter to indicate that no data has been changed since the last save.

Specified by:
resetDataChanged in interface GUIConfigurable

addDataChangeListener

public void addDataChangeListener(DataChangeListener dcl)
Method adds a DataChangeListener that will be notified every time a fireDataChanged() call is made from a filter. Allows main GUI to record all changes to the filters in the undo/redo mechanism.

Specified by:
addDataChangeListener in interface GUIConfigurable
Parameters:
dcl - DataChangeListener

removeDataChangeListener

public void removeDataChangeListener(DataChangeListener dcl)
Method removes a DataChangeListener so that it will no longer be notified every time a fireDataChanged() call is made from a filter.

Specified by:
removeDataChangeListener in interface GUIConfigurable
Parameters:
dcl - DataChangeListener

setConfiguration

public void setConfiguration(UserConfiguration c)
Method provides the filter with values from the user configuration file.

Specified by:
setConfiguration in interface Configurable
Parameters:
c - UserConfiguration

setConfiguration

public void setConfiguration(ApplicationConfiguration c)
Method provides the filter with values from the default configuration file.

Specified by:
setConfiguration in interface Configurable
Parameters:
c - UserConfiguration

validate

public boolean validate()
This method is the default method for filters that don't check for validity and it returns true indicating a valid filter.

Specified by:
validate in interface GUIConfigurable
Returns:
true filter is valid

getValidateMessage

public String getValidateMessage()
This method is the default message for filters that don't check for validity. This won't be called on a valid filter.

Returns:
String

getValidationErrors

public String[] getValidationErrors()
Returns the messages indicating why validation failed. Should only be called if validate() returns false.

Specified by:
getValidationErrors in interface GUIConfigurable
Returns:
the failure messages

getValidationWarnings

public String[] getValidationWarnings()
Returns warnings that were indicated during validation.

Specified by:
getValidationWarnings in interface GUIConfigurable
Returns:
the warning messages

getGUIConfigurableForValidationFailure

public GUIConfigurable getGUIConfigurableForValidationFailure()
Returns the GUIConfigurable whose tab should next be displayed to allow the user to correct an error or warning.

Specified by:
getGUIConfigurableForValidationFailure in interface GUIConfigurable
Returns:
GUIConfigurable to be displayed

setCuiList

public void setCuiList(CuiList cui_list)
Provides filter access to the cui list.

Specified by:
setCuiList in interface SubsetListener
Parameters:
cui_list - CuiList

beginInitializeCuiList

public void beginInitializeCuiList()
Informs SubsetListener that the Initialize Cui List phase is starting.

Specified by:
beginInitializeCuiList in interface SubsetListener

endInitializeCuiList

public void endInitializeCuiList()
Informs SubsetListener that the Initialize Cui List phase is ending.

Specified by:
endInitializeCuiList in interface SubsetListener

beginSubsetContent

public void beginSubsetContent()
Informs SubsetListener that the Subset Content phase is starting.

Specified by:
beginSubsetContent in interface SubsetListener

endSubsetContent

public void endSubsetContent()
Informs SubsetListener that the Subset Content phase is ending.

Specified by:
endSubsetContent in interface SubsetListener

getColor

public Color getColor()
Returns the Color used to represent this filter. Not used yet.

Specified by:
getColor in interface GUIConfigurable
Returns:
Color

applyFilter

public void applyFilter(Concept concept)
Deprecated. Use one of the sub-interfaces instead

Method which removes a given Concept or its components from the release. Called during the subsetting process.

Specified by:
applyFilter in interface Filter
Parameters:
concept - Concept

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Required method for implementing Comparable interface. Indicates the means for comparison between two Filters.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type is not GUIConfigurable.


Copyright ©2005