本文整理匯總了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();
});
}
示例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);
}
});
}
示例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();
}
示例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);
}
}
}
示例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);
}
}
}
示例6: onSuggestionChoosen
import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
private void onSuggestionChoosen(String suggestion){
if(suggestion != null) {
Event.fireEvent(control, new AutoCompletePopup.SuggestionEvent<>(suggestion));
}
}
示例7: getSkinnable
import impl.org.controlsfx.skin.AutoCompletePopup; //導入依賴的package包/類
@Override
public AutoCompletePopup<String> getSkinnable() {
return control;
}