To add a management panel to a REM plugin:

1

Open a terminal, and cd into your REM plugin directory (for example, foo-em).

2

Run ./create-management-panel.sh, optionally specifying the function, class prefix, and package (otherwise the SDK prompts you for them).

For example:

./create-management-panel.sh -f bar -c Bar -p bar

The SDK generates a new management panel from the template into your plugin’s src directory.

3

Configure Google Guice and Gin bindings:

  • Edit your Guice module (such as com/opencloud/rem/foo/server/FooModule.java):

    • Add a binding from your new service interface to your new service implementation. For example:

bind(BarService.class).to(BarServiceImpl.class);
  • Edit your Gin module (such as com/opencloud/rem/foo/client/FooGinModule.java):

    • Add a binding from your new presenter interface to your new presenter implementation.

    • Add a binding from your new view interface to your new panel. For example:

bind(BarPresenter.class).to(BarPresenterImpl.class);
bind(BarView.class).to(BarPanel.class);

4

Hook up your panel to the menus and deck:

  • Edit your main presenter (such as com/opencloud/rem/foo/client/MainPresenterImpl.java):

    • Add a constructor arg for your new presenter (the interface, not the implementation).

    • Add it to the main deck. For example:

@Inject
public MainPresenterImpl(@ExtensionLogHandler Handler logHandler, ExtensionDeckView.Presenter deck, BarPresenter barPresenter) {
    this.deck = deck;
    deck.addPanel(barPresenter.getView().getName(), barPresenter);

    Logger.getLogger("").addHandler(logHandler);
}
  • Edit your extension info (such as com/opencloud/rem/foo/client/FooExtensionInfo.java).

    • Add a new entry in the MENU_EXTENSIONS array for your panel. The third argument should match the string returned from the getName() method of your new panel. For example:

public static final ExtensionMenuInfo[] MENU_EXTENSIONS = {
    new ExtensionMenuInfo("Foo", "Bar Configuration", "bar")
};

5

You can repeat this process using different values to create several management panels within your plugin.

You can then run your plugin to see what it looks like.

Note
  • Google Guice is a dependency injection framework.

  • Google Gin is a layer on top of Guice that provides Guice binding and injection to client-side GWT code.

For details, please see the Google Guice Project.

Previous page Next page