当前位置: 首页>>代码示例>>Java>>正文


Java FilteredList类代码示例

本文整理汇总了Java中javafx.collections.transformation.FilteredList的典型用法代码示例。如果您正苦于以下问题:Java FilteredList类的具体用法?Java FilteredList怎么用?Java FilteredList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FilteredList类属于javafx.collections.transformation包,在下文中一共展示了FilteredList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addListeners

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
/**
 * 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()));
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:26,代码来源:PathController.java

示例2: CollatedTreeItem

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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());
            }
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:CollatedTreeItem.java

示例3: FilterableTreeItem

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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);
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:24,代码来源:FilterableTreeItem.java

示例4: FilterableTreeItem

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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);

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:21,代码来源:FilterableTreeItem.java

示例5: initialize

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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));
//            }
//        });
    }
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:25,代码来源:VenuesPresenter.java

示例6: setupSorting

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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);

}
 
开发者ID:landonreams,项目名称:osrs-equipment-builder,代码行数:25,代码来源:ItemSelectorController.java

示例7: change

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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 ();
  }
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:18,代码来源:ReplayStage.java

示例8: setFilter

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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;
  });
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:17,代码来源:ConsoleMessageTab.java

示例9: constructStatisticRepresentation

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:24,代码来源:TotalPassingTests.java

示例10: constructStatisticRepresentation

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
/**
 * 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 );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:29,代码来源:LastBuildStarted.java

示例11: constructStatisticRepresentation

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
/**
 * 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 );
}
 
开发者ID:DanGrew,项目名称:JttDesktop,代码行数:29,代码来源:NodesInUse.java

示例12: FilterableTreeItem

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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);
}
 
开发者ID:NoticEditorTeam,项目名称:NoticEditor,代码行数:24,代码来源:FilterableTreeItem.java

示例13: createFilterTab

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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;
}
 
开发者ID:talpalaru,项目名称:polTool,代码行数:17,代码来源:EloView.java

示例14: loadStudents

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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);
    }
}
 
开发者ID:kmhasan-class,项目名称:summer2015advancedjava,代码行数:20,代码来源:MainController.java

示例15: toggleVisibility

import javafx.collections.transformation.FilteredList; //导入依赖的package包/类
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);
    });
}
 
开发者ID:speedment,项目名称:speedment,代码行数:17,代码来源:ConnectController.java


注:本文中的javafx.collections.transformation.FilteredList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。