org.concord.biologica.ui
Class PedigreeFamily

java.lang.Object
  |
  +--org.concord.biologica.ui.PedigreeObject
        |
        +--org.concord.biologica.ui.PedigreeFamily

public final class PedigreeFamily
extends PedigreeObject

An object that manages the state for a family in the pedigree view.


Fields inherited from class org.concord.biologica.ui.PedigreeObject
height, width, xLocation, yLocation
 
Constructor Summary
PedigreeFamily(PedigreeOrganismView pedigreeOrganismView, Family aFamily, PedigreeOrganism aMotherPedigreeOrganism, PedigreeOrganism aFatherPedigreeOrganism, java.util.Vector aChildPedigreeOrganisms)
          Creates a new pedigree family
 
Method Summary
 void addChildren(java.util.Vector newChildren, PedigreeOrganismView aPedigreeOrganismView)
          Add the given children to the family.
 boolean canSqueeze()
          Can the family be squeezed any more? Enforces the maximum squeeze factor.
 boolean contains(PedigreeOrganism aPedigreeOrganism)
          Does this family contain this pedigreeOrganism
 boolean containsOrganism(Organism anOrganism)
          Does this family contain this Organism?
 PedigreeOrganism findPedigreeOrganism(Organism anOrganism)
          Find the PedigreeOrganism given the Organism.
 PedigreeOrganism getBottomMostChild()
          Get the bottommost child organism.
 java.util.Enumeration getChildPedigreeOrganisms()
          Get an enumeration over the set of child pedigree organisms in this family
 Family getFamily()
          Get the family for this PedigreeFamily.
 PedigreeOrganism getFatherPedigreeOrganism()
          Get the father PedigreeOrganism
 PedigreeOrganism getLeftMostChild()
          Get the leftmost child organism.
 int getLeftMostParentX()
          Get the X location of the leftmost parent in this family.
 void getMinimumMaximum(java.awt.Point aMinPoint, java.awt.Point aMaxPoint)
          Get the minimum and maximum positions for children of this family.
 PedigreeOrganism getMotherPedigreeOrganism()
          Get the mother PedigreeOrganism
 int getNumberOfChildren()
          Get the number of children for this family.
 PedigreeOrganism getRightMostChild()
          Get the rightmost child organism.
 int getRightMostParentX()
          Get the X location of the rightmost parent in this family.
 int getSqueezeFactor()
          Accessor for squeeze factor.
 PedigreeOrganism getTopMostChild()
          Get the topmost child organism.
 boolean isEmpty()
          Is this family empty? True if there are no children.
 void paint(java.awt.Graphics g, PedigreeOrganismView aPedigreeOrganismView, Trait trait, int fontHeight, SelectionSet selectionSet, SelectionSet highlightSet)
          Paint the Families and Organisms with the given Graphics object on the given PedigreeOrganismView.
 void paintConnections(java.awt.Graphics g, PedigreeOrganismView aPedigreeOrganismView, Trait trait, int fontHeight, SelectionSet selectionSet, SelectionSet highlightSet)
          Paint the connections with the given Graphics object on the given PedigreeOrganismView.
 boolean pickForSnip(int xPick, int yPick)
          Pick this object, determining if the given x,y location is on the object.
 java.awt.Dimension placeChildren()
          Loop through the children and set their relative placement
 void placeConnections()
          Place the connections.
 boolean removeChildPedigreeOrganism(PedigreeOrganism aChildPedigreeOrganism)
          Remove a child pedigree organism, presumably because the child was deleted
 void removeChildren(PedigreeOrganismView aPedigreeOrganismView)
          Remove the children of this family.
 void resetSqueezeFactor()
          Accessor for resetting the squeeze factor.
 java.awt.Dimension squeeze()
          Public interface for squeezing family and redoing the placement.
 void translate(int xDelta, int yDelta)
          Translate the family by the given amount.
 boolean within(int xTopLeft, int yTopLeft, int xBottomRight, int yBottomRight)
          Is this family within the given rectangle? We'll consider a family within the rectangle if the rectangle contains some portion of the child bar, parent bar or vertical bar.
 
Methods inherited from class org.concord.biologica.ui.PedigreeObject
getBottomMidPoint, getHeight, getTopLeftPoint, getTopMidPoint, getWidth, getXLocation, getYLocation, pick, setHeight, setWidth, setXLocation, setYLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PedigreeFamily

public PedigreeFamily(PedigreeOrganismView pedigreeOrganismView,
                      Family aFamily,
                      PedigreeOrganism aMotherPedigreeOrganism,
                      PedigreeOrganism aFatherPedigreeOrganism,
                      java.util.Vector aChildPedigreeOrganisms)
Creates a new pedigree family
Parameters:
pedigreeOrganismView - PedigreeOrganismView - the view
aFamily - Family - the family, may not be null
aMotherPedigreeOrganism - PedigreeOrganism - mother pedigree organism, may not be null
aFatherPedigreeOrganism - PedigreeOrganism - father pedigree organism, may not be null
aChildPedigreeOrganisms - Vector - vector of child pedigree organisms, may not be null
Method Detail

getFamily

public Family getFamily()
Get the family for this PedigreeFamily.
Returns:
Family - the family

getMotherPedigreeOrganism

public PedigreeOrganism getMotherPedigreeOrganism()
Get the mother PedigreeOrganism
Returns:
PedigreeOrganism - the mother pedigree organism

getFatherPedigreeOrganism

public PedigreeOrganism getFatherPedigreeOrganism()
Get the father PedigreeOrganism
Returns:
PedigreeOrganism - the father pedigree organism

getLeftMostParentX

public int getLeftMostParentX()
Get the X location of the leftmost parent in this family.

Overrides:
getLeftMostParentX in class PedigreeObject
Returns:
int - X location

getRightMostParentX

public int getRightMostParentX()
Get the X location of the rightmost parent in this family.

Overrides:
getRightMostParentX in class PedigreeObject
Returns:
int - X location

getLeftMostChild

public PedigreeOrganism getLeftMostChild()
Get the leftmost child organism.

Returns:
PedigreeOrganism - leftmost child organism.

getRightMostChild

public PedigreeOrganism getRightMostChild()
Get the rightmost child organism.

Returns:
PedigreeOrganism - rightmost child organism.

getTopMostChild

public PedigreeOrganism getTopMostChild()
Get the topmost child organism.

Returns:
PedigreeOrganism - topmost child organism.

getBottomMostChild

public PedigreeOrganism getBottomMostChild()
Get the bottommost child organism.

Returns:
PedigreeOrganism - bottommost child organism.

getMinimumMaximum

public void getMinimumMaximum(java.awt.Point aMinPoint,
                              java.awt.Point aMaxPoint)
Get the minimum and maximum positions for children of this family.
Overrides:
getMinimumMaximum in class PedigreeObject
Parameters:
Point - - minimum point. Point is set by this method.
Point - - maximum point. Point is set by this method.

getChildPedigreeOrganisms

public java.util.Enumeration getChildPedigreeOrganisms()
Get an enumeration over the set of child pedigree organisms in this family
Returns:
Enumeration - enumeration over the set of child pedigree organisms in this family

getNumberOfChildren

public int getNumberOfChildren()
Get the number of children for this family.

Returns:
int - the number of children.

isEmpty

public boolean isEmpty()
Is this family empty? True if there are no children.

Returns:
boolean - true or false.

contains

public boolean contains(PedigreeOrganism aPedigreeOrganism)
Does this family contain this pedigreeOrganism
Parameters:
aPedigreeOrganism - PedigreeOrganism - the pedigree organism to find
Returns:
boolean - true or false

containsOrganism

public boolean containsOrganism(Organism anOrganism)
Does this family contain this Organism?

Parameters:
anOrganism - Organism - the organism to find
Returns:
boolean - true or false

findPedigreeOrganism

public PedigreeOrganism findPedigreeOrganism(Organism anOrganism)
Find the PedigreeOrganism given the Organism.

Parameters:
anOrganism - Organism - the organism to find
Returns:
PedigreeOrganism - the found PedigreeOrganism or null.

addChildren

public void addChildren(java.util.Vector newChildren,
                        PedigreeOrganismView aPedigreeOrganismView)
Add the given children to the family.

Current inconsistency: Didn't see the value in creating all the child pedigree organisms in the View, but I guess it's so to be able to add the listener and get the size info. Should move this logic back to the view, I guess.

Parameters:
newChildren - Vector - the children to add to the family.
aPedigreeOrganismView - aPedigreeOrganismView - the view

removeChildren

public void removeChildren(PedigreeOrganismView aPedigreeOrganismView)
Remove the children of this family.

Current inconsistency: same as for add. This could be in the view.

Parameters:
aPedigreeOrganismView - PedigreeOrganismView - the view

removeChildPedigreeOrganism

public boolean removeChildPedigreeOrganism(PedigreeOrganism aChildPedigreeOrganism)
Remove a child pedigree organism, presumably because the child was deleted
Parameters:
aChildPedigreeOrganism - PedigreeOrganism - the pedigree organism to remove
Returns:
boolean - was child successfully found and removed?

translate

public void translate(int xDelta,
                      int yDelta)
Translate the family by the given amount.

Overrides:
translate in class PedigreeObject
Parameters:
xDelta - int - x delta
yDelta - int - y delta

getSqueezeFactor

public int getSqueezeFactor()
Accessor for squeeze factor.

Returns:
int - the squeeze factor.

resetSqueezeFactor

public void resetSqueezeFactor()
Accessor for resetting the squeeze factor.

Overrides:
resetSqueezeFactor in class PedigreeObject

canSqueeze

public boolean canSqueeze()
Can the family be squeezed any more? Enforces the maximum squeeze factor. Also covers shortcomings in the squeezing algorithm (placeChildren). Special cases are mostly empirical.
Overrides:
canSqueeze in class PedigreeObject
Returns:
boolean - true or false

squeeze

public java.awt.Dimension squeeze()
Public interface for squeezing family and redoing the placement.

Overrides:
squeeze in class PedigreeObject
Returns:
Dimension - resulting dimension after placing family.

placeChildren

public java.awt.Dimension placeChildren()
Loop through the children and set their relative placement

Overrides:
placeChildren in class PedigreeObject
Returns:
Dimension - resulting dimension family will be drawn in

placeConnections

public void placeConnections()
Place the connections.

Overrides:
placeConnections in class PedigreeObject

paint

public void paint(java.awt.Graphics g,
                  PedigreeOrganismView aPedigreeOrganismView,
                  Trait trait,
                  int fontHeight,
                  SelectionSet selectionSet,
                  SelectionSet highlightSet)
Paint the Families and Organisms with the given Graphics object on the given PedigreeOrganismView.

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

Overrides:
paint in class PedigreeObject
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 - SelectionSet - the view's selection set
highlightSet - SelectionSet - the view's highlight set

paintConnections

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

Other positions - the ends of the bars and the locations of the lines drawn from the child and parents bars to the children and parents respectively are derived from the positions of the parents and children.

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

Overrides:
paintConnections in class PedigreeObject
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 - SelectionSet - the view's selection set
highlightSet - SelectionSet - the view's highlight set

pickForSnip

public boolean pickForSnip(int xPick,
                           int yPick)
Pick this object, determining if the given x,y location is on the object.

Parameters:
xPick - int - x location of pick
yPick - int - y location of pick
Returns:
boolean - is object at the given pick location

within

public boolean within(int xTopLeft,
                      int yTopLeft,
                      int xBottomRight,
                      int yBottomRight)
Is this family within the given rectangle? We'll consider a family within the rectangle if the rectangle contains some portion of the child bar, parent bar or vertical bar. Otherwise it won't be within. This means a rectangle crossing the lines from the parent bar to the parent organism or crossing the lines from the child bar to the child organisms will not qualify as within.

Overrides:
within in class PedigreeObject
Parameters:
xTopLeft - int - x top left coordinate
yTopLeft - int - y top left coordinate
xBottomRight - int - x bottom right coordinate
yBottomRight - int - y bottom right coordinate
Returns:
boolean - is the object within the given rectangle?