com.objex.panywhere
Class SubtextLegendItem

java.lang.Object
  extended by com.objex.panywhere.SubtextLegendItem
All Implemented Interfaces:
ComparableLegendItem, java.io.Serializable
Direct Known Subclasses:
SubtextLegendItem.MultiColumnSubtextLegendItem, TableSubtextLegendItem

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

SubtextLegendItem represents the legend text that is rendered to the left (and below) the icon of the leftmost person in each generation. There are two types of subtext legend items, those without conditions and those with conditions. Subtext legend items with conditions are assigned only to persons with data that matches the conditions. Those without conditions will be assigned explicitly to a person. Once applied or assigned, any person with data that matches the condition
will have the subtext displayed. The example below shows how you link the SubtextLegendItem to the person's Data object to effect the subtext that will be displayed.



In this example, a subtext legend item with text "Female Patient" and a subtext line with text "Yes" must be displayed for all females in the pedigree. This subtext line must be displayed on the first line.

 
 void conditionbasedSubtextExampleMethod() {
        SubtextLegend l_subtext_legend = Pedigree.getSubtextLegend();
        SubtextLegendItem l_subtext_item = new SubtextLegendItem();
        int GENDER_FIELDID = 2;
        int PERSON_ISFEMALE_FIELDID = 1;
        int SUBTEXT_ITEM_LINE_NUMBER = 1;
        String FEMALE_GENDER_VALUE = "0";
        l_subtext_item.setFieldid(PERSON_ISFEMALE_FIELDID);
        l_subtext_item.setOrder(SUBTEXT_ITEM_LINE_NUMBER);
        l_subtext_item.setLegendDisplayText("Female Patient");
        l_subtext_item.addCondition(GENDER_FIELDID, CompareOperator.QUERY_EQUALS, FEMALE_GENDER_VALUE); //only display persons with a data for fieldid = 2 and value for gender = "0"
        l_subtext_legend.addSubtextLegendItem(l_subtext_item);

        //Now create the equivalent Data object for the SubtextLegendItem thus :-
        Individual ind = new Individual();
        Data l_data = new Data();        
        l_data.setFieldid(PERSON_ISFEMALE_FIELDID);
        l_data.setValue("Yes");  //This will be displayed as subtext
        ind.setData(l_data);

        l_data = new Data();
        l_data.setFieldid(GENDER_FIELDID);
        l_data.setValue(FEMALE_GENDER_VALUE); //This will be used to determine person's eligible to have subtext displayed
        ind.setData(l_data);
    }
 
 
You have to create data dictionary fields and tables to link the subtext fields with the data fields. ProgenyAnywhere has a local datadictionary where you can create these fields and tables as shown in the example below. Whats important
is that for each fieldid specified in the Data and/or SubtextLegendItem, there must be an equivalent DatabaseField object in the dictionary.



 
 void createDatadictionaryTableForSubtext() {
        DatabaseTable table = new DatabaseTable();
        table.setTableid(1);
        table.setTablename("subtext_table"); //assume this field is in a database table called subtext_table

        int PERSON_ISFEMALE_FIELDID = 1;
        DatabaseField field1 = new DatabaseField();
        field1.setFieldid(PERSON_ISFEMALE_FIELDID);
        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);

        int GENDER_FIELDID = 2;
        DatabaseField field2 = new DatabaseField();
        field2.setFieldid(GENDER_FIELDID);
        field2.setFieldname("Gender");
        field2.setDatatype(DataType.TEXT_TYPE);
        table.addField(field2);

        Pedigree.getDatadictionary().setTable(table);
    }
 
 

See Also:
SubtextLegend, Subtext, LegendCondition, Serialized Form

Nested Class Summary
static class SubtextLegendItem.MultiColumnSubtextLegendItem
          A subtext legend item for complex multi-column subtext items.
 
Field Summary
static java.lang.String PROP_SAMPLE_PROPERTY
           
 
Constructor Summary
SubtextLegendItem()
          Creates a new SubtextLegendItem
 
Method Summary
 void addCondition(int ai_conditionfieldid, CompareOperator a_operator, java.lang.Object aCompareValue)
          Adds a new legend condition to a comparable item.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 int getColumn()
           
 java.util.List<LegendCondition> getConditions()
           
 int getFieldid()
           
 java.lang.String getLegendDisplayText()
           
 int getOrder()
           
 int getRow()
          Returns the row number for this SubtextLegendItem.
 int getRowCount()
           
 int getRrn()
           
 java.lang.String getSampleProperty()
           
 int getTableid()
           
 boolean hasConditions()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setColumn(int column)
          Set the subtext column for SubtextLegendItems linked to complex multi-row (and usually multi-column) fields mostly used internally by Progeny.
 void setConditions(java.util.List<LegendCondition> a_subtextconditions)
          Sets the new Iterable list of comparable item conditions
 void setFieldid(int ai_fieldid)
          Sets the fieldid for the for this subtext legend item.
 void setLegendDisplayText(java.lang.String a_legendDisplayText)
          Sets the display text for the comparable item.
 void setOrder(int ai_order)
          Sets the order of display of this legend item within the subtext legend.
 void setRow(int row)
          Set the row number.
 void setRowCount(int ai_rowCount)
          Applies to flat text subtext lines that have \n delimiters effectively making them multi-line.
 void setRrn(int rrn)
          Set the zero based row number for this legend item derived from table if indeed the item is related to a subrow within a table.
 void setSampleProperty(java.lang.String value)
           
 void setTableid(int tableid)
          Set the tableid for this subtext legenditem.
 java.util.Map<java.lang.Integer,java.util.Vector<LegendCondition>> toConditionsMap()
           
 
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)

hasConditions

public boolean hasConditions()
Specified by:
hasConditions in interface ComparableLegendItem
Returns:
TRUE if the comparable item has some conditions associated with it.

getConditions

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

setConditions

public void setConditions(java.util.List<LegendCondition> a_subtextconditions)
Description copied from interface: ComparableLegendItem
Sets the new Iterable list of comparable item conditions

Specified by:
setConditions in interface ComparableLegendItem
Parameters:
a_subtextconditions - The new list of conidtions

getLegendDisplayText

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

setLegendDisplayText

public void setLegendDisplayText(java.lang.String a_legendDisplayText)
Description copied from interface: ComparableLegendItem
Sets the display text for the comparable item. This is what will be drawn on the left side of the comparable (subtext or legend item) line

Specified by:
setLegendDisplayText in interface ComparableLegendItem

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.

Items with negative order values relate to supertext

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.

If the ROW property of SubtextLegendItem is not set and has a default value then the row will be assigned to the new order. ROW and order are synonymous unless ROW is set to a different value. ROW values are usually explicitly set
in cases where the SubtextLegendItem is linked to a complex multi-row (and usually multi-column) field mostly used internally by Progeny.

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.

Negative values for ai_order signify supertext

getFieldid

public int getFieldid()
Returns:
The the fieldid for the for this subtext legend item. This fieldid must correspond to a DatabaseField in ProgenyAnywhere's data dictionary. If a person has subtext, they must have a Data object with the corresponding fieldid.

setFieldid

public void setFieldid(int ai_fieldid)
Sets the fieldid for the for this subtext legend item. This fieldid must correspond to a DatabaseField in ProgenyAnywhere's data dictionary. If a person has subtext, they must have a Data object with the corresponding fieldid.

Parameters:
ai_fieldid - The new fieldid for this subtext legend item

addCondition

public void addCondition(int ai_conditionfieldid,
                         CompareOperator a_operator,
                         java.lang.Object aCompareValue)
Description copied from interface: ComparableLegendItem
Adds a new legend condition to a comparable item. For subtext, only thos subtext (or symbols legend) items for persons with data that matches this condition will be shown

Specified by:
addCondition in interface ComparableLegendItem
Parameters:
ai_conditionfieldid - The ID of the field on which the condition is based
a_operator - The comparison operator used. Possible values enum values of #CompareOperator
aCompareValue - The value that must be matched by a person's data

toConditionsMap

public java.util.Map<java.lang.Integer,java.util.Vector<LegendCondition>> toConditionsMap()
Specified by:
toConditionsMap in interface ComparableLegendItem
Returns:
An map containing lists of conditions grouped by "FIELDID" or null if this comparable item does not have any conditions. The map contains a Map of LegendCondition item vectors keyed by "FIELDID" so that if there are two conditions in the list for the same fieldid the array/vector will have two entries each containing the condition.

getRow

public int getRow()
Returns the row number for this SubtextLegendItem. ROW and order (property getOrder()) are synonymous unless ROW is set to a different value. ROW values are usually explicitly set
in cases where the SubtextLegendItem is linked to a complex multi-row (and usually multi-column) field mostly used internally by Progeny.

Returns:
The row or line number on which the subtext linked to this legenditem must be rendered. Negative row values relate to supertext

setRow

public void setRow(int row)
Set the row number. ROW and order (property getOrder()) are synonymous unless ROW is set to a different value. ROW values are usually explicitly set
in cases where the SubtextLegendItem is linked to a complex multi-row (and usually multi-column) field mostly used internally by Progeny.

Parameters:
row - The row or line number on which the subtext linked to this legenditem must be rendered. Negative row values relate to supertext

getColumn

public int getColumn()
Returns:
The column on which the subtext linked to this legenditem must be rendered. If column is greater than one (1) then the subtext must be drawn to the right of another subtext item with same row number and a smaller column number.

setColumn

public void setColumn(int column)
Set the subtext column for SubtextLegendItems linked to complex multi-row (and usually multi-column) fields mostly used internally by Progeny. Ordinarily you should not have to worry about setting the column values for subtext legend items.

Parameters:
column - The column on which the subtext linked to this legenditem must be rendered. If column is greater than one (1) then the subtext must be drawn to the right of another subtext item with same row number and a smaller column number.

getTableid

public int getTableid()
Returns:
The tableid for this subtext legenditem. The default value is zero if the field in question is a non complex field. The field is set to a non-zero value if the subtextlegend item belongs to a subfield of a table field.

setTableid

public void setTableid(int tableid)
Set the tableid for this subtext legenditem. The default value is zero if the field in question is a non complex field. The field is set to a non-zero value if the subtextlegend item belongs to a subfield of a table field.

Parameters:
tableid - The new fieldid for the table or complex field

getRrn

public int getRrn()
Returns:
The zero based row number for this legend item derived from table if indeed the item is related to a subrow within a table. If a table field linked to this SubtextLegendItem has five (5) rows for instance, then the RRN will run from zero (0) to four (4)

setRrn

public void setRrn(int rrn)
Set the zero based row number for this legend item derived from table if indeed the item is related to a subrow within a table. If a table field linked to this SubtextLegendItem has five (5) rows for instance, then the RRN will run from zero (0) to four (4)

Parameters:
rrn - The zero based row number for this legend item derived from table if indeed the item is related to a subrow within a table

getRowCount

public int getRowCount()
Returns:
Applies to flat text subtext lines that have \n delimiters effectively making them multi-line. If this legend item is linked to any such subtext item then the return value will be equial to the maximum number of lines that have multiple lines from connected subtext lines. Otherwise return 0 or 1 by default. If there are no multi-line subtext items linked then 0 or 1 is returned.

setRowCount

public void setRowCount(int ai_rowCount)
Applies to flat text subtext lines that have \n delimiters effectively making them multi-line. If this legend item is linked to any such subtext item then the return value will be equial to the maximum number of lines that have multiple lines from connected subtext lines. Otherwise return 0 or 1 by default

Parameters:
ai_rowCount - The new maximum row count for this legend item.