java类javafx.collections.transformation.FilteredList的实例源码

PathController.java 文件源码 项目:hygene 阅读 39 收藏 0 点赞 0 评论 0
/**
 * 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()));
}
CollatedTreeItem.java 文件源码 项目:marathonv5 阅读 17 收藏 0 点赞 0 评论 0
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());
            }
        }
    });
}
FilterableTreeItem.java 文件源码 项目:vars-annotation 阅读 15 收藏 0 点赞 0 评论 0
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);
}
FilterableTreeItem.java 文件源码 项目:Gargoyle 阅读 20 收藏 0 点赞 0 评论 0
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);

}
VenuesPresenter.java 文件源码 项目:javaone2016 阅读 16 收藏 0 点赞 0 评论 0
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));
//            }
//        });
    }
ItemSelectorController.java 文件源码 项目:osrs-equipment-builder 阅读 20 收藏 0 点赞 0 评论 0
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);

}
ReplayStage.java 文件源码 项目:xframium-java 阅读 21 收藏 0 点赞 0 评论 0
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 ();
  }
}
ConsoleMessageTab.java 文件源码 项目:xframium-java 阅读 31 收藏 0 点赞 0 评论 0
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;
  });
}
TotalPassingTests.java 文件源码 项目:JttDesktop 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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;
}
LastBuildStarted.java 文件源码 项目:JttDesktop 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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 );
}
NodesInUse.java 文件源码 项目:JttDesktop 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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 );
}
FilterableTreeItem.java 文件源码 项目:NoticEditor 阅读 18 收藏 0 点赞 0 评论 0
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);
}
EloView.java 文件源码 项目:polTool 阅读 16 收藏 0 点赞 0 评论 0
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;
}
TreeViewDemo.java 文件源码 项目:JFoenix 阅读 14 收藏 0 点赞 0 评论 0
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);
}
MainController.java 文件源码 项目:summer2015advancedjava 阅读 19 收藏 0 点赞 0 评论 0
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);
    }
}
ReplayStage.java 文件源码 项目:dm3270 阅读 14 收藏 0 点赞 0 评论 0
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 ();
  }
}
ConsoleMessageTab.java 文件源码 项目:dm3270 阅读 16 收藏 0 点赞 0 评论 0
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;
  });
}
ConnectController.java 文件源码 项目:speedment 阅读 24 收藏 0 点赞 0 评论 0
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);
    });
}
SearchComboBox.java 文件源码 项目:exchange 阅读 16 收藏 0 点赞 0 评论 0
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();
            });
        }
    });
}
SelectExistingReportView.java 文件源码 项目:dwoss 阅读 20 收藏 0 点赞 0 评论 0
@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
}
DbgView.java 文件源码 项目:erlyberly 阅读 18 收藏 0 点赞 0 评论 0
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(); });
}
ActivityController.java 文件源码 项目:PeerWasp 阅读 38 收藏 0 点赞 0 评论 0
/**
 * 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();
                }
            });
}
RecursiveTreeItem.java 文件源码 项目:jabref 阅读 18 收藏 0 点赞 0 评论 0
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());
            }
        }
    });
}
PathController.java 文件源码 项目:hygene 阅读 20 收藏 0 点赞 0 评论 0
@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();
}
LogPane.java 文件源码 项目:CalendarFX 阅读 15 收藏 0 点赞 0 评论 0
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);
}
EffectSelect.java 文件源码 项目:keyboard-light-composer 阅读 15 收藏 0 点赞 0 评论 0
@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();
}
ParsedFilesController.java 文件源码 项目:recruitervision 阅读 17 收藏 0 点赞 0 评论 0
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);
}
AnnotationEditorPaneController.java 文件源码 项目:vars-annotation 阅读 16 收藏 0 点赞 0 评论 0
private void loadComboBoxData() {

        toolBox.getServices()
                .getConceptService()
                .findAllNames()
                .thenAccept(names -> {
                    FilteredList<String> cns = new FilteredList<>(FXCollections.observableArrayList(names));
                    Platform.runLater(() -> conceptComboBox.setItems(cns));
                });
    }
FilteredComboBoxDecorator.java 文件源码 项目:vars-annotation 阅读 23 收藏 0 点赞 0 评论 0
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);
        }
    });
}
EditorPane.java 文件源码 项目:stvs 阅读 26 收藏 0 点赞 0 评论 0
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));
}


问题


面经


文章

微信
公众号

扫码关注公众号