gov.nih.nlm.mms.browser
Class ContentViewBrowserRestrictor

java.lang.Object
  extended by gov.nih.nlm.mms.AbstractGUIConfigurable
      extended by gov.nih.nlm.mms.browser.AbstractBrowserRestrictor
          extended by gov.nih.nlm.mms.browser.ContentViewBrowserRestrictor
All Implemented Interfaces:
BrowserRestrictor, Configurable, GUIConfigurable, Restrictor, Comparable, Comparator

public class ContentViewBrowserRestrictor
extends AbstractBrowserRestrictor

Holds criteria for how to restrict or highlight content in finder searches and/or concept view displays. Offers user restriction/highlight mechanisms based on ContentViews.

Author:
Deborah Shapiro

Field Summary
 
Fields inherited from class gov.nih.nlm.mms.browser.AbstractBrowserRestrictor
cds
 
Fields inherited from class gov.nih.nlm.mms.AbstractGUIConfigurable
data_changed, listeners, user_configuration
 
Constructor Summary
ContentViewBrowserRestrictor()
          Every BrowserRestrictor is required to have a no-arg constructor.
 
Method Summary
 void addIdColorSetting(String id, Color color)
          Sets the given Color to be associated with the given content view id.
 void addIdStyleSetting(String id, String style)
          Sets the given style to be associated with the given content view id.
 int compare(Object o1, Object o2)
          Compares this object with the specified object for order.
 List<Color> getColor(Object o)
          Returns a List of Colors for which the given parameter matches in the BrowserRestrictor's key.
 Color getColorForId(String id)
          Returns the Color associated with the given content view id.
 String getConfigurationDetails()
          Method returns a String detailing the user selections on the GUIConfigurable.
 String getName()
          Returns the name.
 JPanel getPanel()
          Returns a JPanel containing configuration options.
 Properties getProperties()
          Returns the Properties representing the configuration choices.
 List<String> getStyle(Object o)
          Returns a List of font styles for which the given parameter matches in the BrowserRestrictor's key.
 String getStyleForId(String id)
          Returns the style associated with the given content view id.
 String getStyleLegend()
          Returns a HTML string containing a key for how elements from the browser restrictor should be displayed, indicating the color and font style.
 String getTabDescription()
          Returns the description to be used in conjunction with the panel when presented to the user.
 boolean isColorInHashMap(Color color)
          Indicates if the given Color is present in the set of content view id - Color associations.
 boolean isIdInColorHashMap(String id)
          Indicates if the given content view id is present in the set of content view id - Color associations.
 boolean isIdInStyleHashMap(String id)
          Indicates if the given content view id is present in the set of content view id - style associations.
 boolean keep(Object o)
          Indicates if the given Object should be kept according to the restriction rules of this BrowserRestrictor return true if Object should be kept false otherwise
 void removeIdColorSetting(String id)
          Clears the association between the given content view id and its Color setting.
 void removeIdStyleSetting(String id)
          Clears the association between the given content view id and its style setting.
 void setProperties(Properties props)
          Sets the Properties representing the configuration choices.
 void showOptions()
          Presents an advanced options GUI to the user.
 
Methods inherited from class gov.nih.nlm.mms.browser.AbstractBrowserRestrictor
equals, getConceptDataSelector, hasAdvancedOptions, isBold, isConceptViewHideModeEnabled, isConceptViewHighlightModeEnabled, isFinderRestrictionEnabled, isItalics, isUnderline, setBold, setConceptViewHideModeEnabled, setConceptViewHighlightModeEnabled, setFinderRestrictionEnabled, setItalics, setUnderline, toString
 
Methods inherited from class gov.nih.nlm.mms.AbstractGUIConfigurable
addDataChangeListener, addValidationError, addValidationWarning, clearValidationErrors, clearValidationWarnings, compareTo, fireDataChanged, getColor, getGUIConfigurableForValidationFailure, getHelpPanel, getValidationErrors, getValidationWarnings, hasDataChanged, removeDataChangeListener, resetDataChanged, resetToDefaults, setConfiguration, setConfiguration, setDataChanged, setPanelSelections, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nih.nlm.mms.GUIConfigurable
addDataChangeListener, getColor, getGUIConfigurableForValidationFailure, getHelpPanel, getValidationErrors, getValidationWarnings, hasDataChanged, removeDataChangeListener, resetDataChanged, setDataChanged, setPanelSelections, validate
 
Methods inherited from interface gov.nih.nlm.mms.Configurable
resetToDefaults, setConfiguration, setConfiguration
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

ContentViewBrowserRestrictor

public ContentViewBrowserRestrictor()
Every BrowserRestrictor is required to have a no-arg constructor.

Method Detail

keep

public boolean keep(Object o)
Indicates if the given Object should be kept according to the restriction rules of this BrowserRestrictor return true if Object should be kept false otherwise

Specified by:
keep in interface Restrictor
Specified by:
keep in class AbstractBrowserRestrictor
Returns:
true object will be kept false otherwise

compare

public int compare(Object o1,
                   Object o2)
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.

Parameters:
o1 - the first Object to be compared.
02 - the second 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.

getName

public String getName()
Returns the name.

Specified by:
getName in interface GUIConfigurable
Overrides:
getName in class AbstractGUIConfigurable
Returns:
the name

getPanel

public JPanel getPanel()
Returns a JPanel containing configuration options.

Specified by:
getPanel in interface GUIConfigurable
Overrides:
getPanel in class AbstractGUIConfigurable
Returns:
a JPanel containing configuration options

getTabDescription

public String getTabDescription()
Returns the description to be used in conjunction with the panel when presented to the user.

Specified by:
getTabDescription in interface GUIConfigurable
Overrides:
getTabDescription in class AbstractGUIConfigurable
Returns:
the description

getProperties

public Properties getProperties()
Returns the Properties representing the configuration choices.

Specified by:
getProperties in interface Configurable
Overrides:
getProperties in class AbstractBrowserRestrictor
Returns:
the Properties representing the configuration choices

setProperties

public void setProperties(Properties props)
Sets the Properties representing the configuration choices.

Specified by:
setProperties in interface Configurable
Overrides:
setProperties in class AbstractBrowserRestrictor
Parameters:
p - the Properties representing the configuration choices

getConfigurationDetails

public String getConfigurationDetails()
Method returns a String detailing the user selections on the GUIConfigurable. This String will be displayed in the mmsys.log at the completion of subsetting so it should be formatted to be easily read.

Specified by:
getConfigurationDetails in interface Configurable
Overrides:
getConfigurationDetails in class AbstractGUIConfigurable
Returns:
String of data for log

showOptions

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

Specified by:
showOptions in interface GUIConfigurable
Overrides:
showOptions in class AbstractGUIConfigurable

addIdColorSetting

public void addIdColorSetting(String id,
                              Color color)
Sets the given Color to be associated with the given content view id.

Parameters:
id - String
color - Color

addIdStyleSetting

public void addIdStyleSetting(String id,
                              String style)
Sets the given style to be associated with the given content view id.

Parameters:
id - String
style - Color

removeIdColorSetting

public void removeIdColorSetting(String id)
Clears the association between the given content view id and its Color setting.

Parameters:
id - String

removeIdStyleSetting

public void removeIdStyleSetting(String id)
Clears the association between the given content view id and its style setting.

Parameters:
id - String

getColorForId

public Color getColorForId(String id)
Returns the Color associated with the given content view id.

Parameters:
id - String
Returns:
Color

isColorInHashMap

public boolean isColorInHashMap(Color color)
Indicates if the given Color is present in the set of content view id - Color associations.

Parameters:
color - Color
Returns:
true if given Color is present false otherwise

isIdInColorHashMap

public boolean isIdInColorHashMap(String id)
Indicates if the given content view id is present in the set of content view id - Color associations.

Parameters:
id - String
Returns:
true if given content view id is present false otherwise

isIdInStyleHashMap

public boolean isIdInStyleHashMap(String id)
Indicates if the given content view id is present in the set of content view id - style associations.

Parameters:
id - String
Returns:
true if given content view id is present false otherwise

getStyleForId

public String getStyleForId(String id)
Returns the style associated with the given content view id.

Parameters:
id - String
Returns:
style

getStyleLegend

public String getStyleLegend()
Returns a HTML string containing a key for how elements from the browser restrictor should be displayed, indicating the color and font style.

Returns:
legend indicating color and font style meanings

getColor

public List<Color> getColor(Object o)
Returns a List of Colors for which the given parameter matches in the BrowserRestrictor's key.

Specified by:
getColor in interface BrowserRestrictor
Overrides:
getColor in class AbstractBrowserRestrictor
Parameters:
o - Object
Returns:
list of colors

getStyle

public List<String> getStyle(Object o)
Returns a List of font styles for which the given parameter matches in the BrowserRestrictor's key.

Specified by:
getStyle in interface BrowserRestrictor
Overrides:
getStyle in class AbstractBrowserRestrictor
Parameters:
o - Object
Returns:
list of styles, such as bold, underline, italic, regular


Copyright ©2005