org.strbio.mol.lib.pred2ary
Class ProfileDisplayArea

java.lang.Object
  extended by org.strbio.mol.lib.pred2ary.ProfileDisplayArea

public class ProfileDisplayArea
extends java.lang.Object

This represents an area in object that will want to display some proteins in an area. This has to be something that will want to paint into a Graphics object; when it does, it calls ProteinDisplayArea to do the work. This is not an subclass of JComponent or Canvas, in order to be able to print on anything.

  Version 1.0, 6/8/98 - original version
  

Version:
1.0, 6/8/98
Author:
JMC

Nested Class Summary
 class ProfileDisplayArea.ClickedArea
          This class keeps track of rectangular areas of interest, and tells which one has been clicked on.
 
Field Summary
protected  ColorScale blueScale
           
protected  int boxHeight
           
protected  int boxOffset
           
 ProfileDisplayArea.ClickedArea clickedArea
          Keep track of interesting rectangles (where sequences are drawn)
 int clickedProtein
           
 int clickedSequence
           
protected  java.awt.Font f
          Font used for text labels.
protected  java.awt.Font fBold
           
 int fontHeight
           
 int fontWidth
           
 boolean graphPrediction
           
protected  ColorScale greenScale
           
static int MAX_NAME_PRINTED
          maximum length of a name to print (beyond gets truncated)
 int maxLength
          largest protein length in set
 int maxNameLength
          largest name length in set
 int maxSeqNameLength
          largest name of a sequence
protected  int maxX
          Preferred width of component.
protected  int maxY
          Preferred height of component.
 ProfileSet p
          Profiles to display.
protected  int padX
          Padding constant for X dimension.
protected  int padY
          Padding constant for Y dimension.
 java.awt.Component parent
          This is the component this is displayed in.
protected  ColorScale redScale
          Color scales to draw things in.
 boolean sequenceClicked
           
 boolean showCorrect
           
 boolean showPrediction
           
 boolean showProfile
          What exactly to show?
 boolean wrapLines
           
 int wrapPos
           
 
Constructor Summary
ProfileDisplayArea(ProfileSet ps, java.awt.Component par, int fontSize)
          Initialize with given parent container.
 
Method Summary
 void calcMaxNameLength()
          Figure out the maximum name length in the set.
 int calcWrapPos(int pageWidth)
          returns the number of chars in the sequence that will fit on a page with a given width.
 java.awt.Dimension getPreferredSize()
          This gets the preferred size of the component; the parent container should probably just return this.
 void paint(java.awt.Graphics g, java.awt.Rectangle viewRect)
          Paint the area within a viewport; the parent component should provide the dimensions.
 int paintArea(java.awt.Graphics g, int yLo, int yHi)
          Paint graphics from y=yLo to y=yHi.
 void reRender()
           
 void setFont(java.lang.String fName, int fSize)
          Set font to draw labels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

public java.awt.Component parent
This is the component this is displayed in. The area is really part of the component, but must be kept separate to make it independent of component type (i.e. Swing or non-Swing).


p

public ProfileSet p
Profiles to display.


maxNameLength

public int maxNameLength
largest name length in set


maxSeqNameLength

public int maxSeqNameLength
largest name of a sequence


maxLength

public int maxLength
largest protein length in set


MAX_NAME_PRINTED

public static final int MAX_NAME_PRINTED
maximum length of a name to print (beyond gets truncated)

See Also:
Constant Field Values

maxX

protected int maxX
Preferred width of component.


maxY

protected int maxY
Preferred height of component.


f

protected java.awt.Font f
Font used for text labels. This should be monospaced.


fBold

protected java.awt.Font fBold

fontWidth

public int fontWidth

fontHeight

public int fontHeight

boxHeight

protected int boxHeight

boxOffset

protected int boxOffset

padX

protected final int padX
Padding constant for X dimension.

See Also:
Constant Field Values

padY

protected final int padY
Padding constant for Y dimension.

See Also:
Constant Field Values

clickedArea

public final ProfileDisplayArea.ClickedArea clickedArea
Keep track of interesting rectangles (where sequences are drawn)


redScale

protected final ColorScale redScale
Color scales to draw things in.


greenScale

protected final ColorScale greenScale

blueScale

protected final ColorScale blueScale

showProfile

public boolean showProfile
What exactly to show?


wrapLines

public boolean wrapLines

wrapPos

public int wrapPos

graphPrediction

public boolean graphPrediction

showCorrect

public boolean showCorrect

showPrediction

public boolean showPrediction

sequenceClicked

public boolean sequenceClicked

clickedProtein

public int clickedProtein

clickedSequence

public int clickedSequence
Constructor Detail

ProfileDisplayArea

public ProfileDisplayArea(ProfileSet ps,
                          java.awt.Component par,
                          int fontSize)
Initialize with given parent container.

Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
This gets the preferred size of the component; the parent container should probably just return this.


setFont

public void setFont(java.lang.String fName,
                    int fSize)
Set font to draw labels.


calcWrapPos

public int calcWrapPos(int pageWidth)
returns the number of chars in the sequence that will fit on a page with a given width.


calcMaxNameLength

public void calcMaxNameLength()
Figure out the maximum name length in the set.


paintArea

public int paintArea(java.awt.Graphics g,
                     int yLo,
                     int yHi)
Paint graphics from y=yLo to y=yHi. Return first y that needs to go on the next page, or 0 if everything printed.


paint

public void paint(java.awt.Graphics g,
                  java.awt.Rectangle viewRect)
Paint the area within a viewport; the parent component should provide the dimensions.


reRender

public void reRender()