Example usage for javafx.collections FXCollections observableArrayList

List of usage examples for javafx.collections FXCollections observableArrayList

Introduction

In this page you can find the example usage for javafx.collections FXCollections observableArrayList.

Prototype

@SuppressWarnings("unchecked")
public static <E> ObservableList<E> observableArrayList() 

Source Link

Document

Creates a new empty observable list that is backed by an arraylist.

Usage

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXUuidColListPane.java

public void setJavaFXDataCollection(Collection<ICFBamUuidColObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;/*from w  w w.  j  a  v  a2  s . co  m*/
    observableListOfUuidCol = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamUuidColObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfUuidCol.add(iter.next());
        }
        observableListOfUuidCol.sort(compareUuidColByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfUuidCol);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:de.bayern.gdi.gui.Controller.java

/**
 * Handle search and filter the service list.
 *
 * @param event the event/*from   w w  w . j a v a2  s. c o  m*/
 */
@FXML
protected void handleSearch(KeyEvent event) {
    if (!catalogReachable) {
        setStatusTextUI(I18n.getMsg("status.catalog-not-available"));
    }
    String currentText = this.searchField.getText();
    this.serviceList.getItems().clear();
    dataBean.resetCatalogLists();
    if (currentText == null || currentText.isEmpty()) {
        this.serviceList.setItems(this.dataBean.getServicesAsList());
    }

    String searchValue = currentText == null ? "" : currentText.toUpperCase();

    ObservableList<ServiceModel> subentries = FXCollections.observableArrayList();
    ObservableList<ServiceModel> all = this.dataBean.getServicesAsList();
    for (ServiceModel entry : all) {
        boolean match = entry.getName().toUpperCase().contains(searchValue);
        if (match) {
            subentries.add(entry);
        }
    }
    if (currentText != null && currentText.length() > 2) {
        Task task = new Task() {
            @Override
            protected Integer call() throws Exception {
                Platform.runLater(() -> {
                    searchButton.setVisible(false);
                    searchButton.setManaged(false);
                    progressSearch.setVisible(true);
                    progressSearch.setManaged(true);
                });
                if (catalogReachable) {
                    List<Service> catalog = dataBean.getCatalogService().getServicesByFilter(currentText);
                    for (Service entry : catalog) {
                        dataBean.addCatalogServiceToList(entry);
                    }
                    Platform.runLater(() -> {
                        for (Service entry : catalog) {
                            subentries.add(new ServiceModel(entry));
                        }
                    });
                }
                Platform.runLater(() -> {
                    progressSearch.setVisible(false);
                    progressSearch.setManaged(false);
                    searchButton.setManaged(true);
                    searchButton.setVisible(true);
                });
                return 0;
            }
        };
        Thread th = new Thread(task);
        if (catalogReachable) {
            setStatusTextUI(I18n.getMsg("status.calling-service"));
        }
        th.setDaemon(true);
        th.start();
    }
    this.serviceList.setItems(subentries);
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTimeColListPane.java

public void setJavaFXDataCollection(Collection<ICFBamTimeColObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;/*from   w  w w.ja  va  2 s.  co  m*/
    observableListOfTimeCol = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamTimeColObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfTimeCol.add(iter.next());
        }
        observableListOfTimeCol.sort(compareTimeColByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfTimeCol);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXValueListPane.java

public void setJavaFXDataCollection(Collection<ICFBamValueObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;/*from   w w  w.  j  av a 2s  .  c  o  m*/
    observableListOfValue = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        if (javafxSortByChain) {
            Iterator<ICFBamValueObj> iter = javafxDataCollection.iterator();
            ICFBamValueObj head = null;
            while ((head == null) && iter.hasNext()) {
                head = iter.next();
                if (null != head.getOptionalLookupPrev()) {
                    head = null;
                }
            }
            if ((head == null) && (javafxDataCollection.size() > 0)) {
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Could not locate head of object chain");
            }
            ICFBamValueObj cur = head;
            while (cur != null) {
                observableListOfValue.add(cur);
                cur = cur.getOptionalLookupNext();
            }
        } else {
            Iterator<ICFBamValueObj> iter = javafxDataCollection.iterator();
            while (iter.hasNext()) {
                observableListOfValue.add(iter.next());
            }
            observableListOfValue.sort(compareValueByQualName);
        }
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfValue);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTimeTypeListPane.java

public void setJavaFXDataCollection(Collection<ICFBamTimeTypeObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;/*from  w  w  w.j  a  v  a 2 s.  com*/
    observableListOfTimeType = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamTimeTypeObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfTimeType.add(iter.next());
        }
        observableListOfTimeType.sort(compareTimeTypeByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfTimeType);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTZTimeColListPane.java

public void setJavaFXDataCollection(Collection<ICFBamTZTimeColObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;// w  w w  .  j  a  v a  2s. c o  m
    observableListOfTZTimeCol = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamTZTimeColObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfTZTimeCol.add(iter.next());
        }
        observableListOfTZTimeCol.sort(compareTZTimeColByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfTZTimeCol);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTZTimeTypeListPane.java

public void setJavaFXDataCollection(Collection<ICFBamTZTimeTypeObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;//from w w w.  j a  v  a 2  s .  com
    observableListOfTZTimeType = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamTZTimeTypeObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfTZTimeType.add(iter.next());
        }
        observableListOfTZTimeType.sort(compareTZTimeTypeByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfTZTimeType);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXAtomListPane.java

public void setJavaFXDataCollection(Collection<ICFBamAtomObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;/* www.j a  v a  2  s .co m*/
    observableListOfAtom = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamAtomObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfAtom.add(iter.next());
        }
        observableListOfAtom.sort(compareAtomByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfAtom);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXBoolColListPane.java

public void setJavaFXDataCollection(Collection<ICFBamBoolColObj> value) {
    final String S_ProcName = "setJavaFXDataCollection";
    javafxDataCollection = value;//from www  .  jav a2s.c  om
    observableListOfBoolCol = FXCollections.observableArrayList();
    if (javafxDataCollection != null) {
        Iterator<ICFBamBoolColObj> iter = javafxDataCollection.iterator();
        while (iter.hasNext()) {
            observableListOfBoolCol.add(iter.next());
        }
        observableListOfBoolCol.sort(compareBoolColByQualName);
    }
    if (dataTable != null) {
        dataTable.setItems(observableListOfBoolCol);
        // Hack from stackoverflow to fix JavaFX TableView refresh issue
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(false);
        ((TableColumn) dataTable.getColumns().get(0)).setVisible(true);
    }
}