com.objex.panywhere
Class SubtextLegend

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

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

This class defines the Legend for the Subtext elements of an Individual. The SubtextLegend contains any number of SubtextLegendItems that correspond to the custom data contained in the "dataitems" property of the Individual object. While there is only one SubtextLegend object for the whole control, as many instances of the legend are drawn as there are generations within the Pedigree, with each instance being rendered relative to the leftmost Individual within the generation. Rendering SubtextLegend can be switched on or off by setting the Pedigree.setShowSubtextLegend(Boolean) property.

See Also:
Serialized Form

Field Summary
static java.lang.String PROP_SAMPLE_PROPERTY
           
 
Constructor Summary
SubtextLegend()
          Creates a new SubtextLegend instance
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addSubtextLegendItem(SubtextLegendItem aItem)
          Add a new subtext legend item to the subtextlegend
 void addSubtextListener(SubtextListener listener)
          Interested classes must register to receieve Subtext Events
 void clearLegend()
          Clears the Subtext Legend.
 int count()
           
protected  void fireSubtextLegendItemAdded(SubtextEvent evt)
          Fires SubtextEvent events whenevenr a new subtext legend item has been added
protected  void fireSubtextLegendItemRemoved(SubtextEvent evt)
          Fires SubtextEvent events whenever a new subtext legend item has been removed
 double getHeight()
          Returns the maximum height of the subtext legend.
 int getItemCount()
           
 SubtextLegendItem getLegendItem(int ai_order)
           
 java.lang.String getSampleProperty()
           
 SubtextLegendItem getSubtextLegendItem(int ai_fieldid)
           
 java.util.Map<java.lang.Integer,SubtextLegendItem> getSubtextLegendItems()
           
 java.util.Iterator<SubtextLegendItem> getSubtextLegendIterator()
          Return an Iterable list of all SubtextLegendItems in this subtext legend.
 java.util.Iterator<SubtextLegendItem> getSubtextLegendIterator(boolean ab_odered)
          Return an Iterable list of all SubtextLegendItems in this subtext legend.
 double getWidth()
          Returns the maximum width of the subtext legend.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 SubtextLegendItem removeSubtextLegendItem(int ai_fieldid)
          Removes the SubtextLegendItem object corresponding to data field whose id is "ai_fieldid "
 void removeSubtextListener(SubtextListener listener)
          Used to removed SubtextListeners
protected  void render(java.awt.Graphics2D g2d, DrawingContext dc, double ad_genY, double ad_rightMargin)
          Draws all the SubtextLegendItem lines.
 void setHeight(double ai_height)
          Sets the maximum height of the subtext legend.
 void setSampleProperty(java.lang.String value)
           
 void setSubtextLegendItems(java.util.Map<java.lang.Integer,SubtextLegendItem> aSubtextLegendItems)
          Sets the new list of subtext legend Items
 void setWidth(double ai_width)
          Sets the maximum width of the subtext legend.
 
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

SubtextLegend

public SubtextLegend()
Creates a new SubtextLegend instance

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)

getSubtextLegendItem

public SubtextLegendItem getSubtextLegendItem(int ai_fieldid)
Returns:
A subtext legend item corresponding to the data fieldid "ai_fieldid" or null if the is no legend item for the specified datafield.

removeSubtextLegendItem

public SubtextLegendItem removeSubtextLegendItem(int ai_fieldid)
Removes the SubtextLegendItem object corresponding to data field whose id is "ai_fieldid "

Returns:
A subtext legend item corresponding to the data fieldid "ai_fieldid" or null if the is no legend item for the specified datafield.

addSubtextLegendItem

public void addSubtextLegendItem(SubtextLegendItem aItem)
Add a new subtext legend item to the subtextlegend

Parameters:
aItem - The Legend item object to be added

getWidth

public double getWidth()
Returns the maximum width of the subtext legend. This will typically cover the longest subtext item's text when drawn on the Pedigree surface.


setWidth

public void setWidth(double ai_width)
Sets the maximum width of the subtext legend. This will typically cover the longest subtext item's text when drawn on the Pedigree surface.

Parameters:
ai_width - The new maximum width for the subtext legend

getHeight

public double getHeight()
Returns the maximum height of the subtext legend. This will typically cover the tallest subtext item's text when drawn on the Pedigree surface.


setHeight

public void setHeight(double ai_height)
Sets the maximum height of the subtext legend. This will typically cover the tallest subtext item's text when drawn on the Pedigree surface.

Parameters:
ai_height - The new maximum height for the subtext legend

clearLegend

public void clearLegend()
Clears the Subtext Legend.


count

public int count()
Returns:
The current number of Subtext Legend Items

render

protected void render(java.awt.Graphics2D g2d,
                      DrawingContext dc,
                      double ad_genY,
                      double ad_rightMargin)
Draws all the SubtextLegendItem lines.

Parameters:
g2d - The graphics object
dc - The drawing context with the control's specific rendering properties. Of particular importance is the Font used for rendering subtext which is obtained from the "dc".
ad_genY - The Y-Coordinate of the leftmost Individual in the generation for which this SubtextLegend is being drawn
ad_rightMargin - The X-Coordinate of the leftmost Individual within the generation for which this SubtextLegend is being drawn. The SubtextLegendItems will be rendered relative to this X-Coordinate

addSubtextListener

public void addSubtextListener(SubtextListener listener)
Interested classes must register to receieve Subtext Events

Parameters:
listener - The SubtextListener object to be added or registered

removeSubtextListener

public void removeSubtextListener(SubtextListener listener)
Used to removed SubtextListeners

Parameters:
listener - The SubtextListener

fireSubtextLegendItemAdded

protected void fireSubtextLegendItemAdded(SubtextEvent evt)
Fires SubtextEvent events whenevenr a new subtext legend item has been added

Parameters:
evt - The AddEvent

fireSubtextLegendItemRemoved

protected void fireSubtextLegendItemRemoved(SubtextEvent evt)
Fires SubtextEvent events whenever a new subtext legend item has been removed

Parameters:
evt - The SubtextEvent

getSubtextLegendIterator

public java.util.Iterator<SubtextLegendItem> getSubtextLegendIterator()
Return an Iterable list of all SubtextLegendItems in this subtext legend. An empty iterator will be returned if there are no items in this legend. The iterator is in no particular order.


getSubtextLegendIterator

public java.util.Iterator<SubtextLegendItem> getSubtextLegendIterator(boolean ab_odered)
Return an Iterable list of all SubtextLegendItems in this subtext legend. An empty iterator will be returned if there are no items in this legend. if ab_odered is TRUE then the list returend is ordered by the SubtextLegenditem getOrder() property in ascending order. Otherwise the iterator is in no particular order.

Since:
3005

getSubtextLegendItems

public java.util.Map<java.lang.Integer,SubtextLegendItem> getSubtextLegendItems()
Returns:
A map of subtext legend Items

setSubtextLegendItems

public void setSubtextLegendItems(java.util.Map<java.lang.Integer,SubtextLegendItem> aSubtextLegendItems)
Sets the new list of subtext legend Items

Parameters:
aSubtextLegendItems - The new map of subtext legend Items

getItemCount

public int getItemCount()
Returns:
Number of SubtextLegendItems

getLegendItem

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