I tried to use History class to manage the handling of the back/forward
functioning of the browsers. In order to do that, I need to save the screens
with state to a collection, such as a HashMap, hmap.
For example, the screen is represented by a Composite object, compObject,
which contains a widget object: wgtObject. Every time when I said that the
screen was changed, it implied that the only the wgtObject was changed. When
I used the History to do that, the code is like,
Hostory.newItem(screenName);
hmap.put(screenName, compObject);
However, since the compObject is the same instance, on the onValueChange()
public void onValueChange(ValueChangeEvent<String> event) {
String screenName = event.getValue();
Composite composite = hmap.get(screenName);
if (compObject != null) {
RootPanel slot = RootPanel.get("mainPanel");
slot.clear();
slot.add(composite);
}
}
even the code turned to different screens, the same screen remained
unchanged. The reason is that the compObject rather than wgtObject is saved
to hmap!
But I need to save compObject with its state to hmap. So I need to clone the
compObject before saving it to hmap. Since there is no Object.clone()
available for GWT, how can I do that?
Thanks,
Mike J.
--
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.