Skip to content

AIMA3e GUI FX Framework

Rüdiger Lunde edited this page Jun 2, 2019 · 23 revisions

About the design of the GUI FX framework

The GUI FX framework is part of the aima-gui sub-project and consists of the package aima.gui.fx and its sub-packages. The aimax-osm sub-project uses it for the FX versions of the map applications.

The framework provides demonstration applications for algorithms from the core project based on the JavaFX platform and supports the development of this kind of applications. Demo applications can be started as stand-alone applications and also within an integrated application. The first figure shows the NQueensCspApp application which demonstrates how different CSP algorithms solve the N-Queens problem. It was started as stand-alone application.

NQueensCspApp Demo Application

The second figure shows the IntegratedAimaOsmFxApp. It provides a window which integrates several applications and provides a menu to choose one of them. The currently selected application (the ExtendedRouteFindingAgentOsmApp) can be seen in the main pane. It is a map application which demonstrates how different search algorithms explore the state space when solving a routing problem.

IntegratedAimaOsmFxApp.png Integrated Application

The following UML diagram provides an overview about important classes and methods of the framework:

GUI FX Framework Class Diagram

The abstract class IntegrableApplication provides a base class for all demo applications. Its start-method is in fact a template method and can be used as starter for all subclasses. Every concrete demo application class needs to provide a title, a root pane with content, and methods for initialization and cleanup. This unified structure makes integration easy.

An integrated application can be created with a very limited number of lines of code by means of a builder. The IntegratedAppBuilder class creates all the graphical menu Elements and the navigation logic. It just needs to know the classes of the applications to be integrated. See class IntegratedAimaFxApp for an example.

In fact, the framework strongly relies on the GoF builder pattern. Instead of defining layouts by means of XML files explicitly, here, builders create large parts of the layout based on an abstract specification of the content to be shown. To demonstrate, how algorithms do their work, it is often useful to slow down execution and show intermediate results during execution. It is also often useful, to compare example runs with different parameter settings. The TaskExecutionPaneBuilder is specialized on this kind of applications. After being provided with parameter information, a method for task initialization and another for running the task, and with a pane for state visualization, the builder constructs the complete layout of the application including toolbar and status bar and also the application logic. As usual in JavaFX, application logic is placed in so called controller classes which are here marked with class name ending Ctrl.

The following sequence diagram shows how the NQueensCspApp creates its root pane by means of a builder.

NQueensCspApp Sequence Diagram