Beruflich Dokumente
Kultur Dokumente
GEOMAJAS
FOR DUMMIES
Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Acknowledgments
We like dummies!
Especially those who contributed to this Geomajas For Dummies guide.
It all started with Bram Minne during his internship with DFC Software Engineering.
Thanks, for getting this rolling!
First laboratory animals to test and review the initial versions were Zaneta Kaszta, Wout
Swartenbroeckx and Matthias Streulens (the Geomajas Community SysAdmin).
Thanks for making it better and better!
The most recent contributor to the Geomajas For Dummies is Stefan Hogas. He updated the
document to the latest Geomajas versions. Stefan also volunteered to be the Lead Maintainer of
this document. I guess that makes him our ber Dummy?!
Thanks for keeping this rolling, Stefan!
If we have forgotten to mention some contributors, it is not because their work wasn't good. It's just
us being forgetful. So please, Unknown Dummy, accept our deepest appreciation!
We hope this document will be helpful to you. If you find the document to be incomplete, incorrect
or unclear, please do help us making it better. We welcome your feedback and contributions at
geomajas4dummies@geomajas.org.
Dirk Frigne
Founding Father
i
Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
TABLE OF CONTENTS
Chapter 1: Installing Apache Tomcat................................................................................................ 1
Step 1: Downloading and installing Java.......................................................................................1
Step 2: Downloading and installing Apache Tomcat...................................................................... 1
Step 3: Geomajas demo test........................................................................................................ 3
Chapter 2: Installing Maven and Eclipse.......................................................................................... 5
Step 1: Downloading and installing Maven................................................................................... 5
Step 2: Building a Maven Project.................................................................................................. 8
Step 3: Installing and configuring Eclipse....................................................................................10
3.1 m2eclipse: Maven in Eclipse ......................................................................................... 11
3.2 Subclipse....................................................................................................................... 12
3.3 m2eclipse extras............................................................................................................ 12
3.4 Checkstyle..................................................................................................................... 13
3.5 SVN team provider: ...................................................................................................... 13
3.5.4 Google's GWT Eclipse plug-in:................................................................................... 16
Step 4: Running/debugging with the Google Plug-in for Eclipse (embedded Jetty option)..........16
Chapter3. First adjustments........................................................................................................... 23
Step1. Modify the text in browser title bar................................................................................... 23
Step2. Modify Map label............................................................................................................. 24
Step3. Change the background color of the mainLayout............................................................26
Step4. Modify layer representation............................................................................................. 28
ii
Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
TABLE OF FIGURES
iv
Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
This tutorial is organized in Chapters and steps. Chapter 1 will go you through Apache
Tomcat installation, Chapter2 will deal with Apache Maven (software project management and
comprehension too) and Eclipse (Java development environment). We will also make use of GWT
(Google Web Toolkit - development toolkit for building and optimizing complex browser-based
applications).
This tutorial was made using the latest versions (as of May 2012) of any of the software
used. Anyway, for production purposes, Java 7 is not yet fully supported. Please use Java 5 or
Java 6 instead.
v
Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
and get the latest version for your platform. Usually you are on 32 bits platform so the magic file is
jdk-7u3-windows-i586.exe (7u3 is the current version and i586 stands for an 32 bits system). After
downloading, double click on the file and install Java (its a simple Run-Next-Continue-Finish
procedure dont change anything, leave the default options). You can check now in the installation
folder for java and see that two folders are inside : jdk1.7.0_03 and jre7 (versions according to the
downloaded installation kit).
-1Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
The only think you have to do here is to fill a User Name, provide a Password for it and
eventually tick on the checkbox for Create shortcuts for all users. Leave everything as is.
Normally you dont need to change anything. Click on Next.
-2Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
As I mentioned before, Apache Tomcat needs JRE, and more than this, the installation
procedure detects it and let us, eventually, change the path to it. We havent changed anything
during Java installation so we just click again on Next button. The next screen will prompt us for
the installation location of Apache Tomcat (C:\Program Files\Apache Software Foundation\Tomcat
7.0), we will live it as it is and proceed to Install. After installation Apache Tomcat from now on
will start automatically on computer startup. This is one less worry.
Your Tomcat is now accessible via : http://localhost:8080/
-3Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Browse for the war file downloaded and then press Deploy.
A word of caution!
If your war file is larger than 50MB you will get an error page. By default, Apache Tomcat 7 limits
the size of the war files to deploy to 50 MB. To increase this value, go to C:\Program Files\Apache
Software Foundation\Tomcat 7.0\webapps\manager\WEB-INF right click on the file web.xml and
open it with Notepad. Look for:
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
and replace with
<max-file-size>104857600</max-file-size>
<max-request-size>104857600</max-request-size>
After the file was deployed you will see above on the same page Geomajas listed in the
Application list. All you need is to click on the name and you can test Geomajas! (In my case I used
geomajas-gwt-example-1.8.0.war
-4Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
In the System Properties go to Advance tab and click on Environment Variables button on
the lower left corner.
-5Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
-6Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Next to this, also in the System Variables, scroll down to Path and then click Edit. Add at
the end
;%JAVA_HOME%\bin;%M2%\bin
-7Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
-8Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
We will need the Geomajas GWT application archetype so type 1 and press Enter.
Figure 13-Choose the correct archetype
Next maven asks for the groupId: Often the package name is used (i.e. geomajas)
Next maven asks for the artifactId: This represents the name for your application. (i.e. myapp)
Next maven asks for version for your application. It suggests 1.0-SNAPSHOT we agree with
that, so just press Enter
Next maven asks for package suggesting groupID value (geomajas in our case). Just press
Enter.
-9Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
We are now asked for a confirmation of what weve configured till now, we type Y (Yes) and
our project is build.
Figure 15-Maven Project successfully created
Well leave this for the moment and go further to step 3 of this chapter.
- 10 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
The goal of the Eclipse m2eclipse project is to provide Apache Maven support in the
Eclipse IDE, making it easier to edit Maven's pom.xml, run a build from the IDE and much more
m2eclipse - http://m2eclipse.sonatype.org/sites/m2e
Figure 17-Eclipse plug-in: Maven in Eclipse (m2eclipse)
- 11 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Subclipse is an Eclipse plug-in that provides the functionality to interact with a Subversion server,
and to manipulate a project on a Subversion server in the Eclipse environment.
Subclipse - http://subclipse.tigris.org/update_1.8.x
Figure 18-Eclipse plug-in: Subclipse
m2eclipse extras provide Maven integration for : M2Eclipse, Eclipse Extras, Eclipse WTP,
Subclipse, OSGi Development. (*Note - DO NOT install Web Application Runner)
m2eclipse extras - http://m2eclipse.sonatype.org/sites/m2e-extras
Figure 19-Eclipse plug-in: Maven in Eclipse extras (m2e-extras)
- 12 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
The eclipse-cs Checkstyle plug-in integrates the well-known source code analyzer Checkstyle into
today's leading IDE Eclipse
Checkstyle - http://eclipse-cs.sf.net/update/
Figure 20-Eclipse plug-in: Checkstyle
http://download.eclipse.org/releases/indigo
3.5.1 Under 'Collaboration
Figure 21-Eclipse plug-in: SVN team provider : Collaboration
- 13 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 14 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 15 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Google Plugin for Eclipse is a set of software development tools that enables Java
developers to quickly design, build, optimize, and deploy cloud-based applications.
Google's GWT Eclipse plug-in : http://dl.google.com/eclipse/plugin/3.7
Figure 26-Eclipse plug-in: Google GWT
Step 4: Running/debugging with the Google Plug-in for Eclipse (embedded Jetty option)
Now everything is prepared for the project to begin. We will start by importing the maven
project created at Step 2: Building a Maven Project.
Run Eclipse, choose your workspace folder to C:\GeomajasEclipse, and from the File
menu choose Import.
- 16 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 17 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Under Web Toolkit check Use Google Web Toolkit and Use specific SDK
Figure 30-Eclipse: Configure Google Web Toolkit settings - Web Toolkit
- 18 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 19 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
A new_configuration window for a Java Application will be opened. Near the Main class
field click Search button and in the Select Main Type window type Jetty. Choose from the
Matching items JettyRunner org.geomajas.jetty and then click OK. Click then Close.
Figure 34-Eclipse: JettyRunner as main class
- 20 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Its now time to run our project. Right click on myapp, choose Debug As/Web application
Figure 35-Eclipse: Running the GWT application
Wait for a while, and at the end you will have a URL on the right hand of the Eclipse
window.
- 21 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Double click on the link and Voila! we have the Geomajas demo working!
Figure 37-Browser: Geomajas demo working
- 22 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Lets say we are sure of what we are doing and save the project (File/Save). Go back in
your browser and press the Refresh button. Please notice the new text in the browser title bar.
- 23 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 24 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
Go back to you browser and press Refresh. OK, now everybody will know!
- 25 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 26 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 27 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 28 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 29 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.
- 30 Copyright (c) 2012 by Stefan Hogas. This work is made available under the terms of the Creative Commons
Attribution-ShareAlike 3.0 license,
http://creativecommons.org/licenses/by-sa/3.0/. All brand names or trademarks mentioned in this document are the
property of their respective owners.