Package org.compiere.minigrid
Class MiniTableImpl
java.lang.Object
org.compiere.minigrid.MiniTableImpl
- All Implemented Interfaces:
IMiniTable
Headless implementation of
This support the use/test of some UI API (for e.g
IMiniTable
.This support the use/test of some UI API (for e.g
Match
in headless environment (for e.g unit test).- Author:
- hengsin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add column with headervoid
Add Table Column and specify the column header.void
autoSize()
auto size column widthint
convertColumnIndexToModel
(int viewColumnIndex) int
getColorCode
(int row) int
get table layoutint
<T extends Serializable>
TgetRowKeyAt
(int index) get key of record at indexint
<T extends Serializable>
TgetValueAt
(int row, int column) boolean
isCellEditable
(int row, int column) boolean
void
populate tablevoid
populate tableprepareTable
(ColumnInfo[] layout, String from, String where, boolean multiSelection, String tableName) Prepare Table and return SQL required to get resultset to populate tablevoid
repaint()
redraw the whole tablevoid
setColorCompare
(Object dataCompare) void
setColumnClass
(int index, Class<?> classType, boolean readOnly) set column class typevoid
setColumnClass
(int index, Class<?> classType, boolean readOnly, String header) set column class typevoid
setColumnReadOnly
(int index, boolean readOnly) change readonly attribute of a columnvoid
setMultiSelection
(boolean multiSelection) change multi selection attribute of tablevoid
setRowCount
(int rowCount) ensure table has >= rowCount rows.void
setSelectedRow
(int selected) void
setShowTotals
(boolean show) change show total attribute of tablevoid
setValueAt
(Object value, int row, int column) set value at row and column
-
Constructor Details
-
MiniTableImpl
public MiniTableImpl() -
MiniTableImpl
- Parameters:
layout
-
-
-
Method Details
-
isCellEditable
public boolean isCellEditable(int row, int column) - Specified by:
isCellEditable
in interfaceIMiniTable
- Returns:
- true if column is editable
-
getValueAt
- Specified by:
getValueAt
in interfaceIMiniTable
- Returns:
- value at row and column
-
setValueAt
Description copied from interface:IMiniTable
set value at row and column- Specified by:
setValueAt
in interfaceIMiniTable
-
convertColumnIndexToModel
public int convertColumnIndexToModel(int viewColumnIndex) - Specified by:
convertColumnIndexToModel
in interfaceIMiniTable
- Returns:
- corresponding index at underlying model
-
setColumnReadOnly
public void setColumnReadOnly(int index, boolean readOnly) Description copied from interface:IMiniTable
change readonly attribute of a column- Specified by:
setColumnReadOnly
in interfaceIMiniTable
-
prepareTable
public String prepareTable(ColumnInfo[] layout, String from, String where, boolean multiSelection, String tableName) Description copied from interface:IMiniTable
Prepare Table and return SQL required to get resultset to populate table- Specified by:
prepareTable
in interfaceIMiniTable
- Returns:
- sql
-
addColumn
Description copied from interface:IMiniTable
add column with header- Specified by:
addColumn
in interfaceIMiniTable
-
setColumnClass
Description copied from interface:IMiniTable
set column class type- Specified by:
setColumnClass
in interfaceIMiniTable
-
setColumnClass
Description copied from interface:IMiniTable
set column class type- Specified by:
setColumnClass
in interfaceIMiniTable
-
loadTable
Description copied from interface:IMiniTable
populate table- Specified by:
loadTable
in interfaceIMiniTable
-
loadTable
Description copied from interface:IMiniTable
populate table- Specified by:
loadTable
in interfaceIMiniTable
-
getSelectedRowKey
- Specified by:
getSelectedRowKey
in interfaceIMiniTable
- Returns:
- row key
-
getRowKeyAt
get key of record at index- Parameters:
index
-- Returns:
-
getSelectedRow
public int getSelectedRow()- Specified by:
getSelectedRow
in interfaceIMiniTable
- Returns:
- selected row index or -1 if no selected row
-
setSelectedRow
public void setSelectedRow(int selected) -
setRowCount
public void setRowCount(int rowCount) Description copied from interface:IMiniTable
ensure table has >= rowCount rows. i.e to grow a table by 1 row, call table.setRowCount(table.getRowCount()+1)- Specified by:
setRowCount
in interfaceIMiniTable
-
getLayoutInfo
Description copied from interface:IMiniTable
get table layout- Specified by:
getLayoutInfo
in interfaceIMiniTable
- Returns:
- array of
ColumnInfo
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceIMiniTable
- Returns:
- number of columns
-
getRowCount
public int getRowCount()- Specified by:
getRowCount
in interfaceIMiniTable
- Returns:
- number of rows
-
setMultiSelection
public void setMultiSelection(boolean multiSelection) Description copied from interface:IMiniTable
change multi selection attribute of table- Specified by:
setMultiSelection
in interfaceIMiniTable
-
isMultiSelection
public boolean isMultiSelection()- Specified by:
isMultiSelection
in interfaceIMiniTable
- Returns:
- true if multi selection is turn on
-
getColorCode
public int getColorCode(int row) - Specified by:
getColorCode
in interfaceIMiniTable
- Returns:
- color code
-
setColorCompare
- Specified by:
setColorCompare
in interfaceIMiniTable
-
repaint
public void repaint()Description copied from interface:IMiniTable
redraw the whole table- Specified by:
repaint
in interfaceIMiniTable
-
autoSize
public void autoSize()Description copied from interface:IMiniTable
auto size column width- Specified by:
autoSize
in interfaceIMiniTable
-
setShowTotals
public void setShowTotals(boolean show) Description copied from interface:IMiniTable
change show total attribute of table- Specified by:
setShowTotals
in interfaceIMiniTable
-
addColumn
Add Table Column and specify the column header.- Parameters:
header
- name of column headerdescription
-colClass
-
-