當前位置: 首頁>>代碼示例>>Java>>正文


Java AutoCompletePopup類代碼示例

本文整理匯總了Java中impl.org.controlsfx.skin.AutoCompletePopup的典型用法代碼示例。如果您正苦於以下問題:Java AutoCompletePopup類的具體用法?Java AutoCompletePopup怎麽用?Java AutoCompletePopup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AutoCompletePopup類屬於impl.org.controlsfx.skin包,在下文中一共展示了AutoCompletePopup類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AutoCompletionCodeAreaBind

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
/**
 * 
 * @param codeArea
 * @param suggestionProvider
 * @param replaceTextProvider
 *          When a suggestion entered, which range of text should be replaced.
 */
public AutoCompletionCodeAreaBind(CodeArea codeArea,
    BiFunction<String, Integer, Collection<String>> suggestionProvider,
    BiFunction<String, Integer, IndexRange> replaceTextProvider) {
  this.codeArea = codeArea;
  this.suggestionProvider = suggestionProvider;
  this.replaceTextProvider = replaceTextProvider;
  this.popup = new AutoCompletePopup<>();

  codeArea.textProperty().addListener(textChangeListener);
  codeArea.focusedProperty().addListener(focusChangedListener);

  codeArea.setPopupWindow(popup);
  codeArea.setPopupAlignment(PopupAlignment.CARET_BOTTOM);

  popup.setOnSuggestion(sce -> {
    completeUserInput(sce.getSuggestion());
    hidePopup();
  });
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:27,代碼來源:AutoCompletionCodeAreaBind.java

示例2: AbstractFxVoAutoCompletionBinding

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
/**
 * Creates a new AutoCompletionBinding
 * 
 * @param completionTarget
 *            The target node to which auto-completion shall be added
 * @param suggestionProvider
 *            The strategy to retrieve suggestions
 * @param converter
 *            The converter to be used to convert suggestions to strings
 */
protected AbstractFxVoAutoCompletionBinding(Node completionTarget, Callback<ISuggestionRequest, Collection<T>> suggestionProvider,
		StringConverter<T> converter) {

	this.completionTarget = completionTarget;
	this.suggestionProvider = suggestionProvider;
	this.autoCompletionPopup = new AutoCompletePopup<>();
	this.autoCompletionPopup.setConverter(converter);

	autoCompletionPopup.setOnSuggestion(sce -> {
		try {
			setIgnoreInputChanges(true);
			completeUserInput(sce.getSuggestion());
			fireAutoCompletion(sce.getSuggestion());
			hidePopup();
		} finally {
			// Ensure that ignore is always set back to false
			setIgnoreInputChanges(false);
		}
	});
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:31,代碼來源:AbstractFxVoAutoCompletionBinding.java

示例3: ContentAssistPopupSkin

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
public ContentAssistPopupSkin(AutoCompletePopup<String> control){
    this.control = control;
    suggestionList = new ListView<>(control.getSuggestions());

    suggestionList.getStyleClass().add(AutoCompletePopup.DEFAULT_STYLE_CLASS);

    suggestionList.getStylesheets().add(AutoCompletionBinding.class
            .getResource("autocompletion.css").toExternalForm()); //$NON-NLS-1$

    suggestionList.prefHeightProperty().bind(
            Bindings.min(control.visibleRowCountProperty(), Bindings.size(suggestionList.getItems()))
            .multiply(LIST_CELL_HEIGHT).add(18));
    suggestionList.setCellFactory(TextFieldListCell.forListView(control.getConverter()));
    
    suggestionList.prefWidthProperty().bind(control.prefWidthProperty());
    suggestionList.maxWidthProperty().bind(control.maxWidthProperty());
    suggestionList.minWidthProperty().bind(control.minWidthProperty());
    registerEventListener();
}
 
開發者ID:factoryfx,項目名稱:factoryfx,代碼行數:20,代碼來源:ContentAssistPopupSkin.java

示例4: selectFirstSuggestion

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
private static void selectFirstSuggestion(AutoCompletePopup<?> autoCompletionPopup) {
  Skin<?> skin = autoCompletionPopup.getSkin();
  if (skin instanceof AutoCompletePopupSkin) {
    AutoCompletePopupSkin<?> au = (AutoCompletePopupSkin<?>) skin;
    ListView<?> li = (ListView<?>) au.getNode();
    if (li.getItems() != null && !li.getItems().isEmpty()) {
      li.getSelectionModel().select(0);
    }
  }
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:11,代碼來源:AutoCompletionCodeAreaBind.java

示例5: selectFirstSuggestion

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
/**
 * Selects the first suggestion (if any), so the user can choose it by
 * pressing enter immediately.
 */
private void selectFirstSuggestion(AutoCompletePopup<?> autoCompletionPopup) {
	Skin<?> skin = autoCompletionPopup.getSkin();
	if (skin instanceof AutoCompletePopupSkin) {
		AutoCompletePopupSkin<?> au = (AutoCompletePopupSkin<?>) skin;
		ListView<?> li = (ListView<?>) au.getNode();
		if (li.getItems() != null && !li.getItems().isEmpty()) {
			li.getSelectionModel().select(0);
		}
	}
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:15,代碼來源:AbstractFxVoAutoCompletionBinding.java

示例6: onSuggestionChoosen

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
private void onSuggestionChoosen(String suggestion){
    if(suggestion != null) {
        Event.fireEvent(control, new AutoCompletePopup.SuggestionEvent<>(suggestion));
    }
}
 
開發者ID:factoryfx,項目名稱:factoryfx,代碼行數:6,代碼來源:ContentAssistPopupSkin.java

示例7: getSkinnable

import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
@Override
public AutoCompletePopup<String> getSkinnable() {
    return control;
}
 
開發者ID:factoryfx,項目名稱:factoryfx,代碼行數:5,代碼來源:ContentAssistPopupSkin.java


注:本文中的impl.org.controlsfx.skin.AutoCompletePopup類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。