Guest User

Untitled

a guest
Jun 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public void myValChanged(ValueChangeEvent event) {
  2. try {
  3. validate(event.getNewValue());
  4. myValue = event.getNewValue();
  5. } catch (Exception ex) {
  6. /*
  7. Listeners are called before update model values in the request lifecycle so any changes you make in that phase are overwritten by the actual values in the page.
  8. By changing the event's phase to UPDATE_MODEL_VALUES or INVOKE_APPLICATION your changes will overwrite those currently set in the page, which is what you need.
  9. */
  10. myValue = event.getOldValue();
  11. if (!event.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)) {
  12. event.setPhaseId(PhaseId.INVOKE_APPLICATION);
  13. event.queue();
  14. return;
  15. }
  16. }
  17.  
  18. }
Add Comment
Please, Sign In to add comment