Search in sources :

Example 1 with EventType

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);
}
Also used : EventType(eu.hansolo.tilesfx.events.ChartDataEvent.EventType) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane)

Aggregations

EventType (eu.hansolo.tilesfx.events.ChartDataEvent.EventType)1 Pane (javafx.scene.layout.Pane)1 Text (javafx.scene.text.Text)1