1. Domino UI
  2. Getting started
  3. Maven archetype

Create Domino UI project using maven archetype

Prerequisites

  • Java 11 or higher.
  • Maven 3.6.0 or higher.

Steps

  1. Download and install DominoKit CLI tool.
  2. Open a terminal and CD into the folder in which you want to create the project.
  3. Execute the following maven command :
    			mvn archetype:generate \
       -DarchetypeGroupId=net.ltgt.gwt.archetypes \
       -DarchetypeVersion=LATEST \
       -DarchetypeArtifactId=modular-webapp
    		
    Or you can follow the steps here to create a modular-webapp project.
  4. Follow the instructions from the terminal to setup your project artifactId and groupId, leave the rest to the default.
  5. Open the created project folder, there should three folders, [your app name]-client, [your app name]-server, [your app name]-shared
  6. Open the folder [your app name]-client
  7. Edit the pom.xml file in that folder to add the following domino-ui dependency at the end of the dependencies section :
    			<dependency>
      <groupId>org.dominokit</groupId>
      <artifactId>domino-ui</artifactId>
      <version>2.0.0-RC1</version>
    </dependency>
    <dependency>
      <groupId>org.dominokit</groupId>
      <artifactId>domino-ui</artifactId>
      <version>2.0.0-RC1</version>
      <classifier>sources</classifier>
    </dependency>
    		
  8. In the module locate the file module.gwt.xml inside the folder src/main and add the following inherits directive :
    			<inherits name="org.dominokit.domino.ui.DominoUI"/>
    		
  9. In the module locate the file App.java inside the folder src/main/java and replace its content except the first package line with the following code :
    			import com.google.gwt.core.client.EntryPoint;
    import org.dominokit.domino.ui.cards.Card;
    import org.dominokit.domino.ui.icons.lib.Icons;
    import org.dominokit.domino.ui.layout.AppLayout;
    import org.dominokit.domino.ui.tree.Tree;
    import org.dominokit.domino.ui.tree.TreeItem;
    
    import static org.dominokit.domino.ui.utils.ElementsFactory.elements;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class App implements EntryPoint {
    
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
    
            AppLayout layout = AppLayout.create("Domino-ui starter");
                layout
                .withLeftDrawer((parent, leftDrawer) -> {
                        leftDrawer
                            .appendChild(Tree.<String>create("Menu")
                                .appendChild(TreeItem.create(Icons.widgets(), "Menu 1"))
                                .appendChild(TreeItem.create("Menu 2", Icons.widgets()))
                                .addSelectionListener((source, selection) -> {
                                        layout.setContent(Card.create(source.get().getValue())
                                            .appendChild(elements.p("Welcome to domino-ui , you are viewing " + source.get().getValue() + " content"))
                                        );
                                })
                            );
                });
        }
    }
    		
  10. Run the following command to build the project, for the first time this might take some time until maven download the project dependencies.
    			mvn clean verify
    		
  11. To run and start the application :

    In one terminal execute :

    			mvn gwt:codeserver -pl *-client -am
    		

    In another terminal execute :

    			mvn jetty:run -pl *-server -am -Denv=dev
    		
  12. Access the application on http://localhost:8080

Watch a video tutorial

We are a group of passionate people who love what we do

Donate & Support Us