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());
}
}
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();
}
Aggregations