Dayon - Contentstrategie en technologie
By Willem Voogd
At Dayon, Wicket is a component in the standard development stack for web applications. Recently I came across QWickie, a plug-in for the eclipse environment (http://code.google.com/p/qwickie/).
The published version at time of writing is 0.9.3.
The features for QWickie are (as listed on the QWickie project's home page):
- Navigate from java code elements to the corresponding html element via wicket:id
- Show the corresponding html fragment from the java code element
- Show the wicket:id line in the html file on mouse over
- Rename HTML when renaming a wicketized java file (supertype Component)
- Find html files in other locations
- Jump to properties files
- Jump to XML files
- Support for other wicket name-spaces
- Wizard for new wicket pages
- Quickfix to add missing components to onInitialize
- Code assist for wicket:id (Ctrl-1) in Wicket Java files. e.g. new Label("<press Ctrl-1>")
I will review each feature here in the listed order.
Navigate from java code elements to the corresponding html element via wicket:id
This works by Ctrl-clicking the wicket:id string in the java code. You are then navigated to the html template with the corresponding wicket:id tag highlighted. When you hover having the CTRL key pushed, you'll see two options, one for navigating to the main file and one for navigating to corresponding wicket:id. Sometimes however, the pop-up on hovering is not shown while the click does navigate to the HTML template.
Show the corresponding html fragment from the java code element
Taking the feature name into account, I expected this to show the HTML for a Fragment component in another component or page. I did not experience this. I might be expecting the wrong thing though, but for now, I have to say that this doesn't work as expected.
Show the wicket:id line in the html file on mouse over
Rename HTML when renaming a wicketized java file
This works when html file is in the same directory as the java file. However for maven like projects, which have the HTML template files in a different directory, this feature does not seem to work. Instead a new html file is created in the directory where the java file resides. However, when you do it the other way around, rename the html file, the java class and file get renamed correctly.
Find html files in other locations
This feature allows the template to not be in the same location as the java file. This is necessary for maven projects which by default have the template files in a resource directory. This is a thing we need for web-projects at Dayon, since we use maven for our projects. I've tested this and it works. Clicking the wicket id string for a component in a java file will navigate to the correct html file, although for now it does not seem be possible to specify the language of the html file you want to be navigated to. (i.e. filename.html vs filename_nl.html)
Jump to property files
When you click the key attribute value of a wicket:message tag or the wicket:message attribute value of a component, you are navigated to the respective property file. What does not work (yet) is navigating to the properties file when clicking a string value in a java file's getString() call to retrieve a property translation programmatically.
Jump to XML files
This feature is described as being able to jump to property files which are not directly derivable by the application or component name. I will omit this feature for review now, because I really don't know how to configure this.
Support for other wicket name-spaces
At Dayon we do not use alternate name-spaces, therefore I will not validate this feature here.
The wizard can be found by selecting other in the new context menu. Under the QWickie menu-item there are two wizards listed; one for the WicketPage and one for the WicketPanel wizard. This wizard will create a new class, and a new html file in the same package. Since the standard maven setting is that the html templates are in a separate resources folder, this is not really usable for maven wicket projects. It might be an idea to have a QWickie configuration panel where you can assign a directory to be used for new wicket html-templates. Maybe the project type could even be recognized as Maven project, in which case the resource directory will be used to place the html template file.
Quickfix is initiated from eclipse with Crtl-1. What I did to test this functionality is comment out a declaration, and then press Ctrl-1 in the onInitialize() method. This rendered nothing, no fixes were suggested. To me this feature is therefore not functioning, but I might be missing the real use case here.
The feature-list says you have to press Ctrl-1, but, at least in my configuration, which is quite standard, the code assistant is Ctrl-Space. Which works fine. All wicket:ids are listed as possible string values. An improvement might be that only the wicket:id's for the appropriate types are shown.
In its current shape QWickie is a useful extension to an Eclipse Wicket development stack. Not all things are behaving in a way that is directly usable for all use cases, such as the wizard and renaming features. However the main functionality is very usable and will save time since in my experience switching to and from template's and java files is done very frequently. QWickie is worth installing for that feature alone.