當前位置: 首頁>>代碼示例>>Java>>正文


Java ObservableList.contains方法代碼示例

本文整理匯總了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));
}
 
開發者ID:BITPlan,項目名稱:can4eve,代碼行數:25,代碼來源:JavaFXDisplay.java

示例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));
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:28,代碼來源:CreateTerrainDialog.java

示例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);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:ProgressIndicatorBar.java

示例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);
    }
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:16,代碼來源:SettingsPaneImpl.java

示例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();
}
 
開發者ID:VerifAPS,項目名稱:stvs,代碼行數:16,代碼來源:VariableCollectionController.java

示例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);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:12,代碼來源:EditorFXScene.java

示例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);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:34,代碼來源:TextureLayerSettings.java

示例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);
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:11,代碼來源:CodeAnalysis.java


注:本文中的javafx.collections.ObservableList.contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。