Menu

HowToDialog

Sahits GmbH

HowTo Dialogs

Over the time the game was developed the dialogs were defined in various different ways. Some of these ways are still valid and or might be used for creating more complex setups. Therefore the whole documentation is on this page with the most recent/preferred one at the top.

  1. Create a new implementation of the dialog as a subclass of Dialog or probably more appropriatly DefaultSimpleDialog
  2. The dialog must be annotated as @Protype bean and have a @PostConstruct initialisation method named initializeDialog. In this method goes the setup of the dialog.
  3. The super class DefaultSimpleDialog supplies utility methods to add nodes and decorated text elements based on keys in the default position CENTER_LEFT, CENTER, and CENTER_RIGHT.
  4. Create a Main class for the dialog in the test directory tree for the testing of the dialog outside the whole application. This main class extends DialogTestApplicationContainerV2.
  5. This class has a static inner class that extends DialogParameters whicht holds a reference to all the member variables of the dialog as well as any usefull test data.
  6. In the method configureDialogParameters these parameter are initialized.
  7. In the method getDialog the dialog is created based on these parameters by injecting the fields defined in the parameter object into the dialog and invoiking the initializeDialog method.
  8. Implement a Test class with a @Rule JavaFXThreadingRule. This rule ensures that the test also run in headless mode.
  9. Each test method then creates a new Parameter object and configures it through the corresponding Main class
  10. Additional setup is done after the parameters are configured through configureDialogParameters
  11. Create a dialog instance through the corresponding Main class.
  12. Do the testing.

  1. Create a new implementation of the dialog as a subclass of Dialog or probably more appropriatly CloseButtonDialog
  2. The dialog must be annotated as @Protype bean and have a @PostConstruct initialisation method named initializeDialog. In this method goes the setup of the dialog. It is suggested to create the content of the dialog as DecoratedText through the DecoratedTextFactory.
  3. If the closing of the dialog should update the noticeboard the executeOnCloseButtonClicked must be overridden
  4. Create a Main class for the dialog in the test directory tree for the testing of the dialog outside the whole application. This main class extends DialogTestApplicationContainer.
  5. The method getDialog contains the setup with suppling all the data and services for the dialog.
  6. The method startupFakeApplication should have an empty implementation.
  7. In the getDialog method the starupFakeApplication method must be called before the dialog is instantiated.
  8. Implement a test class extending the Main class.
  9. The test class implements the startupFakeApplication by calling FakeApplicationStartup.startupFakeApplication()
  10. Test actions and dialog navigation
  11. In DialogFactory add a case for retrieving the dialog bean
  12. Where the dialog should be opened call the dialogContoller to replace the dialog.

Related

Wiki: HowToDev

MongoDB Logo MongoDB