use of org.compiere.swing.CEditor in project adempiere by adempiere.
the class SmallViewController method validateFields.
/**
* Validate all fields for values and mandatory
* @return null if nothing happens
*/
public String validateFields() {
log.config("");
StringBuffer sb = new StringBuffer();
int size = fields.size();
for (int i = 0; i < size; i++) {
GridField field = fields.get(i);
// FR [ 566 ] Only Information
if (field == null || field.isInfoOnly())
continue;
// if there is an error, the field's error flag will be set
if (!field.validateValue()) {
if (sb.length() > 0)
sb.append(", ");
sb.append(field.getHeader());
CEditor editor = editors.get(i);
if (editor != null)
editor.setBackground(field.isError());
}
// Check for Range
GridField fieldTo = fieldsTo.get(i);
// Validate
if (fieldTo != null && !fieldTo.validateValue()) {
if (sb.length() > 0)
sb.append(", ");
sb.append(fieldTo.getHeader());
CEditor editor = editorsTo.get(i);
if (editor != null)
editor.setBackground(fieldTo.isError());
}
// range field
}
// Valid if exists a error
if (sb.length() != 0) {
return sb.toString();
}
// Nothing happened
return null;
}
use of org.compiere.swing.CEditor in project adempiere by adempiere.
the class VPAttributeDialog method cmd_newEdit.
// cmd_select
/**
* Instance New/Edit
*/
private void cmd_newEdit() {
boolean rw = cbNewEdit.isSelected();
log.config("R/W=" + rw + " " + m_masi);
//
fieldLotString.setEditable(rw && m_masi.getM_Lot_ID() == 0);
if (fieldLot != null)
fieldLot.setReadWrite(rw);
bLot.setReadWrite(rw);
fieldSerNo.setReadWrite(rw);
bSerNo.setReadWrite(rw);
fieldGuaranteeDate.setReadWrite(rw);
//
for (int i = 0; i < m_editors.size(); i++) {
CEditor editor = (CEditor) m_editors.get(i);
editor.setReadWrite(rw);
}
}
Aggregations