Example usage for javafx.collections.transformation FilteredList FilteredList

List of usage examples for javafx.collections.transformation FilteredList FilteredList

Introduction

In this page you can find the example usage for javafx.collections.transformation FilteredList FilteredList.

Prototype

public FilteredList(@NamedArg("source") ObservableList<E> source) 

Source Link

Document

Constructs a new FilteredList wrapper around the source list.

Usage

From source file:caillou.company.clonemanager.gui.customComponent.results.ResultController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    this.guiApplicationFileListFiltered = new FilteredList<>(guiApplicationFileList);
    this.initializePhaseAutomaticResizing();
    this.initializeContextDependant();

    SortedList<GUIApplicationFile> sortedList = new SortedList<>(guiApplicationFileListFiltered);
    // Bind the SortedList comparator to the TableView comparator.
    sortedList.comparatorProperty().bind(resultViewId.comparatorProperty());

    resultViewId.setItems(sortedList);//from  ww w . ja v  a 2s . co  m
    resultViewId.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    this.filterList(guiApplicationFileListFiltered);
    this.initializeFilter();
    this.initializeRowFactory();

    this.initializeStatistic();

    accordionPaneId.setExpandedPane(informationPaneId);

    groupId.getItems().add(Group.GROUPA);
    groupId.getItems().add(Group.GROUPB);
    groupId.setValue(Group.GROUPA);

    /**
     * Due to the bug
     * "https://bitbucket.org/controlsfx/controlsfx/issue/185/nullpointerexception-when-using-popover"
     */
    MainApp.getInstance().getStage().setOnCloseRequest(new EventHandler<WindowEvent>() {
        @Override
        public void handle(WindowEvent event) {
            if (popOver != null) {
                popOver.hide(Duration.millis(0));
            }
        }
    });
    /**
     * End *
     */
}

From source file:dtv.controller.FXMLMainController.java

@Override
public void initialize(URL url, ResourceBundle rb) {

    pi.setVisible(false);/*from  w  w w .  j  a va  2 s .com*/

    // test
    FilteredList<DVBChannel> filteredDataS2 = new FilteredList<>(serviceDataS2);
    FilteredList<DVBChannel> filteredDataT2 = new FilteredList<>(serviceDataT2);

    s_name.textProperty().addListener(obs -> filteredDataS2.setPredicate(getPredicate(obs)));
    s_name.textProperty().addListener(obs -> filteredDataT2.setPredicate(getPredicate(obs)));

    sortedDataS2 = new SortedList<>(filteredDataS2);
    sortedDataT2 = new SortedList<>(filteredDataT2);
    sortedDataS2.comparatorProperty().bind(serviceDVBS2Table.comparatorProperty());
    sortedDataT2.comparatorProperty().bind(serviceDVBT2Table.comparatorProperty());

    init(serviceDataS2, serviceDVBS2Table, s_idxColumnS2, s_nameColumnS2, s_typeColumnS2, s_pprColumnS2);
    init(serviceDataT2, serviceDVBT2Table, s_idxColumnT2, s_nameColumnT2, s_typeColumnT2, s_pprColumnT2);

    logs.setEditable(false);
    disableComponents(true);
}

From source file:eu.over9000.skadi.ui.MainWindow.java

private void setupTable() {
    this.table = new TableView<>();

    this.liveCol = new TableColumn<>("Live");
    this.liveCol.setCellValueFactory(p -> p.getValue().onlineProperty());
    this.liveCol.setSortType(SortType.DESCENDING);
    this.liveCol.setCellFactory(p -> new LiveCell());

    this.nameCol = new TableColumn<>("Channel");
    this.nameCol.setCellValueFactory(p -> p.getValue().nameProperty());

    this.titleCol = new TableColumn<>("Status");
    this.titleCol.setCellValueFactory(p -> p.getValue().titleProperty());

    this.gameCol = new TableColumn<>("Game");
    this.gameCol.setCellValueFactory(p -> p.getValue().gameProperty());

    this.viewerCol = new TableColumn<>("Viewer");
    this.viewerCol.setCellValueFactory(p -> p.getValue().viewerProperty().asObject());
    this.viewerCol.setSortType(SortType.DESCENDING);
    this.viewerCol.setCellFactory(p -> new RightAlignedCell<>());

    this.uptimeCol = new TableColumn<>("Uptime");
    this.uptimeCol.setCellValueFactory((p) -> p.getValue().uptimeProperty().asObject());
    this.uptimeCol.setCellFactory(p -> new UptimeCell());

    this.table.setPlaceholder(new Label("no channels added/matching the filters"));

    this.table.getColumns().add(this.liveCol);
    this.table.getColumns().add(this.nameCol);
    this.table.getColumns().add(this.titleCol);
    this.table.getColumns().add(this.gameCol);
    this.table.getColumns().add(this.viewerCol);
    this.table.getColumns().add(this.uptimeCol);

    this.table.getSortOrder().add(this.liveCol);
    this.table.getSortOrder().add(this.viewerCol);
    this.table.getSortOrder().add(this.nameCol);

    this.filteredChannelList = new FilteredList<>(this.channelHandler.getChannels());
    this.sortedChannelList = new SortedList<>(this.filteredChannelList);
    this.sortedChannelList.comparatorProperty().bind(this.table.comparatorProperty());

    this.table.setItems(this.sortedChannelList);

    this.table.setRowFactory(tv -> {
        final TableRow<Channel> row = new TableRow<>();
        row.setOnMouseClicked(event -> {
            if ((event.getButton() == MouseButton.PRIMARY) && (event.getClickCount() == 2) && !row.isEmpty()) {
                this.detailChannel.set(row.getItem());
                if (!this.sp.getItems().contains(this.detailPane)) {
                    this.sp.getItems().add(this.detailPane);
                    this.doDetailSlide(true);
                }// w  ww  . ja  v  a2  s. c  o  m
            }
        });
        return row;
    });
    this.table.getSelectionModel().selectedItemProperty().addListener((obs, oldV, newV) -> {

        this.details.setDisable(newV == null);
        this.remove.setDisable(newV == null);
        this.chatAndStreamButton.setDisable(newV == null);
        this.chatAndStreamButton.resetQualities();
        if ((newV == null) && this.sp.getItems().contains(this.detailPane)) {
            this.doDetailSlide(false);
        }

    });
}