Hello,
I am using GWT 2.1 RC1 and I have managed to make RPC calls to fetch
Entities, which come back as their respective EntityProxy, but I can
not seem to make an update request fire off a ProxyChangeEvent. Here
is my source:
*/
public class DonorActivity extends AbstractActivity
implements BasicActivity,
EntityProxyChange.Handler {
private static final Logger LOG = Logger.getLogger("donor
activity");
protected DonorDisplay display;
protected PlaceController placeController;
protected final WellRequestFactory requestFactory;
@Inject
public DonorActivity(
DonorDisplay display,
PlaceController placeController,
WellRequestFactory requestFactory) {
this.display = display;
this.placeController = placeController;
this.requestFactory = requestFactory;
}
public void start(AcceptsOneWidget panel, EventBus eventBus) {
LOG.info("Starting");
display.setActivity(this);
panel.setWidget(display);
EntityProxyChange
.registerForProxyType(eventBus, DonorProxy.class, this);
requestFactory.donorRequest().fetchAll().fire(new
Receiver<List<DonorProxy>>() {
public void onSuccess(final List<DonorProxy> donors) {
final DonorRequest donorRequest =
requestFactory.donorRequest();
DonorProxy donorEdit =
donorRequest.edit(donors.get(0));
donorEdit.setFirstName("first namade some");
donorRequest.persist(donorEdit).fire();
}
@Override
public void onFailure(ServerFailure error) {
LOG.info(error.getMessage());
}
});
}
public void goTo(Place place) {
placeController.goTo(place);
}
public void onProxyChange(EntityProxyChange event) {
LOG.info("Proxy Donor Change");
}
}
As you can see I'm using GIN to do DI. EventBus is bound to
SimpleEventBus. I can see by using firebug that the RPC requests are
going through and coming back with JSON. For example:
{"result":
{"id":"1","lastName":"lastName","email":"[email protected]","dob":"523339200000","!
version":3,"gender":0,"!id":"1","isDeleted":0,"firstName":"first
namade some"},"sideEffects":{"UPDATE":[{"!version":4,"!
id":"org.thewell.shared.proxy.donorpr...@1"}]},"related":{}}
I can see their is a sideeffect and the version number is changing,
but still no event is firing off.
Also, is there any event automatically fired over the eventBus when a
fetch is run or is that the point of a "Receiver"?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.