Search in sources :

Example 96 with GridField

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;
}
Also used : GridField(org.compiere.model.GridField) WEditor(org.adempiere.webui.editor.WEditor) LinkedHashMap(java.util.LinkedHashMap)

Example 97 with GridField

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

Example 98 with GridField

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;
}
Also used : IDColumn(org.compiere.minigrid.IDColumn) MBrowseField(org.adempiere.model.MBrowseField) SQLException(java.sql.SQLException) GridField(org.compiere.model.GridField)

Example 99 with GridField

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

Example 100 with GridField

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());
}
Also used : AReport(org.compiere.print.AReport) MQuery(org.compiere.model.MQuery) GridField(org.compiere.model.GridField) Point(java.awt.Point)

Aggregations

GridField (org.compiere.model.GridField)114 MQuery (org.compiere.model.MQuery)15 WEditor (org.adempiere.webui.editor.WEditor)11 GridFieldVO (org.compiere.model.GridFieldVO)10 GridTab (org.compiere.model.GridTab)10 Lookup (org.compiere.model.Lookup)9 org.apache.ecs.xhtml.tr (org.apache.ecs.xhtml.tr)8 MLookup (org.compiere.model.MLookup)8 Component (java.awt.Component)7 AdempiereException (org.adempiere.exceptions.AdempiereException)7 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)7 org.apache.ecs.xhtml.input (org.apache.ecs.xhtml.input)7 ValueNamePair (org.compiere.util.ValueNamePair)7 SQLException (java.sql.SQLException)6 MBrowseField (org.adempiere.model.MBrowseField)6 org.apache.ecs.xhtml.td (org.apache.ecs.xhtml.td)6 VEditor (org.compiere.grid.ed.VEditor)6 Point (java.awt.Point)5 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)5 org.apache.ecs.xhtml.div (org.apache.ecs.xhtml.div)5