本文整理汇总了Java中com.sun.javafx.collections.ObservableListWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ObservableListWrapper类的具体用法?Java ObservableListWrapper怎么用?Java ObservableListWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObservableListWrapper类属于com.sun.javafx.collections包,在下文中一共展示了ObservableListWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCollection
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
@Override
protected Object createCollection(Class type) {
if (type == ObservableListWrapper.class) {
return FXCollections.observableArrayList();
}
if (type.getName().indexOf("$") > 0) {
if (type.getName().equals("javafx.collections.FXCollections$SynchronizedObservableList")) {
return FXCollections.synchronizedObservableList(FXCollections.observableArrayList());
}
}
return new SimpleListProperty<>(FXCollections.observableArrayList());
}
示例2: loadData
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private void loadData(List<Map<String, String>> data) {
batchDataTable.getColumns().clear();
TableColumn<Map<String, String>, String> numberCol = new TableColumn("");
numberCol.setCellValueFactory(row -> new ReadOnlyObjectWrapper(
(row.getTableView().getItems().indexOf(row.getValue()) + 1) + ""));
batchDataTable.getColumns().add(numberCol);
numberCol.setMinWidth(50);
data.get(0).keySet().forEach(varName -> {
TableColumn<Map<String, String>, String> varCol = new TableColumn(varName);
varCol.setCellValueFactory(row -> new ReadOnlyObjectWrapper(row.getValue().get(varName)));
batchDataTable.getColumns().add(varCol);
});
batchDataTable.setItems(new ObservableListWrapper<>(data));
}
示例3: updateBatchSize
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private void updateBatchSize(String newValue) {
try {
batchSizeValue = Integer.parseInt(newValue);
} catch (NumberFormatException ex) {
batchSizeValue = -1;
}
if (batchSizeValue <= 0 || batchSizeValue >= batchDataTable.getItems().size()) {
batchNumberChoice.setValue(null);
batchNumberChoice.setDisable(true);
batchSize.clear();
batchSizeValue = -1;
if (newValue != null && !newValue.isEmpty()) {
Platform.runLater(()->batchSize.setText(null));
}
return;
} else {
batchNumberChoice.setDisable(false);
int numBatches = (batchDataTable.getItems().size() + batchSizeValue - 1) / batchSizeValue;
numBatches = Math.min(numBatches, 50);
List<Integer> selections = IntStream.range(1, numBatches+1).boxed().collect(Collectors.toList());
batchNumberChoice.setItems(new ObservableListWrapper<>(selections));
batchNumberChoice.setValue(1);
}
}
示例4: setTableData
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private void setTableData(List<List<String>> data) {
tableData = new ObservableListWrapper<>(data);
int numberOfColumns = data.stream().map(List::size).reduce(Math::max).orElse(0);
contentTable.getColumns().clear();
colMapping = new ArrayList<>();
for (int i = 0; i < numberOfColumns; i++) {
colMapping.add(DONT_USE);
TableColumn<List<String>, String> column = new TableColumn<>();
final int index = i;
ComboBox<String> selector = generateVariableSelector();
selector.getSelectionModel().selectedItemProperty().
addListener((prop, oldValue, newValue) -> colMapping.set(index, newValue));
column.setGraphic(selector);
column.setCellValueFactory((TableColumn.CellDataFeatures<List<String>, String> param) -> {
List<String> row = param.getValue();
String value = row.size() > index ? row.get(index) : null;
return new SimpleStringProperty(value);
});
contentTable.getColumns().add(column);
}
contentTable.setItems(tableData);
}
示例5: createObservableList
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private ObservableList<Object> createObservableList(RfxTableView tableView) {
try {
Object methodOwner=tableView.getMethodOwner();
ActionMethodInfo actionMethodInfo=tableView.getMethodInfo();
Object methodParameterValue=tableView.getMethodParameter();
Object result = actionMethodInfo.invoke(methodOwner, methodParameterValue);
List<Object> list = (List<Object>) result;
// TODO create a createObservableList for all types, and that can be
// updated when needed
return new ObservableListWrapper<Object>(list);
} catch (Exception e) {
UserInterfaceController userInterfaceController = tableView.getuserInterfaceContainer()
.get(UserInterfaceController.class);
userInterfaceController.showErrorDialog(tableView.getViewTitle(), "Error getting table values.",
e);
return null;
}
}
示例6: buildAssemblageConceptList
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private ObservableList<SimpleDisplayConcept> buildAssemblageConceptList()
{
ObservableList<SimpleDisplayConcept> assemblageConcepts = new ObservableListWrapper<>(new ArrayList<SimpleDisplayConcept>());
try
{
ConceptVersionBI colCon = OTFUtility.getConceptVersion(RefexDynamic.REFEX_DYNAMIC_IDENTITY.getNid());
Set<ConceptVersionBI> colCons = OTFUtility.getAllChildrenOfConcept(colCon, false);
for (ConceptVersionBI col : colCons) {
assemblageConcepts.add(new SimpleDisplayConcept(col));
}
}
catch (Exception e)
{
logger_.error("Unexpected error reading existing assemblage concepts", e);
}
return assemblageConcepts;
}
示例7: initialize
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
public void initialize() {
categoryList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
categoryList.setItems(new ObservableListWrapper(Viewer.log.getCategories()));
categoryList.getSelectionModel().clearSelection();
levelList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
levelList.setItems(new ObservableListWrapper(CollectionHelper.setToList(Viewer.log.levelSet)));
levelList.getSelectionModel().clearSelection();
reloadLog();
}
示例8: openWorkbook
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private void openWorkbook(Workbook workbook) {
ObservableList<String> sheets = new ObservableListWrapper<>(new ArrayList<>());
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
worksheetSelector.getItems().add(workbook.getSheetName(i));
}
sheetReader = (String sheetName) -> readSheet(workbook.getSheet(sheetName));
Platform.runLater(() -> worksheetSelector.getSelectionModel().selectFirst());
}
示例9: Benchmark
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Benchmark() {
values = new ObservableList[Type.values().length];
for (int i = 0; i < values.length; i++)
values[i] = new ObservableListWrapper<>(new ArrayList<>());
vertices = new ArrayList<>();
edges = new ArrayList<>();
}
示例10: inputMethodEventComposed
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
private ObservableList<InputMethodTextRun> inputMethodEventComposed(String text, int commitCount)
{
List<InputMethodTextRun> composed = new ArrayList<>();
if (commitCount < text.length())
{
composed.add(new InputMethodTextRun(
text.substring(commitCount), InputMethodHighlight.UNSELECTED_RAW));
}
return new ObservableListWrapper<>(composed);
}
示例11: prepareList
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
public void prepareList(String password) throws IOException {
if (!ConfigurationUtil.exist()) {
return;
}
websiteList.setCellFactory(new Callback<ListView<Configuration>, ListCell<Configuration>>() {
@Override
public ListCell<Configuration> call(ListView<Configuration> param) {
return new ConfigListCell();
}
});
websiteList.setItems(new ObservableListWrapper<>(ConfigurationUtil.readConfig(password.getBytes("UTF-8"))));
}
示例12: getSaves
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
/**
* Get the list of saves from the server for load from server.
*/
@FXML
public void getSaves() {
Client client = new Client();
if (isLoggedIn && client.isConnected()) {
try {
Thread saves = client.send("getsaves" + "-=-" + username);
Thread quit = client.send("quit");
saves.start();
saves.join();
quit.start();
quit.join();
String[] saveArray = client.getSaveArray();
if (!saveArray[0].isEmpty()) {
System.out.println();
List<String> arrayList = Arrays.asList(saveArray);
ObservableList<String> list = new ObservableListWrapper<>(arrayList);
loadList.setItems(list);
loadList.getSelectionModel().select(0);
switchToLoadChoice();
} else {
dialogPane.createWarningDialog("No server saves found",
"It looks like you've never saved to the server before.\n" +
"Try saving to the server before loading from the server.");
}
} catch (Exception e) {
e.printStackTrace();
}
} else if (!isLoggedIn && client.isConnected()) {
switchToLoginPage();
} else {
cancelLoadChoice();
}
}
示例13: setTvEditPane
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
/**
* Populates the tv edit pane based on passed in arguments. Called after fetch.
*/
protected void setTvEditPane(List<String> outputList) {
tvTitleTextField.setText(outputList.get(0));
if (outputList.get(1).equals("true")) {
tvWatchedCheckBox.setSelected(true);
}
tvGenreTextField.setText(outputList.get(2));
tvCreatorTextField.setText(outputList.get(3));
tvNetworkTextField.setText(outputList.get(4));
tvRuntimeTextField.setText(outputList.get(5));
tvNumSeasonsTextField.setText(outputList.get(6));
tvNumEpisodesTextField.setText(outputList.get(7));
tvDescriptionTextField.setText(outputList.get(8));
Type listType = new TypeToken<List<List<String>>>(){}.getType();
List<List<String>> list = gson.fromJson(outputList.get(9), listType);
ObservableList<List<Episode>> seasonList = FXCollections.observableArrayList();
for (List<String> episodes : list) {
List<Episode> episodeList = new ArrayList<>();
for (String json : episodes) {
Type mapType = new TypeToken<HashMap<String, String>>(){}.getType();
HashMap<String, String> map = gson.fromJson(json, mapType);
Episode episode = new Episode(map.get("seasonNum"), map.get("episodeName"), Boolean.parseBoolean(map.get("watched")));
episodeList.add(episode);
}
seasonList.add(episodeList);
}
addEpisodesToTable(seasonList, tvEpisodeTable, seasonCol, episodeCol, watchedCol);
masterSeasonList = new ObservableListWrapper<>(new ArrayList<>());
episodeList.set(seasonList);
}
示例14: createTvShow
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
/**
* Creates a new TvShow object.
* @param titleString is the title of the TvShow object.
* @return a new TvShow object.
*/
public TvShow createTvShow(String titleString) {
StringProperty title = new SimpleStringProperty();
title.set(titleString);
StringProperty watched = new SimpleStringProperty();
watched.set("false");
StringProperty genre = new SimpleStringProperty();
genre.set("");
StringProperty runtime = new SimpleStringProperty();
runtime.set("");
StringProperty creator = new SimpleStringProperty();
creator.set("");
StringProperty network = new SimpleStringProperty();
network.set("");
StringProperty numSeasons = new SimpleStringProperty();
numSeasons.set("0");
StringProperty numEpisodes = new SimpleStringProperty();
numEpisodes.set("0");
StringProperty description = new SimpleStringProperty();
description.set("");
ListProperty<List<Episode>> episodeList = new SimpleListProperty<>();
episodeList.set(new ObservableListWrapper<>(new ArrayList<>()));
ListProperty<Boolean> seasonWatchedList = new SimpleListProperty<>();
seasonWatchedList.set(new ObservableListWrapper<>(new ArrayList<>()));
return new TvShow(title, watched, genre, runtime, description, creator, network, numSeasons, numEpisodes,
episodeList, seasonWatchedList);
}
示例15: getGames
import com.sun.javafx.collections.ObservableListWrapper; //导入依赖的package包/类
public ObservableList<Game> getGames() {
if (observableGames == null) {
observableGames = new ObservableListWrapper<>(games);
observableGames.addListener((ListChangeListener<? super Game>) c -> scoreProperty().set(calculateScore()));
}
return observableGames;
}