|
I am trying to change the value being entered in the editor for a property grid panel. The issue I am running up against is demonstrated by the sample code below. If you edit the value and CLICK to exit the field, the value will be updated on the display. If however, you press ENTER, the display does not get updated. I have tried using the two ways below (one commented out). Does anybody have a suggestion for a more reliable way to accomplish this?
Thanks!
PropertyGridPanel grid = new PropertyGridPanel(); grid.setStore(new Store(){}); HashMap source = new HashMap(); source.put("Text", "value"); grid.setSource(source); HashMap customEditors = new HashMap(); final TextField lcaseTextField = new TextField(); lcaseTextField.addListener(new TextFieldListenerAdapter(){ public void onChange(Field field, Object newVal, Object oldVal){ lcaseTextField.setRawValue(((String)newVal).toLowerCase()); } }); /*lcaseTextField.setValidator(new Validator(){ public boolean validate(String value) throws ValidationException { lcaseTextField.setRawValue(value.toLowerCase()); return true; } });*/ customEditors.put("Text", new GridEditor(lcaseTextField)); grid.setCustomEditors(customEditors); this.add(grid);
|