Skip to content

v1 03. Integration

Frank Hossfeld edited this page Nov 28, 2019 · 1 revision

Introduction

To integrate Nalu into your project, the following steps need to be done:

  • for GWT 2.x:

  • Add needed library to your project or add a Maven dependency

  • Modify the module Descriptor (*.gwt.xml)

  • Set up the entry point

  • Create application-, controller- and component-classes

  • for GWT 3.0:

Once GWT 3 / J2Cl is available, we will update this section.

Dependencies

Nalu has dependencies to the following projects:

See #9 for current status before downloading the dependencies.

Maven Dependency

Add Nalu to the maven dependency:

    <dependency>
      <groupId>com.github.nalukit</groupId>
      <artifactId>nalu</artifactId>
      <version>LATEST</version>
    </dependency>
    <dependency>
      <groupId>com.github.nalukit</groupId>
      <artifactId>nalu-processor</artifactId>
      <version>LATEST</version>
      <scope>provided</scope>
    </dependency>

Depending on the widget library the project is using, you have to add a plugin. In case the project is using a widget library based on elemental 2 or elemento or the project is using a library like Domino-UI, add the following plguin to your pom:

    <dependency>
      <groupId>com.github.nalukit</groupId>
      <artifactId>nalu-plugin-elemental2</artifactId>
      <version>LATEST</version>
    </dependency>

In case the project is based on GWT widgets, add the following plugin to your pom:

   <dependency>
      <groupId>com.github.nalukit</groupId>
      <artifactId>nalu-plugin-gwt</artifactId>
      <version>LATEST</version>
    </dependency>
    <dependency>
      <groupId>com.github.nalukit</groupId>
      <artifactId>nalu-plugin-gwt-processor</artifactId>
      <version>LATEST</version>
      <scope>provided</scope>
    </dependency>

Nalu is available on Maven central.

Requirements

Nalu requires Java 8 and GWT 2.8.x. We recommend to use always the latest version GWT.

Using with GWT 2

GWT configuration file

Add dependencies

Insert the Nalu module into your module descriptor:

  <inherits name='com.github.nalukit.nalu.Nalu'/>

Depending on the plugin the project is using, add:

  <inherits name='com.github.nalukit.nalu.plugin.elemental2.NaluPluginElemental2'/>

in case the project is using a elemental 2 or Elemento based Widget library.

In case the project is using a GWT based widget library, add:

  <inherits name='com.github.nalukit.nalu.plugin.gwt.NaluPluginGWT'/>

Set an entry point

  <entrypoint class='[path to your entrypoint]'/>

Implement Entrypoint

To implement Nalu in your application, first create an application interface:

@Application(loader = MyLoader.class,
             startRoute = "/application/search",
             context = MyApplicationContext.class,
             routeError = "/errorShell/error")
interface MyApplication
    extends IsApplication {
}

The application interface must extends IsApplication and needs the @Application annotation. The shell-, start- and context- attribute of the @Application annotation is required, where as the loader-attribute is optional. (more informations about the context) (more informations about Nalu application loader).

Create the application EntryPoint:

public class Application
    implements EntryPoint {

  public void onModuleLoad() {
    // Create the application.
    // The ApplicationImpl-class
    // will be generated by the framework.
    MyApplication application = new MyApplicationImpl();
    // start the application by calling the run()-method.
    application.run(new NaluPluginGWT());
  }
}

The MyApplicationImpl-class will be generated by the annotation processor and is available once a build is done. The run-method requires as parameter the instance of the plugin the project is using.

Controller, Components, Handlers ...

Now that you have configured your project to use Nalu, you can look at the rest of the documentation to create the different elements you need.

com.github.nalukit.nalu.internal.*

All code inside the com.github.nalukit.nalu.internal.* packages is considered private API and should not be relied upon at all. It can change at any time and with no announcement.