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) Convert view column index to model indexint
getColorCode
(int row) Get color code of rowint
Get number of columnsGet table column layoutint
Get number of rows<T extends Serializable>
TgetRowKeyAt
(int index) get key of record at indexint
Get selected row index<T extends Serializable>
TGet row key of selected rowgetValueAt
(int row, int column) Get value at row and columnboolean
isCellEditable
(int row, int column) Is column editableboolean
Is multi selection turn onvoid
Populate table from result setvoid
Populate table from POsprepareTable
(ColumnInfo[] layout, String from, String where, boolean multiSelection, String tableName) Prepare Table and return SQL to get resultset to populate tablevoid
repaint()
Redraw the whole tablevoid
setColorCompare
(Object dataCompare) Set comparison object for determination of row color codevoid
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 multiple selection attribute of tablevoid
setRowCount
(int rowCount) Ensure table has >= rowCount rows.
i.e to grow a table by 1 row, call table.setRowCount(table.getRowCount()+1)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) Description copied from interface:IMiniTable
Is column editable- Specified by:
isCellEditable
in interfaceIMiniTable
- Returns:
- true if column is editable
-
getValueAt
Description copied from interface:IMiniTable
Get value at row and column- 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) Description copied from interface:IMiniTable
Convert view column index to model index- 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 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 from result set- Specified by:
loadTable
in interfaceIMiniTable
-
loadTable
Description copied from interface:IMiniTable
Populate table from POs- Specified by:
loadTable
in interfaceIMiniTable
-
getSelectedRowKey
Description copied from interface:IMiniTable
Get row key of selected row- Specified by:
getSelectedRowKey
in interfaceIMiniTable
- Returns:
- row key
-
getRowKeyAt
get key of record at index- Parameters:
index
-- Returns:
-
getSelectedRow
public int getSelectedRow()Description copied from interface:IMiniTable
Get selected row index- 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 column layout- Specified by:
getLayoutInfo
in interfaceIMiniTable
- Returns:
- array of
ColumnInfo
-
getColumnCount
public int getColumnCount()Description copied from interface:IMiniTable
Get number of columns- Specified by:
getColumnCount
in interfaceIMiniTable
- Returns:
- number of columns
-
getRowCount
public int getRowCount()Description copied from interface:IMiniTable
Get number of rows- Specified by:
getRowCount
in interfaceIMiniTable
- Returns:
- number of rows
-
setMultiSelection
public void setMultiSelection(boolean multiSelection) Description copied from interface:IMiniTable
Change multiple selection attribute of table- Specified by:
setMultiSelection
in interfaceIMiniTable
-
isMultiSelection
public boolean isMultiSelection()Description copied from interface:IMiniTable
Is multi selection turn on- Specified by:
isMultiSelection
in interfaceIMiniTable
- Returns:
- true if multi selection is turn on
-
getColorCode
public int getColorCode(int row) Description copied from interface:IMiniTable
Get color code of row- Specified by:
getColorCode
in interfaceIMiniTable
- Returns:
- color code
-
setColorCompare
Description copied from interface:IMiniTable
Set comparison object for determination of row color code- 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
-
-