Skip to the content.

Modifying the GUI

You will need to install SceneBuilder.

CAViewer uses the MVC or Model, View, Controller framework.
Model contains the classes the run the simulation as well as search programs.
Controller contains the event handling classes and the dialogs.
Resources contains the resources needed to render the application such as the *.fxml files and icons.

main.fxml contains the GUI of the main window. Open it in SceneBuilder to modify it.
Events from main.fxml are handled by MainController.java. See the comments / javadoc in MainController.java for more information.

Adding custom rule families

  1. Create a new class for your rule family. It should inherit from RuleFamily.java.
  2. Implement the necessary methods from RuleFamily.java and Rule.java.

You may choose to inherit BaseHROT.java if you are implementing any HROT variants or BaseINT.java if you are impementing an INT variant.

Do ensure that you also add a dummy constructor with no arguments. This ensures that Jackson is able to construct the rule from the serialised JSON stored in settings.json.

To allow apgtable generation implement the ApgtableGeneratable.java interface. To allow min / max rule generation implement the MinMaxRuleable.java interface.

Some useful methods in writing the new rule family would be Ruletable.java for apgtable generation (Unbounded variables and B0 support (must provide the background)!), CommentGenerator.java for generating the RLE comments / multiline rulestrings, NeighbourhoodGenerator.java for handling the different neighbourhoods supported by CAViewer and Utils.java with useful methods for parsing strings and canonising rulestrings.

  1. Create a new class for the rule family's dialog. It should inherit from RuleWidget.java.
  2. Implement the necessary methods from RuleWidget.java. Some other widgets that would be helpful are
  1. Add the new rule family to Utils.java and the new rule dialog to RuleDialog.java.

If you use these widgets, construct them via the methods in [SharedWidgets.java] so that the values in these widgets do not change when the rulespace is changed.

See the javadocs for more information on implementation and the other classes. Also see the rules folder for application implementations of other rulespaces.

Adding custom named neighbourhood types

  1. Add a generator function in NeighbourhoodGenerator.java. It should generate an array of Coordinates.
  2. Add a new case in the switch in the generateFromSymbol method.
  3. If the neighbourhood has weights, add another generator function for the weights. It should generate an array of integers which correspond to the weights of each of the coordinates in the first generator function.
  4. Add a new case in the switch in the generateWeightsFromSymbol method.
  5. Add a new case in the switch in the generateTilingFromSymbol method.
  6. Finally, add the symbol used to the static neighbourhoodSymbols variable.

Adding custom naive reading orders

  1. Create a new class for your naive reading order. It should inherit from ReadingOrder.java.
  2. Implement the necessary methods as required. Ensure that it has a no-arg dummy constructor.
  3. Finally, add the new class to the list in Utils.java.