I am following the model of DynaTableRf in building a sample app
combining RequestFactory, EditorFramework, CellTable, and Objectify.
In tracing the code for DynaTableRf after a new Person is created
(when the user clicks on New Person), the onPersonChanged method is
called, since it was registered using the following code:
EntityProxyChange.registerForProxyType(eventBus, PersonProxy.class,
new EntityProxyChange.Handler<PersonProxy>() {
public void onProxyChange(EntityProxyChange<PersonProxy> event)
{
SummaryWidget.this.onPersonChanged(event);
}
});
However, in my code (which is essentially identical - same type of
"workflow", usage of RequestFactory, cellTable) my onProxyChange() is
NOT being called. My code is shown below - yes, it looks quite
similar :).
EntityProxyChange.registerForProxyType(eventBus,
CommitmentProxy.class,
new EntityProxyChange.Handler<CommitmentProxy>() {
public void onProxyChange(EntityProxyChange<CommitmentProxy>
event) {
SummaryWidget.this.onCommitmentChanged(event);
System.out.println("In onCommitmentChanged");
}
});
In both cases (DynaTableRf, my code) the new objects (Person,
Commitment) are created - it is a matter of how to get the
EntityProxyChange to be called to update the display.
Two things I Hadn't noticed at first (but which had no effect when I
tried them):
1. To my CommitmentProxy class, I added the following line to match
the equivalent in PersonProxy
EntityProxyId<CommitmentProxy> stableId(); // For EntityProxyChange
- but no help
2. To my persist() method, I added a manual update to the version
field, thinking that might be necessary to trigger the
EntityProxyChange.
The one significant difference between my code and DynaTableRf is that
I am using Objectify, whereas DynaTableRf appears to use an in-memory
datastore.
So my questions are:
1. What is it that should trigger the EntityProxyChange event? The
code for when the user presses the New Person button is:
PersonRequest context = requestFactory.personRequest();
AddressProxy address = context.create(AddressProxy.class);
PersonProxy person = context.edit(context.create(PersonProxy.class));
person.setAddress(address);
context.persist().using(person);
eventBus.fireEvent(new EditPersonEvent(person, context));
My code for the new Commitment button is:
CommitmentRequest context = requestFactory.commitmentRequest();
CommitmentProxy commitment =
context.edit(context.create(CommitmentProxy.class));
commitment.setPhase("Negotiation");
context.persist(currentCommitUserProxy).using(commitment);
eventBus.fireEvent(new EditCommitmentEvent(commitment, context));
2. Is Objectify the problem? Does it interfere with the magic that
triggers EntityProxyChange?
Thanks so much for any assistance!
RB
--
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.