Wednesday, February 1, 2012

Problem with ValueChangeEvent.fire(HasValueChangeHandlers, T)

Hello,

I have a strange behavior when using the method ValueChangeEvent.fire(HasValueChangeHandlers<T>, T). This method works well with browsers Mozilla Firefox 6.0.2 and Opera 11.10, but does not work for browsers Chrome, Internet Explorer 9 and Safari 5.0.3.

Do you have any idea about this problem?

The Java code is:

 private class ValueChangeAndSelectionHandler implements ValueChangeHandler<String>,
      SelectionHandler<Suggestion>
   {
      private boolean _valueChangeEventhandled = false;

      @Override
      public void onSelection(SelectionEvent<Suggestion> event)
      {
         MySuggestion selectedItem = (MySuggestion) event
            .getSelectedItem();
         if (_valueChangeEventhandled)
         {
            SuggestBox source = (SuggestBox) event.getSource();
            String selected = event.getSelectedItem().getReplacementString();
            ValueChangeEvent.fire(source, selected);
            _valueChangeEventhandled = false;
         }

      }

      @Override
      public void onValueChange(ValueChangeEvent<String> event)
      {
         _valueChangeEventhandled = true;
         SuggestBox source = (SuggestBox) event.getSource();
         DefaultSuggestionDisplay suggestionDisplay = (DefaultSuggestionDisplay) source
            .getSuggestionDisplay();
         boolean listShowing = suggestionDisplay.isSuggestionListShowing();
         if (!listShowing)
         {
            doWork();
            _valueChangeEventhandled = false;
         }
      }
   }

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment