Style Intelligence v12.0

inetsoft.report
Interface TableLens

All Superinterfaces:
Cloneable, Serializable, StyleConstants, XConstants, XTable
All Known Subinterfaces:
BinaryTableFilter, DataTableLens, GroupedTable, MemberObjectTableLens, RegionTable, SortedTable, TableFilter
All Known Implementing Classes:
AbstractBinaryTableFilter, AbstractConditionFilter, AbstractGroupedTable, AbstractTableLens, AttributeTableLens, CalcTableLens, ColumnMapFilter, CompositeTableLens, ConditionFilter, CORBATableLens, CrossJoinTableLens, CrosstabConditionFilter, CrossTabCubeFilter, CrossTabFilter, CubeTableFilter, DataSetTable, DefaultSortedTable, DefaultTableFilter, DefaultTableLens, DistinctTableLens, EightyTwentyFilter, FormulaTableLens, GroupedColumnMapFilter, GroupedSortFilter, GroupFilter, HeaderRowTableLens, HighlightFilter, IntersectTableLens, JDBCTableLens, JoinTableLens, MaxRowsTableLens, MaxRowsTableLens2, MergedJoinTableLens, MetaTableFilter, MinusTableLens, PagedTableLens, RankingTableLens, RotatedTableLens, RowSummaryFilter, SelfJoinTableLens, SetTableLens, SortFilter, SubTableLens, SummaryFilter, SummaryTableLens, TableSummaryFilter, TextTableLens, TopNFilter, TransparentGroupFilter, UnionTableLens, XMLTableLens, XNodeTableLens

public interface TableLens
extends XTable, StyleConstants

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
 
Fields inherited from interface inetsoft.report.StyleConstants
ARROW_LINE_1, ARROW_LINE_2, ARROW_LINE_3, BACKGROUND_CENTER, BACKGROUND_TILED, BOX_RECTANGLE, BOX_ROUNDED_RECTANGLE, CENTER, CHART_3D_BAR, CHART_3D_BAR_3D, CHART_3D_PIE, CHART_3D_STACK_BAR, CHART_AREA, CHART_BAR, CHART_BUBBLE, CHART_CANDLE, CHART_CURVE, CHART_FILL_RADAR, CHART_GANTT, CHART_INV_BAR, CHART_INV_CURVE, CHART_INV_LINE, CHART_INV_POINT, CHART_INV_STACK_BAR, CHART_LINE, CHART_MAX_USER, CHART_PARETO, CHART_PIE, CHART_PIE_EXPLODED_ALL, CHART_PIE_EXPLODED_FIRST, CHART_PIE_EXPLODED_NONE, CHART_POINT, CHART_RADAR, CHART_RIBBON, CHART_SCATTER, CHART_SPEEDOMETER, CHART_STACK_AREA, CHART_STACK_BAR, CHART_STICK, CHART_STOCK, CHART_SURFACE, CHART_USER, CHART_VOLUME, CHART_WATERFALL, CHART_XY_LINE, CIRCLE, CROSS, CURRENCY, DASH_LINE, DASH_MASK, DEFAULT_PAGE_SIZE, DIAMOND, DOT_LINE, DOUBLE_3D_LOWERED, DOUBLE_3D_RAISED, DOUBLE_LINE, DOUBLE_MASK, FILL, FILLED_CIRCLE, FILLED_DIAMOND, FILLED_SQUARE, FILLED_TRIANGLE, FRACTION_WIDTH_MASK, H_ALIGN_MASK, H_CENTER, H_CURRENCY, H_LEFT, H_LINE, H_RIGHT, LANDSCAPE, LARGE_DASH, LEFT, LINECAP_BUTT, LINECAP_ROUND, LINECAP_SQUARE, LINEJOIN_BEVEL, LINEJOIN_MITER, LINEJOIN_ROUND, LOWERED_3D, LOWERED_MASK, LT_ANGLE, MEDIUM_DASH, MEDIUM_LINE, NIL, NO_BORDER, NONE, PAPER_10X11, PAPER_10X14, PAPER_11X17, PAPER_15X11, PAPER_9X11, PAPER_A_PLUS, PAPER_A2, PAPER_A3, PAPER_A3_EXTRA, PAPER_A3_EXTRA_TRANSVERSE, PAPER_A3_TRANSVERSE, PAPER_A4, PAPER_A4_EXTRA, PAPER_A4_PLUS, PAPER_A4_TRANSVERSE, PAPER_A4SMALL, PAPER_A5, PAPER_A5_EXTRA, PAPER_A5_TRANSVERSE, PAPER_B_PLUS, PAPER_B4, PAPER_B5, PAPER_B5_EXTRA, PAPER_B5_TRANSVERSE, PAPER_CSHEET, PAPER_DSHEET, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, PAPER_ENV_14, PAPER_ENV_9, PAPER_ENV_B4, PAPER_ENV_B5, PAPER_ENV_B6, PAPER_ENV_C3, PAPER_ENV_C4, PAPER_ENV_C5, PAPER_ENV_C6, PAPER_ENV_C65, PAPER_ENV_DL, PAPER_ENV_INVITE, PAPER_ENV_ITALY, PAPER_ENV_MONARCH, PAPER_ENV_PERSONAL, PAPER_ESHEET, PAPER_EXECUTIVE, PAPER_FANFOLD_LGL_GERMAN, PAPER_FANFOLD_STD_GERMAN, PAPER_FANFOLD_US, PAPER_FOLIO, PAPER_ISO_B4, PAPER_JAPANESE_POSTCARD, PAPER_LEDGER, PAPER_LEGAL, PAPER_LEGAL_EXTRA, PAPER_LETTER, PAPER_LETTER_EXTRA, PAPER_LETTER_EXTRA_TRANSVERSE, PAPER_LETTER_PLUS, PAPER_LETTER_TRANSVERSE, PAPER_LETTERSMALL, PAPER_NOTE, PAPER_QUARTO, PAPER_STATEMENT, PAPER_TABLOID, PAPER_TABLOID_EXTRA, PATTERN_0, PATTERN_1, PATTERN_10, PATTERN_11, PATTERN_12, PATTERN_13, PATTERN_14, PATTERN_15, PATTERN_16, PATTERN_17, PATTERN_18, PATTERN_19, PATTERN_2, PATTERN_3, PATTERN_4, PATTERN_5, PATTERN_6, PATTERN_7, PATTERN_8, PATTERN_9, PATTERN_NONE, PORTRAIT, RAISED_3D, RAISED_MASK, REMAINDER, RIGHT, RIGHT_ANGLE, SOLID_MASK, SQUARE, STAR, THICK_LINE, THIN_LINE, THIN_THIN_LINE, TRAY_AUTO, TRAY_CASSETTE, TRAY_ENVELOPE, TRAY_ENVMANUAL, TRAY_FORMSOURCE, TRAY_LARGECAPACITY, TRAY_LARGEFMT, TRAY_LOWER, TRAY_MANUAL, TRAY_MIDDLE, TRAY_ONLYONE, TRAY_SMALLFMT, TRAY_TRACTOR, TRAY_UPPER, TRIANGLE, ULTRA_THIN_LINE, V_ALIGN_MASK, V_ANGLE, V_BASELINE, V_BOTTOM, V_CENTER, V_LINE, V_TOP, WIDTH_MASK, X
 
Fields inherited from interface inetsoft.uql.XConstants
AM_PM_DATE_GROUP, AM_PM_OF_DAY_DATE_GROUP, AVERAGE_FORMULA, CALC_FORMULA, COLUMN, CONCAT_FORMULA, CONDITION_EMPTY_STRING, CONDITION_NULL_STRING, CONDITION_NULL_VALUE, CONDITION_REAL_NULL, CORRELATION_FORMULA, COUNT_FORMULA, COVARIANCE_FORMULA, CURRENCY_FORMAT, CURRENT_REP_CHANGED, CURRENT_REP_WILL_CHANGE, DATE_FORMAT, DAY_DATE_GROUP, DAY_OF_MONTH_DATE_GROUP, DAY_OF_WEEK_DATE_GROUP, DAY_OF_YEAR_DATE_GROUP, DECIMAL_FORMAT, DISTINCTCOUNT_FORMULA, FIRST_FORMULA, FULL_JOIN, GREATER_EQUAL_JOIN, GREATER_JOIN, GROUP_OTHERS, HOUR_DATE_GROUP, HOUR_OF_DAY_DATE_GROUP, INNER_JOIN, JOIN, LAST_FORMULA, LEAVE_OTHERS, LEFT_JOIN, LESS_EQUAL_JOIN, LESS_JOIN, MAX_FORMULA, MEDIAN_FORMULA, MESSAGE_FORMAT, MILLISECOND_DATE_GROUP, MIN_FORMULA, MINUTE_DATE_GROUP, MODE_FORMULA, MONTH_DATE_GROUP, MONTH_OF_YEAR_DATE_GROUP, NONE_DATE_GROUP, NONE_FORMULA, NOT_EQUAL_JOIN, NTHLARGEST_FORMULA, NTHMOSTFREQUENT_FORMULA, NTHSMALLEST_FORMULA, PARAM_PREFIX, PART_DATE_GROUP, PERCENT_FORMAT, PERCENTAGE_BY_COL, PERCENTAGE_BY_ROW, PERCENTAGE_NONE, PERCENTAGE_OF_COL_GRANDTOTAL, PERCENTAGE_OF_COL_GROUP, PERCENTAGE_OF_GRANDTOTAL, PERCENTAGE_OF_GROUP, PERCENTAGE_OF_ROW_GRANDTOTAL, PERCENTAGE_OF_ROW_GROUP, POPULATIONSTANDARDDEVIATION_FORMULA, POPULATIONVARIANCE_FORMULA, PRODUCT_FORMULA, PTHPERCENTILE_FORMULA, QUARTER_DATE_GROUP, QUARTER_OF_YEAR_DATE_GROUP, RIGHT_JOIN, SECOND_DATE_GROUP, SET_FORMULA, SORT_ASC, SORT_DESC, SORT_NONE, SORT_ORIGINAL, SORT_SPECIFIC, SORT_VALUE_ASC, SORT_VALUE_DESC, STANDARDDEVIATION_FORMULA, SUB_QUERY_PARAM, SUM_FORMULA, SUMSQ_FORMULA, SUMWT_FORMULA, VARIANCE_FORMULA, WEEK_DATE_GROUP, WEEK_OF_MONTH_DATE_GROUP, WEEK_OF_YEAR_DATE_GROUP, WEIGHTEDAVERAGE_FORMULA, YEAR_DATE_GROUP
 
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

BREAK_BORDER

static final int BREAK_BORDER
A constant representing a break border constant. This value can be OR'ed with the border style to insert a page break in to a table. The break is only recognized when returned as the row border of the first column cells.

See Also:
Constant Field Values

NULL

static final Object NULL
A special object value marking a value that does not exist in table.

Method Detail

getDescriptor

TableDataDescriptor getDescriptor()
Get internal table data descriptor which contains table structural infos.

Specified by:
getDescriptor in interface XTable
Returns:
table data descriptor.

addChangeListener

void addChangeListener(TableChangeListener listener)
Add table change listener to the filtered table. If the table filter's data changes, a TableChangeEvent will be triggered for the TableChangeListener to process.

Parameters:
listener - the specified TableChangeListener

removeChangeListener

void removeChangeListener(TableChangeListener listener)
Remove table change listener from the filtered table.

Parameters:
listener - the specified TableChangeListener to be removed

getRowHeight

int getRowHeight(int row)
Get the current row heights setting. The meaning of row heights depends on the table layout policy setting. If the row height is to be calculated by the ReportSheet based on the content, return -1.

Returns:
row height.

getColWidth

int getColWidth(int col)
Get the current column width setting. The meaning of column widths depends on the table layout policy setting. If the column width is to be calculated by the ReportSheet based on the content, return -1. A special value, StyleConstants.REMAINDER, can be returned by this method to indicate that width of this column should be calculated based on the remaining space after all other columns' widths are satisfied. If there are more than one column that return REMAINDER as their widths, the remaining space is distributed evenly among these columns.

Returns:
column width.

getRowBorderColor

Color getRowBorderColor(int r,
                        int c)
Return the color for drawing the row border lines.

Parameters:
r - row number.
c - column number.
Returns:
ruling color.

getColBorderColor

Color getColBorderColor(int r,
                        int c)
Return the color for drawing the column border lines.

Parameters:
r - row number.
c - column number.
Returns:
ruling color.

getRowBorder

int getRowBorder(int r,
                 int c)
Return the style for bottom border of the specified cell. The flag must be one of the style options defined in the StyleConstants class. If the row number is -1, it's checking the outside ruling on the top.

Parameters:
r - row number.
c - column number.
Returns:
ruling flag.

getColBorder

int getColBorder(int r,
                 int c)
Return the style for right border of the specified row. The flag must be one of the style options defined in the StyleConstants class. If the column number is -1, it's checking the outside ruling on the left.

Parameters:
r - row number.
c - column number.
Returns:
ruling flag.

getInsets

Insets getInsets(int r,
                 int c)
Return the cell gap space.

Parameters:
r - row number.
c - column number.
Returns:
cell gap space.

getSpan

Dimension getSpan(int r,
                  int c)
Return the spanning setting for the cell. If the specified cell is not a spanning cell, it returns null. Otherwise it returns a Dimension object with Dimension.width equals to the number of columns and Dimension.height equals to the number of rows of the spanning cell.

Parameters:
r - row number.
c - column number.
Returns:
span cell dimension.

getAlignment

int getAlignment(int r,
                 int c)
Return the per cell alignment.

Parameters:
r - row number.
c - column number.
Returns:
cell alignment.

getFont

Font getFont(int r,
             int c)
Return the per cell font. Return null to use default font.

Parameters:
r - row number.
c - column number.
Returns:
font for the specified cell.

isLineWrap

boolean isLineWrap(int r,
                   int c)
Return the per cell line wrap mode. If the line wrap mode is true, lines are wrapped when the text can not fit on one line. Otherwise the wrapping is never done and any overflow text will be truncated.

Parameters:
r - row number.
c - column number.
Returns:
true if line wrapping should be done.

getForeground

Color getForeground(int r,
                    int c)
Return the per cell foreground color. Return null to use default color.

Parameters:
r - row number.
c - column number.
Returns:
foreground color for the specified cell.

getBackground

Color getBackground(int r,
                    int c)
Return the per cell background color. Return null to use default color.

Parameters:
r - row number.
c - column number.
Returns:
background color for the specified cell.

getDefaultFormat

Format getDefaultFormat(int row,
                        int col)
Return the per cell format.

Parameters:
row - row number.
col - column number.
Returns:
format for the specified cell.

getXDrillInfo

XDrillInfo getXDrillInfo(int r,
                         int c)
Return the per cell drill info.

Parameters:
r - row number.
c - column number.
Returns:
drill info for the specified cell.

containsFormat

boolean containsFormat()
Check if contains format.

Returns:
true if contains format.

containsDrill

boolean containsDrill()
Check if contains drill.

Returns:
true if contains drill.

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.