当前位置: 首页>>代码示例>>Java>>正文


Java SuggestOracle.Suggestion方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.SuggestOracle.Suggestion方法的典型用法代码示例。如果您正苦于以下问题:Java SuggestOracle.Suggestion方法的具体用法?Java SuggestOracle.Suggestion怎么用?Java SuggestOracle.Suggestion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.ui.SuggestOracle的用法示例。


在下文中一共展示了SuggestOracle.Suggestion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSuggestions

import com.google.gwt.user.client.ui.SuggestOracle; //导入方法依赖的package包/类
private void findSuggestions(String query, final AsyncCallback<List<SuggestOracle.Suggestion>> callback) {
    if (!termsContext.isEnabled()) {
        callback.onSuccess(new ArrayList<SuggestOracle.Suggestion>());
        return;
    }
    String[] terms = query.trim().split("\\s");
    String lastTerm = terms[terms.length - 1];
    termsContext.setPrefix(lastTerm);
    termsManager.getTerms(new Callback<TermsResult>() {
        public void onSuccess(TermsResult termsResult) {
            List<SuggestOracle.Suggestion> suggestions = new ArrayList<SuggestOracle.Suggestion>();
            for (TermResult termResult : termsResult.getTermResultByFieldName().values()) {
                for (TermEntry termEntry : termResult.getEntries()) {
                    suggestions.add(new TermSuggestion(termEntry));
                }
            }
            callback.onSuccess(suggestions);
        }
    });
}
 
开发者ID:cominvent,项目名称:solr-explorer,代码行数:21,代码来源:SearchAutoCompletionPlugin.java

示例2: getSelectedUsers

import com.google.gwt.user.client.ui.SuggestOracle; //导入方法依赖的package包/类
public List<User> getSelectedUsers() {
    List<? extends SuggestOracle.Suggestion> values = acList.getValue();
    List<User> users = new ArrayList<>(values.size());
    for(SuggestOracle.Suggestion value : values){
        if(value instanceof UserSuggestion){
            UserSuggestion us = (UserSuggestion) value;
            User user = us.getUser();
            users.add(user);
        }
    }
    return users;
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material-demo,代码行数:13,代码来源:AutoCompleteView.java

示例3: wrapSuggestions

import com.google.gwt.user.client.ui.SuggestOracle; //导入方法依赖的package包/类
private List<SuggestOracle.Suggestion> wrapSuggestions(
		List<SuggestFieldSuggestion> in) {
	List<SuggestOracle.Suggestion> out = new ArrayList<SuggestOracle.Suggestion>();
	for (final SuggestFieldSuggestion wrappedSuggestion : in) {
		out.add(new OracleSuggestionImpl(wrappedSuggestion));
	}
	return out;

}
 
开发者ID:markoradinovic,项目名称:suggestfield,代码行数:10,代码来源:VSuggestField.java

示例4: AriaSuggestBox

import com.google.gwt.user.client.ui.SuggestOracle; //导入方法依赖的package包/类
public AriaSuggestBox(AriaTextBox box, SuggestOracle oracle) {
	iOracle = oracle;
	iText = box;
	iText.setStyleName("gwt-SuggestBox");
	initWidget(iText);
	
	addEventsToTextBox();
	
	iSuggestionMenu = new SuggestionMenu();
	
	iPopupScroll = new ScrollPanel(iSuggestionMenu);
	iPopupScroll.addStyleName("scroll");
	
	iSuggestionPopup = new PopupPanel(true, false);
	iSuggestionPopup.setPreviewingAllNativeEvents(true);
	iSuggestionPopup.setStyleName("unitime-SuggestBoxPopup");
	iSuggestionPopup.setWidget(iPopupScroll);
	iSuggestionPopup.addAutoHidePartner(getElement());
	
	iSuggestionCallback = new SuggestionCallback() {
		@Override
		public void onSuggestionSelected(Suggestion suggestion) {
			if (!suggestion.getReplacementString().isEmpty()) {
				setStatus(ARIA.suggestionSelected(status(suggestion)));
			}
			iCurrentText = suggestion.getReplacementString();
			setText(suggestion.getReplacementString());
			hideSuggestionList();
			fireSuggestionEvent(suggestion);
		}
	};
	
	iOracleCallback = new SuggestOracle.Callback() {
		@Override
		public void onSuggestionsReady(Request request, Response response) {
			if (response.getSuggestions() == null || response.getSuggestions().isEmpty()) {
				if (iSuggestionPopup.isShowing()) iSuggestionPopup.hide();
			} else {
				iSuggestionMenu.clearItems();
				SuggestOracle.Suggestion first = null;
				for (SuggestOracle.Suggestion suggestion: response.getSuggestions()) {
					iSuggestionMenu.addItem(new SuggestionMenuItem(suggestion));
					if (first == null) first = suggestion;
				}
				iSuggestionMenu.selectItem(0);
				ToolBox.setMinWidth(iSuggestionMenu.getElement().getStyle(), (iText.getElement().getClientWidth() - 4) + "px");
				iSuggestionPopup.showRelativeTo(iText);
				iSuggestionMenu.scrollToView();
				if (response.getSuggestions().size() == 1) {
					if (first.getReplacementString().isEmpty())
						setStatus(status(first));
					else
						setStatus(ARIA.showingOneSuggestion(status(first)));
				} else {
					setStatus(ARIA.showingMultipleSuggestions(response.getSuggestions().size(), request.getQuery(), status(first)));
				}
			}
		}
	};
	
	Roles.getTextboxRole().setAriaAutocompleteProperty(iText.getElement(), AutocompleteValue.NONE);
	
	iSuggestionPopup.getElement().setAttribute("id", DOM.createUniqueId());
	Roles.getTextboxRole().setAriaOwnsProperty(iText.getElement(), Id.of(iSuggestionPopup.getElement()));
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:66,代码来源:AriaSuggestBox.java


注:本文中的com.google.gwt.user.client.ui.SuggestOracle.Suggestion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。