use of org.compiere.model.GridTab in project adempiere by adempiere.
the class AbstractADWindowPanel method onFind.
//
/**
* @see ToolbarListener#onFind()
*/
public void onFind() {
GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
if (currentTab == null)
return;
if (!onSave(false))
return;
// Gets Fields from AD_Field_v
GridField[] findFields = GridField.createFields(ctx, currentTab.getWindowNo(), 0, currentTab.getAD_Tab_ID());
// FindWindow find = new FindWindow (currentTab.getWindowNo(), currentTab.getName(),
// currentTab.getAD_Table_ID(), currentTab.getTableName(),
// currentTab.getWhereExtended(), findFields, 1, currentTab.getAD_Tab_ID());
// Open a popup or the search window
WSearch find = new WSearch(this, toolbar.getEvent().getTarget(), currentTab, findFields);
}
use of org.compiere.model.GridTab in project adempiere by adempiere.
the class InterfaceWrapperHelper method getValueByColumnId.
public static <T> T getValueByColumnId(Object model, int adColumnId) {
Check.assumeNotNull(model, "model is not null");
Check.assume(adColumnId > 0, "adColumnId > 0");
if (GridTabWrapper.isHandled(model)) {
final GridTab gridTab = GridTabWrapper.getGridTab(model);
for (final GridField field : gridTab.getFields()) {
if (field.getAD_Column_ID() == adColumnId) {
@SuppressWarnings("unchecked") final T value = (T) field.getValue();
return value;
}
}
throw new AdempiereException("No field with AD_Column_ID=" + adColumnId + " found in " + gridTab + " for " + model);
} else if (POWrapper.isHandled(model)) {
PO po = POWrapper.getPO(model, false);
@SuppressWarnings("unchecked") T value = (T) po.get_ValueOfColumn(adColumnId);
return value;
} else // else if (POJOWrapper.isHandled(model))
// {
// final POJOWrapper wrapper = POJOWrapper.getWrapper(model);
// // MColumn.getColumnName(ctx, AD_Column_ID)
// }
{
throw new AdempiereException("Model wrapping is not supported for " + model + " (class:" + model.getClass() + ")");
}
}
use of org.compiere.model.GridTab in project adempiere by adempiere.
the class Stocktake method refresh.
// dynInit
/**************************************************************************
* Refresh - Create Query and refresh grid
*/
public void refresh(Object inventory, Object locator, Object product, Object aislex, Object lineFrom, Object lineTo, IStatusBar statusBar, Boolean isSecondCount) {
m_mTab.dataSave(true);
/**
* Create Where Clause
*/
MQuery query = m_staticQuery.deepCopy();
// Physical Inventory
if (inventory == null || inventory.toString().length() == 0)
return;
query.addRestriction("M_Inventory_ID", MQuery.EQUAL, inventory);
// Locator
if (locator != null && locator.toString().length() > 0)
query.addRestriction("M_Locator_ID", MQuery.EQUAL, locator);
// Product
if (product != null && product.toString().length() > 0)
query.addRestriction("M_Product_ID", MQuery.EQUAL, product);
// aislex
if (aislex != null && aislex.toString().length() > 0)
query.addRestriction("M_Locator_ID IN (SELECT M_Locator_ID FROM M_Locator WHERE X='" + aislex.toString() + "')");
// DateFrom
if (lineFrom != null)
query.addRestriction("Line", MQuery.GREATER_EQUAL, lineFrom);
// DateTO
if (lineTo != null)
query.addRestriction("Line", MQuery.LESS_EQUAL, lineTo);
if (isSecondCount) {
// Hardcoded Window: Physical Inventory
int AD_Window_ID = 168;
GridWindowVO wVO = AEnv.getMWindowVO(m_WindowNo, AD_Window_ID, 0);
if (wVO == null)
return;
GridWindow m_mWindow2 = new GridWindow(wVO);
//second count tab
GridTab m_mTab2 = m_mWindow2.getTab(3);
String sql = m_mTab2.getWhereClause();
query.addRestriction(sql);
}
log.info("VTrxMaterial.refresh query=" + query.toString());
/**
* Refresh/Requery
*/
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "StartSearch"), false);
//
m_mTab.setQuery(query);
m_mTab.query(false);
//
int no = m_mTab.getRowCount();
statusBar.setStatusLine(" ", false);
statusBar.setStatusDB(Integer.toString(no));
}
Aggregations