application is similar to a NetBeans web application. The differences are that (a) there's no JSP file, (b) HTML files are located in Java packages, (c) each HTML file is accompanied by a Java source file of the same name, (d) there's some Wicket-specific code in web.xml
, and (e) Wicket uses Wicket-specific tags in HTML files to link the HTML files to the Java source files. So, the most important aspect of tools support for Wicket would be a project template located in the New Project wizard -- the project template should provide all of the aforementioned and the New Project wizard should enable you to specify one or two things (like project name, class name, HTML name, etc). Well, without typing a single line of code
, this can be done. And here's how (use NetBeans IDE Dev, and a very recent version of it, because the following hasn't been available for very long):
- Use the New Project wizard to create a web application in NetBeans IDE. Then use the New File wizard to create all the files that you would like to include in the Wicket project template. Here's what it looked like for me:
You could also include all the Wicket JAR files, but it's better to share the JAR files between applications. So, for the Wicket JAR files, you'd take the following steps separately.
- Use the New Project wizard to create a new plug-in module project. Then use the New File wizard to create a project template, selecting the Wicket application you defined in the previous step as the basis of the template. The New Project wizard even lets you specify where in the New Project wizard the Wicket project template should be located (click to enlarge):
When you click Finish above, you get a whole bunch of files. The files define the wizard for creating the Wicket application. Here's what the Projects window looks like after you create the project template:
There's also an XML Layer file that specifies where the project template will be found in the New Project wizard:
Finally, the Wicket application that you defined in step 1 above, and which you selected in the first step of the Project Template wizard, is zipped up (WicketProjectTemplateProject.zip in the illustration above), and will be unzipped when you choose the Wicket application from the New Project wizard.
- Now you're done! You could finesse things a bit -- for example, you could add your own icon (which I did, in the illustration above), you could add additional panels to the wizard, you could change the description that appears in the New Project wizard, and you could reorganize the place of the template within the New Project wizard. There are many things you could do. But, basically, you're done. Right-click the project template module and choose Run Project. A new instance of the IDE opens. Click Ctrl-Shift-N and look in the category where you placed the Wicket project template (click to enlarge):
Not bad, huh? Without typing a single line of code, you've created a project template that extends NetBeans IDE by enabling it to provide support for a technology that it doesn't support by default.
But this is only one aspect of tools support for Wicket. Other things to consider are -- file templates for web pages (each template would produce two files, an HTML file and a Java source file) and code completion for the Wicket tags in the HTML files. (Are there other things that Wicket users would like, Eelco and Martijn?) I'll look at these things in future blog entries.