Is it possible to have a settings page for a custom module in the Gateway in much the same way that the Mobile Module does? I want to have a user configurable port number in a module that otherwise has no direct UI.
Yes, it is possible. I have done it by following these steps (if anyone see a better or simpler way to do it, please let me know). This is assuming you will store the settings in the internal database:
-
create your PersistentRecord class containing your settings
-
Add your link to the left menu in the config section by adding it to the
GatewayContext.getConfigMenuModel
-
[Optional, I believe] Customise your page by extending RecordActionTable and/or EditRecordAction
If you write a driver you might not need add your link to the left menu.
It is not very easy initially, but I manage to do it, so it is possible Don’t hesitate to post
Good luck
Yep. Here’s a copy/paste example of how it’s done:
private static final String[] XOPC_MENU_PATH = {"xopc"};
private void addMenuNodes() {
LabelConfigMenuNode header = new LabelConfigMenuNode(XOPC_MENU_PATH[0], "xopc.config.menutitle");
header.setPosition(590);
context.getConfigMenuModel().addConfigMenuNode(null, header);
LinkConfigMenuNode settingsNode = new LinkConfigMenuNode(
"settings",
"xopc.config.settings.menutitle",
SettingsPage.class);
context.getConfigMenuModel().addConfigMenuNode(XOPC_MENU_PATH, settingsNode);
}
In this case, SettingsPage is a subclass of RecordEditForm, which gives you the settings editing UI you see all over the gateway for one or more of your module’s PersistentRecords.