本文整理汇总了Java中javafx.scene.control.cell.TextFieldListCell类的典型用法代码示例。如果您正苦于以下问题:Java TextFieldListCell类的具体用法?Java TextFieldListCell怎么用?Java TextFieldListCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextFieldListCell类属于javafx.scene.control.cell包,在下文中一共展示了TextFieldListCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: select
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
@Test public void select() {
@SuppressWarnings("unchecked")
ListView<String> listView = (ListView<String>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
LoggingRecorder lr = new LoggingRecorder();
Platform.runLater(() -> {
@SuppressWarnings("unchecked")
TextFieldListCell<String> cell = (TextFieldListCell<String>) getCellAt(listView, 3);
Point2D point = getPoint(listView, 3);
RFXListView rfxListView = new RFXListView(listView, null, point, lr);
rfxListView.focusGained(rfxListView);
cell.startEdit();
cell.updateItem("Item 4 Modified", false);
cell.commitEdit("Item 4 Modified");
rfxListView.focusLost(rfxListView);
});
List<Recording> recordings = lr.waitAndGetRecordings(1);
Recording recording = recordings.get(0);
AssertJUnit.assertEquals("recordSelect", recording.getCall());
AssertJUnit.assertEquals("Item 4 Modified", recording.getParameters()[0]);
}
示例2: performSetup
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
@Override
protected void performSetup() {
setTitle();
// TODO: Better loading.
Platform.runLater(new Runnable() {
@Override
public void run() {
devicesLoadingLabel.setVisible(true);
diskListView.setCellFactory(lv -> {
TextFieldListCell<Disk> cell = new TextFieldListCell<>();
cell.setConverter(workflowController.getStringConverterForDisks());
return cell;
});
ObservableList<Disk> disks = FXCollections.observableArrayList();
disks.addAll(workflowController.getAvailableDisks());
devicesLoadingLabel.setVisible(false);
diskListView.setItems(disks);
}});
}
示例3: CodeAreaClipboardItemListView
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public CodeAreaClipboardItemListView() {
// List<ClipboardContent> clipBoardItems = parent.getClipBoardItems();
setCellFactory(TextFieldListCell.forListView(new StringConverter<ClipboardContent>() {
@Override
public String toString(ClipboardContent object) {
return object.getString();
}
@Override
public ClipboardContent fromString(String string) {
return null;
}
}));
setOnKeyPressed(this::onKeyPress);
setOnMouseClicked(this::onMouseClick);
}
示例4: initialize
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
@FXML
private void initialize() {
this.list.setCellFactory(TextFieldListCell.forListView());
List<String> path = configuration.getList(String.class, Settings.PATH_KEY, Collections.emptyList());
this.list.getItems().addAll(path);
stage = new Stage();
stage.setOnCloseRequest(event -> {
event.consume();
stage.hide();
this.list.getItems().removeAll(Arrays.asList(null, ""));
configuration.setProperty(Settings.PATH_KEY, this.list.getItems());
eventBus.post(new PathUpdatedEvent());
pathController.reload();
});
stage.setScene(new Scene(root));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/res/icon.png")));
stage.setTitle("Edit Path");
}
示例5: setNames
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public void setNames(ObservableList<String> observableList) {
textFiledName.setText(defaultPlaylistName);
listNames.setEditable(true);
listNames.setCellFactory(TextFieldListCell.forListView());
listNames.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
listNames.setItems(observableList);
listNames.getSelectionModel().selectFirst();
textFiledName.setOnKeyReleased((event) -> {
if (event.getCode() == KeyCode.ENTER) {
createFile();
}
});
}
示例6: getEditFactoryComboBoxChoser
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
private ComboBox getEditFactoryComboBoxChoser() {
ComboBox<CellsApp.CellType> cb = new ComboBox<CellsApp.CellType>();
cb.getItems().addAll(FXCollections.observableArrayList(CellsApp.CellType.values()));
cb.setId(LIST_FACTORY_CHOICE_ID);
cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<CellsApp.CellType>() {
public void changed(ObservableValue<? extends CellsApp.CellType> ov, CellsApp.CellType t, CellsApp.CellType t1) {
switch (t1) {
case ChoiceBox:
testedControl.setCellFactory(ChoiceBoxListCell.forListView(new CellCustomStringConverter(), someValues));
break;
case ComboBox:
testedControl.setCellFactory(ComboBoxListCell.forListView(new CellCustomStringConverter(), someValues));
break;
case TextField:
testedControl.setCellFactory(TextFieldListCell.forListView(new CellCustomStringConverter()));
break;
default:
testedControl.setCellFactory(new ListView().getCellFactory());
}
}
});
return cb;
}
示例7: ContentAssistPopupSkin
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的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();
}
示例8: BattleOfDecksConfigView
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public BattleOfDecksConfigView() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/BattleOfDecksConfigView.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
setupBehaviourBox();
setupNumberOfGamesBox();
selectedDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
selectedDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
availableDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
availableDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
addButton.setOnAction(this::handleAddButton);
removeButton.setOnAction(this::handleRemoveButton);
backButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU));
startButton.setOnAction(this::handleStartButton);
}
示例9: CardCollectionEditor
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public CardCollectionEditor(String title, CardCollection cardCollection, ICardCollectionEditingListener listener, int cardLimit) {
super("CardCollectionEditor.fxml");
this.listener = listener;
this.cardLimit = cardLimit;
setTitle(title);
editableListView.setCellFactory(TextFieldListCell.forListView(new CardStringConverter()));
populateEditableView(cardCollection);
catalogueListView.setCellFactory(TextFieldListCell.forListView(new CardStringConverter()));
populateCatalogueView(null);
filterTextfield.textProperty().addListener(this::onFilterTextChanged);
clearFilterButton.setOnAction(actionEvent -> filterTextfield.clear());
okButton.setOnAction(this::handleOkButton);
cancelButton.setOnAction(this::handleCancelButton);
addCardButton.setOnAction(this::handleAddCardButton);
removeCardButton.setOnAction(this::handleRemoveCardButton);
}
示例10: TrainingConfigView
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public TrainingConfigView() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/TrainingConfigView.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
setupDeckBox();
setupNumberOfGamesBox();
selectedDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
selectedDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
availableDecksListView.setCellFactory(TextFieldListCell.forListView(new DeckStringConverter()));
availableDecksListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
addButton.setOnAction(this::handleAddButton);
removeButton.setOnAction(this::handleRemoveButton);
backButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU));
startButton.setOnAction(this::handleStartButton);
}
示例11: AutoCompletePopupSkin
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public AutoCompletePopupSkin(AutoCompletePopup<T> control) {
this.control = control;
suggestionList = new ListView<T>(control.getSuggestions());
suggestionList.getStyleClass().add(AutoCompletePopup.STYLE_CLASS);
final URL cssUrl = AutoCompletionBinding.class.getResource(STYLE_SHEET);
if (cssUrl != null) {
suggestionList.getStylesheets().add(cssUrl.toExternalForm());
} else {
final Logger logger = LoggerFactory.getLogger(AutoCompletePopupSkin.class);
logger.error("Failed to load the resource: {}", STYLE_SHEET);
}
suggestionList.prefHeightProperty().bind(
Bindings.size(suggestionList.getItems())
.multiply(LIST_CELL_HEIGHT)
.add(LIST_CELL_MARGIN_BOTTOM)
);
suggestionList.maxHeightProperty().bind(control.maxHeightProperty());
suggestionList.setCellFactory(
TextFieldListCell.forListView(control.getConverter()));
registerEventListener();
}
示例12: call
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
@Override
public ListCell<NavItem> call(ListView<NavItem> param) {
return new TextFieldListCell(new StringConverter<NavItem>() {
@Override
public String toString(NavItem object) {
return object == null ? "null" : object.getName() + " (" + object.getCount() + ")";
}
@Override
public NavItem fromString(String string) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}) {
};
}
示例13: TextFieldListViewSample
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public TextFieldListViewSample() {
final ListView<String> listView = new ListView<String>();
listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
"Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
"Row 19", "Row 20"));
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
listView.setEditable(true);
listView.setCellFactory(TextFieldListCell.forListView());
getChildren().add(listView);
}
示例14: _getValue
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
@SuppressWarnings("unchecked") @Override public String _getValue() {
TextFieldListCell<?> cell = (TextFieldListCell<?>) node;
@SuppressWarnings("rawtypes")
StringConverter converter = cell.getConverter();
if (converter != null) {
return converter.toString(cell.getItem());
}
return cell.getItem().toString();
}
示例15: createList
import javafx.scene.control.cell.TextFieldListCell; //导入依赖的package包/类
public static <T extends BasicEntity> ListView<T> createList(Class<T> elementType) {
ListView<T> list = new ListView<>();
@SuppressWarnings("unchecked")
Editor<T> editor = PluginRegistry.getPlugin(elementType, Editor.class);
if (editor == null) {
list.setCellFactory(TextFieldListCell.forListView(ToStringConverter.of(Object::toString)));
}
else {
list.setCellFactory(CellWrappers.forList(editor.createCellFactory()));
}
return list;
}