Search in sources :

Example 16 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class Browser method setParameters.

/**
	 * FR [ 245 ]
	 * Set Parameters
	 */
public void setParameters() {
    parametersValues = new ArrayList<Object>();
    parameters = new ArrayList<Object>();
    m_parameters_field = new ArrayList<GridFieldVO>();
    boolean onRange = false;
    for (Entry<String, GridField> entry : getPanelParameters().entrySet()) {
        GridField editor = (GridField) entry.getValue();
        GridFieldVO field = editor.getVO();
        if (!onRange) {
            if (editor.getValue() != null && !editor.getValue().toString().isEmpty() && !field.IsRange) {
                parameters.add(field.ColumnNameAlias);
                parametersValues.add(editor.getValue());
                m_parameters_field.add(field);
            } else if (editor.getValue() != null && !editor.getValue().toString().isEmpty() && field.IsRange) {
                parameters.add(field.ColumnNameAlias);
                parametersValues.add(editor.getValue());
                m_parameters_field.add(field);
                onRange = true;
            } else
                continue;
        } else if (editor.getValue() != null && !editor.getValue().toString().isEmpty()) {
            parameters.add(field.ColumnNameAlias);
            parametersValues.add(editor.getValue());
            m_parameters_field.add(field);
            onRange = false;
        }
    }
}
Also used : GridFieldVO(org.compiere.model.GridFieldVO) GridField(org.compiere.model.GridField)

Example 17 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class Process method doPost.

/*private static void ProcessDocAction(GridField field, int record_id, WWindowStatus ws)
	throws IOException
	{
		//select sel = new select();
		LookupValues lvs = LookupValues.Factory.newInstance(); //sel.setName("SetDocAction");
		renderDocActionOptions(lvs, ws.curTab);
		//frm.addElement(new input("hidden", "action", "DocAction"));
		
		//center.addElement( WebUtil.createClosePopupButton() );

	}*/
public void doPost() throws IOException {
    //WebUtil.getParameter(request, "ColumnName");
    String column_name = "";
    //WebUtil.getParameter(request, "action");
    String action = "";
    //WWindowStatus.get(request);
    WWindowStatus ws = null;
    //WebUtil.getParameter(request, "SetDocAction"); 
    String DA = "";
    ws.curTab.setValue("DocAction", DA);
    if (//slain - nie wyrzucaj bledu, jesli nie musiales zapisac
    ws.curTab.needSave(true, false)) //if (! cmd_save(ws))
    {
    //doc.addWindowCenter(false).addElement("B��d zapisu..." );
    //return;
    }
    GridField f = ws.curTab.getField(column_name);
    int process_id = f.getAD_Process_ID();
    int record_id = ws.curTab.getRecord_ID();
    String qs = "AD_Process_ID=" + Integer.toString(process_id) + "&" + "AD_Record_ID=" + Integer.toString(record_id);
    return;
}
Also used : GridField(org.compiere.model.GridField) JasperPrint(net.sf.jasperreports.engine.JasperPrint)

Example 18 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class GridTabRowRenderer method render.

/**
	 * @param row
	 * @param data
	 * @see RowRenderer#render(Row, Object)
	 */
public void render(Row row, Object[] data, int index) throws Exception {
    //don't render if not visible
    if (gridPanel != null && !gridPanel.isVisible()) {
        return;
    }
    if (grid == null)
        grid = (Grid) row.getParent().getParent();
    if (rowListener == null)
        rowListener = new RowListener((Grid) row.getParent().getParent());
    currentValues = data;
    int columnCount = gridTab.getTableModel().getColumnCount();
    GridField[] gridField = gridTab.getFields();
    Grid grid = (Grid) row.getParent().getParent();
    org.zkoss.zul.Columns columns = grid.getColumns();
    int rowIndex = row.getParent().getChildren().indexOf(row);
    if (paging != null && paging.getPageSize() > 0) {
        rowIndex = (paging.getActivePage() * paging.getPageSize()) + rowIndex;
    }
    int colIndex = -1;
    for (int i = 0; i < columnCount; i++) {
        if (!(gridField[i].isDisplayed())) {
            continue;
        }
        colIndex++;
        Div div = new Div();
        ThemeUtils.addSclass("ad-gridtabrowrenderer", div);
        org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex);
        if (column.isVisible()) {
            Component component = getDisplayComponent(currentValues[i], gridField[i]);
            div.appendChild(component);
            //				if (compCount == 1) {
            //add hidden input component to help focusing to row
            div.appendChild(createAnchorInput());
            if (DisplayType.YesNo == gridField[i].getDisplayType() || DisplayType.Image == gridField[i].getDisplayType()) {
                ThemeUtils.addSclass("yes-no", div);
            //divStyle += "text-align:center; ";
            } else if (DisplayType.isNumeric(gridField[i].getDisplayType())) {
                ThemeUtils.addSclass("numeric", div);
            //divStyle += "text-align:right; ";
            }
        }
        div.setAttribute("columnName", gridField[i].getColumnName());
        div.addEventListener(Events.ON_CLICK, rowListener);
        div.addEventListener(Events.ON_DOUBLE_CLICK, rowListener);
        row.appendChild(div);
    }
    if (rowIndex == gridTab.getCurrentRow()) {
        setCurrentRow(row);
    }
    row.addEventListener(Events.ON_OK, rowListener);
}
Also used : Grid(org.zkoss.zul.Grid) GridField(org.compiere.model.GridField) Div(org.zkoss.zul.Div) Component(org.zkoss.zk.ui.Component) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent)

Example 19 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class ListPanel method dynamicDisplay.

/**
	 * validate the display properties of fields of current row
	 * @param col
	 */
public void dynamicDisplay(int col) {
    if (!gridTab.isOpen()) {
        return;
    }
    //  Selective
    if (col > 0)
        return;
    boolean noData = gridTab.getRowCount() == 0;
    List<WEditor> list = renderer.getEditors();
    for (WEditor comp : list) {
        GridField mField = comp.getGridField();
        if (mField != null && mField.getIncluded_Tab_ID() <= 0) {
            if (noData) {
                comp.setReadWrite(false);
            } else {
                //  r/w - check Context
                boolean rw = mField.isEditable(true);
                comp.setReadWrite(rw);
                comp.dynamicDisplay();
            }
        }
    }
//  all components
}
Also used : WEditor(org.adempiere.webui.editor.WEditor) GridField(org.compiere.model.GridField)

Example 20 with GridField

use of org.compiere.model.GridField in project adempiere by adempiere.

the class GridTabDataBinder method saveMultipleRecords.

// ValueChange
/**************************************************************************
	 * Save Multiple records - Clone a record and assign new values to each 
	 * clone for a specific column.
	 * @param ctx context
	 * @param tableName Table Name
	 * @param columnName Column for which value need to be changed
	 * @param recordId Record to clone
	 * @param values Values to be assigned to clones for the specified column
	 * @param trxName Transaction
	 * @throws Exception If error is occured when loading the PO or saving clones
	 * 
	 * @author ashley
	 */
protected void saveMultipleRecords(Properties ctx, String tableName, String columnName, int recordId, Integer[] values, String trxName) throws Exception {
    if (values == null) {
        return;
    }
    int oldRow = gridTab.getCurrentRow();
    GridField lineField = gridTab.getField("Line");
    for (int i = 0; i < values.length; i++) {
        if (!gridTab.dataNew(true)) {
            throw new IllegalStateException("Could not clone tab");
        }
        gridTab.setValue(columnName, values[i]);
        if (lineField != null) {
            gridTab.setValue(lineField, 0);
        }
        if (!gridTab.dataSave(false)) {
            throw new IllegalStateException("Could not update tab");
        }
        gridTab.setCurrentRow(oldRow);
    }
}
Also used : GridField(org.compiere.model.GridField)

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