Example usage for javafx.collections ObservableList clear

List of usage examples for javafx.collections ObservableList clear

Introduction

In this page you can find the example usage for javafx.collections ObservableList clear.

Prototype

void clear();

Source Link

Document

Removes all of the elements from this list (optional operation).

Usage

From source file:jp.toastkid.script.Controller.java

/**
 * Set stage to this controller and apply style.
 * @param stage//from   w w w  .j a v  a2s .c  o  m
 */
public void setStage(final Stage stage) {
    this.stage = stage;
    final ObservableList<String> stylesheets = this.stage.getScene().getStylesheets();
    if (stylesheets != null) {
        stylesheets.clear();
    }
    stylesheets.addAll(stage.getScene().getStylesheets());
    stylesheets.add(getClass().getClassLoader().getResource("keywords.css").toExternalForm());
}

From source file:com.SignalDiagram.FXMLDocumentController.java

private void updateAnalogChart(List<XYChart.Series<Double, Double>> serieList,
        ObservableList<XYChart.Series<Double, Double>> chartData, AnalogSignal signal) {

    chartData.clear();
    serieList.clear();// ww w .  ja  v  a  2 s .co  m

    for (List<Point2D> lp : signal.getPoints()) {
        XYChart.Series<Double, Double> test = updatePoints(lp);
        serieList.add(updatePoints(lp));
    }

    chartData.addAll(serieList);
}

From source file:com.ggvaidya.scinames.summary.HigherStabilityView.java

public void init() {
    Project project = projectView.getProject();

    // Setup stage.
    stage.setTitle("Higher taxonomy stability between " + project.getDatasets().size() + " datasets");

    // Setup table.
    controller.getTableEditableProperty().set(false);
    //controller.setTableColumnResizeProperty(TableView.CONSTRAINED_RESIZE_POLICY);
    ObservableList<TableColumn> cols = controller.getTableColumnsProperty();
    cols.clear();

    // Precalculating.

    // Generate list of all dataset columns to search on
    datasetColumns = project.getDatasets().stream().flatMap(ds -> ds.getColumns().stream())
            .collect(Collectors.toSet());

    // Set up columns.
    cols.add(createTableColumnFromPrecalc(precalc, "HigherTaxon"));

    // One column per dataset
    for (Dataset ds : project.getDatasets()) {
        String dsBaseName = ds.getName();
        String dsName = dsBaseName;

        int index = 1;
        while (datasetNames.containsKey(dsName)) {
            dsName = dsBaseName + "_" + index;
            index += 1;/*from  w ww  . ja  v  a2  s .co  m*/
        }
        datasetNames.put(dsName, ds);
        datasetNamesInOrder.add(dsName);

        cols.add(createTableColumnFromPrecalc(precalc, dsName + "_with_synonymy"));
        cols.add(createTableColumnFromPrecalc(precalc, dsName + "_without_synonymy"));
    }

    // Set table items to an observable list.
    controller.getTableItemsProperty().set(higherTaxaList);

    // Set up callbacks so we modify that observable list whenever the user changes the header text.
    controller.getHeaderTextEditableProperty().set(true);
    controller.getHeaderTextProperty().set("Enter higher taxonomy column name here, or set blank for genus");
    controller.getHeaderTextProperty().addListener(a -> {
        generateHigherTaxonomyList(controller.getHeaderTextProperty().get());
    });

    // Start with "" (which means genus)
    generateHigherTaxonomyList("");
}

From source file:edu.mit.lib.handbag.Controller.java

private void setMetadataList(Workflow wf) {
    ObservableList<PropertySheet.Item> items = metadataPropertySheet.getItems();
    items.clear();
    boolean anyNeeded = false;
    for (MetadataSpec spec : wf.getMetadata()) {
        if (!spec.isOptional() && spec.needsValue()) {
            anyNeeded = true;//from w  ww .  j  a va 2  s  . co m
        }
        items.add(new MetadataItem(spec));
    }
    cleanMetadata = true;
    completeMetadata = !anyNeeded;
}

From source file:edu.mit.lib.handbag.Controller.java

private void reset(boolean keepStickies) {
    payloadTreeView.getRoot().getChildren().clear();
    ObservableList<PropertySheet.Item> items = metadataPropertySheet.getItems();
    List<PropertySheet.Item> saveItems = new ArrayList<>();
    saveItems.addAll(items);/*from  ww  w .ja va 2 s.  c  o m*/
    items.clear();
    cleanMetadata = true;
    gooeyMetadata = false;
    boolean anyNeeded = false;
    int i = 0;
    for (MetadataSpec spec : workflowChoiceBox.getValue().getMetadata()) {
        if (!spec.isOptional() && spec.needsValue()) {
            anyNeeded = true;
        }
        MetadataItem item = new MetadataItem(spec);
        String oldValue = (String) saveItems.get(i).getValue();
        if (spec.isSticky() && keepStickies && oldValue != null) {
            item.setValue(oldValue);
            gooeyMetadata = true;
        }
        items.add(item);
        i++;
    }
    completeMetadata = !anyNeeded;
    updateButtons();
    bagSize = 0L;
    bagSizeLabel.setText("[empty]");
    generateBagName(workflowChoiceBox.getValue().getBagNameGenerator());
    bagLabel.setText(bagName);
}

From source file:com.ggvaidya.scinames.complexquery.ComplexQueryViewController.java

private void updatePrerecordedQueries() {
    ObservableList<String> items = prerecordedQueries.getItems();
    items.clear();
    items.add("Choose one of the pre-recorded queries, or enter your own below:");
    prerecordedQueries.getSelectionModel().clearAndSelect(0);
}

From source file:herudi.controller.customerController.java

private void displayZip() {
    Service<ObservableList<MicroMarket>> service = new Service<ObservableList<MicroMarket>>() {
        @Override/*  ww w .  j  av  a2  s  .  c  o  m*/
        protected Task<ObservableList<MicroMarket>> createTask() {
            return new Task<ObservableList<MicroMarket>>() {
                @Override
                protected ObservableList<MicroMarket> call() throws Exception {
                    ObservableList<MicroMarket> listTask = FXCollections.observableArrayList();
                    if (listTask == null) {
                        listTask = FXCollections.observableArrayList(crud.selectZip());
                    } else {
                        listTask.clear();
                        listTask.addAll(crud.selectZip());
                    }
                    cbZip.setItems(listTask);
                    return listTask;
                }
            };
        }
    };
    service.start();
}

From source file:herudi.controller.customerController.java

private void displayDiscountCode() {
    Service<ObservableList<DiscountCode>> service = new Service<ObservableList<DiscountCode>>() {
        @Override//from w ww.j  ava 2 s  .  com
        protected Task<ObservableList<DiscountCode>> createTask() {
            return new Task<ObservableList<DiscountCode>>() {
                @Override
                protected ObservableList<DiscountCode> call() throws Exception {
                    ObservableList<DiscountCode> listTask = FXCollections.observableArrayList();
                    if (listTask == null) {
                        listTask = FXCollections.observableArrayList(crud.selectCode());
                    } else {
                        listTask.clear();
                        listTask.addAll(crud.selectCode());
                    }
                    cbDiscount.setItems(listTask);
                    return listTask;
                }
            };
        }
    };
    service.start();
}

From source file:herudi.controller.productController.java

private void displayProductCode() {
    Service<ObservableList<ProductCode>> service = new Service<ObservableList<ProductCode>>() {
        @Override//  ww w. j  a v  a 2  s .c o m
        protected Task<ObservableList<ProductCode>> createTask() {
            return new Task<ObservableList<ProductCode>>() {
                @Override
                protected ObservableList<ProductCode> call() throws Exception {
                    ObservableList<ProductCode> listTask = FXCollections.observableArrayList();
                    if (listTask == null) {
                        listTask = FXCollections.observableArrayList(crud.selectProductCode());
                    } else {
                        listTask.clear();
                        listTask.addAll(crud.selectProductCode());
                    }
                    cbProductCode.setItems(listTask);
                    return listTask;
                }
            };
        }
    };
    service.start();
}

From source file:herudi.controller.productController.java

private void displayManufacturer() {
    Service<ObservableList<Manufacturer>> service = new Service<ObservableList<Manufacturer>>() {
        @Override/*from  www . j av a 2s.  c om*/
        protected Task<ObservableList<Manufacturer>> createTask() {
            return new Task<ObservableList<Manufacturer>>() {
                @Override
                protected ObservableList<Manufacturer> call() throws Exception {
                    ObservableList<Manufacturer> listTask = FXCollections.observableArrayList();
                    if (listTask == null) {
                        listTask = FXCollections.observableArrayList(crud.selectManufacturerID());
                    } else {
                        listTask.clear();
                        listTask.addAll(crud.selectManufacturerID());
                    }
                    cbManufacturer.setItems(listTask);
                    return listTask;
                }
            };
        }
    };
    service.start();
}