use of org.compiere.model.GridField in project adempiere by adempiere.
the class WBrowser method getPanelParameters.
@Override
public LinkedHashMap<String, GridField> getPanelParameters() {
LinkedHashMap<String, GridField> m_List = new LinkedHashMap<String, GridField>();
for (Entry<String, Object> entry : searchGrid.getParameters().entrySet()) {
WEditor editor = (WEditor) entry.getValue();
// BR [ 251 ]
if (!editor.isVisible() || editor.getGridField().isInfoOnly())
continue;
//
GridField field = editor.getGridField();
m_List.put(entry.getKey(), field);
}
// Default Return
return m_List;
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class WBrowserListItemRenderer method valueChange.
/**
* Editor Listener
* @param evt Event
*/
public void valueChange(ValueChangeEvent evt) {
if (evt.getSource() instanceof WEditor) {
GridField changedField = ((WEditor) evt.getSource()).getGridField();
if (changedField != null) {
//processDependencies(changedField);
// future processCallout (changedField);
}
}
String columnName = "";
if (evt.getSource() instanceof WEditor) {
WEditor wEditor = (WEditor) evt.getSource();
columnName = wEditor.getGridField().getVO().ColumnNameAlias;
}
//processNewValue(evt.getNewValue(), columnName);
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class WBrowserTable method loadTable.
@Override
public int loadTable(ResultSet rs) {
int no = 0;
int row = 0;
//
clearTable();
try {
while (rs.next()) {
no++;
setRowCount(row + 1);
int colOffset = 1;
int col = 0;
// BR [ 257 ]
for (MBrowseField field : getFields()) {
Object value = null;
if (field.isKey() && DisplayType.isID(field.getAD_Reference_ID()) && !field.getAD_View_Column().getColumnSQL().equals("'Row' AS \"Row\""))
value = new IDColumn(rs.getInt(col + colOffset));
else if (field.isKey() && DisplayType.isNumeric(field.getAD_Reference_ID()) && field.getAD_View_Column().getColumnSQL().equals("'Row' AS \"Row\""))
value = new IDColumn(no);
else if (DisplayType.isID(field.getAD_Reference_ID()) || field.getAD_Reference_ID() == DisplayType.Integer) {
Integer id = rs.getInt(col + colOffset);
value = id != 0 ? id : null;
} else if (DisplayType.isNumeric(field.getAD_Reference_ID()))
value = rs.getBigDecimal(col + colOffset);
else if (DisplayType.isDate(field.getAD_Reference_ID()))
value = rs.getTimestamp(col + colOffset);
else if (DisplayType.YesNo == field.getAD_Reference_ID()) {
value = rs.getString(col + colOffset);
if (value != null)
value = value.equals("Y");
} else
value = rs.getObject(col + colOffset);
GridField gridField = MBrowseField.createGridFieldVO(field, browser.getWindowNo());
gridField.setValue(value, true);
// Set Value
setValueAnyColumn(row, col, gridField);
col++;
}
row++;
}
} catch (SQLException exception) {
logger.log(Level.SEVERE, "", exception);
}
autoSize();
if (isShowTotals())
addTotals();
// repaint the table
this.repaint();
logger.config("Row(rs)=" + getRowCount());
// Return Row No
return no;
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class APanel method initialQuery.
// getWindowNo
/**
* Initial Query
* @param query initial query
* @param mTab tab
* @return query or null
*/
private MQuery initialQuery(MQuery query, GridTab mTab) {
MRole role = MRole.getDefault(m_ctx, false);
// We have a (Zoom) query
if (query != null && query.isActive() && !role.isQueryMax(query.getRecordCount()))
return query;
//
StringBuffer where = new StringBuffer(Env.parseContext(m_ctx, m_curWindowNo, mTab.getWhereExtended(), false));
// Query automatically if high volume and no query
boolean require = mTab.isHighVolume();
if (// No Trx Window
!require && !m_onlyCurrentRows) {
/* Where Extended already appended above, check for variables */
if (query != null) {
String wh2 = query.getWhereClause();
if (wh2.length() > 0) {
if (where.length() > 0)
where.append(" AND ");
where.append(wh2);
}
}
//
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ").append(mTab.getTableName());
if (where.length() > 0)
sql.append(" WHERE ").append(where);
// Does not consider security
int no = DB.getSQLValue(null, sql.toString());
//
require = MRole.getDefault().isQueryRequire(no);
}
// Show Query
if (require) {
GridField[] findFields = mTab.getFields();
Find find = new Find(Env.getFrame(this), m_curWindowNo, mTab.getName(), mTab.getAD_Tab_ID(), mTab.getAD_Table_ID(), mTab.getTableName(), where.toString(), findFields, // no query below 10
10);
query = find.getQuery();
//Goodwill
isCancel = (query == null);
find.dispose();
find = null;
}
return query;
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class APanel method cmd_report.
// cmd_refresh
/**
* Print standard Report
*/
private void cmd_report() {
log.info("");
if (!MRole.getDefault().isCanReport(m_curTab.getAD_Table_ID())) {
ADialog.error(m_curWindowNo, this, "AccessCannotReport");
return;
}
cmd_save(false);
// Query
MQuery query = new MQuery(m_curTab.getTableName());
// Link for detail records
String queryColumn = m_curTab.getLinkColumnName();
// Current row otherwise
if (queryColumn.length() == 0)
queryColumn = m_curTab.getKeyColumnName();
// Find display
String infoName = null;
String infoDisplay = null;
for (int i = 0; i < m_curTab.getFieldCount(); i++) {
GridField field = m_curTab.getField(i);
if (field.isKey())
infoName = field.getHeader();
if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo")) && field.getValue() != null)
infoDisplay = field.getValue().toString();
if (infoName != null && infoDisplay != null)
break;
}
if (queryColumn.length() != 0) {
if (queryColumn.endsWith("_ID"))
query.addRestriction(queryColumn, MQuery.EQUAL, new Integer(Env.getContextAsInt(m_ctx, m_curWindowNo, queryColumn)), infoName, infoDisplay);
else
query.addRestriction(queryColumn, MQuery.EQUAL, Env.getContext(m_ctx, m_curWindowNo, queryColumn), infoName, infoDisplay);
}
new AReport(m_curTab.getAD_Table_ID(), aReport.getButton(), query, this, m_curWindowNo, m_curTab.getWhereExtended());
}
Aggregations