Re: Firing a ChangeEvent from a widget that wouldn't natively fire one
Is there any reason to be concerned about firing a ChangeEvent from a composite based on a FlowPanel?
I'm trying to track user edits within a form, in order to set a dirty data flag. Sometimes the form has subforms, each of which has it's own data dirty tracking. Basically, I'm handling ChangeEvents and ValueChangeEvents within the subform, and when those occur, I'm firing a ChangeEvent from the subform. It all seems to work, but I have a vague discomfort with it, knowing that things like textboxes and selects natively fire change events, but div tags don't. Is all the event management related to manually fired change events done entirely in GWT?
Not sure if that has any bad consequences but I would guess it does not. Maybe some old IE's have bugs regarding event bubble'ing for change events.
However, as dirty tracking is a logical thing I would fire a logical event and not a DOM event. I think I would have created a DirtyEvent/FormEditedEvent + Handler. Alternatively you could also create an interface DirtyTracker that has some methods like setDirty(Form/IsWidget) and have the top most class that controls your form hierarchy handle the dirtiness of all forms (you would pass the DirtyTracker down the Form hierarchy, and each form would call setDirty(this) if it detects that it is dirty).
As an aside, it's a little weird that ListBox fires ChangeEvent, and not ValueChangeEvent, while ValueListBox fires ValueChangeEvent but not ChangeEvent, given that they're both based on select tags.
They serve different purpose. ListBox is the direct wrapper of the select tag while ValueListBox works on a higher level as it can deal with any kind of values not just strings. The fact that ValueListBox uses a ListBox internally is an implementation detail.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home