Java 类javafx.collections.transformation.FilteredList 实例源码

项目:hygene    文件:PathController.java   
/**
 * Adds event listeners to update the list of genomes when the user selects a specific genome.
 * <p>
 * Will update the
 */
void addListeners() {
    final FilteredList<GenomePath> filteredList = new FilteredList<>(graphVisualizer.getGenomePathsProperty(),
            s -> s.getName().contains(searchField.textProperty().get()));

    pathTable.setItems(filteredList);

    // Updates the filtered list predicate on a search
    searchField.textProperty().addListener((observable, oldValue, newValue) ->
            filteredList.setPredicate(getPredicate(newValue)));

    matchCase.selectedProperty().addListener((observable, oldValue, newValue) ->
            filteredList.setPredicate(getPredicate(searchField.getText())));

    regex.selectedProperty().addListener((observable, oldValue, newValue) ->
            filteredList.setPredicate(getPredicate(searchField.getText())));

    // Updates the label with the number of paths that are displayed
    filteredList.getSource().addListener((ListChangeListener<GenomePath>) c ->
            pathsFound.textProperty().setValue("Paths found: " + filteredList.size()));
}
项目:marathonv5    文件:CollatedTreeItem.java   
public CollatedTreeItem() {
    children = FXCollections.observableArrayList();
    filteredChildren = new FilteredList<>(children, new Predicate<TreeItem<T>>() {
        @Override public boolean test(TreeItem<T> t) {
            return filter.test(t.getValue());
        }
    });
    sortedChildren = new SortedList<>(filteredChildren);
    ObservableList<TreeItem<T>> original = super.getChildren();
    sortedChildren.addListener(new ListChangeListener<TreeItem<T>>() {
        @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<T>> c) {
            while (c.next()) {
                original.removeAll(c.getRemoved());
                original.addAll(c.getFrom(), c.getAddedSubList());
            }
        }
    });
}
项目:vars-annotation    文件:FilterableTreeItem.java   
public FilterableTreeItem(T value) {
    super(value);
    this.sourceList = FXCollections.observableArrayList();
    this.filteredList = new FilteredList<>(this.sourceList);
    this.filteredList.predicateProperty().bind(Bindings.createObjectBinding(() -> {
        return child -> {
            // Set the predicate of child items to force filtering
            if (child instanceof FilterableTreeItem) {
                FilterableTreeItem<T> filterableChild = (FilterableTreeItem<T>) child;
                filterableChild.setPredicate(this.predicate.get());
            }
            // If there is no predicate, keep this tree item
            if (this.predicate.get() == null)
                return true;
            // If there are children, keep this tree item
            if (child.getChildren().size() > 0)
                return true;
            // Otherwise ask the TreeItemPredicate
            return this.predicate.get().test(this, child.getValue());
        };
    }, this.predicate));
    setHiddenFieldChildren(this.filteredList);
}
项目:Gargoyle    文件:FilterableTreeItem.java   
public FilterableTreeItem(T value) {
    super(value);

    FilteredList<TreeItem<T>> filteredChildren = new FilteredList<>(sourceChildren);
    filteredChildren.predicateProperty().bind(Bindings.createObjectBinding(() -> {
        Predicate<TreeItem<T>> p = child -> {
            if (child instanceof FilterableTreeItem) {
                ((FilterableTreeItem<T>) child).predicateProperty().set(predicate.get());
            }
            if (predicate.get() == null || !child.getChildren().isEmpty()) {
                return true;
            }
            return predicate.get().test(this, child.getValue());
        };
        return p;
    }, predicate));

    setHiddenFieldChildren(filteredChildren);

}
项目:javaone2016    文件:VenuesPresenter.java   
public void initialize() {
        venues.setOnShowing(event -> {
            AppBar appBar = getApp().getAppBar();
            appBar.setNavIcon(getApp().getNavMenuButton());
            appBar.setTitleText(OTNView.VENUES.getTitle());
            appBar.getActionItems().add(getApp().getSearchButton());
            venuesListView.setSelectedItem(null);
        });

        venuesListView.getStyleClass().add("venues-list-view");

        venuesListView.setPlaceholder(new Placeholder(PLACEHOLDER_MESSAGE, OTNView.VENUES.getMenuIcon()));

        filteredVenues = new FilteredList<>(service.retrieveVenues());
        venuesListView.setItems(filteredVenues);

        venuesListView.setCellFactory(p -> new VenueCell());
//        venuesListView.selectedItemProperty().addListener((observable, oldValue, newValue) -> {
//            if (newValue != null) {
//                OTNView.VENUE.switchView().ifPresent( presenter ->
//                        ((VenuePresenter)presenter).setVenue(newValue));
//            }
//        });
    }
项目:osrs-equipment-builder    文件:ItemSelectorController.java   
private void setupSorting() {
    FilteredList<Item> filteredData = new FilteredList<>(itemList, p -> true);

    filterField.textProperty().addListener((observable, oldValue, newValue) -> {
        filteredData.setPredicate(item -> {
            if(newValue == null || newValue.isEmpty() )
                return true;

            if(item.getName().toLowerCase().contains(newValue.toLowerCase())){
                return true;
            } else {
                return false;
            }

        });
    });

    SortedList<Item> sortedData = new SortedList<>(filteredData);

    sortedData.comparatorProperty().bind(itemTable.comparatorProperty());

    itemTable.setItems(sortedData);

}
项目:xframium-java    文件:ReplayStage.java   
private void change (SessionTable table, FilteredList<SessionRecord> filteredData)
{
  // get the previously selected line
  SessionRecord selectedRecord = table.getSelectionModel ().getSelectedItem ();

  // change the filter predicate
  filteredData.setPredicate (sessionRecord -> sessionRecord.isTN3270 ()
      || (sessionRecord.isTelnet () && showTelnetCB.isSelected ())
      || (sessionRecord.isTN3270Extended () && show3270ECB.isSelected ()));

  // restore the previously selected item (if it is still visible)
  if (selectedRecord != null)
  {
    table.getSelectionModel ().select (selectedRecord);
    table.requestFocus ();
  }
}
项目:xframium-java    文件:ConsoleMessageTab.java   
private void setFilter (FilteredList<ConsoleMessage> filteredData)
{
  String time = txtTime.getText ();
  String task = txtTask.getText ();
  String code = txtMessageCode.getText ();
  String text = txtMessageText.getText ();

  filteredData.setPredicate (message ->
  {
    boolean p0 = message.getTime ().startsWith (time);
    boolean p1 = message.getTask ().startsWith (task);
    boolean p2 = message.getMessageCode ().startsWith (code);
    boolean p3 = message.getMessage ().contains (text);
    return p0 && p1 && p2 && p3;
  });
}
项目:JttDesktop    文件:TotalPassingTests.java   
/**
 * Method to recalculate the statistic value.
 * @param relevantJobs the {@link FilteredList} of {@link JenkinsJob}s to use in the statistic.
 * @return the {@link String} representation of the statistic.
 */
@Override protected String constructStatisticRepresentation( FilteredList< JenkinsJob > relevantJobs ){
   int recalculatedTotal = 0;
   int recalculatedCount = 0;

   for ( JenkinsJob j : relevantJobs ) {
      recalculatedCount += ( j.testTotalCount().get() - j.testFailureCount().get() );
      recalculatedTotal += j.testTotalCount().get();
   }

   if ( recalculatedCount == passing && recalculatedTotal == total ) {
      return null;
   }

   this.passing = recalculatedCount;
   this.total = recalculatedTotal;

   return recalculatedCount + "/" + recalculatedTotal;
}
项目:JttDesktop    文件:LastBuildStarted.java   
/**
 * Method to recalculate the statistic value.
 * @param relevantJobs the {@link FilteredList} of {@link JenkinsJob}s to use in the statistic.
 * @return the {@link String} representation of the statistic.
 */
@Override protected String constructStatisticRepresentation( FilteredList< JenkinsJob > relevantJobs ){
   Long recalculatedTimestamp = null;

   for ( JenkinsJob j : relevantJobs ) {
      Long timestamp = j.buildTimestampProperty().get();
      if ( timestamp == null ) {
         continue;
      }
      if ( recalculatedTimestamp == null ) {
         recalculatedTimestamp = timestamp;
         continue;
      }
      if ( recalculatedTimestamp < timestamp ) {
         recalculatedTimestamp = j.buildTimestampProperty().get();
      }
   }

   if ( recalculatedTimestamp == null ) {
      return UNKNOWN;
   }

   return timestampformatter.format( recalculatedTimestamp, DATE_TIME_FORMATTER );
}
项目:JttDesktop    文件:NodesInUse.java   
/**
 * Method to recalculate the statistic value.
 * @param relevantJobs the {@link FilteredList} of {@link JenkinsJob}s to use in the statistic.
 * @return the {@link String} representation of the statistic.
 */
@Override protected String constructStatisticRepresentation( FilteredList< JenkinsJob > relevantJobs ){
   Set< JenkinsNode > nodesInUse = new HashSet<>();

   for ( JenkinsJob j : relevantJobs ) {
      if ( j.buildStateProperty().get() == BuildState.Built ) {
         continue;
      }
      JenkinsNode node = j.builtOnProperty().get();
      if ( node == null ) {
         continue;
      }
      nodesInUse.add( node );
   }

   int recalculatedCount = nodesInUse.size();
   if ( recalculatedCount == this.count ) {
      return null;
   }

   this.count = recalculatedCount;

   return Integer.toString( recalculatedCount );
}
项目:NoticEditor    文件:FilterableTreeItem.java   
public FilterableTreeItem(T value) {
    super(value);
    sourceList = FXCollections.observableArrayList();
    filteredList = new FilteredList<>(sourceList);
    filteredList.predicateProperty().bind(Bindings.createObjectBinding(() -> {
        return child -> {
            // Set the predicate of child items to force filtering
            if (child instanceof FilterableTreeItem) {
                FilterableTreeItem<T> filterableChild = (FilterableTreeItem<T>) child;
                filterableChild.setPredicate(predicate.get());
            }
            // If there is no predicate, keep this tree item
            if (predicate.get() == null)
                return true;
            // If there are children, keep this tree item
            if (child.getChildren().size() > 0)
                return true;
            // Otherwise ask the TreeItemPredicate
            return predicate.get().test(this, child.getValue());
        };
    }, predicate));
    setHiddenFieldChildren(filteredList);
}
项目:polTool    文件:EloView.java   
private Node createFilterTab() {
    GridPane pane = new GridPane();
    pane.setHgap(10d);
    pane.setVgap(10d);

    leageList = new FilteredList<String>(model.getLeages(), value -> true);
    leageFilter = new ComboBox<String>(leageList);
    // leageFilter.valueProperty().addListener(value -> update());
    from = new NumberField();
    to = new NumberField();
    teamEloTable.fromProperty().bindBidirectional(from.integerProperty());
    teamEloTable.toProperty().bindBidirectional(to.integerProperty());
    pane.add(leageFilter, 1, 1);
    pane.addRow(2, from, to);
    return pane;
}
项目:JFoenix    文件:TreeViewDemo.java   
public FilterableTreeItem(T value) {
    super(value);
    this.sourceList = FXCollections.observableArrayList();
    this.filteredList = new FilteredList<>(this.sourceList);
    this.filteredList.predicateProperty().bind(Bindings.createObjectBinding(() -> {
        return child -> {
            // Set the predicate of child items to force filtering
            if (child instanceof FilterableTreeItem) {
                FilterableTreeItem<T> filterableChild = (FilterableTreeItem<T>) child;
                filterableChild.setPredicate(this.predicate.get());
            }
            // If there is no predicate, keep this tree item
            if (this.predicate.get() == null)
                return true;
            // If there are children, keep this tree item
            if (child.getChildren().size() > 0)
                return true;
            // Otherwise ask the TreeItemPredicate
            return this.predicate.get().test(this, child.getValue());
        };
    }, this.predicate));
    setHiddenFieldChildren(this.filteredList);
}
项目:summer2015advancedjava    文件:MainController.java   
private void loadStudents() {
    try {
        String query = "SELECT * FROM student";
        System.out.println("Query [" + query + "]");
        ResultSet result = statement.executeQuery(query);
        students = FXCollections.observableArrayList();
        filteredStudents = new FilteredList(students, p -> true);
        studentListView.setItems(filteredStudents);
        while (result.next()) {
            Student student = new Student(result.getString("id"), 
                    result.getString("name"), 
                    result.getString("sex").charAt(0) == 'M' ? Sex.MALE : Sex.FEMALE,
                    result.getDate("dob").toLocalDate());
            students.add(student);
        }
    } catch (SQLException ex) {
        Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
    }
}
项目:dm3270    文件:ReplayStage.java   
private void change (SessionTable table, FilteredList<SessionRecord> filteredData)
{
  // get the previously selected line
  SessionRecord selectedRecord = table.getSelectionModel ().getSelectedItem ();

  // change the filter predicate
  filteredData.setPredicate (sessionRecord -> sessionRecord.isTN3270 ()
      || (sessionRecord.isTelnet () && showTelnetCB.isSelected ())
      || (sessionRecord.isTN3270Extended () && show3270ECB.isSelected ()));

  // restore the previously selected item (if it is still visible)
  if (selectedRecord != null)
  {
    table.getSelectionModel ().select (selectedRecord);
    table.requestFocus ();
  }
}
项目:dm3270    文件:ConsoleMessageTab.java   
private void setFilter (FilteredList<ConsoleMessage> filteredData)
{
  String time = txtTime.getText ();
  String task = txtTask.getText ();
  String code = txtMessageCode.getText ();
  String text = txtMessageText.getText ();

  filteredData.setPredicate (message ->
  {
    boolean p0 = message.getTime ().startsWith (time);
    boolean p1 = message.getTask ().startsWith (task);
    boolean p2 = message.getMessageCode ().startsWith (code);
    boolean p3 = message.getMessage ().contains (text);
    return p0 && p1 && p2 && p3;
  });
}
项目:speedment    文件:ConnectController.java   
private void toggleVisibility(RowConstraints row,
                              FilteredList<Node> children,
                              boolean show) {
    if (show) {
        row.setMaxHeight(USE_COMPUTED_SIZE);
        row.setMinHeight(10);
    } else {
        row.setMaxHeight(0);
        row.setMinHeight(0);
    }

    children.forEach(n -> {
        n.setVisible(show);
        n.setManaged(show);
    });
}
项目:exchange    文件:SearchComboBox.java   
public SearchComboBox(final ObservableList<T> items) {
    super(new FilteredList<>(items));
    filteredList = new FilteredList<>(items);
    setEditable(true);

    itemsProperty().addListener((observable, oldValue, newValue) -> {
        filteredList = new FilteredList<>(newValue);
        setItems(filteredList);
    });
    getEditor().textProperty().addListener((observable, oldValue, newValue) -> {
        if (!filteredList.stream().filter(item -> getConverter().toString(item).equals(newValue)).
                findAny().isPresent()) {
            UserThread.execute(() -> {
                filteredList.setPredicate(item -> newValue.isEmpty() ||
                        getConverter().toString(item).toLowerCase().contains(newValue.toLowerCase()));
                hide();
                setVisibleRowCount(Math.min(12, filteredList.size()));
                show();
            });
        }
    });
}
项目:dwoss    文件:SelectExistingReportView.java   
@Override
public void accept(List<Report> allReports) {
    reports = FXCollections.observableList(allReports);
    filteredReports = new FilteredList<>(reports);
    reportListView.setItems(filteredReports);

    ObservableList<TradeName> typeItems = FXCollections.observableList(allReports
            .stream()
            .map(Report::getType)
            .distinct()
            .collect(Collectors.toList()));
    typeBox.setItems(typeItems);
    typeBox.getSelectionModel().selectFirst(); // select triggers tradename filter

    ObservableList<Integer> yearItems = FXCollections.observableList(allReports
            .stream()
            .map(r -> LocalDate.from(Instant.ofEpochMilli(r.getStartingDate().getTime()).atZone(systemDefault())).getYear())
            .distinct()
            .collect(Collectors.toList())
    );
    Collections.reverse(yearItems); //newest date on the top oldest on the button

    yearBox.setItems(yearItems);
    yearBox.getSelectionModel().selectFirst(); // select triggers year filter
}
项目:erlyberly    文件:DbgView.java   
private void filterForFunctionTextMatch(String search) {
    String[] split = search.split(":");

    if(split.length == 0)
        return;

    final String moduleName = split[0];
    final String funcName = (split.length > 1) ? split[1] : "";

    if(search.contains(":")) {
        for (TreeItem<ModFunc> treeItem : filteredTreeModules) {
            treeItem.setExpanded(true);
        }
    }

    for (FilteredList<TreeItem<ModFunc>> funcItemList : functionLists.values()) {
        funcItemList.setPredicate((t) -> { return isMatchingModFunc(funcName, t); });
    }

    filteredTreeModules.setPredicate((t) -> { return isMatchingModFunc(moduleName, t) && !t.getChildren().isEmpty(); });
}
项目:PeerWasp    文件:ActivityController.java   
/**
 * Wires the list view with the items source and configures filtering and sorting of the items.
 */
private void loadItems() {
    // filtering -- default show all
    FilteredList<ActivityItem> filteredItems = new FilteredList<>(activityLogger.getActivityItems(), p -> true);
    txtFilter.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            // filter on predicate
            filteredItems.setPredicate(new ActivityItemFilterPredicate(newValue));
        }
    });

    // sorting
    SortedList<ActivityItem> sortedItems = new SortedList<>(filteredItems, new ActivityItemTimeComparator());

    // set item source
    lstActivityLog.setItems(sortedItems);
    lstActivityLog
            .setCellFactory(new Callback<ListView<ActivityItem>, ListCell<ActivityItem>>() {
                @Override
                public ListCell<ActivityItem> call(ListView<ActivityItem> param) {
                    return new ActivityItemCell();
                }
            });
}
项目:jabref    文件:RecursiveTreeItem.java   
private void addChildrenListener(T value) {
    children = new FilteredList<>(
            BindingsHelper.mapBacked(childrenFactory.call(value),
                    child -> new RecursiveTreeItem<>(child, getGraphic(), childrenFactory, expandedProperty, filter)));
    children.predicateProperty().bind(Bindings.createObjectBinding(() -> this::showNode, filter));

    getChildren().addAll(0, children);

    children.addListener((ListChangeListener<RecursiveTreeItem<T>>) change -> {
        while (change.next()) {

            if (change.wasRemoved()) {
                getChildren().removeAll(change.getRemoved());
            }

            if (change.wasAdded()) {
                getChildren().addAll(change.getFrom(), change.getAddedSubList());
            }
        }
    });
}
项目:hygene    文件:PathController.java   
@Override
public void initialize(final URL location, final ResourceBundle resources) {
    nameColumn.setCellValueFactory(cell -> {
        if (cell.getValue().getName() == null) {
            return new SimpleStringProperty("[unknown genome]");
        } else {
            return new SimpleStringProperty(cell.getValue().getName());
        }
    });

    colorColumn.setCellValueFactory(cell -> cell.getValue().getColor());

    colorColumn.setCellFactory(cell -> new TableCell<GenomePath, Color>() {
        @Override
        protected void updateItem(final Color color, final boolean empty) {
            super.updateItem(color, empty);

            if (color == null) {
                setBackground(Background.EMPTY);
            } else {
                setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
            }
        }
    });

    selectedColumn.setCellValueFactory(cell -> cell.getValue().selectedProperty());

    selectedColumn.setCellFactory(CheckBoxTableCell.forTableColumn(selectedColumn));

    final FilteredList<GenomePath> filteredList = new FilteredList<>(graphVisualizer.getGenomePathsProperty(),
            s -> s.getName().contains(searchField.textProperty().get()));

    pathTable.setItems(filteredList);

    pathTable.setEditable(true);

    addListeners();
}
项目:CalendarFX    文件:LogPane.java   
public LogPane() {
    super();
    table = new TableView<>();

    TableColumn<LogItem, StatusType> statusColumn = new TableColumn<>("Status");
    statusColumn.setCellValueFactory(new PropertyValueFactory<>("status"));
    statusColumn.prefWidthProperty().bind(Bindings.multiply(0.1, table.widthProperty()));
    statusColumn.setCellFactory(col -> new StatusTypeCell());

    TableColumn<LogItem, ActionType> actionColumn = new TableColumn<>("Action");
    actionColumn.setCellValueFactory(new PropertyValueFactory<>("action"));
    actionColumn.prefWidthProperty().bind(Bindings.multiply(0.1, table.widthProperty()));
    actionColumn.setCellFactory(col -> new ActionTypeCell());

    TableColumn<LogItem, LocalDateTime> timeColumn = new TableColumn<>("Time");
    timeColumn.setCellValueFactory(new PropertyValueFactory<>("time"));
    timeColumn.prefWidthProperty().bind(Bindings.multiply(0.2, table.widthProperty()));
    timeColumn.setCellFactory(col -> new TimeCell());

    TableColumn<LogItem, String> calendarColumn = new TableColumn<>("Calendar");
    calendarColumn.setCellValueFactory(new PropertyValueFactory<>("calendar"));
    calendarColumn.prefWidthProperty().bind(Bindings.multiply(0.2, table.widthProperty()));

    TableColumn<LogItem, String> descriptionColumn = new TableColumn<>("Description");
    descriptionColumn.setCellValueFactory(new PropertyValueFactory<>("description"));
    descriptionColumn.prefWidthProperty().bind(Bindings.multiply(0.4, table.widthProperty()));

    filteredData = new FilteredList<>(items);
    SortedList<LogItem> sortedData = new SortedList<>(filteredData);
    sortedData.comparatorProperty().bind(table.comparatorProperty());

    table.getColumns().add(statusColumn);
    table.getColumns().add(actionColumn);
    table.getColumns().add(timeColumn);
    table.getColumns().add(calendarColumn);
    table.getColumns().add(descriptionColumn);
    table.setTableMenuButtonVisible(true);
    table.setItems(sortedData);
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
项目:keyboard-light-composer    文件:EffectSelect.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    effects = FXCollections.observableArrayList();
    filteredEffects = new FilteredList<>(effects);

    listSearch.visibleProperty().bind(textFieldSearch.textProperty().isNotEmpty());
    accordionGroups.visibleProperty().bind(textFieldSearch.textProperty().isEmpty());
    listSearch.setItems(filteredEffects);
    listSearch.setCellFactory(list -> new EffectFactoryListCell());

    textFieldSearch.textProperty().addListener((v, o, n) -> search(n));

    setupEffectList();
}
项目:recruitervision    文件:ParsedFilesController.java   
private void initTable() {
    fileName.setCellValueFactory(param -> new SimpleStringProperty(FilenameUtils.getBaseName(param.getValue().getFile().getPath())));
    fileLocation.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getFile().getPath()));
    fileExtension.setCellValueFactory(param -> new SimpleStringProperty(FilenameUtils.getExtension(param.getValue().getFile().getPath())));
    language.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getLanguage()));

    fileStatus_parsed.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getParsedStatus()));
    fileStatus_extracted.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getExtractedStatus()));

    // Searchable
    FilteredList<Filed> filteredData = new FilteredList<>(observableFiles, f -> true);
    searcheableField.textProperty().addListener((observable, oldValue, newValue) -> filteredData.setPredicate(filed -> {
        if (newValue == null || newValue.isEmpty()) {
            return true;
        }
        String lowerCaseFilter = newValue.toLowerCase();

        if (FilenameUtils.getBaseName(filed.getFile().getPath()).toLowerCase().contains(lowerCaseFilter)) {
            return true;
        } else if (filed.getFile().getPath().toLowerCase().contains(lowerCaseFilter)) {
            return true;
        } else if (filed.getLanguage().toLowerCase().contains(lowerCaseFilter)) {
            return true;
        }
        return false;
    }));
    SortedList<Filed> sortedList = new SortedList<>(filteredData);
    sortedList.comparatorProperty().bind(millingTable.comparatorProperty());

    millingTable.getColumns().setAll(fileName, fileLocation, fileExtension, language, fileStatus);
    millingTable.setItems(sortedList);
}
项目:vars-annotation    文件:AnnotationEditorPaneController.java   
private void loadComboBoxData() {

        toolBox.getServices()
                .getConceptService()
                .findAllNames()
                .thenAccept(names -> {
                    FilteredList<String> cns = new FilteredList<>(FXCollections.observableArrayList(names));
                    Platform.runLater(() -> conceptComboBox.setItems(cns));
                });
    }
项目:vars-annotation    文件:FilteredComboBoxDecorator.java   
public FilteredComboBoxDecorator(final ComboBox<T> comboBox,
                                 AutoCompleteComparator<T> comparator) {
    this.comboBox = comboBox;
    this.comparator = comparator;

    filteredItems = new FilteredList<>(comboBox.getItems());
    comboBox.setItems(filteredItems);

    Tooltip tooltip = new Tooltip();
    tooltip.getStyleClass().add("tooltip-combobox");
    comboBox.setTooltip(tooltip);
    filter.addListener((observable, oldValue, newValue) -> handleFilterChanged(newValue));
    comboBox.setOnKeyPressed(this::handleOnKeyPressed);
    comboBox.setOnHidden(this::handleOnHiding);

    comboBox.itemsProperty().addListener((obs, oldV, newV) -> {
        if (newV != filteredItems) {
            //log.info("New list of size " + newV.size());
            if (!(newV instanceof FilteredList)) {
                filteredItems = new FilteredList<>(newV);
            }
            else {
                filteredItems = (FilteredList<T>) newV;
            }
            comboBox.setItems(filteredItems);
        }
    });
}
项目:stvs    文件:EditorPane.java   
private void setLineIcon(int i, FilteredList<SyntaxError> syntaxErrors, Label icon) {
  icon.setVisible(syntaxErrors.size() != 0);
  String combinedMessages = syntaxErrors.stream()
      .map(SyntaxError::getMessage)
      .reduce("", (s, s2) -> s + s2);
  icon.setTooltip(new Tooltip(combinedMessages));
}
项目:stvs    文件:EditorPane.java   
/**
 * prefix the line with the line number and possibly an error icon
 * @param i line number
 * @return Node intended as the prefix
 */
private Node createLinePrefixForLine(int i) {

  Label icon = GlyphsDude.createIconLabel(FontAwesomeIcon.EXCLAMATION_CIRCLE, "", null, null, null);
  FilteredList<SyntaxError> lineSyntaxErrors = syntaxErrors.filtered(syntaxError -> syntaxError.getLine() == i + 1);
  setLineIcon(i, lineSyntaxErrors, icon);
  syntaxErrors.addListener((ListChangeListener.Change<?> change) -> {
    setLineIcon(i, lineSyntaxErrors, icon);
  });
  return new HBox(lineNumberFactory.apply(i), icon);
}
项目:travelimg    文件:SlideshowOrganizerImpl.java   
public void setSlideshows(ObservableList<Slideshow> slideshows) {
    // only display real slideshows (no placeholder)
    if (slideshows == null) {
        slideshowList.setItems(null);
        return;
    }

    FilteredList<Slideshow> filtered = slideshows.filtered(s -> s.getId() >= 0);
    slideshowList.setItems(filtered);
}
项目:fx-log    文件:MainController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    config = Config.getInstance();
    columnizedLogs = FXCollections.observableArrayList(new CircularArrayList<>());
    filteredLogs = new FilteredList<>(columnizedLogs);
    colorizer = new SimpleObjectProperty<>();
    columnizer = new SimpleObjectProperty<>();
    autoScrollActive = new SimpleBooleanProperty(true);
    tailingFile = new SimpleBooleanProperty(false);
    tailedFileName = new SimpleStringProperty();
    closeMenu.disableProperty().bind(tailingFile.not());

    // show the search panel only when the search is active
    searchPanel.setVisible(false);

    configureTitleBinding();
    configureNumberOfLogs();
    configureColumnizerSelector();
    configureColorizerSelector();
    configureFiltering();
    configureLogsTable();
    configureRecentFilesMenu();
    configureSecondaryStages();
    configureAutoScroll();

    searchPanelController.configure(config, filteredLogs, logsTable, columnizer);
}
项目:Simulizer    文件:Registers.java   
private void refreshRegisters() {
    FilteredList<Data> changed;
    synchronized (table) {
        synchronized (changedRegisters) {
            if (changedRegisters.size() == 0)
                return;
            changed = table.getItems().filtered(d -> changedRegisters.contains(d.id));
            changedRegisters.clear();
        }
        changed.forEach(Data::refresh);
    }
}
项目:JttDesktop    文件:StatisticCalculatorBase.java   
/**
 * Method to recalculate the statistic value.
 */
protected void recalculateStatistic(){
   FilteredList< JenkinsJob > relevantJobs = database.jenkinsJobs()
            .filtered( j -> !configuration.excludedJobs().contains( j ) ); 
   String value = constructStatisticRepresentation( relevantJobs );

   if ( value == null || value.equals( statistic.getStatisticValue() ) ) {
      return;
   }
   statistic.setStatisticValue( value );
}
项目:JttDesktop    文件:TotalJobsAtState.java   
/**
 * Method to recalculate the statistic value.
 * @param relevantJobs the {@link FilteredList} of {@link JenkinsJob}s to use in the statistic.
 * @return the {@link String} representation of the statistic.
 */
@Override protected String constructStatisticRepresentation( FilteredList< JenkinsJob > relevantJobs ){
   final int recalculatedTotal = relevantJobs.size();
   final int recalculatedCount = relevantJobs
            .filtered( j -> j.getBuildStatus() == monitoredState ).size();

   if ( this.total == recalculatedTotal && this.count == recalculatedCount ) {
      return null;
   }

   this.total = recalculatedTotal;
   this.count = recalculatedCount;
   return recalculatedCount + "/" + recalculatedTotal;
}
项目:qupath    文件:CommandFinderTools.java   
static void updateTableFilter(final String text, final FilteredList<CommandEntry> commands) {
    commands.setPredicate(new Predicate<CommandEntry>() {
        @Override
        public boolean test(CommandEntry entry) {
            return entry.getCommandPath().toLowerCase().contains(text);
        }
    });

}
项目:addressbook-level4    文件:ModelManager.java   
/**
 * Initializes a ModelManager with the given addressBook and userPrefs.
 */
public ModelManager(ReadOnlyAddressBook addressBook, UserPrefs userPrefs) {
    super();
    requireAllNonNull(addressBook, userPrefs);

    logger.fine("Initializing with address book: " + addressBook + " and user prefs " + userPrefs);

    this.addressBook = new AddressBook(addressBook);
    filteredPersons = new FilteredList<>(this.addressBook.getPersonList());
}
项目:polTool    文件:MatchSetTable.java   
protected void createTable() {
    TableColumn<MatchSet, LocalDateTime> date = createColumn("Spieldatum",
            "date", LocalDateTime.class, 100d);
    createColumn("HeimTeam", "homeTeam", String.class, 120d);
    createColumn("Gäste", "guestTeam", String.class, 120d);
    createColumn("Satz", "setNr", Integer.class, 45d);
    createColumn("Heimspieler 1", "homePlayer1", String.class, 140d);
    createColumn("Heimspieler 2", "homePlayer2", String.class, 140d);
    createColumn("Gastspieler 1", "guestPlayer1", String.class, 140d);
    createColumn("Gastspieler 2", "guestPlayer2", String.class, 140d);
    createColumn("Punkte Heim", "homeResult", Integer.class, 70d);
    createColumn("Punkte Gast", "guestResult", Integer.class, 70d);

    date.setCellFactory(column -> {
        return new TableCell<MatchSet, LocalDateTime>() {

            @Override
            protected void updateItem(LocalDateTime item, boolean empty) {
                super.updateItem(item, empty);
                if (item == null || empty) {
                    setText(null);
                    setStyle("");
                } else {
                    setText(item.format(DateTimeFormatter
                            .ofPattern("dd.MM.yyyy HH:mm")));
                }
            }

        };
    });

    setList = new FilteredList<MatchSet>(model.getSets(), set -> true);
    SortedList<MatchSet> sortedSets = new SortedList<MatchSet>(setList);
    sortedSets.comparatorProperty().bind(comparatorProperty());
    setItems(sortedSets);
}
项目:polTool    文件:AbstractTable.java   
public AbstractTable(GuiModel model) {
    this.model = model;
    // prefHeightProperty().bind(parent.heightProperty());
    // prefWidthProperty().bind(parent.widthProperty());
    FilteredList<S> filteredList = new FilteredList<S>(
            FXCollections.observableArrayList());
    predicate = filteredList.predicateProperty();
    setItems(filteredList);

    createTable();
}