Search in sources :

Example 36 with GridTab

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);
}
Also used : WSearch(org.adempiere.webui.WSearch) GridTab(org.compiere.model.GridTab) GridField(org.compiere.model.GridField)

Example 37 with GridTab

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() + ")");
    }
}
Also used : GridTab(org.compiere.model.GridTab) AdempiereException(org.adempiere.exceptions.AdempiereException) GridField(org.compiere.model.GridField) PO(org.compiere.model.PO)

Example 38 with GridTab

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));
}
Also used : GridWindow(org.compiere.model.GridWindow) GridTab(org.compiere.model.GridTab) GridWindowVO(org.compiere.model.GridWindowVO) MQuery(org.compiere.model.MQuery)

Aggregations

GridTab (org.compiere.model.GridTab)38 GridField (org.compiere.model.GridField)10 MQuery (org.compiere.model.MQuery)8 AdempiereException (org.adempiere.exceptions.AdempiereException)4 Point (java.awt.Point)3 MRole (org.compiere.model.MRole)3 PO (org.compiere.model.PO)3 Dimension (java.awt.Dimension)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 MBrowse (org.adempiere.model.MBrowse)2 ProcessModalDialog (org.adempiere.webui.apps.ProcessModalDialog)2 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)2 org.apache.ecs.xhtml.div (org.apache.ecs.xhtml.div)2 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)2 GridController (org.compiere.grid.GridController)2 ICreateFrom (org.compiere.grid.ICreateFrom)2 GridTable (org.compiere.model.GridTable)2 MOrderLine (org.compiere.model.MOrderLine)2