ReportCat 1.1

li.netcat.print.table
Class DefaultTableCellDrawer

java.lang.Object
  extended byli.netcat.print.table.DefaultTableCellDrawer
All Implemented Interfaces:
TableCellDrawer

public class DefaultTableCellDrawer
extends java.lang.Object
implements TableCellDrawer

Default implementation of a TableCellDrawer that uses a LabelDrawer for rendering.

Author:
Arthur Marxer

Constructor Summary
DefaultTableCellDrawer()
          Constructs and initializes a new DefaultTableCellDrawer.
DefaultTableCellDrawer(int horizontalAlignment)
          Constructs and initializes a new DefaultTableCellDrawer.
 
Method Summary
 void draw(java.awt.Graphics g, java.lang.Object value, java.lang.Object type, int x, int y, int width, int height, int rowIndex, int columnIndex)
          Draws the given value to the graphics within the given bounds.
 LabelDrawer getDrawer()
          Returns the drawer that is used for rendering.
protected  javax.swing.Icon getIcon(java.lang.Object value, java.lang.Object type, int rowIndex, int columnIndex)
          Override this callback for icon conversion.
 int getMinimumWidth(java.awt.Graphics g, java.lang.Object value, java.lang.Object type, int rowIndex, int columnIndex)
          Returns the minimum width of this cell drawer.
 int getPreferredHeight(java.awt.Graphics g, java.lang.Object value, java.lang.Object type, int rowIndex, int columnIndex, int availableWidth)
          Returns the preferred height of this cell drawer.
 int getPreferredWidth(java.awt.Graphics g, java.lang.Object value, java.lang.Object type, int rowIndex, int columnIndex)
          Returns the preferred width of this cell drawer.
protected  java.lang.String getText(java.lang.Object value, java.lang.Object type, int rowIndex, int columnIndex)
          Override this callback for text conversion.
 void setDrawer(LabelDrawer drawer)
          Sets the drawer that is used for rendering.
 void setMinimumWidth(int minWidth)
          Sets the minimum width of this table cell drawer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTableCellDrawer

public DefaultTableCellDrawer()
Constructs and initializes a new DefaultTableCellDrawer.


DefaultTableCellDrawer

public DefaultTableCellDrawer(int horizontalAlignment)
Constructs and initializes a new DefaultTableCellDrawer.

Parameters:
horizontalAlignment - The horizontal alignment, one of LEFT, CENTER or RIGHT.
Method Detail

getDrawer

public LabelDrawer getDrawer()
Returns the drawer that is used for rendering. Use this drawer to specify properties like font and insets.

Returns:
The drawer that is used for rendering.

setDrawer

public void setDrawer(LabelDrawer drawer)
Sets the drawer that is used for rendering.

Parameters:
drawer - The drawer that is used for rendering, not null.

setMinimumWidth

public void setMinimumWidth(int minWidth)
Sets the minimum width of this table cell drawer. If the minimum width depends on different parameters, override the method getMinimumWidth(...).

Parameters:
minWidth - The minimum cell with.

getMinimumWidth

public int getMinimumWidth(java.awt.Graphics g,
                           java.lang.Object value,
                           java.lang.Object type,
                           int rowIndex,
                           int columnIndex)
Description copied from interface: TableCellDrawer
Returns the minimum width of this cell drawer.

Specified by:
getMinimumWidth in interface TableCellDrawer
Parameters:
g - The relevant Graphics object.
value - The data value retrieved from the model.
type - The data type retrieved from the model.
rowIndex - The absolute index of the row. For a header cell, this value is defined as -1, for a footer cell, it is Integer.MAX_VALUE.
columnIndex - The index of the column.
Returns:
The preferred width of this cell drawer.

getPreferredWidth

public int getPreferredWidth(java.awt.Graphics g,
                             java.lang.Object value,
                             java.lang.Object type,
                             int rowIndex,
                             int columnIndex)
Description copied from interface: TableCellDrawer
Returns the preferred width of this cell drawer. At this point, the cell drawer assumes, that the available size is infinite.

Specified by:
getPreferredWidth in interface TableCellDrawer
Parameters:
g - The relevant Graphics object.
value - The data value retrieved from the model.
type - The data type retrieved from the model.
rowIndex - The absolute index of the row. For a header cell, this value is defined as -1, for a footer cell, it is Integer.MAX_VALUE.
columnIndex - The index of the column.
Returns:
The preferred width of this cell drawer.

getPreferredHeight

public int getPreferredHeight(java.awt.Graphics g,
                              java.lang.Object value,
                              java.lang.Object type,
                              int rowIndex,
                              int columnIndex,
                              int availableWidth)
Description copied from interface: TableCellDrawer
Returns the preferred height of this cell drawer. At this point, the cell drawer assumes, that the available height is infinite and the width of the cell will be as wide as the given width.

Specified by:
getPreferredHeight in interface TableCellDrawer
Parameters:
g - The relevant Graphics object.
value - The data value retrieved from the model.
type - The data type retrieved from the model.
rowIndex - The absolute index of the row. For a header cell, this value is defined as -1, for a footer cell, it is Integer.MAX_VALUE.
columnIndex - The index of the column.
availableWidth - The final available width of the cell.
Returns:
The preferred height of this cell drawer.

draw

public void draw(java.awt.Graphics g,
                 java.lang.Object value,
                 java.lang.Object type,
                 int x,
                 int y,
                 int width,
                 int height,
                 int rowIndex,
                 int columnIndex)
Description copied from interface: TableCellDrawer
Draws the given value to the graphics within the given bounds.

Specified by:
draw in interface TableCellDrawer
Parameters:
g - The relevant graphics object to paint on.
value - The data value retrieved from the model.
type - The data type retrieved from the model.
x - The x coordinate of the upper left corner of the cell.
y - The y coordinate of the upper left corner of the cell.
width - The width of the cell.
height - The height of the cell.
rowIndex - The absolute index of the row. For a header cell, this value is defined as -1, for a footer cell, it is Integer.MAX_VALUE.
columnIndex - The index of the column.

getText

protected java.lang.String getText(java.lang.Object value,
                                   java.lang.Object type,
                                   int rowIndex,
                                   int columnIndex)
Override this callback for text conversion.

Parameters:
value - The value retrieved from the model.
type - The type retrieved from the model.
rowIndex - The absolute row index.
columnIndex - The absolute column index.
Returns:
The string used for rendering.

getIcon

protected javax.swing.Icon getIcon(java.lang.Object value,
                                   java.lang.Object type,
                                   int rowIndex,
                                   int columnIndex)
Override this callback for icon conversion.

Parameters:
value - The value retrieved from the model.
type - The type retrieved from the model.
rowIndex - The absolute row index.
columnIndex - The absolute column index.
Returns:
The icon used for rendering.

ReportCat 1.1

Copyright 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation, Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation, Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation