GWT How to undo changes in the editor

Am I there the way the Editor discards changes made to its properties? This is on the client side. No perseverance.

I have:

public class ClaseEditor extends PopupPanel implements Editor<ClaseProxy> {
  @UiField ValidatedTextBox tema;
  @UiField ValidatedTextBox catedratico;
}

I use this editor in ListEditor, since you know that there is a list of editors in

 ListEditor<ClaseProxy, ClaseEditor>

If the user creates one, this is normal, then if the user edits it. I have options to save or cancel, I save ok, just hide the editor and the changes made are in order.

But in the user clicks “Cancel”, and if some changes have been made to the properties, the editor resets the (lazy) editor, which changes to a proxy.

Yes, I can save the initial value in a string and then restore using setValue () in texboxes. But is there another way (API editor) that prevents this?

thank

+3
2

. () - . , -, . ( RequestFactoryEditorDriver, , driver.edit(proxy,ctx). Fire() - , 't , .

0

SimpleBeanEditorDriver, edit, flush.

SimpleBeanEditorDriver bean edit bean flush.

, , flush , flush. , flush .

private Bean currentObject;

/**
 * Start editing the given object.
 */
public void edit(Bean object) {
  this.currentObject = object;
  this.driver.edit(object);
}

/**
 * Call this every time an editor is in a consistent state.
 * (e.g. onBlur event if validation succeeds)
 */
private void save() {
  this.driver.flush(); // saves editors' state into currentObject
}

/**
 * Call this to cancel changes on all editing editors.
 * (e.g. onBlur event if validation fails)
 */
private void revert() {
  this.driver.edit(currentObject); // reloads currentObject into editors
}

/**
 * Stores all pending changes to the server.
 * Remember to validate all editors.
 */
public void commit() {
  Bean object = this.driver.flush();
  Server.persist(object);
}
0

All Articles