[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
When I run your sample I never see the suggest box. What should I be typing? On Wed, Oct 12, 2011 at 9:10 PM, stephen.haber...@gmail.com wrote: I published a demo here: http://sh-hello.appspot.com/ http://gwt-code-reviews.**appspot.com/1567803/http://gwt-code-reviews.appspot.com/1567803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
On 2011/10/14 16:30:07, rjrjr wrote: When I run your sample I never see the suggest box. What should I be typing? Crap--I set setSuggestionListHiddenWhenEmpty(false) thinking that would show the list if nothing was typed, hence be a hint of what was in the list, but I guess not. Yeah, sorry, I should have noted the contents: one, two, or three. http://gwt-code-reviews.appspot.com/1567803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
LGTM Nice tests there, thanks. I'll put this through the test gauntlet and submit. http://gwt-code-reviews.appspot.com/1567803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
r10703 http://gwt-code-reviews.appspot.com/1567803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
Reviewers: rjrjr, Message: Thanks for taking this over Stephen. Could you extend SuggestBoxTest to cover it? Also, have you looked at the behavior manually? Does it actually work as expected? In particular I'm wondering what happens if the user tabs into the box. All good ideas, I'll look in to it. Please review this at http://gwt-code-reviews.appspot.com/1567803/ Affected files: M user/src/com/google/gwt/user/client/ui/SuggestBox.java Index: user/src/com/google/gwt/user/client/ui/SuggestBox.java diff --git a/user/src/com/google/gwt/user/client/ui/SuggestBox.java b/user/src/com/google/gwt/user/client/ui/SuggestBox.java index 7a1f4318e11d09ea7350c09b9da62c6fb2b1dc8b..d74b1fea77167d676519f5c7162038eea7f2a8cb 100644 --- a/user/src/com/google/gwt/user/client/ui/SuggestBox.java +++ b/user/src/com/google/gwt/user/client/ui/SuggestBox.java @@ -105,7 +105,7 @@ import java.util.List; */ @SuppressWarnings(deprecation) public class SuggestBox extends Composite implements HasText, HasFocus, -HasAnimation, SourcesClickEvents, SourcesChangeEvents, +HasAnimation, HasEnabled, SourcesClickEvents, SourcesChangeEvents, SourcesKeyboardEvents, FiresSuggestionEvents, HasAllKeyHandlers, HasValueString, HasSelectionHandlersSuggestion, IsEditorLeafValueEditorString { @@ -923,6 +923,15 @@ public class SuggestBox extends Composite implements HasText, HasFocus, } /** + * Gets whether this widget is enabled. + * + * @return codetrue/code if the widget is enabled + */ + public boolean isEnabled() { +return box.isEnabled(); + } + + /** * Check if the {@link DefaultSuggestionDisplay} is showing. Note that this * method only has a meaningful return value when the * {@link DefaultSuggestionDisplay} is used. @@ -1012,6 +1021,16 @@ public class SuggestBox extends Composite implements HasText, HasFocus, this.selectsFirstItem = selectsFirstItem; } + /** + * Sets whether this widget is enabled. + * + * @param enabled codetrue/code to enable the widget, codefalse/code + * to disable it + */ + public void setEnabled(boolean enabled) { +box.setEnabled(enabled); + } + public void setFocus(boolean focused) { box.setFocus(focused); } -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
http://gwt-code-reviews.appspot.com/1567803/diff/4001/user/src/com/google/gwt/user/client/ui/SuggestBox.java File user/src/com/google/gwt/user/client/ui/SuggestBox.java (left): http://gwt-code-reviews.appspot.com/1567803/diff/4001/user/src/com/google/gwt/user/client/ui/SuggestBox.java#oldcode576 user/src/com/google/gwt/user/client/ui/SuggestBox.java:576: } This method was flagged as unused, so I removed it. Perhaps it was overriding an old method in MenuBar? It is no longer there if so. Tests still pass. http://gwt-code-reviews.appspot.com/1567803/diff/4001/user/src/com/google/gwt/user/client/ui/SuggestBox.java#oldcode621 user/src/com/google/gwt/user/client/ui/SuggestBox.java:621: @SuppressWarnings(hiding) Not sure what this was for, but it had a warning it was unneeded. http://gwt-code-reviews.appspot.com/1567803/diff/4001/user/src/com/google/gwt/user/client/ui/SuggestBox.java File user/src/com/google/gwt/user/client/ui/SuggestBox.java (right): http://gwt-code-reviews.appspot.com/1567803/diff/4001/user/src/com/google/gwt/user/client/ui/SuggestBox.java#newcode1023 user/src/com/google/gwt/user/client/ui/SuggestBox.java:1023: display.hideSuggestions(); Actually trying this was a good idea; I made a sample that enabled/disabled the box every 2 seconds, and if you were in the box when it was disabled, the suggestion list stayed put. So this fixes that. I added a few more elements on the page and tabbed around while it was both enabled and disabled and didn't see any issues. When disabled, it's not in the tab order. When re-enabled, it's back in the tab order. http://gwt-code-reviews.appspot.com/1567803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add HasEnabled to SuggestBox (issue1567803)
I published a demo here: http://sh-hello.appspot.com/ http://gwt-code-reviews.appspot.com/1567803/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors