com.objex.panywhere
Class SubtextLegendItem

java.lang.Object
  extended by com.objex.panywhere.SubtextLegendItem
All Implemented Interfaces:
ComparableItems, java.io.Serializable

public class SubtextLegendItem
extends java.lang.Object
implements java.io.Serializable, ComparableItems

This class defines the objects to be displayed in the SubtextLegend. Each SubtextItem describes the display text, the fieldid pointing to the Data item contained by an Individual object, and a list of conditions / where clauses that must be satisfied by an Individual for this SubtextItem to be applied to that Individual's Subtext. If there are no conditions specified for this SubtextItem, then the SubtextItem will necessarily be applied to the Individual so that the Data item whose fieldid is specified by the property SubtextItem.getFieldID() will be displayed as the as the Icon subtext for that Individual. An example shown below describes how you link the SubtextLegendItem to the Individual's Data property.



In this example, a subtext line with text "Yes" must be displayed for all female Individuals and not for male Individuals. This subtext line must be displayed on the first line. To achieve this we create a SubtextLegendItem as follows :-

SubtextLegend lLegend = pedigree.getSubtextLegend();

SubtextLegendItem lItem = new SubtextLegendItem();

lItem.setFieldid(1);

lItem.setOrder(1);

lItem.setLegendDisplayText("Female Patient");

lItem.addCondition(2, ComparableItems.EQUALS_OPERATOR, "0"); //only display where field with ID 2 is equal to zero (0)

lLegend.addSubtextLegendItem(lItem);



Now create the equivalent Data object for the SubtextLegendItem thus :-



Individual ind = new Individual();

Data lData = new Data();

lData.setFieldid(1);

lData.setValue("Yes"); //This will be displayed as subtext

ind.setData(lData);



lData = new Data();

lData.setFieldid(2);

lData.setValue("0"); //This will be used to determine Individual eligible to have subtext displayed

ind.setData(lData);

Note that the a fields with fieldid "1" and fieldid "2" may optionally be inserted into the control's data dictionary if there is a need to link the Data object above to some database field. To do so, you would create a DatabaseTable object, a DatabaseField object (all typically imported by the application from a Database) as follows :-



DatabaseTable table = new DatabaseTable();

table.setTableid(1);

table.setTablename("people_basics"); //assume this field is in a database table called people_basics



DatabaseField field1 = new DatabaseField();

field1.setFieldid(1);

field1.setFieldname("Female Patient"); //may be the actual fieldname for the Database from which this data was extracted

field1.setDatatype(DataType.TEXT_TYPE);

table.addField(field1);



DatabaseField field2 = new DatabaseField();

field2.setFieldid(2);

field2.setFieldname("Gender");

field2.setDatatype(DataType.TEXT_TYPE);

table.addField(field2);



Pedigree.getDatadictionary().setTable(table);



With the field added to the database as shown above, you could also create custom datasheets that may be used to edit Data objects contained by the Individual. Note that the key in all cases is "fieldid" which you can use to obtain the Data from the Individual using Individual.getData(fieldid).

See Also:
SubtextLegend, Subtext, Serialized Form

Field Summary
static java.lang.String PROP_SAMPLE_PROPERTY
           
 
Fields inherited from interface com.objex.panywhere.ComparableItems
AND_OPERATOR, EQUALS_OPERATOR, GREATER_THAN_OPERATOR, GREATER_THAN_OR_EQUAL_OPERATOR, ISNOTNULL_OPERATOR, ISNULL_OPERATOR, OR_OPERATOR, SMALLER_THAN_OPERATOR, SMALLER_THAN_OR_EQUAL_OPERATOR
 
Constructor Summary
SubtextLegendItem()
          Creates a new SubtextLegendItem
 
Method Summary
 void addCondition(int ai_conditionfieldid, java.lang.String as_operator, java.lang.Object aCompareValue)
          Adds a new Subtext condition that will determine whethere or not an Indvidual subject's subtext value should be deisplayed based on whether or not the data value in the specified field for this subtext item satisfies the specified condition.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 java.util.List<LegendCondition> getConditions()
           
 java.util.Iterator<LegendCondition> getConditionsIterator()
           
 int getFieldid()
           
 java.lang.String getLegendDisplayText()
           
 int getOrder()
           
 java.lang.String getSampleProperty()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setConditions(java.util.List<LegendCondition> aSubtextconditions)
          Sets the new Iterable list of subtext conditions
 void setFieldid(int ai_fieldid)
          Sets the fieldid for the data item that this subtext item corresponds to.
 void setLegendDisplayText(java.lang.String legendDisplayText)
          Sets the display text for the legend item.
 void setOrder(int ai_order)
          Sets the order of display of this legend item within the subtext legend.
 void setSampleProperty(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_SAMPLE_PROPERTY

public static final java.lang.String PROP_SAMPLE_PROPERTY
See Also:
Constant Field Values
Constructor Detail

SubtextLegendItem

public SubtextLegendItem()
Creates a new SubtextLegendItem

Method Detail

getSampleProperty

public java.lang.String getSampleProperty()

setSampleProperty

public void setSampleProperty(java.lang.String value)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

getConditions

public java.util.List<LegendCondition> getConditions()
Specified by:
getConditions in interface ComparableItems
Returns:
an Iterable list of subtext conditions or null if there are no conditions for this subtext

setConditions

public void setConditions(java.util.List<LegendCondition> aSubtextconditions)
Sets the new Iterable list of subtext conditions

Specified by:
setConditions in interface ComparableItems
Parameters:
aSubtextconditions - The new list of conidtions

getLegendDisplayText

public java.lang.String getLegendDisplayText()
Specified by:
getLegendDisplayText in interface ComparableItems
Returns:
The display text for the legend item. This is what will be drawn on the left side of the subtext line

setLegendDisplayText

public void setLegendDisplayText(java.lang.String legendDisplayText)
Sets the display text for the legend item. This is what will be drawn on the left side of the subtext line

Specified by:
setLegendDisplayText in interface ComparableItems

getOrder

public int getOrder()
Returns:
The order of display of this legend item within the subtext legend. Items with lower values for this property will be displayed before ones with higher ones.

setOrder

public void setOrder(int ai_order)
Sets the order of display of this legend item within the subtext legend. Items with lower values for this property will be displayed before ones with higher ones.

Parameters:
ai_order - The new field order for this subtext item. This determines where in the list of subtext items this item will be rendered on the Pedigree surface.

getFieldid

public int getFieldid()
Returns:
The fieldid for the data item that this subtext item corresponds to.

setFieldid

public void setFieldid(int ai_fieldid)
Sets the fieldid for the data item that this subtext item corresponds to.

Parameters:
ai_fieldid - The new fieldid for this subtext item

addCondition

public void addCondition(int ai_conditionfieldid,
                         java.lang.String as_operator,
                         java.lang.Object aCompareValue)
Adds a new Subtext condition that will determine whethere or not an Indvidual subject's subtext value should be deisplayed based on whether or not the data value in the specified field for this subtext item satisfies the specified condition.

Specified by:
addCondition in interface ComparableItems
Parameters:
ai_conditionfieldid - The field on which the condition is based
as_operator - The comparison operator used. Possible values are ComparableItems.EQUALS_OPERATOR, ComparableItems.SMALLER_THAN_OPERATOR, ComparableItems.GREATER_THAN_OPERATOR, ComparableItems.GREATER_THAN_OR_EQUAL_OPERATOR, ComparableItems.SMALLER_THAN_OR_EQUAL_OPERATOR, ComparableItems.ISNULL_OPERATOR, ComparableItems.ISNOTNULL_OPERATOR
aCompareValue - The value that the subject Individual's corresponding data field must satisfy in order for the condition to be statisfied.

getConditionsIterator

public java.util.Iterator<LegendCondition> getConditionsIterator()
Specified by:
getConditionsIterator in interface ComparableItems
Returns:
An iterator for the subtext condion objects or null if this subtext item does not have any conditions.