Java – add / modify suggestoracle after building suggestbox in GWT

I can do it for you Suggest@R_804_2419 @All the information found by and multiwordsuggest Oracle shows that the only way to set up Oracle for the suggestion box is to construct it I don't think it makes sense, because there is a default constructor that doesn't accept Oracle and creates one for you, which may be empty It's no good I'm looking for methods such as setsuggestoracle (multiwordsuggestoracle) or addtosuggestoracle (string), but I can't find any suggestions on how to do this in the document

Solution

Creating Suggest@R_804_2419 @After that, it seems that you cannot change the instance of suggestoracle, but you can use Sugget@R_804_2419 @: getsuggestoracle() to access it From there, you must turn to the implementation class to change it; The suggestoracle base class itself does not provide anything So it's similar to:

SuggestOracle oracle = new MultiWordSuggestOracle();
Suggest@R_804_2419@ @R_804_2419@ = new Suggest@R_804_2419@(oracle);

try {
  MultiWordSuggestOracle multiWordOracle = (MultiWordSuggestOracle)@R_804_2419@.getOracle();
  multiWordOracle.add("This awesome suggestion.");
} catch (ClassCastException e ) {
  // the oracle was not what you thought it was
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>