}
@Override
public void createStyles() {
Map<String, Object> dataSnapshot = new HashMap<String, Object>();
HasSourceReference item = (HasSourceReference) getItem();
dataSnapshot.put("item", item);
dataSnapshot.put("oldSrcUrl", item.getSourceReference());
dataSnapshot.put("newSrcUrl", getSrcUrl());
bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
@Override
public void onEvent(UndoableEvent event) { }
@Override
public void undoAction(UndoableEvent event) {
HasSourceReference item = (HasSourceReference) event.getData("item");
String srcRef = (String) event.getData("oldSrcUrl");
item.setSourceReference(srcRef);
}
@Override
public void doAction(UndoableEvent event) {
HasSourceReference item = (HasSourceReference) event.getData("item");
String srcRef = (String) event.getData("newSrcUrl");
item.setSourceReference(srcRef);
}
}));
}