Search in sources :

Example 1 with Find

use of org.compiere.apps.search.Find in project adempiere by adempiere.

the class VOrderPlanning method find.

private String find() {
    int AD_Window_ID = MTable.get(Env.getCtx(), MOrder.Table_ID).getAD_Window_ID();
    int AD_Tab_ID = MTab.getTab_ID(AD_Window_ID, "Order");
    //
    GridField[] findFields = GridField.createFields(Env.getCtx(), AD_Window_ID, 0, AD_Tab_ID);
    Find find = new Find(Env.getFrame(this), AD_Window_ID, this.getName(), AD_Tab_ID, AD_Table_ID, getTableName(), "", findFields, 1);
    MQuery query = find.getQuery();
    if (query != null && query.isActive())
        return query.getWhereClause();
    else
        return "";
}
Also used : Find(org.compiere.apps.search.Find) MQuery(org.compiere.model.MQuery) GridField(org.compiere.model.GridField)

Example 2 with Find

use of org.compiere.apps.search.Find 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;
}
Also used : MRole(org.compiere.model.MRole) Find(org.compiere.apps.search.Find) GridField(org.compiere.model.GridField) Point(java.awt.Point)

Example 3 with Find

use of org.compiere.apps.search.Find in project adempiere by adempiere.

the class ASearch method find.

/**
	 * 
	 * Open Find window
	 */
private void find() {
    GridField[] findFields = GridField.createFields(Env.getCtx(), m_targetWindowNo, 0, m_AD_Tab_ID);
    Find find = new Find(Env.getFrame(m_owner), m_targetWindowNo, m_title, m_AD_Tab_ID, m_AD_Table_ID, m_tableName, m_where, findFields, 1);
    m_query = find.getQuery();
    find.dispose();
    find = null;
    if (m_gt != null && m_gc != null) {
        //	Confirmed query
        if (m_query != null) {
            //m_onlyCurrentRows = false;      	//  search history too
            m_gt.setQuery(m_query);
            //  autoSize
            m_gc.query(false, m_onlycurrentdays, 0);
        }
        m_appsaction.setPressed(m_gt.isQueryActive());
    }
    if (m_reportEngine != null) {
        m_reportEngine.setQuery(m_query);
        m_viewer.revalidate();
    }
}
Also used : Find(org.compiere.apps.search.Find) GridField(org.compiere.model.GridField)

Aggregations

Find (org.compiere.apps.search.Find)3 GridField (org.compiere.model.GridField)3 Point (java.awt.Point)1 MQuery (org.compiere.model.MQuery)1 MRole (org.compiere.model.MRole)1