com.bbn.openmap.omGraphics.rule
Class IndexRule

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.omGraphics.rule.Rule<java.util.List<?>>
              extended by com.bbn.openmap.omGraphics.rule.IndexRule
All Implemented Interfaces:
LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener
Direct Known Subclasses:
DbfHandler.DbfRule

public abstract class IndexRule
extends Rule<java.util.List<?>>

A Rule is an attribute inspector that makes decisions about rendering attributes, information line contents, tooltips and visibility based on scale.

Author:
dietrick

Field Summary
protected  int[] infolineIndicies
           
protected  int keyIndex
          The column index where the testing value can be found for the rule to compare against the value.
protected  int[] labelIndicies
           
protected  int[] tooltipIndicies
           
 
Fields inherited from class com.bbn.openmap.omGraphics.rule.Rule
displayMaxScale, displayMinScale, drawingAttributes, infolineFields, keyField, labelFields, labelMaxScale, labelMinScale, op, RuleActionInfoline, RuleActionLabel, RuleActionMaxScale, RuleActionMinScale, RuleActionRender, RuleActionTooltip, RuleKeyProperty, RuleListProperty, RuleOperatorProperty, RuleValueProperty, tooltipFields, val
 
Fields inherited from class com.bbn.openmap.OMComponent
i18n, propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
IndexRule()
           
 
Method Summary
 boolean evaluate(java.util.List<?> record)
          Asks the Op class to evaluate the provided value against the Rules value.
 OMGraphic evaluate(java.util.List<?> record, OMGraphic omg, Projection proj)
          Evaluate the record against this rule.
 java.lang.String getColumnNamesFromIndicies(int[] indicies)
          Given a prefix + ActionProperty, get the column names listed as the property value and figure out what the indexes of the columns are.
 java.lang.String getContent(java.util.List<java.lang.String> fieldNames, java.util.List<?> record)
          Returns a String of concatenated record values.
 java.lang.String getContentFromIndicies(int[] indicies, java.util.List<?> record)
          Returns a String of concatenated record values.
 int[] getIndicies(java.util.List<java.lang.String> fieldNames)
          Given a prefix + ActionProperty, get the column names listed as the property value and figure out what the indexes of the columns are.
 int[] getInfolineIndicies()
           
 int getKeyIndex()
           
 int[] getLabelIndicies()
           
abstract  int getRecordColumnIndexForName(java.lang.String columnName)
          A record List for the attributes of an OMGraphic might have a name for each entry.
abstract  java.lang.String getRecordColumnName(int index)
          Provide the title of the attribute at a specific entry.
 int[] getTooltipIndicies()
           
 void setInfolineIndicies(int[] infolineIndicies)
           
 void setKeyIndex(int keyIndex)
           
 void setLabelIndicies(int[] labelIndicies)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setTooltipIndicies(int[] tooltipIndicies)
           
 
Methods inherited from class com.bbn.openmap.omGraphics.rule.Rule
getDisplayMaxScale, getDisplayMinScale, getDrawingAttribtues, getFieldsAsString, getInfolineFields, getKeyName, getLabelFields, getLabelMaxScale, getLabelMinScale, getOp, getProperties, getStringFromFields, getTooltipFields, getVal, setDisplayMaxScale, setDisplayMinScale, setDrawingAttributes, setInfolineFields, setKeyName, setLabelFields, setLabelMaxScale, setLabelMinScale, setOp, setTooltipFields, setVal
 
Methods inherited from class com.bbn.openmap.OMComponent
getPropertyInfo, getPropertyPrefix, setProperties, setPropertyPrefix
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyIndex

protected int keyIndex
The column index where the testing value can be found for the rule to compare against the value.


tooltipIndicies

protected int[] tooltipIndicies

infolineIndicies

protected int[] infolineIndicies

labelIndicies

protected int[] labelIndicies
Constructor Detail

IndexRule

public IndexRule()
Method Detail

getRecordColumnIndexForName

public abstract int getRecordColumnIndexForName(java.lang.String columnName)
A record List for the attributes of an OMGraphic might have a name for each entry. Given a name, provide the index into the List to get that attribute value. NOTE: This method will be overridden by subclasses that read data and create attribute data structures.

Parameters:
columnName - name of a attribute in a List, like a column name of a list of lists.
Returns:
the int index of the entry in the record List.

getRecordColumnName

public abstract java.lang.String getRecordColumnName(int index)
Provide the title of the attribute at a specific entry. NOTE: This method will be overridden by subclasses that read data and create attribute data structures.

Parameters:
index - into the record List.
Returns:
the record List name for that index.

evaluate

public boolean evaluate(java.util.List<?> record)
Asks the Op class to evaluate the provided value against the Rules value.

Specified by:
evaluate in class Rule<java.util.List<?>>
Parameters:
record - list of objects to evaluate, the keyIndex will be used to fetch the appropriate object from the List.
Returns:
true of the operation passed

getContent

public java.lang.String getContent(java.util.List<java.lang.String> fieldNames,
                                   java.util.List<?> record)
Returns a String of concatenated record values. This method will work, but another method can be called that takes indices that will save a lookup step.

Specified by:
getContent in class Rule<java.util.List<?>>
Parameters:
fieldNames - name of columns
record - List to use for return value
Returns:
String of content

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class Rule<java.util.List<?>>
Parameters:
prefix - the token to prefix the property names
props - the Properties object

evaluate

public OMGraphic evaluate(java.util.List<?> record,
                          OMGraphic omg,
                          Projection proj)
Evaluate the record against this rule.

Overrides:
evaluate in class Rule<java.util.List<?>>
Parameters:
record - A List of attributes for a particular OMGraphic/map object. The indices for the rule are indexes into this record.
omg - The OMGraphic to evaluate.
proj - The current map projection.
Returns:
the OMGraphic if it should be drawn, null if it shouldn't.

getContentFromIndicies

public java.lang.String getContentFromIndicies(int[] indicies,
                                               java.util.List<?> record)
Returns a String of concatenated record values.

Parameters:
indicies - column indexes of values to be concatenated in return value
record - List to use for return value
Returns:
String of content

getIndicies

public int[] getIndicies(java.util.List<java.lang.String> fieldNames)
Given a prefix + ActionProperty, get the column names listed as the property value and figure out what the indexes of the columns are.

Parameters:
fieldNames - a List of Strings for property title
Returns:
int array of column indexes in the dbf file reflecting the order and number of column names listed as the property value.

getColumnNamesFromIndicies

public java.lang.String getColumnNamesFromIndicies(int[] indicies)
Given a prefix + ActionProperty, get the column names listed as the property value and figure out what the indexes of the columns are.

Parameters:
indicies - int[] of column indexes in the dbf file reflecting the order and number of column names to be listed as a property value.
Returns:
String for use in properties of space-separated column names.

getInfolineIndicies

public int[] getInfolineIndicies()

setInfolineIndicies

public void setInfolineIndicies(int[] infolineIndicies)

getKeyIndex

public int getKeyIndex()

setKeyIndex

public void setKeyIndex(int keyIndex)

getLabelIndicies

public int[] getLabelIndicies()

setLabelIndicies

public void setLabelIndicies(int[] labelIndicies)

getTooltipIndicies

public int[] getTooltipIndicies()

setTooltipIndicies

public void setTooltipIndicies(int[] tooltipIndicies)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details