If I get a bean and a dialog, and they are coupled with bidirectional data-binding, what is the best way to roll back to the original bean when user canceled the editing.
EDIT 1
If user opened up the dialog in edit mode, he then did some modification and pressed "OK", then this dialog closed and the underlying bean got updated. When I said "canceled the editing", I mean the user opened up the dialog and did some modification but pressed "cancel" button. In this case, the underlying bean should keep untouched, but due to data-binding, it become dirty, I want the original bean back.
I can just clone a bean when the dialog opens, if user presses "OK" the cloned bean will be copied back to original bean; if user presses "cancel" the cloned bean will be abandoned. I don't know if this is a good approach.