Adding custom UI Modules to Boomega

April 28, 2022 ยท View on GitHub

This page will show you what are Modules in Boomega and guide you how to contribute new UI-Modules for Boomega + gives the fundamentals for developing module-plugins.

What are modules in Boomega?

A Module in Boomega provides a particular UI area where specific tasks can be achieved.

On the Boomega Home Screen, each module has its own tile displayed there:

Tiles on the Boomega Home Screen

As you can see, the Records-View and the Google Books Import View are present in Boomega as modules.

And when you click on a tile, it opens a tab for the module's content: Tabs displayed for modules

You have the ability to add your custom modules to the app by plugins.

The Module class

If you want to create your own, you should extend the com.dansoftware.boomega.gui.databaseview.Module class.

The members you must override are:

  • name: String - The user-visible name of the module
  • icon: Node - The javafx node that serves as a symbol/icon for the module
  • id: String - a unique identifier of the module
  • buildContent(): Node - The actual UI content the module provides
  • destroy(): Boolean - gets called when the user closes the module (by closing its tab); if it returns false the user won't be able to

Simple example:

Kotlin Java
class HelloModule : Module() {
    override val id: String = "hello-module"
    override val name: String = "Hello"
    override val icon: Node get() = MaterialDesignIconView(MaterialDesignIcon.EMOTICON_HAPPY)

    override fun buildContent(): Node = StackPane(Label("Hello"))
    override fun destroy(): Boolean = true
}
public class HelloModule extends Module {

    @NotNull
    @Override
    public String getId() {
        return "hello-module";
    }

    @NotNull
    @Override
    public String getName() {
        return "Hello";
    }

    @NotNull
    @Override
    public Node getIcon() {
        return new MaterialDesignIconView(MaterialDesignIcon.EMOTICON_HAPPY);
    }

    @NotNull
    @Override
    protected Node buildContent() {
        return new StackPane(new Label("Hello"));
    }

    @Override
    protected boolean destroy() {
        return true;
    }
}

We've just created a module that will display the text "Hello" on the screen.

If you're developing your module as a plugin, look at the plugin guide for further instructions!


Result:

On the Home Page:

Result on the home screen

After opened:

Result opened