Monday, April 29, 2013

Tools for Wickets Development with IntelliJ's Idea

One of Java's most popular web frameworks is Wicket.

If you want to start developing Wickets let me guide you through the installation of 2 plugins which will make your development much more productive.

I will write the steps to install these plugins, but I will write them in a short way, if you want a more detailed guide please refer to this page: Installing Wicket Source

1. IntelliJ --> Settings --> Plugins --> Browse Repositories --> Search for "Wicket" --> Install Wicket Forge & Wicket Source.

2. Restart IntelliJ

2.5. You have installed the 2 plugins and you are set to go (the next steps are highly recommended but optional) - WicketForge lets IntelliJ understand Wicket (you can now start a new Wicket file etc), WicketSource lets IntelliJ understand the html wicket ids, which means that you can click on a wicket:id and jump to it's definition in the code / html.

The following steps are optional and will enable your browser to understand the wickets as well, by inspecting any html element, and jumping to its definition in IntelliJ's exact line!

3. Integration into a specific Project: In the project you want to work on, add the following dependency to pom.xml:
<dependency>
      <groupId>net.ftlines.wicket-source</groupId>
      <artifactId>wicket-source</artifactId>
      <version>6.0.0.8</version>
 </dependency>


4. In WicketApplication.java --> init() --> Add the following: WicketSource.configure(this);

Please add a debug flag here so your production environment won't be affected (something like if(DEBUG_MODE) )

5. Last step is integrating the plugin into firefox:
5.a. Install firebug plugin
5.b. Click on the following (using firefox) which will install the firebug 
plugin: https://github.com/downloads/42Lines/wicket-source/wicketsource@gmail.com.xpi

Or Chrome:
https://chrome.google.com/webstore/search/WicketSource



That's it!



Now start your Wicket app (Jetty?), goto localhost using firefox, inspect any element and goto "wicketsource" tab --> it will send you to the right place in your source code.

No comments: