Search in sources :

Example 1 with LogListCell

use of com.canoo.platform.logger.client.widgets.LogListCell in project dolphin-platform by canoo.

the class ViewSample method start.

@Override
public void start(final Stage primaryStage) throws Exception {
    final ListView<LogMessage> listView = new ListView<>();
    listView.setCellFactory(v -> new LogListCell());
    listView.setItems(LogClientUtil.createObservableListFromLocalCache());
    Executors.newSingleThreadExecutor().execute(() -> {
        while (true) {
            try {
                Thread.sleep(2_000);
            } catch (InterruptedException e) {
            }
            LOG.info(MarkerFactory.getMarker("MyMarker"), "System " + UUID.randomUUID() + " starting");
            LOG.info("Found 3 modules");
            LOG.debug("Starting module 'Base'");
            if (Math.random() > 0.5) {
                LOG.trace("Module 'Base' started in 45 ms");
            } else {
                LOG.trace("Module 'Base' is using default configuration");
                LOG.trace("Module 'Base' started in 67 ms");
            }
            LOG.debug("Starting module 'Platform'");
            if (Math.random() > 0.5) {
                LOG.trace("Module 'Platform' started in 35 ms");
            } else {
                LOG.warn("Module 'Platform' is using default configuration! Please configure it!");
                LOG.trace("Module 'Platform' started in 67 ms");
            }
            LOG.debug("Starting module 'Security'");
            if (Math.random() > 0.5) {
                LOG.trace("Module 'Security' started in 35 ms");
            } else {
                LOG.error("Module 'Security' can not be started!", new RuntimeException("Error in param foo"));
            }
        }
    });
    Executors.newSingleThreadExecutor().execute(() -> {
        while (true) {
            try {
                Thread.sleep(1_500);
            } catch (InterruptedException e) {
            }
            LOG.trace("Will ping server");
            LOG.debug("Server ping returned in 42 ms");
        }
    });
    final LogFilterView filterView = new LogFilterView();
    final VBox main = new VBox(filterView, listView);
    main.setFillWidth(true);
    VBox.setVgrow(filterView, Priority.NEVER);
    VBox.setVgrow(listView, Priority.ALWAYS);
    primaryStage.setScene(new Scene(main));
    primaryStage.show();
}
Also used : LogFilterView(com.canoo.platform.logger.client.widgets.LogFilterView) ListView(javafx.scene.control.ListView) LogMessage(com.canoo.platform.logging.spi.LogMessage) LogListCell(com.canoo.platform.logger.client.widgets.LogListCell) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox)

Aggregations

LogFilterView (com.canoo.platform.logger.client.widgets.LogFilterView)1 LogListCell (com.canoo.platform.logger.client.widgets.LogListCell)1 LogMessage (com.canoo.platform.logging.spi.LogMessage)1 Scene (javafx.scene.Scene)1 ListView (javafx.scene.control.ListView)1 VBox (javafx.scene.layout.VBox)1