use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.
the class MultipleValueaxisChart method onInit.
@Subscribe
protected void onInit(InitEvent event) {
List<DateValueVolume> items = new ArrayList<>();
Date startDate = DateUtils.addDays(timeSource.currentTimestamp(), -DAYS_COUNT);
for (int i = 0; i < DAYS_COUNT; i++) {
items.add(generateDateValueVolume(DateUtils.addDays(startDate, i), i));
}
lineChartDc.setItems(items);
}
use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.
the class ContainerDataProviderScreen method onInit.
@Subscribe
private void onInit(InitEvent event) {
stackedArea.setDataProvider(new ContainerDataProvider(transportCountsDc));
stackedArea.setCategoryField("year");
}
use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.
the class OrdersHistory method onInit.
// end::queue[]
// tag::orders-history2[]
@Subscribe
private void onInit(InitEvent event) {
// <2>
Order initialValue = metadata.create(Order.class);
initialValue.setAmount(new BigDecimal(random.nextInt(1000) + 100));
initialValue.setDate(timeSource.currentTimestamp());
// <3>
ordersDc.getMutableItems().add(initialValue);
}
use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.
the class OrdersHistory method onTimerTick.
// end::orders-history2[]
// tag::orders-history3[]
@Subscribe("updateChartTimer")
private void onTimerTick(Timer.TimerActionEvent event) {
// <4>
Order orderHistory = metadata.create(Order.class);
orderHistory.setAmount(new BigDecimal(random.nextInt(1000) + 100));
orderHistory.setDate(timeSource.currentTimestamp());
ordersDc.getMutableItems().add(orderHistory);
// end::orders-history3[]
// tag::queue-code[]
// <1>
itemsQueue.add(orderHistory);
if (itemsQueue.size() > 10) {
// <2>
ordersDc.getMutableItems().remove(0);
System.out.println("in");
}
// end::queue-code[]
// tag::orders-history4[]
System.out.println("get");
}
use of io.jmix.ui.screen.Subscribe in project jmix-docs by Haulmont.
the class SerialChartJsonTitleTwo method onInit.
@Subscribe
private void onInit(InitEvent event) {
ListDataProvider serialChartDataProvider = new ListDataProvider();
int[] serialChartData = { 5, 7, 6, 9, 7, 8, 5, 6, 4, 6, 5, 7, 4, 5, 3, 4, 2, 0 };
for (int i = 0; i < serialChartData.length; i++) {
serialChartDataProvider.addItem(graphData(serialChartData[i]));
}
serialChart.setDataProvider(serialChartDataProvider);
}
Aggregations