org.concord.biologica.ui
Class PedigreeLevel

java.lang.Object
  |
  +--org.concord.biologica.ui.PedigreeLevel

public final class PedigreeLevel
extends java.lang.Object

An object that manages the contents and layout of a generation in the pedigree view.


Constructor Summary
PedigreeLevel()
          Creates a new pedigree level.
 
Method Summary
 void addFamily(PedigreeFamily aPedigreeFamily)
          Add a family to this level.
 void addOrganism(PedigreeOrganism aPedigreeOrganism)
          Add an organism to this level.
 boolean contains(PedigreeFamily aPedigreeFamily)
          Does this level contain this pedigreeFamily
 boolean contains(PedigreeOrganism aPedigreeOrganism)
          Does this level contain this pedigreeOrganism? Looks within families and at stand-alone organisms.
 boolean containsOrganism(Organism anOrganism)
          Does this level contain this organism? Looks within families and at stand-alone organisms.
 PedigreeFamily findPedigreeFamily(Family aFamily)
          Find the PedigreeFamily at this level given the Family
 PedigreeOrganism findPedigreeOrganism(Organism anOrganism)
          Find the Pedigree Organism at this level given the Organism
 int getHeight()
          Get our height.
 java.awt.Point getLocation()
          Get our location.
 int getNumberOfFamilies()
          Get the number of families at this level.
 int getNumberOfOrganisms()
          Get the total number of organisms at this level.
 java.util.Enumeration getPedigreeObjects()
          Get an enumeration of all the PedigreeObjects in this level
 int getWidth()
          Get our width.
 boolean isEmpty()
          Is this level empty? True of there are no PedigreeObjects
 void paintConnections(java.awt.Graphics g, PedigreeOrganismView aPedigreeOrganismView, Trait trait, int fontHeight, SelectionSet selectionSet, SelectionSet highlightSet)
          Paint the level's connections given PedigreeOrganismView.
 void paintOrganisms(java.awt.Graphics g, PedigreeOrganismView aPedigreeOrganismView, Trait trait, int fontHeight, SelectionSet selectionSet, SelectionSet highlightSet)
          Paint the level's PedigreeOrganisms given PedigreeOrganismView.
 void placeConnections()
          Place the connections at this level.
 java.awt.Dimension placeFamilies(java.awt.Dimension bounds)
          Place all the families at this level.
 void removeAll()
          Remove everything from this level
 boolean removeFamily(PedigreeFamily aPedigreeFamily)
          Remove a family from this level.
 boolean removeObject(PedigreeObject aPedigreeObject)
          Remove an object from this level.
 boolean removeOrganism(PedigreeOrganism aPedigreeOrganism)
          Remove an organism from this level.
 void translate(int x, int y)
          Translate the level by the given amount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PedigreeLevel

public PedigreeLevel()
Creates a new pedigree level.
Method Detail

getLocation

public java.awt.Point getLocation()
Get our location.

Returns:
location Point - our location

getWidth

public int getWidth()
Get our width.

Returns:
width int - our width

getHeight

public int getHeight()
Get our height.

Returns:
height int - our height

getPedigreeObjects

public java.util.Enumeration getPedigreeObjects()
Get an enumeration of all the PedigreeObjects in this level
Returns:
Enumeration - Enumeration of the objects or an empty enumeration.

isEmpty

public boolean isEmpty()
Is this level empty? True of there are no PedigreeObjects
Returns:
boolean - true or false

addOrganism

public void addOrganism(PedigreeOrganism aPedigreeOrganism)
Add an organism to this level.

Parameters:
aPedigreeOrganism - PedigreeOrganism - an organism to add, may not be null
Throws:
java.lang.IllegalArgumentException - - input organism null

addFamily

public void addFamily(PedigreeFamily aPedigreeFamily)
Add a family to this level.

Parameters:
aPedigreeFamily - PedigreeFamily - a family to add, may not be null
Throws:
java.lang.IllegalArgumentException - - input family null

removeFamily

public boolean removeFamily(PedigreeFamily aPedigreeFamily)
Remove a family from this level.

Parameters:
aPedigreeOrganism - PedigreeOrganism - a family to remove, may not be null
Returns:
result boolean - success or not
Throws:
java.lang.IllegalArgumentException - - input organism null

removeOrganism

public boolean removeOrganism(PedigreeOrganism aPedigreeOrganism)
Remove an organism from this level.

Parameters:
aPedigreeOrganism - PedigreeOrganism - an organism to remove , may not be null
Returns:
result boolean - success or not
Throws:
java.lang.IllegalArgumentException - - input organism null

removeObject

public boolean removeObject(PedigreeObject aPedigreeObject)
Remove an object from this level.
Parameters:
aPedigreeObject - PedigreeObject - either an pedigree organism or a pedigree family
Returns:
boolean - true or false

removeAll

public void removeAll()
Remove everything from this level

getNumberOfOrganisms

public int getNumberOfOrganisms()
Get the total number of organisms at this level. Includes children within families and stand-alone organisms.
Returns:
int - total number of organisms.

getNumberOfFamilies

public int getNumberOfFamilies()
Get the number of families at this level.
Returns:
int - the number of families.

contains

public boolean contains(PedigreeFamily aPedigreeFamily)
Does this level contain this pedigreeFamily
Parameters:
aPedigreeFamily - PedigreeFamily - the pedigree family to find
Returns:
boolean - true or false

contains

public boolean contains(PedigreeOrganism aPedigreeOrganism)
Does this level contain this pedigreeOrganism? Looks within families and at stand-alone organisms.
Parameters:
aPedigreeOrganism - PedigreeOrganism - the pedigree organism to find
Returns:
boolean - true or false

containsOrganism

public boolean containsOrganism(Organism anOrganism)
Does this level contain this organism? Looks within families and at stand-alone organisms.
Parameters:
anOrganism - Organism - an organism
Returns:
boolean - true or false

findPedigreeFamily

public PedigreeFamily findPedigreeFamily(Family aFamily)
Find the PedigreeFamily at this level given the Family
Parameters:
aFamily - Family - the Family
Returns:
PedigreeFamily - the PedigreeFamily or null if not found

findPedigreeOrganism

public PedigreeOrganism findPedigreeOrganism(Organism anOrganism)
Find the Pedigree Organism at this level given the Organism
Parameters:
anOrganism - Organism - the Organism
Returns:
PedigreeOrganism - the PedigreeOrganism or null if not found

translate

public void translate(int x,
                      int y)
Translate the level by the given amount.

Parameters:
x - int - x position to set
y - int - y position to set

placeFamilies

public java.awt.Dimension placeFamilies(java.awt.Dimension bounds)
Place all the families at this level. Position them horizontally given the bounds dimension supplied. Loops over objects at this level placing them and repeatedly squeezing them until they fit horizontally.
Parameters:
bounds - Dimension - dimension (especially width) the level is to be placed within.
Returns:
Dimension - resulting dimension this level will use when drawn.

placeConnections

public void placeConnections()
Place the connections at this level.

paintConnections

public void paintConnections(java.awt.Graphics g,
                             PedigreeOrganismView aPedigreeOrganismView,
                             Trait trait,
                             int fontHeight,
                             SelectionSet selectionSet,
                             SelectionSet highlightSet)
Paint the level's connections given PedigreeOrganismView.

The caller of this method must set the foreground and background colors of the Graphics object before calling this method.

Parameters:
g - Graphics - graphics object to use in painting
pedigreeOrganismView - PedigreeOrganismView - the pedigree organism view
trait - Trait - the trait to show, may be null
fontHeight - int - the font height
selectionSet - - the selection set

paintOrganisms

public void paintOrganisms(java.awt.Graphics g,
                           PedigreeOrganismView aPedigreeOrganismView,
                           Trait trait,
                           int fontHeight,
                           SelectionSet selectionSet,
                           SelectionSet highlightSet)
Paint the level's PedigreeOrganisms given PedigreeOrganismView.

The caller of this method must set the foreground and background colors of the Graphics object before calling this method.

Parameters:
g - Graphics - graphics object to use in painting
pedigreeOrganismView - PedigreeOrganismView - the pedigree organism view
trait - Trait - the trait to show, may be null
fontHeight - int - the font height
selectionSet - - the selection set
highlightSet - - the highlight set