|
Style Intelligence v12.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface TableLens
TableLens defines a view into a table. It contains functions to access the contents of the table, as well as the attributes of the table. The TableLens is used to create a table in a document. There are builtin table lens classes that can be used to create a TableLens object from other data source, such as a Swing JTable or a JDBC query. Under most circumstance, the user should not need to implement the TableLens directly to create a table.
If the builtin table lens (in inetsoft.report.lens package) does not satisfy the need of an application, a program can create a customized TableLens to tailor to its need. There are several classes that can be used as the starting point for this. They are designed to make defining a custom table lens easier.
The AbstractTableLens provides a default value to most of the methods in the TableLens, except the getRowCount(), getColCount(), and getObject() methods. A table lens class can be easily created by extending the AbstractTableLens to provide a view into a different data source. The other methods can be overriden to provide a more customized view. Alternative, a pre-built or custom built style class can be used to provide a table style. The styles are cover in more details later. e.g.
TableLens table = new AbstractTableLens() {
public int getRowCount() {
return data.length;
}
public int getColCount() {
return data[0].length;
}
public Object getObject(int r, int c) {
return data[r][c];
}
private String[][] data = {
{"Sales", "Profit", "Domestic", "International"},
{"1,000", "200", "800", "200"}
}
};
The DefaultTableLens provides a concrete class that can be instantiated without any additional coding. The user of the class is responsible to populate the contents in the DefaultTableLens by setting the approriate attributes and data. Since the StyleReport is based on the MVC design pattern, we strongly encourage the use of table lens as a view into other data source, instead of creating a duplicated copy, which in less efficient in storage and flexibility.
Another class, AttributeTableLens, is similar to the AbstractTableLens. But instead of having no internal storage, it has storage for the table attributes so the user of this class (or it's derived class) can set the attributes by calling the setter methods. The attribute table lens and abstract table lens can be combined to create a table lens into a data source and which users can change the attributes by calling the setter methods. e.g.
TableLens lens = ...;
AbstractTableLens table = new AbstractTableLens(lens);
...
table.setFormat(1, NumberFormat.getCurrencyInstance());
If a table is populated in background, the data can be used to process a report before all data is loaded in the table lens. To facilitate streaming of data, the table lens can be supplied to a report before it's fully loaded. The table lens must conform to the following conventions:
1. The getRowCount() method should return negative number of loaded rows
minus 1, before the table is fully loaded. It should not block.
2. The moreRows() method must be implemented to check if there are more
rows available. It should block in the row specified by row index is
not loaded.
3. If getObject() is called on a row that is not loaded, it should block
until the row is loaded.
The TableLens interface is also used to create visual styles of tables independent of the data in the table. There are over 80 builtin style classes in the inetsoft.report.style package. A style can be combined with a table lens to create a visual presentation of the table where the attributes (color, font, border ...) are defined in the style, and the data is defined in the table lens.
TableLens lens = new inetsoft.report.lens.swing.JTableLens(jTable1);
report.addTable(new Grid4(lens)); // attach a style, Grid4
Any styles can be created and reused as the builtin styles. Refer to the inetsoft.report.style.TableStyle class on how to create a table style class.
| Field Summary | |
|---|---|
static int |
BREAK_BORDER
A constant representing a break border constant. |
static Object |
NULL
A special object value marking a value that does not exist in table. |
| Fields inherited from interface inetsoft.uql.XTable |
|---|
EOT |
| Method Summary | |
|---|---|
void |
addChangeListener(TableChangeListener listener)
Add table change listener to the filtered table. |
boolean |
containsDrill()
Check if contains drill. |
boolean |
containsFormat()
Check if contains format. |
int |
getAlignment(int r,
int c)
Return the per cell alignment. |
Color |
getBackground(int r,
int c)
Return the per cell background color. |
int |
getColBorder(int r,
int c)
Return the style for right border of the specified row. |
Color |
getColBorderColor(int r,
int c)
Return the color for drawing the column border lines. |
int |
getColWidth(int col)
Get the current column width setting. |
Format |
getDefaultFormat(int row,
int col)
Return the per cell format. |
TableDataDescriptor |
getDescriptor()
Get internal table data descriptor which contains table structural infos. |
Font |
getFont(int r,
int c)
Return the per cell font. |
Color |
getForeground(int r,
int c)
Return the per cell foreground color. |
Insets |
getInsets(int r,
int c)
Return the cell gap space. |
int |
getRowBorder(int r,
int c)
Return the style for bottom border of the specified cell. |
Color |
getRowBorderColor(int r,
int c)
Return the color for drawing the row border lines. |
int |
getRowHeight(int row)
Get the current row heights setting. |
Dimension |
getSpan(int r,
int c)
Return the spanning setting for the cell. |
XDrillInfo |
getXDrillInfo(int r,
int c)
Return the per cell drill info. |
boolean |
isLineWrap(int r,
int c)
Return the per cell line wrap mode. |
void |
removeChangeListener(TableChangeListener listener)
Remove table change listener from the filtered table. |
| Methods inherited from interface inetsoft.uql.XTable |
|---|
dispose, getBoolean, getByte, getColCount, getColType, getColumnIdentifier, getDouble, getFloat, getHeaderColCount, getHeaderRowCount, getInt, getLong, getObject, getRowCount, getShort, getTrailerColCount, getTrailerRowCount, isNull, isPrimitive, moreRows, setColumnIdentifier, setObject |
| Field Detail |
|---|
static final int BREAK_BORDER
static final Object NULL
| Method Detail |
|---|
TableDataDescriptor getDescriptor()
getDescriptor in interface XTablevoid addChangeListener(TableChangeListener listener)
listener - the specified TableChangeListenervoid removeChangeListener(TableChangeListener listener)
listener - the specified TableChangeListener to be removedint getRowHeight(int row)
int getColWidth(int col)
Color getRowBorderColor(int r,
int c)
r - row number.c - column number.
Color getColBorderColor(int r,
int c)
r - row number.c - column number.
int getRowBorder(int r,
int c)
r - row number.c - column number.
int getColBorder(int r,
int c)
r - row number.c - column number.
Insets getInsets(int r,
int c)
r - row number.c - column number.
Dimension getSpan(int r,
int c)
r - row number.c - column number.
int getAlignment(int r,
int c)
r - row number.c - column number.
Font getFont(int r,
int c)
r - row number.c - column number.
boolean isLineWrap(int r,
int c)
r - row number.c - column number.
Color getForeground(int r,
int c)
r - row number.c - column number.
Color getBackground(int r,
int c)
r - row number.c - column number.
Format getDefaultFormat(int row,
int col)
row - row number.col - column number.
XDrillInfo getXDrillInfo(int r,
int c)
r - row number.c - column number.
boolean containsFormat()
boolean containsDrill()
|
Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||