use of eu.hansolo.tilesfx.events.ChartDataEvent.EventType in project tilesfx by HanSolo.
the class LeaderBoardTileSkin method initGraphics.
// ******************** Initialization ************************************
@Override
protected void initGraphics() {
super.initGraphics();
updateHandler = e -> {
final EventType TYPE = e.getType();
switch(TYPE) {
case UPDATE:
updateChart();
break;
case FINISHED:
sortItems();
break;
}
};
paneSizeListener = o -> resizeItems();
handlerMap = new HashMap<>();
List<LeaderBoardItem> leaderBoardItems = tile.getLeaderBoardItems().stream().sorted(Comparator.comparing(LeaderBoardItem::getValue).reversed()).collect(Collectors.toList());
registerItemListeners();
leaderBoardPane = new Pane();
leaderBoardPane.getChildren().addAll(leaderBoardItems);
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
getPane().getChildren().addAll(titleText, text, leaderBoardPane);
}