|
Adempiere 3.5.2a | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
org.compiere.model.GridTable
public class GridTable
Grid Table Model for JDBC access including buffering.
The following data types are handeled
Integer for all IDs
BigDecimal for all Numbers
Timestamp for all Dates
String for all others
The data is read via r/o resultset and cached in m_buffer. Writes/updates
are via dynamically constructed SQL INSERT/UPDATE statements. The record
is re-read via the resultset to get results of triggers.
The model maintains and fires the requires TableModelEvent changes,
the DataChanged events (loading, changed, etc.)
as well as Vetoable Change event "RowChange"
(for row changes initiated by moving the row in the table grid).
| Field Summary | |
|---|---|
static String |
PROPERTY
Property of Vetoable Bean support "RowChange" |
static char |
SAVE_ABORT
Save Abort Error - U |
static char |
SAVE_ACCESS
Save Access Error - A |
static char |
SAVE_ERROR
Save Error - E |
static char |
SAVE_MANDATORY
Save Mandatory Error - M |
static char |
SAVE_OK
Save OK - O |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
GridTable(Properties ctx,
int AD_Table_ID,
String TableName,
int WindowNo,
int TabNo,
boolean withAccessControl)
JDBC Based Buffered Table |
|
| Method Summary | |
|---|---|
void |
addDataStatusListener(DataStatusListener l)
Add Data Status Listener |
void |
addField(GridField field)
Add Field to Table |
void |
addVetoableChangeListener(VetoableChangeListener l)
Add Vetoable change listener for row changes |
void |
close(boolean finalCall)
Close Resultset |
boolean |
dataDelete(int row)
Delete Data |
void |
dataIgnore()
Ignore changes |
boolean |
dataNew(int currentRow,
boolean copyCurrent)
New Record after current Row |
void |
dataRefresh(int row)
Refresh Row - ignore changes |
void |
dataRefreshAll()
Refresh all Rows - ignore changes |
boolean |
dataRequery(String whereClause,
boolean onlyCurrentRows,
int onlyCurrentDays)
Requery with new whereClause |
char |
dataSave(boolean manualCmd)
Save unconditional. |
boolean |
dataSave(int newRow,
boolean manualCmd)
Check if it needs to be saved and save it. |
int |
findColumn(String columnName)
Returns a column given its name. |
protected void |
fireDataStatusEEvent(String AD_Message,
String info,
boolean isError)
Create and fire Data Status Error Event |
protected void |
fireDataStatusEEvent(ValueNamePair errorLog)
Create and fire Data Status Event (from Error Log) |
protected void |
fireDataStatusIEvent(String AD_Message,
String info)
Create and fire Data Status Info Event |
protected void |
fireVetoableChange(PropertyChangeEvent e)
Fire Vetoable change listener for row changes |
int |
getColorCode(int row)
Get ColorCode for Row. |
Class<?> |
getColumnClass(int index)
Returns Class of database column/field |
int |
getColumnCount()
Get total database column count (displayed and not displayed) |
String |
getColumnName(int index)
Returns database column name |
boolean |
getCompareDB()
Get Compare DB. |
protected GridField |
getField(int index)
Get Column at index |
protected GridField |
getField(String identifier)
Return Columns with Indentifier (ColumnName) |
int |
getFieldCount()
Get (displayed) field count |
GridField[] |
getFields()
Get all Fields |
String |
getKeyColumnName()
Get Key ColumnName |
int |
getKeyID(int row)
Get Key ID or -1 of none |
Object |
getOldValue(int row,
int col)
Get Old Value |
String |
getOrderClause()
Get Order Clause (w/o the ORDER BY) |
int |
getRowCount()
Return number of rows |
String |
getSelectWhereClause()
Get record set Where Clause (w/o the WHERE and w/o History) |
String |
getTableName()
Get Table Name |
Object |
getValueAt(int row,
int col)
Get Value in Resultset |
boolean |
isCellEditable(int row,
int col)
Is Cell Editable. |
boolean |
isInserting()
Is inserting |
boolean |
isLoading()
Is Loading |
boolean |
isOnlyCurrentRowsDisplayed()
Is History displayed |
boolean |
isOpen()
Is it open? |
boolean |
isReadOnly()
Is entire Table Read/Only |
boolean |
isRowEditable(int row)
Is Current Row Editable |
void |
loadComplete()
Wait until async loader of Table and Lookup Fields is complete Used for performance tests |
boolean |
needSave()
Check if the row needs to be saved |
boolean |
needSave(boolean onlyRealChange)
Check if the current row needs to be saved. |
boolean |
needSave(int newRow)
Check if the row needs to be saved |
boolean |
needSave(int newRow,
boolean onlyRealChange)
Check if the row needs to be saved |
boolean |
open(int maxRows)
Open Database. |
void |
removeDataStatusListener(DataStatusListener l)
Remove Data Status Listener |
void |
removeVetoableChangeListener(VetoableChangeListener l)
Remove Vetoable change listener for row changes |
void |
setChanged(boolean changed)
Indicate that there will be a change |
void |
setColorColumn(String columnName)
Set the Column to determine the color of the row |
void |
setCompareDB(boolean compareDB)
Set Compare DB. |
void |
setDeleteable(boolean value)
Can Table rows be deleted |
protected void |
setFieldVFormat(String identifier,
String strNewFormat)
Feature Request [1707462] Enable runtime change of VFormat |
void |
setOrderClause(String newOrderClause)
Set Order Clause (w/o the ORDER BY) |
void |
setParameterSELECT(int index,
Object parameter)
Set Select Clause Parameter. |
void |
setParameterWHERE(int index,
Object parameter)
Set Where Clause Parameter. |
void |
setReadOnly(boolean value)
Set entire table as read only |
boolean |
setSelectWhereClause(String newWhereClause,
boolean onlyCurrentRows,
int onlyCurrentDays)
Set Where Clause (w/o the WHERE and w/o History). |
void |
setTableName(String newTableName)
Set Table Name |
void |
setValueAt(Object value,
int row,
int col)
Set Value in data and update MField. |
void |
setValueAt(Object value,
int row,
int col,
boolean force)
Set Value in data and update MField. |
void |
sort(int col,
boolean ascending)
Sort Entries by Column. |
String |
toString()
toString |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTY
public static final char SAVE_OK
public static final char SAVE_ERROR
public static final char SAVE_ACCESS
public static final char SAVE_MANDATORY
public static final char SAVE_ABORT
| Constructor Detail |
|---|
public GridTable(Properties ctx,
int AD_Table_ID,
String TableName,
int WindowNo,
int TabNo,
boolean withAccessControl)
ctx - PropertiesAD_Table_ID - table idTableName - table nameWindowNo - window noTabNo - tab nowithAccessControl - if true adds AD_Client/Org restrictuins| Method Detail |
|---|
public void setTableName(String newTableName)
newTableName - table namepublic String getTableName()
public boolean setSelectWhereClause(String newWhereClause,
boolean onlyCurrentRows,
int onlyCurrentDays)
newWhereClause - sql where clauseonlyCurrentRows - only current rowsonlyCurrentDays - how many days back for current
public String getSelectWhereClause()
public boolean isOnlyCurrentRowsDisplayed()
public void setOrderClause(String newOrderClause)
newOrderClause - sql order by clausepublic String getOrderClause()
public void addField(GridField field)
field - fieldpublic String getColumnName(int index)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelindex - the column being queried
public int findColumn(String columnName)
findColumn in class AbstractTableModelcolumnName - string containing name of column to be located
columnName, or -1 if not foundpublic Class<?> getColumnClass(int index)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelindex - the column being queried
public void setParameterSELECT(int index,
Object parameter)
index - indexparameter - parameter
public void setParameterWHERE(int index,
Object parameter)
index - indexparameter - parameterprotected GridField getField(int index)
index - index
protected GridField getField(String identifier)
identifier - column name
public GridField[] getFields()
public boolean open(int maxRows)
maxRows - maximum number of rows or 0 for all
public void loadComplete()
public boolean isLoading()
public boolean isOpen()
public void close(boolean finalCall)
finalCall - final callpublic int getColumnCount()
getColumnCount in interface TableModelpublic int getFieldCount()
public int getRowCount()
getRowCount in interface TableModelpublic void setColorColumn(String columnName)
columnName - column namepublic int getColorCode(int row)
If numerical value in compare column is
negative = -1,
positive = 1,
otherwise = 0
row - row
setColorColumn(java.lang.String)
public void sort(int col,
boolean ascending)
col - colascending - ascendingpublic int getKeyID(int row)
row - row
public String getKeyColumnName()
public Object getValueAt(int row,
int col)
getValueAt in interface TableModelrow - rowcol - col
public void setChanged(boolean changed)
changed - changed
public final void setValueAt(Object value,
int row,
int col)
setValueAt in interface TableModelsetValueAt in class AbstractTableModelvalue - value to assign to cellrow - row index of cellcol - column index of cell
public final void setValueAt(Object value,
int row,
int col,
boolean force)
value - value to assign to cellrow - row index of cellcol - column index of cellforce - force setting new value
public Object getOldValue(int row,
int col)
row - rowcol - col
public boolean needSave(boolean onlyRealChange)
onlyRealChange - if true the value of a field was actually changed
(e.g. for new records, which have not been changed) - default false
public boolean needSave()
public boolean needSave(int newRow)
newRow - to check
public boolean needSave(int newRow,
boolean onlyRealChange)
newRow - to checkonlyRealChange - if true the value of a field was actually changed
(e.g. for new records, which have not been changed) - default false
public boolean dataSave(int newRow,
boolean manualCmd)
newRow - rowmanualCmd - manual command to save
public char dataSave(boolean manualCmd)
manualCmd - if true, no vetoable PropertyChange will be fired for save confirmation
public boolean dataNew(int currentRow,
boolean copyCurrent)
currentRow - rowcopyCurrent - copy
public boolean dataDelete(int row)
row - row
public void dataIgnore()
public void dataRefresh(int row)
row - rowpublic void dataRefreshAll()
public boolean dataRequery(String whereClause,
boolean onlyCurrentRows,
int onlyCurrentDays)
whereClause - sql where clauseonlyCurrentRows - only current rowsonlyCurrentDays - how many days back
public boolean isCellEditable(int row,
int col)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelrow - the row index being queriedcol - the column index being queried
public boolean isRowEditable(int row)
row - row
public void setReadOnly(boolean value)
value - new read only valuepublic boolean isReadOnly()
public boolean isInserting()
public void setCompareDB(boolean compareDB)
compareDB - compare DB - false forces overwritepublic boolean getCompareDB()
public void setDeleteable(boolean value)
value - new deleteable valuepublic void removeDataStatusListener(DataStatusListener l)
l - listenerpublic void addDataStatusListener(DataStatusListener l)
l - listener
protected void fireDataStatusIEvent(String AD_Message,
String info)
AD_Message - messageinfo - additional info
protected void fireDataStatusEEvent(String AD_Message,
String info,
boolean isError)
AD_Message - messageinfo - infoisError - errorprotected void fireDataStatusEEvent(ValueNamePair errorLog)
errorLog - error log infopublic void removeVetoableChangeListener(VetoableChangeListener l)
l - listenerpublic void addVetoableChangeListener(VetoableChangeListener l)
l - listener
protected void fireVetoableChange(PropertyChangeEvent e)
throws PropertyVetoException
e - event
PropertyVetoExceptionpublic String toString()
toString in class Object
protected void setFieldVFormat(String identifier,
String strNewFormat)
Identifier - field identstrNewFormat - new mask
|
Adempiere 3.5.2a | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||