이 블로그 검색

2011년 8월 11일 목요일

uiBinder안에 composite을 넣고 composite에서 발생한 이벤트 받기


In the definition of my Country-and-State view, I added 
  public class CountryStateView extends Composite implements
HasValueChangeHandlers<Object> 

and I implemented the required method with: 
  @Override
    public HandlerRegistration addValueChangeHandler(
        ValueChangeHandler<Object> handler) {
      return addHandler(handler, ValueChangeEvent.getType());
    } 

Whenever the country or state listboxes changes, I do: 
   ValueChangeEvent.fire(...the.composite.object..., null); 
and finally, in the UiBinder created form, I wrote 
  @UiHandler("countryStateView")
  void uiOnChange(ValueChangeEvent<Object> event) {
    // ...do whatever needs be done...
  } 

This is working perfectly (at least to my eyes!) but I'd like to know
if it could/should be done in a better way. 

댓글 없음:

댓글 쓰기