public AgentInfo(String field, String value) { this.field = field; this.value = value; this.active = true; color = Configuration.getInstance().getColor(getName()); inventory.addListener( (Observable o) -> { if (inventory.get() != null) { filteredInventory = new FilteredList<Inventory>(inventory.get()); filteredInventory.addListener( (Observable e) -> { addToChart(this); }); filteredInventory.predicateProperty().bind(_currentNuclideFilterProperty); } }); }
public static void filterTableColumn( TableColumn<ty_any_type, ty_any_type> column, ty_table_column PPLColumn, FilterCriteria filterCriteria) { TableView<ty_any_type> tableView = column.getTableView(); FilteredList<ty_any_type> filteredList = (FilteredList<ty_any_type>) tableView.getProperties().get(GenericTableRowsService.filteredListpropertyId); if (filterCriteria == null) { // no filter filteredList.setPredicate(rowObject -> true); } else { Predicate<String> stringPredicate = getStringPredicate(filterCriteria); filteredList.setPredicate( rowObject -> { ty_any_type cellValue; if (rowObject == null) { cellValue = null; } else { cellValue = PPLColumn.getRow_to_cell_value_converter().convert(rowObject); } if (cellValue != null) { // return cellValue.to_string ().getJavaString ().toLowerCase ().contains ( // filterValue.toLowerCase () ); if (!filterCriteria.excludeElements) { return stringPredicate.test(cellValue.to_string().getJavaString()); } else { return !stringPredicate.test(cellValue.to_string().getJavaString()); } } else { return false; } }); } }
@FXML private void initialize() { initMenu(); strokes.setCellFactory(param -> new ModelCell<>(lang)); strokes .getSelectionModel() .selectedItemProperty() .addListener((observable, oldValue, newValue) -> onSelect(newValue)); isSelected.bind(strokes.getSelectionModel().selectedItemProperty().isNotNull()); search .textProperty() .addListener( observable -> { if (search.getText() == null || search.getText().isEmpty()) { allStrokes.setPredicate(set -> true); } else { allStrokes.setPredicate( set -> set.uiString(lang).toLowerCase().contains(search.getText().toLowerCase())); } }); populate(); }
protected void setFilteredListPredicate(FilteredList<Dispute> filteredList) { filteredList.setPredicate( dispute -> !dispute.getArbitratorPubKeyRing().equals(keyRing.getPubKeyRing())); }
@FXML public void initialize() { System.out.println("<main_contr>: controller initiation"); // observableTeams = FXCollections.observableArrayList(BetterDataGenerator.generateTeams()); observableTeams = FXCollections.observableArrayList(); teamsTable.setPlaceholder(new Label("No matching data")); FilteredList<Team> filteredTeams = new FilteredList<>(observableTeams, p -> false); teamSearcherTextField .textProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue != null && newValue.length() == 3 && oldValue.length() < newValue.length()) { System.out.println("<main_contr>: query to db for '" + newValue + "'"); observableTeams.clear(); observableTeams.addAll(dbHandle.loadTeams()); } filteredTeams.setPredicate( team -> { if (newValue == null || newValue.isEmpty() || newValue.length() < 3) { return false; } String lowerCaseFilter = newValue.toLowerCase(); if (lowerCaseFilter.equals("all")) { return true; } else if (team.getTeamName().toLowerCase().contains(lowerCaseFilter)) { return true; } else if (team.getSupervisor() != null && team.getSupervisor() .toString() .toLowerCase() .contains(lowerCaseFilter)) { return true; } return false; }); }); FilteredList<Team> orphanTeams = new FilteredList<>( observableTeams, team -> { if (team.getSupervisor() == null) { return true; } else { return false; } }); SortedList<Team> sortedFilteredTeams = new SortedList<>(filteredTeams); sortedFilteredTeams.comparatorProperty().bind(teamsTable.comparatorProperty()); teamsTable.setItems(sortedFilteredTeams); SortedList<Team> sortedOrphanTeams = new SortedList<>(orphanTeams); sortedOrphanTeams.comparatorProperty().bind(orphanTeamsTable.comparatorProperty()); orphanTeamsTable.setItems(sortedOrphanTeams); teamsTable.setRowFactory( p -> { TableRow<Team> row = new TableRow<>(); row.setOnMouseClicked( event -> { if (event.getClickCount() == 2 && !row.isEmpty()) { Team selectedTeam = row.getItem(); handleTeamDoubleClick(selectedTeam); } }); return row; }); }
@Override public void initialize(URL url, ResourceBundle rb) { TableColumnCodigo.setCellValueFactory(cellData -> cellData.getValue().CodigoProperty()); TableColumnNome.setCellValueFactory(cellData -> cellData.getValue().NomeProperty()); TableColumnServico.setCellValueFactory(cellData -> cellData.getValue().ServicoProperty()); // TableColumnVencimento.setCellValueFactory(cellData -> cellData.getValue().StatusProperty()); TableColumnValor.setCellValueFactory(cellData -> cellData.getValue().ValorProperty()); TableColumnSituacao.setCellValueFactory(cellData -> cellData.getValue().SituacaoProperty()); try { carregaTabela(); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (itens.size() > 0) TableViewBuscar.setItems(itens); itens.addListener( new ListChangeListener<BuscaCadastroContaReceberFiltro>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change< ? extends BuscaCadastroContaReceberFiltro> arg0) { TextFieldTotal.setText(Integer.toString(TableViewBuscar.getItems().size())); } }); FilteredList<BuscaCadastroContaReceberFiltro> filteredData = new FilteredList<>(itens, p -> true); TextFieldFiltro.textProperty() .addListener( (observable, oldValue, newValue) -> { TextFieldTotal.setText(Integer.toString(TableViewBuscar.getItems().size())); filteredData.setPredicate( person -> { if (newValue == null || newValue.isEmpty()) { return true; } String lowerCaseFilter = newValue.toLowerCase(); if (person.getNome().toLowerCase().indexOf(lowerCaseFilter) != -1) { return true; } return false; }); }); SortedList<BuscaCadastroContaReceberFiltro> sortedData = new SortedList<>(filteredData); sortedData.comparatorProperty().bind(TableViewBuscar.comparatorProperty()); TableViewBuscar.setItems(sortedData); ButtonOk.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (TableViewBuscar.getSelectionModel().getSelectedItems().size() < 1) { Alerta alerta = new Alerta("Busca", "Conta não selecionada!"); alerta.Alertar(BuscaCadastroContaReceberView.myStage); return; } try { // if (opt == 0){ CadastroContasReceberController.setcontareceber( ControllerContaReceber.BuscaContaReceber( TableViewBuscar.getSelectionModel().getSelectedItems().get(0).getCodigo())); CadastroContasReceberController.tela.carregaInfo(); // }else if(opt == 1){ // CadastroMatriculaController.setaluno(ControllerAluno.BuscaAluno(TableViewBuscar.getSelectionModel().getSelectedItems().get(0).getCodigo())); // CadastroMatriculaController.tela.carregaInfoAluno(); // } } catch (ClassNotFoundException | SQLException e1) { e1.printStackTrace(); } BuscaCadastroContaReceberView.myStage.close(); } }); ButtonCancelar.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { BuscaCadastroContaReceberView.myStage.close(); } }); }