@Override protected Void call() throws Exception { while (!isCancelled()) { Tweet tweet = tweetSetData.getNextOrRandomTweet(5, 10); if (null != tweet) { // parents.put(createTweetInfoBox(tweets.take())); Platform.runLater(() -> wordle.setTweet(tweet)); addTweetToCloud(tweet); Thread.sleep(3000); Platform.runLater(() -> wordle.setLayoutMode(Wordle.LayoutMode.TWEET)); Thread.sleep(8000); Platform.runLater(() -> wordle.setLayoutMode(Wordle.LayoutMode.WORDLE)); Thread.sleep(5000); // removeTweetFromCloud(tweetWords); Platform.runLater( () -> wordle.setWords( tweetSetData .getTree() .entrySet() .stream() .sorted(TweetSetData.COMPARATOR.reversed()) .limit(TagTweets.NUM_MAX_WORDS) .map( (java.util.Map.Entry<String, Long> entry) -> new Word(entry.getKey(), entry.getValue())) .collect(Collectors.toList()))); Thread.sleep(5000); } } return null; }
private void createWordle() { if (null == wordle) { wordle = new Wordle(); hWordle.getChildren().setAll(wordle); wordle.prefWidthProperty().bind(hWordle.widthProperty()); wordle.prefHeightProperty().bind(hWordle.heightProperty()); } Platform.runLater( () -> { wordle.setWords( tweetSetData .getTree() .entrySet() .stream() .sorted(TweetSetData.COMPARATOR.reversed()) .limit(NUM_MAX_WORDS) .map(entry -> new Word(entry.getKey(), entry.getValue())) .collect(Collectors.toList())); wordle.setTweet(tweetSetData.getNextOrRandomTweet(0, 3)); }); }