Skip to content

Desktop

org.blockchainbench.desktop is the JavaFX front end. It lets a user load configurations, set the shared evaluation parameters, start a run, watch its progress, and inspect the results. It is packaged as an Eclipse application: the bundle contributes an application through plugin.xml, and that application boots JavaFX.

The startup chain crosses three layers before any window appears.

sequenceDiagram
  autonumber
  participant PDE as Eclipse application
  participant L as Launcher
  participant App as BlockchainApp
  participant SM as SceneManager
  PDE->>L: start() via plugin.xml
  L->>App: BlockchainApp.main()
  App->>App: Application.launch()
  App->>SM: init(stage)
  App->>SM: showConfig()

Launcher implements the Equinox IApplication contract and simply calls BlockchainApp.main. BlockchainApp is the JavaFX Application; its start hands the primary stage to SceneManager and opens the first screen. The configuration screen is the current entry point; the older main-menu screen is still present but commented out.

SceneManager is a small static navigator. It keeps the primary Stage and exposes one method per screen: showMainMenu, showConfig, showSimulation, showResults, and showError. For the screens that need a constructed controller — the running-simulation view and the results view — it uses an FXMLLoader controller factory so it can pass the simulationId and the IBlockchainBench handle into the controller’s init(...) after loading.

flowchart LR
  Config["config.fxml<br/>ConfigController"] --> Sim
  MainMenu["mainMenu.fxml<br/>MainMenuController"] --> Sim
  Sim["simulation.fxml<br/>SimulationController"] --> Results["result.fxml<br/>ResultsController"]
  Sim -. cancel .-> MainMenu
  Error["error_dialog.fxml<br/>ErrorDialogController"]

The error dialog is an overlay shown on demand from any screen via ErrorDialogController, not a node in the main flow.

Each screen is an FXML view bound to a controller. There are two ways into a run — the configuration screen and the older main-menu screen — that converge on the same running-simulation view.

ViewControllerPurpose
config.fxmlConfigControllerEdit the shared BaseConfig (spinners, validation) and the per-run SimulationConfig table; start a run. Current entry screen.
mainMenu.fxmlMainMenuControllerBrowse a CSV and a JSON, preview the configurations in a table, choose a mode, and start a run.
simulation_config_dialog.fxmlSimulationConfigDialogControllerAdd or edit a single SimulationConfig row.
simulation.fxmlSimulationControllerShow live progress of a running group and route to the results view on completion.
result.fxmlResultsControllerPresent the collected results of a finished group.
error_dialog.fxmlErrorDialogControllerReusable error and message dialog.

RunningController and LogViewerController exist in the controller package as well. LogViewerController wraps a log text area but is not currently wired into any loaded view.

The desktop programs against IBlockchainBench. A run is started by collecting the selected SimulationConfig list and the BaseConfig, then calling bench.submit(...) and navigating to the running-simulation view with the returned id.

SimulationController then observes progress by polling. Its init(id, bench) starts a one-second JavaFX Timeline; each tick reads bench.getSimulation(id), updates the progress bar and status labels from the run counts, and — once the group reaches FINISHED or ERROR — stops the timer and navigates to the results view. Because the poll runs on the JavaFX application thread, no cross-thread marshalling is needed for these reads.

sequenceDiagram
  autonumber
  participant C as ConfigController / MainMenuController
  participant B as IBlockchainBench
  participant S as SimulationController
  C->>B: submit(configs, baseConfig, mode)
  B-->>C: simulationId
  C->>S: SceneManager.showSimulation(id, bench)
  loop every second
    S->>B: getSimulation(id)
    B-->>S: SimulationInfo (status, run counts)
  end
  S->>S: on FINISHED or ERROR, show results

SimulationService is a singleton that holds the currently selected list of SimulationConfig between screens.

The ui package provides small reusable helpers used mainly by the configuration screen: SpinnerFactory (typed integer and double spinners), TooltipFactory (labelled tooltips), UIFieldRegistry (binding UI fields to model fields), and Validation (input validation). FieldMetadata describes a configuration field for those helpers.

SimulationRunner and the desktop’s own SimulationApplication are headless paths that submit a default run without any UI; they are convenience and test entry points rather than part of the interactive flow. The interactive application always starts through Launcher and BlockchainApp.