Java Code Examples for javafx.collections.ObservableList#removeAll()

The following examples show how to use javafx.collections.ObservableList#removeAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateTerrainDialog.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Handle changing type of heightmap.
 */
@FxThread
private void processChangeType(@NotNull final HeightMapType newValue) {

    final VBox root = getSettingsRoot();
    final ObservableList<Node> children = root.getChildren();
    children.removeAll(flatSettings, heightMapSettings, hillSettings);

    switch (newValue) {
        case FLAT: {
            children.add(flatSettings);
            break;
        }
        case HILL: {
            children.add(hillSettings);
            break;
        }
        case IMAGE_BASED: {
            children.add(heightMapSettings);
            break;
        }
    }

    validate();
    getDialog().sizeToScene();
}
 
Example 2
Source File: CreateSkyDialog.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Handle changing sky type.
 */
@FxThread
private void processChange(@NotNull final SkyType newValue) {

    final VBox settingsRoot = getSettingsRoot();
    final GridPane singleTextureSettings = getSingleTextureSettings();
    final GridPane multiplyTextureSettings = getMultipleTextureSettings();

    final ObservableList<javafx.scene.Node> children = settingsRoot.getChildren();
    children.removeAll(singleTextureSettings, getMultipleTextureSettings());

    switch (newValue) {
        case SINGLE_TEXTURE: {
            children.add(singleTextureSettings);
            break;
        }
        case MULTIPLE_TEXTURE: {
            children.add(multiplyTextureSettings);
        }
    }

    validate();
    getDialog().sizeToScene();
}
 
Example 3
Source File: ShipTablePane.java    From logbook-kai with MIT License 6 votes vote down vote up
@Override
protected void updateItem(Integer cond, boolean empty) {
    super.updateItem(cond, empty);

    if (!empty) {
        ObservableList<String> styleClass = this.getStyleClass();
        styleClass.removeAll("deepgreen", "green", "orange", "red");
        if (cond >= Ships.DARK_GREEN && cond < Ships.GREEN) {
            styleClass.add("deepgreen");
        } else if (cond >= Ships.GREEN) {
            styleClass.add("green");
        } else if (cond <= Ships.ORANGE && cond > Ships.RED) {
            styleClass.add("orange");
        } else if (cond <= Ships.RED) {
            styleClass.add("red");
        }
        this.setText(cond.toString());
    } else {
        this.setText(null);
    }
}
 
Example 4
Source File: NdockPane.java    From logbook-kai with MIT License 6 votes vote down vote up
/**
 * 画面を更新します
 */
public void update() {
    // 残り時間を計算
    Duration d = Duration.ofMillis(this.ndock.getCompleteTime() - System.currentTimeMillis());
    // 残り時間を更新
    this.time.setText(Time.toString(d, "修復完了"));

    ObservableList<String> styleClass = this.getStyleClass();

    styleClass.removeAll("stage1", "stage2", "stage3");

    // スタイルを更新
    if (d.compareTo(this.stage3) < 0) {
        styleClass.add("stage3");
    } else if (d.compareTo(this.stage2) < 0) {
        styleClass.add("stage2");
    } else if (d.compareTo(this.stage1) < 0) {
        styleClass.add("stage1");
    }
}
 
Example 5
Source File: HistoryDataSetRenderer.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
/**
 * @return all DataSets that are either from the calling graph or this first specific renderer
 */
private ObservableList<DataSet> getLocalDataSets() {
    final ObservableList<DataSet> retVal = FXCollections.observableArrayList();
    retVal.addAll(getDatasets());

    final List<DataSet> removeList = new ArrayList<>();
    for (final Renderer r : renderers) {
        removeList.addAll(r.getDatasets());
    }

    retVal.removeAll(removeList);
    return retVal;
}
 
Example 6
Source File: ProgressIndicatorBar.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void setBarColor() {
    ObservableList<String> styleClass = bar.getStyleClass();
    String sucessColor = "green-bar";
    String failureColor = "red-bar";
    styleClass.removeAll(sucessColor);
    styleClass.removeAll(failureColor);
    styleClass.add(error ? failureColor : sucessColor);
}
 
Example 7
Source File: MenuBarUtils.java    From NSMenuFX with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static void removeExistingMenuBar(ObservableList<Node> children) {
	children.removeAll(children.stream().filter(node -> node instanceof MenuBar).collect(Collectors.toList()));
}
 
Example 8
Source File: MissionPane.java    From logbook-kai with MIT License 4 votes vote down vote up
/**
 * 画面を更新します
 */
public void update() {
    // 0=未出撃, 1=遠征中, 2=遠征帰還, 3=遠征中止
    int state = this.port.getMission().get(0).intValue();
    // 遠征先ID
    int target = this.port.getMission().get(1).intValue();
    // 帰還時間
    long time = this.port.getMission().get(2);

    ObservableList<String> styleClass = this.getStyleClass();
    styleClass.removeAll("stage1", "stage2", "stage3", "empty");

    if (state == 0 || target == 0 || time == 0) {
        // 未出撃
        // プログレスバー
        this.progress.setProgress(0);
        this.progress.setVisible(false);
        // 艦隊名
        this.fleet.setText(this.port.getName());
        // 遠征先
        this.name.setText("<未出撃>");
        // 残り時間
        this.time.setText("");

        styleClass.add("empty");
    } else {
        // 出撃(遠征中・遠征帰還・遠征中止)
        Optional<Mission> mission = Optional.ofNullable(MissionCollection.get()
                .getMissionMap()
                .get(target));

        // 遠征の最大時間
        Duration max = Duration.ofMinutes(mission.map(Mission::getTime).orElse(0));
        // 残り時間を計算
        Duration now = Duration.ofMillis(time - System.currentTimeMillis());

        if (!max.isZero()) {
            double p = (double) (max.toMillis() - now.toMillis()) / (double) max.toMillis();
            this.progress.setProgress(p);
            this.progress.setVisible(true);
        } else {
            this.progress.setProgress(0);
            this.progress.setVisible(false);
        }
        // 艦隊名
        this.fleet.setText(this.port.getName());
        // 遠征先
        this.name.setText(mission.map(Mission::getName).orElse(""));
        // 残り時間を更新
        this.time.setText(Time.toString(now, "まもなく帰還します"));

        // スタイルを更新
        if (now.compareTo(this.stage3) < 0) {
            styleClass.add("stage3");
        } else if (now.compareTo(this.stage2) < 0) {
            styleClass.add("stage2");
        } else if (now.compareTo(this.stage1) < 0) {
            styleClass.add("stage1");
        }
    }
}