com.objex.panywhere
Class Subtext

java.lang.Object
  extended by com.objex.panywhere.Subtext
All Implemented Interfaces:
java.io.Serializable

public class Subtext
extends java.lang.Object
implements java.io.Serializable

This class defines an object that contains the subtext lines or items. A Subtext object contains one of more subtext items of type Subtext.SubtextItem. A Subtext.SubtextItem object corresponds to the SubtextLegendItem with the same order / line number. Note that this an auxilliary object used only for the display of subtext lines on the Pedigree. The storage and persistence of the actual data relating to the SubtextItem's in this object are stored as Data properties within the Individual object.

See Also:
SubtextLegendItem, Serialized Form

Nested Class Summary
static class Subtext.MultiColumnSubtextItem
          A subtext item that encapsulates a row with more than one subtext items or columns on one row.
static class Subtext.SubtextItem
          Represents a Subtext line or item.
 
Field Summary
static java.lang.String PROP_SAMPLE_PROPERTY
           
 
Constructor Summary
Subtext()
          Creates a new Subtext object for the display of iconsubtext lines
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addSubtextItem(Subtext.SubtextItem aItem, int ai_line)
          Adds a new SubtextItem to the list of SubtextItems making up this Subtext object
 void addSubtextItem(Subtext.SubtextItem aItem, int ai_line, int ai_subitem_row)
          Adds a new SubtextItem that is is linked to a table subfield.
 void clear()
          Clears the current subtext items
 Subtext.SubtextItem getItem(int ai_order)
           
 Subtext.SubtextItem getItem(int ai_mainrow_order, int ai_subitem_order)
           
 java.lang.String getSampleProperty()
           
 java.util.Map<java.lang.Integer,Subtext.SubtextItem> getSubtextItems()
           
 java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,Subtext.SubtextItem>> getTablesubtextItems()
           
 boolean isEmpty()
           
protected  boolean isRenderNullItem(SubtextLegend aLegend, int ai_cur_subtext_order, boolean ab_rendering_supertext)
          Look ahead of the current subtext item to see if there is at least another non-null subtext item.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removeSubtextItem(int ai_line)
          Removes the SubtextItem to at the specified item line
 void removeSubtextItem(int ai_line, int ai_subitem_row)
          Removes the SubtextItem to at the specified item line and subline.
protected  void render(java.awt.Graphics2D g2d, DrawingContext dc, double indX, double indY, MarkerData a_chromo_data, SubtextLegend aLegend)
          Draws all the subtext lines making up this Subtext object.
protected  void renderMarkers(double ad_indx, MarkerData a_chromo_data, boolean showHaplotypeBars, java.awt.Graphics2D g2d, double starty, DrawingContext dc)
           
protected  double renderNoLegend(java.awt.Graphics2D g2d, DrawingContext dc, double indX, double indY, SubtextLegend aLegend)
           
protected  java.awt.font.TextLayout renderNullItem(java.awt.Font lFont, double ld_indx, double starty, double w, java.awt.Graphics2D g2d, java.awt.Color lWasColor, boolean ab_render)
          get a fake layout object for this non present subtext item
protected  void renderSupertext(java.awt.Graphics2D g2d, DrawingContext dc, double indX, double indY, SubtextLegend aLegend)
           
 void setSampleProperty(java.lang.String value)
           
 void setSubtextItems(java.util.Map<java.lang.Integer,Subtext.SubtextItem> aSubtextItems)
           
 void setTablesubtextItems(java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,Subtext.SubtextItem>> tablesubtextItems)
           
 
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

Subtext

public Subtext()
Creates a new Subtext object for the display of iconsubtext lines

Method Detail

getTablesubtextItems

public java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,Subtext.SubtextItem>> getTablesubtextItems()
Returns:
The list of table subtext items where the key is the ROWID for the main table while the inner map is keyed by the rowoder within the table.

setTablesubtextItems

public void setTablesubtextItems(java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,Subtext.SubtextItem>> tablesubtextItems)
Parameters:
tablesubtextItems - Set the new list of table subtext items

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)

addSubtextItem

public void addSubtextItem(Subtext.SubtextItem aItem,
                           int ai_line)
Adds a new SubtextItem to the list of SubtextItems making up this Subtext object

Parameters:
aItem - The new SubtextItem
ai_line - The line number for the new item. This determines where on the list this item will be drawn. The line number also corresponds to the order number within the subtext legend to which this item is linked.

addSubtextItem

public void addSubtextItem(Subtext.SubtextItem aItem,
                           int ai_line,
                           int ai_subitem_row)
Adds a new SubtextItem that is is linked to a table subfield.

Parameters:
ai_subitem_row - The row within the tabledata
aItem - The new SubtextItem
ai_line - The line number for the new item. This determines where on the list this item will be drawn. The line number also corresponds to the order number within the subtext legend to which this item is linked.

removeSubtextItem

public void removeSubtextItem(int ai_line)
Removes the SubtextItem to at the specified item line

Parameters:
ai_line - The line number for the item to be removed

removeSubtextItem

public void removeSubtextItem(int ai_line,
                              int ai_subitem_row)
Removes the SubtextItem to at the specified item line and subline. This is for removing items that are linked to a subfield of a table

Parameters:
ai_line - The line number for the item to be removed
ai_subitem_row - The row within the tabledata

isRenderNullItem

protected boolean isRenderNullItem(SubtextLegend aLegend,
                                   int ai_cur_subtext_order,
                                   boolean ab_rendering_supertext)
Look ahead of the current subtext item to see if there is at least another non-null subtext item. If none is found then this Item is a potential subject for skipping if itself is empty

Parameters:
ai_cur_subtext_order - The subtext item that is being considered for rendering.
aLegend - The subtext legend from which subtext data order and properties will be derived. If this subtext only a subset of the subtext items that exist on the legend, blank spaces are drawn in the place of those subtext elements that are non-existent.
ab_rendering_supertext - If true then the null item check is for rendering supertext

render

protected void render(java.awt.Graphics2D g2d,
                      DrawingContext dc,
                      double indX,
                      double indY,
                      MarkerData a_chromo_data,
                      SubtextLegend aLegend)
Draws all the subtext lines making up this Subtext object. The order of rendering of items depends on the line number for each item. This method also draws any markers on chromosome "aChromosome". A blank/null subtext item will be rendered IFF there are markers under the subtext or there are some non-null items below it.

Parameters:
g2d - The graphics context
dc - The drawing context
indX - The X-Coodirnate of the Individual whose subtext this is
indY - The Y-Coodirnate of the Individual whose subtext this is
a_chromo_data - The genetic data comprising chromsomes assigned to this Individual
aLegend - The subtext legend from which subtext data order and properties will be derived.

renderNullItem

protected java.awt.font.TextLayout renderNullItem(java.awt.Font lFont,
                                                  double ld_indx,
                                                  double starty,
                                                  double w,
                                                  java.awt.Graphics2D g2d,
                                                  java.awt.Color lWasColor,
                                                  boolean ab_render)
get a fake layout object for this non present subtext item


renderMarkers

protected void renderMarkers(double ad_indx,
                             MarkerData a_chromo_data,
                             boolean showHaplotypeBars,
                             java.awt.Graphics2D g2d,
                             double starty,
                             DrawingContext dc)

getSubtextItems

public java.util.Map<java.lang.Integer,Subtext.SubtextItem> getSubtextItems()
Returns:
A Map of subtextitems that belong to this subtext

setSubtextItems

public void setSubtextItems(java.util.Map<java.lang.Integer,Subtext.SubtextItem> aSubtextItems)

clear

public void clear()
Clears the current subtext items


getItem

public Subtext.SubtextItem getItem(int ai_order)
Parameters:
ai_order - The line number/order for the SubtextItem to be returned
Returns:
The SubtextItem at the specified order. May return null if no item is found with speified order

getItem

public Subtext.SubtextItem getItem(int ai_mainrow_order,
                                   int ai_subitem_order)
Parameters:
ai_mainrow_order - The line number/order for the SubtextItem to be returned
ai_subitem_order - The subitem line number
Returns:
The SubtextItem at the specified order. May return null if no item is found with speified order

renderSupertext

protected void renderSupertext(java.awt.Graphics2D g2d,
                               DrawingContext dc,
                               double indX,
                               double indY,
                               SubtextLegend aLegend)

isEmpty

public boolean isEmpty()
Returns:
TRUE if there are no subtext items in this subtext object

renderNoLegend

protected double renderNoLegend(java.awt.Graphics2D g2d,
                                DrawingContext dc,
                                double indX,
                                double indY,
                                SubtextLegend aLegend)