本文整理汇总了Java中org.controlsfx.control.textfield.AutoCompletionBinding类的典型用法代码示例。如果您正苦于以下问题:Java AutoCompletionBinding类的具体用法?Java AutoCompletionBinding怎么用?Java AutoCompletionBinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutoCompletionBinding类属于org.controlsfx.control.textfield包,在下文中一共展示了AutoCompletionBinding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupAutoComplete
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
private void setupAutoComplete() {
List<AutoCompletionBinding<String>> bindings = new ArrayList<>();
bindings.add(TextFields.bindAutoCompletion(generalFields.get(0),
manager.getCharacters().keySet()));
for(int x = 0; x < 5; x++) {
bindings.add(TextFields.bindAutoCompletion(itemFields.get(x),
manager.getItems().keySet()));
bindings.add(TextFields.bindAutoCompletion(skillFields.get(x),
manager.getSkills().keySet()));
}
bindings.get(0).setOnAutoCompleted(event -> generalFields.get(0).setText(
manager.getRealEntry(generalFields.get(0).getText())));
for(int x = 0; x < 5; x++) {
int i = x;
bindings.get((x * 2) + 1).setOnAutoCompleted(event -> itemFields.get(i).setText(
manager.getRealEntry(itemFields.get(i).getText())));
bindings.get((x * 2) + 2).setOnAutoCompleted(event -> skillFields.get(i).setText(
manager.getRealEntry(skillFields.get(i).getText())));
}
}
示例2: medicineAutoCompleteBinding
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
public void medicineAutoCompleteBinding() {
TextFields.bindAutoCompletion(medicine_name, whole_medicine_list).setOnAutoCompleted((AutoCompletionBinding.AutoCompletionEvent<String> autoCompletionEvent) -> {
String selectedItem = medicine_name.getText();
try {
Connection dbConnection = JDBC.databaseConnect();
PreparedStatement preparedStatement = dbConnection.prepareStatement("SELECT medicine.hsn_number, medicine.salt, medicine.company, medicine.type, gst.sgst, gst.cgst, gst.igst FROM medicine JOIN gst ON medicine.medicine_id=gst.medicine_id WHERE name=?");
preparedStatement.setString(1, selectedItem);
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
hsn_code.setText(resultSet.getString("hsn_number"));
salt.setText(resultSet.getString("salt"));
company.setText(resultSet.getString("company"));
medicine_type.getSelectionModel().select(resultSet.getString("type"));
sgst.setText(String.valueOf(resultSet.getInt("sgst")));
cgst.setText(String.valueOf(resultSet.getInt("cgst")));
igst.setText(String.valueOf(resultSet.getInt("igst")));
}
} catch (Exception e) {
e.printStackTrace();
}
});
}
示例3: itemAutoCompleteBinding
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
public void itemAutoCompleteBinding() {
TextFields.bindAutoCompletion(item, whole_item_list).setOnAutoCompleted((AutoCompletionBinding.AutoCompletionEvent<String> autoCompletionEvent) -> {
batch_list.clear();
String selectedItem = item.getText();
batch.setItems(batch_list);
try {
Connection dbConnection = JDBC.databaseConnect();
PreparedStatement preparedStatement = dbConnection.prepareStatement("SELECT medicine_info.batch_number FROM medicine JOIN medicine_info ON medicine.medicine_id=medicine_info.medicine_id WHERE medicine.name=?");
preparedStatement.setString(1, selectedItem);
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
batch_list.add(resultSet.getString("batch_number"));
}
} catch (Exception e) {
e.printStackTrace();
}
batch.setDisable(false);
});
}
示例4: ContentAssistPopupSkin
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的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();
}
示例5: initialize
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle rb) {
GuiData.getInstance().getStage().setOnCloseRequest(we -> close());
try {
file = new FatesTerrainFile(FileData.getInstance().getWorkingFile(), "rw");
for (TileBlock t : file.getTiles()) {
tileList.getItems().add(t.getTid());
}
} catch (IOException ex) {
ex.printStackTrace();
}
setupGrid();
populateForm();
tileList.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) ->
updateFields(newValue.intValue()));
scrollPane.widthProperty().addListener((observable, oldValue, newValue) ->
anchorPane.setPrefWidth(newValue.doubleValue()));
scrollPane.heightProperty().addListener((observable, oldValue, newValue) ->
anchorPane.setPrefHeight(newValue.doubleValue()));
AutoCompletionBinding<String> binding = TextFields.bindAutoCompletion(blockFields.get(0),
manager.getTiles().keySet());
binding.setOnAutoCompleted(event -> blockFields.get(0).setText(manager.getRealEntry(blockFields.get(0).getText())));
binding = TextFields.bindAutoCompletion(blockFields.get(1),
manager.getTiles().keySet());
binding.setOnAutoCompleted(event -> blockFields.get(1).setText(manager.getRealEntry(blockFields.get(1).getText())));
}
示例6: isMatch
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@Override
protected boolean isMatch(SecurityData suggestion, AutoCompletionBinding.ISuggestionRequest request) {
String userTextLower = request.getUserText().toLowerCase();
String suggestionStr = suggestion.getSymbol().toLowerCase();
return suggestionStr.contains(userTextLower)
&& !suggestionStr.equals(userTextLower);
}
示例7: complete
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Collection<ParsedEntryLink> complete(AutoCompletionBinding.ISuggestionRequest request) {
//We have to cast the BibEntries from the BibEntrySuggestionProvider to ParsedEntryLink
Collection<BibEntry> bibEntries = (Collection<BibEntry>) super.complete(request);
return bibEntries.stream().map(ParsedEntryLink::new).collect(Collectors.toList());
}
示例8: isMatch
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@Override
protected boolean isMatch(BibEntry suggestion, AutoCompletionBinding.ISuggestionRequest request) {
String userTextLower = request.getUserText().toLowerCase();
return suggestion.getCiteKeyOptional()
.map(key -> key.toLowerCase().contains(userTextLower))
.orElse(false);
}
示例9: call
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@Override
public Collection<String> call(AutoCompletionBinding.ISuggestionRequest request) {
List<String> suggestions = new ArrayList<>();
if (suggestionProvider != null) {
suggestions.addAll(suggestionProvider.call(request));
}
suggestions.addAll(contentSelectorValues);
return suggestions;
}
示例10: getRequest
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
public static AutoCompletionBinding.ISuggestionRequest getRequest(String text) {
return new AutoCompletionBinding.ISuggestionRequest() {
@Override
public boolean isCancelled() {
return false;
}
@Override
public String getUserText() {
return text;
}
};
}
示例11: setupQueryAutoCompletion
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
private AutoCompletionBinding<Image> setupQueryAutoCompletion(Collection collection) {
return TextFields.bindAutoCompletion(queryField, collection.getImages());
}
示例12: TagField
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
public TagField(ArrayList<Tag> tags, ArrayList<Tag> allAvailableTags, NewPaymentController parentController)
{
this.tags = tags;
this.allTags = allAvailableTags;
this.parentController = parentController;
this.hboxTags = initHboxTags();
ScrollPane scrollPane = new ScrollPane();
scrollPane.setContent(hboxTags);
scrollPane.setVbarPolicy(ScrollBarPolicy.NEVER);
scrollPane.setMinHeight(50);
scrollPane.setStyle("-fx-background-color: #FFFFFF; -fx-background-radius: 5px; -fx-border-color: #000000; -fx-border-width: 1 1 0 1; -fx-border-radius: 5px 5px 0 0");
this.getChildren().add(scrollPane);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
textField = new TextField();
textField.setStyle("-fx-background-color: #FFFFFF; -fx-border-color: #000000; -fx-border-width: 1; -fx-background-radius: 5px; -fx-border-radius: 0 0 5px 5px");
textField.setPromptText(Localization.getString(Strings.TAGFIELD_PLACEHOLDER));
textField.setMaxWidth(Double.MAX_VALUE);
textField.setOnKeyPressed((event)->{
if(event.getCode().equals(KeyCode.ENTER))
{
addTag(textField.getText().trim());
}
else if(event.getCode().equals(KeyCode.DOWN))
{
textField.setText(" ");
textField.setText("");
}
});
textField.setOnMousePressed((event)->{
textField.setText(" ");
textField.setText("");
});
TextFields.bindAutoCompletion(textField, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<String>>()
{
@Override
public Collection<String> call(org.controlsfx.control.textfield.AutoCompletionBinding.ISuggestionRequest param)
{
ArrayList<String> completions = getCompletions(allTags);
ArrayList<String> remainingCompletions = new ArrayList<>();
for(String currentCompletion : completions)
{
if(currentCompletion.toLowerCase().contains(param.getUserText().toLowerCase()))
{
remainingCompletions.add(currentCompletion);
}
}
return remainingCompletions;
}
});
this.getChildren().add(textField);
this.setStyle("-fx-background-color: #FFFFFF; -fx-background-radius: 5px;");
refresh(false);
}
示例13: complete
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Collection<Author> complete(AutoCompletionBinding.ISuggestionRequest request) {
return (Collection<Author>) super.complete(request);
}
示例14: complete
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
public Collection<?> complete(AutoCompletionBinding.ISuggestionRequest request) {
return suggestionProvider.call(request);
}
示例15: isMatch
import org.controlsfx.control.textfield.AutoCompletionBinding; //导入依赖的package包/类
@Override
protected boolean isMatch(Author suggestion, AutoCompletionBinding.ISuggestionRequest request) {
String userTextLower = request.getUserText().toLowerCase();
String suggestionStr = suggestion.getLastFirst(false).toLowerCase();
return suggestionStr.contains(userTextLower);
}