Search in sources :

Example 21 with WEditor

use of org.adempiere.webui.editor.WEditor in project adempiere by adempiere.

the class FindWindow method valueChange.

//  getTotalRecords
public void valueChange(ValueChangeEvent evt) {
    if (evt != null && evt.getSource() instanceof WEditor) {
        WEditor editor = (WEditor) evt.getSource();
        // Editor component
        Component component = editor.getComponent();
        ListCell listcell = (ListCell) component.getParent();
        listcell.setAttribute("value", evt.getNewValue());
    }
}
Also used : ListCell(org.adempiere.webui.component.ListCell) WEditor(org.adempiere.webui.editor.WEditor) Component(org.zkoss.zk.ui.Component)

Example 22 with WEditor

use of org.adempiere.webui.editor.WEditor in project adempiere by adempiere.

the class FindWindow method getEditorComponent.

//  addOperators
/**
     *  Get Editor
     *  @param row row
     *  @return Editor component
    **/
public Component getEditorComponent(ListItem row, boolean to) {
    String columnName = getColumnName(row);
    boolean between = false;
    Listbox listOp = (Listbox) row.getFellow("listOperator" + row.getId());
    String betweenValue = listOp.getSelectedItem().getValue().toString();
    String opValue = MQuery.OPERATORS[MQuery.BETWEEN_INDEX].getValue();
    if (to && betweenValue != null && betweenValue.equals(opValue))
        between = true;
    boolean enabled = !to || (to && between);
    //  Create Editor
    GridField field = getTargetMField(columnName);
    if (field == null)
        return new Label("");
    WEditor editor = null;
    if (field.isKey())
        editor = new WNumberEditor(field);
    else
        editor = WebEditorFactory.getEditor(field, true);
    if (editor == null)
        editor = new WStringEditor(field);
    field.addPropertyChangeListener(editor);
    editor.addValueChangeListener(this);
    editor.setValue(null);
    editor.setReadWrite(enabled);
    editor.setVisible(enabled);
    editor.dynamicDisplay();
    // So we have to do this after setting the ReadWrite
    if (enabled && editor instanceof WTableDirEditor) {
        ((WTableDirEditor) editor).actionRefresh();
    }
    //
    return editor.getComponent();
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) Label(org.adempiere.webui.component.Label) GridField(org.compiere.model.GridField) WEditor(org.adempiere.webui.editor.WEditor) Listbox(org.adempiere.webui.component.Listbox) WNumberEditor(org.adempiere.webui.editor.WNumberEditor) WStringEditor(org.adempiere.webui.editor.WStringEditor)

Aggregations

WEditor (org.adempiere.webui.editor.WEditor)22 GridField (org.compiere.model.GridField)11 Component (org.zkoss.zk.ui.Component)6 Label (org.adempiere.webui.component.Label)4 WEditorPopupMenu (org.adempiere.webui.editor.WEditorPopupMenu)4 Div (org.zkoss.zul.Div)4 Listbox (org.adempiere.webui.component.Listbox)3 Hbox (org.zkoss.zul.Hbox)3 Button (org.adempiere.webui.component.Button)2 ListCell (org.adempiere.webui.component.ListCell)2 WButtonEditor (org.adempiere.webui.editor.WButtonEditor)2 WNumberEditor (org.adempiere.webui.editor.WNumberEditor)2 WStringEditor (org.adempiere.webui.editor.WStringEditor)2 AbstractADWindowPanel (org.adempiere.webui.panel.AbstractADWindowPanel)2 ADWindow (org.adempiere.webui.window.ADWindow)2 Label (org.zkoss.zhtml.Label)2 HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)2 Listcell (org.zkoss.zul.Listcell)2 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1