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

public static <E> ObservableList<E> observableArrayList(Collection<? extends E> col) 

Source Link

Document

Creates a new observable array list and adds a content of collection col to it.

Usage

From source file:org.dataconservancy.packaging.gui.presenter.impl.EditPackageContentsPresenterImplTest.java

@Test
public void testIgnoreCollection() {
    presenter.rebuildTreeView();/*from ww w  .  j a  v  a  2s.  c  o  m*/
    presenter.toggleItemIgnore(FXCollections.observableArrayList(presenter.findItem(collection)), true);

    assertTrue(collection.isIgnored());
    assertTrue(dataItem.isIgnored());
    assertTrue(dataFile.isIgnored());
}

From source file:org.dataconservancy.packaging.gui.presenter.impl.EditPackageContentsPresenterImplTest.java

@Test
public void testUnignoreCollection() {
    presenter.rebuildTreeView();/*  w  w  w . ja v a2  s.  co  m*/

    //First ignore the collection
    presenter.toggleItemIgnore(FXCollections.observableArrayList(presenter.findItem(collection)), true);

    assertTrue(collection.isIgnored());
    assertTrue(dataFile.isIgnored());
    assertTrue(dataItem.isIgnored());

    //Now unignore the collection and check that all children are also unignored.
    presenter.toggleItemIgnore(FXCollections.observableArrayList(presenter.findItem(collection)), false);

    assertFalse(dataItem.isIgnored());
    assertFalse(dataFile.isIgnored());
}

From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

@FXML
protected void handleSearchButtonAction(ActionEvent event) {
    String searchText = txtSearch.getText();
    if (searchText.length() > 0) {
        this.setSelectedTerm();
        List<Term> terms = terminologyBase.getTermsByText(searchText);
        tblTerms.setItems(FXCollections.observableArrayList(this.wrapTerms(terms)));
        this.pushTermTable();
    } else {//w  w  w . j  a v a2 s  . c  om
        this.showAlert("Search text is too short.");
    }
}

From source file:com.hengyi.japp.print.client.controller.MdController.java

@FXML
private void handleAutoXd() {
    try {//from  w  w  w  .  j  av  a2  s  .  co m
        MdValidate.checkMdInput(md);
        md.xdsProperty().clear();
        md.setXds(FXCollections.observableArrayList(IntStream.range(0, md.getZcanmge()).mapToObj(i -> {
            Xd xd = new Xd();
            xd.zboxsnrProperty().set(i + 1);
            xd.sapYmmmachProperty().bind(md.sapYmmmachProperty());
            xd.zrolmgeProperty().bind(md.zrolmgeProperty());
            return xd;
        }).collect(Collectors.toList())));
        if (md.getZdzflg()) {
            zsgwghtColumn.setEditable(false);
            md.getXds().forEach(xd -> {
                xd.zsnwghtProperty().bind(md.zcnwghtProperty());
                xd.zsgwghtProperty().bind(new ObjectBinding<BigDecimal>() {
                    {
                        bind(xd.zsnwghtProperty(), xd.zrolmgeProperty(), md.sapYmmzhixProperty(),
                                md.sapYmmtonggProperty());
                    }

                    @Override
                    protected BigDecimal computeValue() {
                        return xd.getZsnwght().add(tareF.apply(md, xd));
                    }
                });
            });
        } else {
            zsgwghtColumn.setEditable(true);
            md.getXds().forEach(xd -> {
                xd.zsnwghtProperty().bind(new ObjectBinding<BigDecimal>() {
                    {
                        bind(xd.zsgwghtProperty(), xd.zrolmgeProperty(), md.sapYmmzhixProperty(),
                                md.sapYmmtonggProperty());
                    }

                    @Override
                    protected BigDecimal computeValue() {
                        return xd.getZsgwght().add(tareF.apply(md, xd).negate());
                    }
                });
            });
        }
        md.zsgwghtProperty().bind(new ObjectBinding<BigDecimal>() {
            {
                md.getXds().forEach(xd -> bind(xd.zsgwghtProperty()));
            }

            @Override
            protected BigDecimal computeValue() {
                BigDecimal result = BigDecimal.ZERO;
                for (Xd xd : md.getXds()) {
                    result = result.add(xd.getZsgwght());
                }
                return result;
            }
        });
        md.zsnwghtProperty().bind(new ObjectBinding<BigDecimal>() {
            {
                md.getXds().forEach(xd -> bind(xd.zsnwghtProperty()));
            }

            @Override
            protected BigDecimal computeValue() {
                BigDecimal result = BigDecimal.ZERO;
                for (Xd xd : md.getXds()) {
                    result = result.add(xd.getZsnwght());
                }
                return result;
            }
        });
    } catch (AppException e) {
        Util.alertDialog(e);
    }
}

From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

@FXML
protected void handleMarkedButtonAction(ActionEvent event) {
    this.setSelectedTerm();
    List<Term> terms = terminologyBase.getMarkedTerms();
    tblTerms.setItems(FXCollections.observableArrayList(this.wrapTerms(terms)));
    this.pushTermTable();
}

From source file:org.dataconservancy.packaging.gui.presenter.impl.EditPackageContentsPresenterImplTest.java

@Test
public void testIgnoreDataItem() {
    presenter.rebuildTreeView();/*from   w  ww.ja  va2  s. c om*/
    presenter.toggleItemIgnore(FXCollections.observableArrayList(presenter.findItem(dataItem)), true);

    //Parent should not be ignored
    assertFalse(collection.isIgnored());

    //Item and it's children should be ignored
    assertTrue(dataFile.isIgnored());
    assertTrue(dataItem.isIgnored());
}

From source file:jduagui.Controller.java

private void init() {
    try {/*from   w  ww .j ava  2s.c o m*/
        directoryTable.setRoot(buildFileTree(rootPath));
        directoryTable.getSelectionModel().selectedItemProperty().addListener(listener);
        directoryTable.getColumns().setAll(setNameColumn(), setSizeColumn());
        directoryTable.getColumns().addAll(setPercentColumn(), setItemColumn());
        directoryTable.getColumns().addAll(setDirColumn(), setFileColumn());
        FileItem.getExtensions(rootPath, extensions);
        tableContent = FXCollections.observableArrayList(extensions.entrySet());
        extensionTable.setItems(tableContent);
        extensionTable.getColumns().addAll(extNameColumn(), extCountColumn(), extSizeColumn());
        statusIndicator.setText("Done.");

        int width = (int) swingPane.getMinWidth() + (int) swingPane.getMaxWidth();
        int length = (int) swingPane.getMinHeight() + (int) swingPane.getMaxHeight();

        File root = (File) directoryTable.getRoot().getValue();
        treeMap = new FileTree(length, width, root);
        swingNode.setContent(treeMap.getContent());

    } catch (Exception e) {
        System.out.println("error occured: " + e);
        e.printStackTrace();
    }
}

From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

@FXML
protected void handleHeadsButtonAction(ActionEvent event) {
    Term term = tblTerms.getSelectionModel().getSelectedItem();
    if (term != null) {
        this.setSelectedTerm();
        if (term instanceof TermWrapper) {
            term = ((TermWrapper) term).getWrappedTerm();
        }/*  w w w  . jav  a  2  s  .c  o  m*/
        Set<Term> heads = terminologyBase.getHeads(term);
        tblTerms.setItems(FXCollections.observableArrayList(this.wrapTerms(heads)));
        this.pushTermTable();
    }
}

From source file:org.dataconservancy.packaging.gui.presenter.impl.EditPackageContentsPresenterImplTest.java

@Test
public void testUnIgnoreDataItem() {
    presenter.rebuildTreeView();/*from w ww  .j av a2 s. co  m*/
    presenter.toggleItemIgnore(FXCollections.observableArrayList(presenter.findItem(dataItem)), true);

    //Parent should not be ignored
    assertFalse(collection.isIgnored());

    //Item and it's children should be ignored
    assertTrue(dataItem.isIgnored());
    assertTrue(dataFile.isIgnored());

    presenter.toggleItemIgnore(FXCollections.observableArrayList(presenter.findItem(dataItem)), false);

    //Parent should not be ignored
    assertFalse(collection.isIgnored());

    //Item and it's children should be ignored
    assertFalse(dataFile.isIgnored());
    assertFalse(dataItem.isIgnored());
}

From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java

void doExpansions() {
    Term term = tblTerms.getSelectionModel().getSelectedItem();
    if (term != null) {
        this.setSelectedTerm();
        if (term instanceof TermWrapper) {
            term = ((TermWrapper) term).getWrappedTerm();
        }/*from   www  .j av a 2  s. c  om*/
        Set<Term> expansions = terminologyBase.getExpansions(term);
        tblTerms.setItems(FXCollections.observableArrayList(this.wrapTerms(expansions)));
        this.pushTermTable();
    }
}