gov.lbl.genome.gui
Class Picture

java.lang.Object
  extended by gov.lbl.genome.gui.Picture
Direct Known Subclasses:
AnnotationPanelPicture, AxisPanelPicture, ChromPanelPicture, ContigPanelPicture, RepeatPanelPicture

public class Picture
extends java.lang.Object

Title: Picture

Description: Some panel require intermediate class for drawing. This class provides basic methods for drawing pictures

Copyright: Copyright (c) 2002 Ernest Orlando Lawrence Berkeley National Laboratory

Company: LBNL


Field Summary
protected  javax.swing.JComponent component
           
protected  boolean debug
           
protected  java.text.DecimalFormat df
           
protected  java.awt.Graphics g
           
protected  java.awt.Graphics2D g2d
           
protected  boolean G2D
           
protected  int height
           
protected  java.awt.image.BufferedImage image
           
protected  int imageableHeight
           
protected  int imageableWidth
           
protected  int marginBottom
           
protected  int marginLeft
           
protected  int marginRight
           
protected  int marginTop
           
protected  int maxHeight
           
protected  int maxWidth
           
protected  long maxX
           
protected  long minX
           
protected  java.lang.String name
           
protected  double pixelWidth
           
protected  boolean tooSmall
           
protected  VistaApp va
           
protected  int width
           
protected  int z
           
 
Constructor Summary
Picture(VistaApp vapp, java.lang.String name)
          Picture
 
Method Summary
protected  int convertX(double x)
          convert cromosome coordinate to the picture coordinate
protected  int convertX(long x)
          convert cromosome coordinate to the picture coordinate
 void debug(java.lang.String s)
          pring debuging output
 void drawPicture(java.awt.Graphics gr)
          draw Picture
 void drawPicture(java.awt.Graphics gr, int width, int height)
          draw Picture
 void drawPicture(java.awt.Graphics gr, javax.swing.JComponent comp)
          draw Picture
 void drawPicture(java.awt.Graphics gr, javax.swing.JComponent comp, int i)
          draw Picture
 void drawPicture(java.awt.Graphics gr, java.awt.print.PageFormat pf)
          draw Picture
 void drawPicture(java.awt.Graphics gr, java.awt.print.PageFormat pf, int line)
          draw Picture
 long getDX()
          return maxX-minX
 java.lang.String getFormattedNumberString(double x, int maxFracDigits)
          return Formatted Number String
 java.lang.String getFormattedNumberString(int x, int maxFracDigits)
          return Formatted Number String
 java.lang.String getFormattedXDisplayString(int currXPos)
          return Formatted String converted to the chromosome coordinates
 int getHeight()
          return picture Height
 java.awt.image.BufferedImage getImage()
          return new Image with default size
 java.awt.image.BufferedImage getImage(int width, int height)
          return new Image with the size specified by parameters
 java.awt.image.BufferedImage getImage(javax.swing.JComponent comp)
          return new Image with the size equals to the componet size
 java.awt.image.BufferedImage getImage(javax.swing.JComponent comp, int i)
          return new Image with the size equals to the componet size
 java.awt.image.BufferedImage getImage(java.awt.print.PageFormat pf)
          return new Image with the size equals to the page size
 int getImageableHeight()
          return height of the Imageable rectangle
 int getImageableWidth()
          return width of the Imageable rectangle
 int getMarginBottom()
          return bottom Margin
 int getMarginLeft()
          return left Margin
 int getMarginRight()
          return right Margin
 int getMarginTop()
          return top Margin
 int getMaxHeight()
          return Max drawable Height
 int getMaxWidth()
          return tMax drawable Width
 double getRelX(double x)
          eturn relative position from the begining
 double getRelX(long x)
          return relative position from the begining
 int getStringWidth(java.lang.String s, java.awt.Font f)
          return Width (in pixels) of the string
 int getWidth()
          return picture Width
 long getXDisplay(int currXPos)
          convert the parameter into chromosome coordinates
 void setComponent(javax.swing.JComponent comp)
          set Component
 void setDebug(boolean d)
          set Debuging mode
 void setImageableArea(int left, int top, int width, int height)
          set Imageable Area from the parameters
 void setImageableArea(java.awt.print.PageFormat pf)
          setI mageable Area from the pages Imageable area
 void setMarginRight(int x)
          set right Margin
 void setMargins(int left, int top, int right, int bottom)
          set Margins from the parameters
 void setMargins(java.awt.print.PageFormat pf)
          set Margins from the page margins
 void setMaxX(int i)
          set Max X
 void setMaxX(long maxx)
          set Max X
 void setMinMaxX(int i)
          set Min and Max X
 void setMinMaxX(long minx, long maxx)
          set Min and Max X
 void setMinX(int i)
          set Min X
 void setMinX(long minx)
          set Min X
 void setPage(java.awt.print.PageFormat pf)
          set Page
 void setSize()
          set size from the default component
 void setSize(int width, int height)
          set Size from the parameters
 void setSize(javax.swing.JComponent comp)
          set size from the component
 void setSize(java.awt.print.PageFormat pf)
          set Size from the page
 void setZ(int Z)
          this parameter can be 0 or 1.
 java.lang.String shortenString(java.lang.String s, java.awt.Font f, int width)
          remove last characters from the string until its width is less or equal the maximum parameter
 java.lang.String toString()
          return summary string
 void translate(int x, int y)
          translate imageable area
 void translate(int x, int y, int x1, int y1)
          change size and position of the imageable area
 int X(int x)
          correct x coordinates
 int Y(int y)
          correct y coordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

va

protected VistaApp va

width

protected int width

height

protected int height

imageableWidth

protected int imageableWidth

imageableHeight

protected int imageableHeight

marginLeft

protected int marginLeft

marginRight

protected int marginRight

marginTop

protected int marginTop

marginBottom

protected int marginBottom

maxWidth

protected int maxWidth

maxHeight

protected int maxHeight

pixelWidth

protected double pixelWidth

g

protected java.awt.Graphics g

g2d

protected java.awt.Graphics2D g2d

df

protected java.text.DecimalFormat df

name

protected java.lang.String name

debug

protected boolean debug

G2D

protected boolean G2D

component

protected javax.swing.JComponent component

image

protected java.awt.image.BufferedImage image

minX

protected long minX

maxX

protected long maxX

tooSmall

protected boolean tooSmall

z

protected int z
Constructor Detail

Picture

public Picture(VistaApp vapp,
               java.lang.String name)
Picture

Parameters:
vapp - VistaApp
name - String
Method Detail

getImage

public java.awt.image.BufferedImage getImage()
return new Image with default size

Returns:
BufferedImage

getImage

public java.awt.image.BufferedImage getImage(javax.swing.JComponent comp,
                                             int i)
return new Image with the size equals to the componet size

Returns:
BufferedImage

getImage

public java.awt.image.BufferedImage getImage(javax.swing.JComponent comp)
return new Image with the size equals to the componet size

Returns:
BufferedImage

getImage

public java.awt.image.BufferedImage getImage(java.awt.print.PageFormat pf)
return new Image with the size equals to the page size

Returns:
BufferedImage

getImage

public java.awt.image.BufferedImage getImage(int width,
                                             int height)
return new Image with the size specified by parameters

Returns:
BufferedImage

drawPicture

public void drawPicture(java.awt.Graphics gr,
                        javax.swing.JComponent comp,
                        int i)
draw Picture

Parameters:
gr - Graphics
comp - JComponent
i - int

drawPicture

public void drawPicture(java.awt.Graphics gr,
                        javax.swing.JComponent comp)
draw Picture

Parameters:
gr - Graphics
comp - JComponent

drawPicture

public void drawPicture(java.awt.Graphics gr,
                        java.awt.print.PageFormat pf)
draw Picture

Parameters:
gr - Graphics
pf - PageFormat

drawPicture

public void drawPicture(java.awt.Graphics gr,
                        java.awt.print.PageFormat pf,
                        int line)
draw Picture

Parameters:
gr - Graphics
pf - PageFormat
line - int

drawPicture

public void drawPicture(java.awt.Graphics gr,
                        int width,
                        int height)
draw Picture

Parameters:
gr - Graphics
width - int
height - int

drawPicture

public void drawPicture(java.awt.Graphics gr)
draw Picture

Parameters:
gr - Graphics

debug

public void debug(java.lang.String s)
pring debuging output

Parameters:
s - String

setDebug

public void setDebug(boolean d)
set Debuging mode

Parameters:
d - boolean

getWidth

public int getWidth()
return picture Width

Returns:
int

getHeight

public int getHeight()
return picture Height

Returns:
int

getMaxWidth

public int getMaxWidth()
return tMax drawable Width

Returns:
int

getMaxHeight

public int getMaxHeight()
return Max drawable Height

Returns:
int

getImageableWidth

public int getImageableWidth()
return width of the Imageable rectangle

Returns:
int

getImageableHeight

public int getImageableHeight()
return height of the Imageable rectangle

Returns:
int

getMarginLeft

public int getMarginLeft()
return left Margin

Returns:
int

getMarginRight

public int getMarginRight()
return right Margin

Returns:
int

getMarginTop

public int getMarginTop()
return top Margin

Returns:
int

getMarginBottom

public int getMarginBottom()
return bottom Margin

Returns:
int

setSize

public void setSize()
set size from the default component


setSize

public void setSize(javax.swing.JComponent comp)
set size from the component

Parameters:
comp - JComponent

setSize

public void setSize(java.awt.print.PageFormat pf)
set Size from the page

Parameters:
pf - PageFormat

setSize

public void setSize(int width,
                    int height)
set Size from the parameters

Parameters:
width - int
height - int

setMargins

public void setMargins(java.awt.print.PageFormat pf)
set Margins from the page margins

Parameters:
pf - PageFormat

setMargins

public void setMargins(int left,
                       int top,
                       int right,
                       int bottom)
set Margins from the parameters

Parameters:
left - int
top - int
right - int
bottom - int

setImageableArea

public void setImageableArea(java.awt.print.PageFormat pf)
setI mageable Area from the pages Imageable area

Parameters:
pf - PageFormat

setImageableArea

public void setImageableArea(int left,
                             int top,
                             int width,
                             int height)
set Imageable Area from the parameters

Parameters:
left - int
top - int
width - int
height - int

toString

public java.lang.String toString()
return summary string

Overrides:
toString in class java.lang.Object
Returns:
String

translate

public void translate(int x,
                      int y)
translate imageable area

Parameters:
x - int
y - int

translate

public void translate(int x,
                      int y,
                      int x1,
                      int y1)
change size and position of the imageable area

Parameters:
x - int
y - int
x1 - int
y1 - int

setMarginRight

public void setMarginRight(int x)
set right Margin

Parameters:
x - int

getStringWidth

public int getStringWidth(java.lang.String s,
                          java.awt.Font f)
return Width (in pixels) of the string

Parameters:
s - String
f - Font
Returns:
int

shortenString

public java.lang.String shortenString(java.lang.String s,
                                      java.awt.Font f,
                                      int width)
remove last characters from the string until its width is less or equal the maximum parameter

Parameters:
s - String
f - Font
width - int
Returns:
String

X

public int X(int x)
correct x coordinates

Parameters:
x - int
Returns:
int

Y

public int Y(int y)
correct y coordinates

Parameters:
y - int
Returns:
int

convertX

protected int convertX(double x)
convert cromosome coordinate to the picture coordinate

Parameters:
x - double
Returns:
int

convertX

protected int convertX(long x)
convert cromosome coordinate to the picture coordinate

Parameters:
x - long
Returns:
int

getFormattedNumberString

public java.lang.String getFormattedNumberString(double x,
                                                 int maxFracDigits)
return Formatted Number String

Parameters:
x - double
maxFracDigits - int
Returns:
String

getFormattedNumberString

public java.lang.String getFormattedNumberString(int x,
                                                 int maxFracDigits)
return Formatted Number String

Parameters:
x - int
maxFracDigits - int
Returns:
String

getFormattedXDisplayString

public java.lang.String getFormattedXDisplayString(int currXPos)
return Formatted String converted to the chromosome coordinates

Parameters:
currXPos - int
Returns:
String

getXDisplay

public long getXDisplay(int currXPos)
convert the parameter into chromosome coordinates

Parameters:
currXPos - int
Returns:
long

setMinX

public void setMinX(long minx)
set Min X

Parameters:
minx - long

setMaxX

public void setMaxX(long maxx)
set Max X

Parameters:
maxx - long

setMinMaxX

public void setMinMaxX(long minx,
                       long maxx)
set Min and Max X

Parameters:
minx - long
maxx - long

setMinX

public void setMinX(int i)
set Min X

Parameters:
i - int
See Also:
VistaApp.getMinX(int)

setMaxX

public void setMaxX(int i)
set Max X

Parameters:
i - int
See Also:
VistaApp.getMaxX(int)

setMinMaxX

public void setMinMaxX(int i)
set Min and Max X

Parameters:
i - int
See Also:
VistaApp.getMinX(int), VistaApp.getMaxX(int)

setComponent

public void setComponent(javax.swing.JComponent comp)
set Component

Parameters:
comp - JComponent

setPage

public void setPage(java.awt.print.PageFormat pf)
set Page

Parameters:
pf - PageFormat

getDX

public long getDX()
return maxX-minX

Returns:
long

getRelX

public double getRelX(long x)
return relative position from the begining

Parameters:
x - long
Returns:
double

getRelX

public double getRelX(double x)
eturn relative position from the begining

Parameters:
x - double
Returns:
double

setZ

public void setZ(int Z)
this parameter can be 0 or 1. Usualy it's 0, but because of the "off by one" bug in the PDF library, all "fill" operations require corrected coordinates.

Parameters:
Z - int