當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。