import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
final ObservableList<Tweet> filteredList = FXCollections.observableArrayList();
final ObservableList<TweetNode> tweetNodes = FXCollections.observableArrayList();
tweets.addListener(new InvalidationListener() {
@Override
public void invalidated(Observable observable) {
for( Tweet tweet : tweets )
{
if( contains( "javafx" ) )
{
filteredList.add( tweet );
}
}
}
});
filteredList.addListener(new InvalidationListener() {
@Override
public void invalidated(Observable observable) {
for( Tweet tweet : tweets )
{
tweetNodes.add( toTweetNode( tweet ) );
}
}
});
bindContent( tweetsListView.getItems(), tweetNodes );