本文整理汇总了Java中javafx.collections.ObservableList.contains方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.contains方法的具体用法?Java ObservableList.contains怎么用?Java ObservableList.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ObservableList
的用法示例。
在下文中一共展示了ObservableList.contains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMenuBar
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* show or hide the menuBar
*
* @param scene
* @param pMenuBar
*/
public void showMenuBar(Scene scene, MenuBar pMenuBar, boolean show) {
Parent sroot = scene.getRoot();
ObservableList<Node> rootChilds = null;
if (sroot instanceof VBox)
rootChilds = ((VBox) sroot).getChildren();
if (rootChilds == null)
throw new RuntimeException(
"showMenuBar can not handle scene root of type "
+ sroot.getClass().getName());
if (!show && rootChilds.contains(pMenuBar)) {
rootChilds.remove(pMenuBar);
} else if (show) {
rootChilds.add(0, pMenuBar);
}
pMenuBar.setVisible(show);
hideMenuButton
.setText(show ? I18n.get(I18n.HIDE_MENU) : I18n.get(I18n.SHOW_MENU));
}
示例2: updatePathSizeValues
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Update a list of available path sizes.
*/
@FXThread
private void updatePathSizeValues() {
final ComboBox<Integer> pathSizeComboBox = getPatchSizeComboBox();
final SingleSelectionModel<Integer> selectionModel = pathSizeComboBox.getSelectionModel();
final Integer current = selectionModel.getSelectedItem();
final ObservableList<Integer> items = pathSizeComboBox.getItems();
items.clear();
final ComboBox<Integer> totalSizeComboBox = getTotalSizeComboBox();
final Integer naxValue = totalSizeComboBox.getSelectionModel().getSelectedItem();
for (final Integer value : PATCH_SIZE_VARIANTS) {
if (value >= naxValue) break;
items.add(value);
}
if (items.contains(current)) {
selectionModel.select(current);
} else {
selectionModel.select(items.get(items.size() - 1));
}
}
示例3: setBarColor
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void setBarColor() {
ObservableList<String> styleClass = bar.getStyleClass();
String sucessColor = "green-bar";
String failureColor = "red-bar";
if (error) {
if (styleClass.contains(sucessColor)) {
styleClass.remove(sucessColor);
}
styleClass.add(failureColor);
} else {
if (styleClass.contains(failureColor)) {
styleClass.remove(failureColor);
}
styleClass.add(sucessColor);
}
}
示例4: load
import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
public void load() {
final ObservableList<String> devices =
FXCollections.observableArrayList(imageCaptureService.listDevices());
comboBox.setItems(devices);
final String selected = prefs.get(DEVICE_KEY, "");
final ObservableList<String> items = comboBox.getItems();
if (!items.contains(selected)) {
items.add(noDevice);
comboBox.getSelectionModel().select(noDevice);
}
else {
comboBox.getSelectionModel().select(selected);
}
}
示例5: onDeleteVariableClicked
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void onDeleteVariableClicked(ActionEvent actionEvent) {
TableView<FreeVariable> tableView = view.getFreeVariableTableView();
List<FreeVariable> newList = new LinkedList<>();
ObservableList<Integer> sm = tableView.getSelectionModel().getSelectedIndices();
for (int i = 0; i < tableView.getItems().size(); i++) {
if (!sm.contains(i)) {
newList.add(tableView.getItems().get(i));
}
}
tableView.getItems().setAll(newList);
// naive implementation does not work, if two rows are equals (in name, type and constraint)
//tableView.getItems().removeAll(tableView.getSelectionModel().getSelectedItems());
tableView.getSelectionModel().clearSelection();
}
示例6: hideCanvas
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Move the canvas component to hide layer.
*/
@FXThread
public void hideCanvas() {
final ObservableList<Node> children = hideLayer.getChildren();
if (children.contains(canvas)) return;
children.add(canvas);
}
示例7: refresh
import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
* Refresh the layers list.
*/
@FXThread
public void refresh() {
final ListView<TextureLayer> listView = getListView();
final MultipleSelectionModel<TextureLayer> selectionModel = listView.getSelectionModel();
final TextureLayer selectedItem = selectionModel.getSelectedItem();
final ObservableList<TextureLayer> items = listView.getItems();
items.clear();
final int maxLevels = getMaxLevels() - 1;
for (int i = 0; i < maxLevels; i++) {
final float scale = getTextureScale(i);
if (scale == -1F) continue;
items.add(new TextureLayer(this, i));
}
if (items.contains(selectedItem)) {
selectionModel.select(selectedItem);
} else if (!items.isEmpty()) {
selectionModel.select(items.get(0));
}
final ExecutorManager executorManager = ExecutorManager.getInstance();
executorManager.addFXTask(this::refreshHeight);
executorManager.addFXTask(this::refreshAddButton);
}
示例8: addToErrors
import javafx.collections.ObservableList; //导入方法依赖的package包/类
private static void addToErrors(final Component component, final Message message) {
if(!ENABLED) return;
final ObservableList<Message> list = getErrors(component);
if (list.contains(message)) return;
list.add(message);
errors.add(message);
}