use of eu.hansolo.tilesfx.events.TileEventListener in project tilesfx by HanSolo.
the class Tile method registerListeners.
private void registerListeners() {
disabledProperty().addListener(o -> setOpacity(isDisabled() ? 0.4 : 1));
valueProperty().addListener((o, ov, nv) -> oldValue.set(ov.doubleValue()));
currentValueProperty().addListener(o -> {
double currentValue = getCurrentValue();
if (currentValue > getMaxValue()) {
fireTileEvent(MAX_VALUE_EXCEEDED);
} else if (currentValue < getMinValue()) {
fireTileEvent(MIN_VALUE_UNDERRUN);
} else {
fireTileEvent(VALUE_IN_RANGE);
}
});
showing.addListener((o, ov, nv) -> {
if (nv) {
while (tileEventQueue.peek() != null) {
TileEvent event = tileEventQueue.poll();
for (TileEventListener listener : tileEventListeners) {
listener.onTileEvent(event);
}
}
}
});
}
Aggregations