Package org.compiere.report.core
Class RModel
- java.lang.Object
-
- org.compiere.report.core.RModel
-
- All Implemented Interfaces:
Serializable
public class RModel extends Object implements Serializable
Report Model. Data is maintained in RModelData- Version:
- $Id: RModel.java,v 1.2 2006/07/30 00:51:06 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- BF [ 1778373 ] AcctViewer: data is not sorted proper
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFUNCTION_COUNTFunction: Countstatic StringFUNCTION_SUMFunction: Sumstatic StringTABLE_ALIASTable Alias for SQL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(RColumn rc)Add ColumnvoidaddColumn(RColumn rc, int index)Add Column at IndexvoidaddRow()Add RowvoidaddRow(int index)Add Row at IndexvoidaddRow(ArrayList<Object> l)Add RowvoidaddRow(ArrayList<Object> l, int index)Add Row at IndexClass<?>getColumnClass(int col)Get Column ClassintgetColumnCount()Get total number of columnsintgetColumnIndex(String columnName)Find index for ColumnNameStringgetColumnName(int col)Get Column Display NameRColumngetRColumn(int col)Get Column Display NameRColumngetRColumn(String columnName)Get column by column nameintgetRowCount()Return Total mumber of rowsArrayList<ArrayList<Object>>getRows()Returns the ArrayList of ArrayLists that contains the table's data values.ObjectgetValueAt(int row, int col)Get Value AtbooleanisCellEditable(int rowIndex, int columnIndex)Is Cell EditablebooleanisGroupRow(int row)Is Row a Group RowvoidmoveRow(int from, int to)Move Rowvoidquery(Properties ctx, String whereClause, String orderClause)QueryvoidsetFunction(int col, String function)Set Group Function - for the column, set a function like FUNCTION_SUM, FUNCTION_COUNT, ...voidsetFunction(String columnName, String function)Set Group FunctionvoidsetGroup(int col)Set a group column - if the group value changes, a new row in inserted performing the calculations set in setGroupFunction().voidsetGroup(String columnName)Set a group columnvoidsetValueAt(Object aValue, int row, int col)Set Value At
-
-
-
Field Detail
-
TABLE_ALIAS
public static final String TABLE_ALIAS
Table Alias for SQL- See Also:
- Constant Field Values
-
FUNCTION_COUNT
public static final String FUNCTION_COUNT
Function: Count- See Also:
- Constant Field Values
-
FUNCTION_SUM
public static final String FUNCTION_SUM
Function: Sum- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RModel
public RModel(String TableName)
Constructor. Creates RModelData- Parameters:
TableName-
-
-
Method Detail
-
getRColumn
public RColumn getRColumn(int col)
Get Column Display Name- Parameters:
col-- Returns:
- RColumn
-
getRColumn
public RColumn getRColumn(String columnName)
Get column by column name- Parameters:
columnName-- Returns:
- column or null if not found author Teo Sarca, SC ARHIPAC SERVICE SRL
-
addColumn
public void addColumn(RColumn rc)
Add Column- Parameters:
rc-
-
addColumn
public void addColumn(RColumn rc, int index)
Add Column at Index- Parameters:
rc-index-
-
addRow
public void addRow()
Add Row
-
addRow
public void addRow(int index)
Add Row at Index- Parameters:
index-
-
getColumnIndex
public int getColumnIndex(String columnName)
Find index for ColumnName- Parameters:
columnName-- Returns:
- index or -1 if not found
-
query
public void query(Properties ctx, String whereClause, String orderClause)
Query- Parameters:
ctx-whereClause-orderClause-
-
setGroup
public void setGroup(String columnName)
Set a group column- Parameters:
columnName-
-
setGroup
public void setGroup(int col)
Set a group column - if the group value changes, a new row in inserted performing the calculations set in setGroupFunction(). If you set multiple groups, start with the highest level (e.g. Country, Region, City) The data is assumed to be sorted to result in meaningful groups.A AA 1 A AB 2 B BA 3 B BB 4 after setGroup (0) A AA 1 A AB 2 A B BA 3 B BB 4 B
- Parameters:
col- The Group BY Column
-
isGroupRow
public boolean isGroupRow(int row)
Is Row a Group Row- Parameters:
row- index- Returns:
- true if row is a group row
-
setFunction
public void setFunction(String columnName, String function)
Set Group Function- Parameters:
columnName-function-
-
setFunction
public void setFunction(int col, String function)Set Group Function - for the column, set a function like FUNCTION_SUM, FUNCTION_COUNT, ...- Parameters:
col- The column on which the function is performedfunction- The function
-
getRowCount
public int getRowCount()
Return Total mumber of rows- Returns:
- row count
-
getColumnCount
public int getColumnCount()
Get total number of columns- Returns:
- column count
-
getColumnName
public String getColumnName(int col)
Get Column Display Name- Parameters:
col- index- Returns:
- ColumnName
-
getColumnClass
public Class<?> getColumnClass(int col)
Get Column Class- Parameters:
col- index- Returns:
- Column Class
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)Is Cell Editable- Parameters:
rowIndex-columnIndex-- Returns:
- true, if editable
-
getValueAt
public Object getValueAt(int row, int col)
Get Value At- Parameters:
row-col-- Returns:
- value
-
setValueAt
public void setValueAt(Object aValue, int row, int col)
Set Value At- Parameters:
aValue-row-col-- Throws:
IllegalArgumentException- if row/column is invalid or cell is read only
-
moveRow
public void moveRow(int from, int to)Move Row- Parameters:
from- indexto- index
-
getRows
public ArrayList<ArrayList<Object>> getRows()
Returns the ArrayList of ArrayLists that contains the table's data values. The ArrayLists contained in the outer vector are each a single row of values.- Returns:
- the ArrayList of ArrayLists containing the tables data values author Teo Sarca [ 1734327 ]
-
-