| Wicket editor |
Wicket editor is a tabbed editor that allows a quick switch between java/html/property files. A recommended configuration is to set Wicket editor launcher as a default editor for Java files (from Window->Preferences->General->Editors->File Associations). This launcher will open a normal Java editor for regular Java classes. The tabs in editor can be swiched using ctrl-alt-, and ctrl-alt-. keybindings. A new html or properties file can be created using shift-ctrl-alt-, and shift-ctrl-alt-. keybindings. Preview pane is wicket:preview attribute aware. It is possible to include other markup files for preview by adding wicket:preview attribute to wicket component tag:
<span wicket:id="myPanel" wicket:preview="../MyPanel.html" />
There's no limit how deep the previewed hierarchies can be. Preview pane can also
inline non-packaged CSS and relocate images. A common way for instance is to keep some
files in src/webapp/css/ and src/webapp/images/. The context root and css files can be
configured for the plugin from Properties -> Wicket. If configured, the preview pane will
include them. WicketEditor adds toggle buttons to toolbar to enable/disable these features.
|
| Create Wicket Project |
A new Wicket project can be created using a wizard. The wizard is activated from File -> New -> Other -> Wicket The wizard creates a Java project and sets the classpath containing Wicket jar and its dependencies. A template application class is created to a desginated package. web.xml is created to a context root folder.
|
| Create Wicket Panel |
Wicket panel wizard is used to create a panel Java class and its html template.
|
| Create Wicket WebPage |
Wicket WebPage wizard is used to create a WebPage Java class and its html template. All templates can be edited from Window -> Preferences -> Wicket -> Templates |
| Form generation |
A form Java code can be generated from provided Html markup file. Select a form markup from Html file, right click and select 'Generate Wicket form code'. This will open a popup containing a sample implementation of the form. This can be copy-pasted to a destination Java file and finished there.
|
| Quick fixes for problem markers |
Quick fixes to create Wicket Panel, WebPage or Form are installed at problem locations where an instance of Wicket component is needed.
|
| Rename |
Rename refactoring has been enhanced so that it renames non-java based resources with the same
name as the type being renamed when the type inhertis from |
| Markup parser |
Wicket's markup parser is used to validate the correctness of associated markup file. The parser must be activated by configuring builder 'wicketbench.associatedMarkupAuditor' for the Wicket project. Please, see post installation steps from project page.
|
| Design time launcher |
Wicket Bench uses JUnit test case to launch the component that is under development. You should extend from WicketTestCase (which extends JUnit's TestCase) to provide a factory to create the component. This component is then launched in isolation from rest of the application.
public IComponentFactory
Remember to add wicket-bench-api.jar and its dependencies to your project's build path. With maven2 this can be done by putting following to your pom.xml.
<project>
<repositories>
<repository>
<id>laughing-panda</id>
<name>Laughing Panda</name>
<url>http://www.laughingpanda.org/maven2/</url>
</repository>
<dependencies>
<dependency>
<groupId>wicket-bench</groupId>
<artifactId>wicket-bench-api</artifactId>
<version>0.5.0</version>
</dependency>
</dependencies>
</repositories>
</project>
The launcher opens an Eclipse view containing a simple browser. This browser opens a page where the component can be tested. The view can be detached to its own window by right clicking the tab and selecting 'Detached'. Open url 'http://localhost:8090/wicket-bench' if you want see the page in a real browser.
|
| Selenium launcher |
Wicket bench integrates Selenium remote control functional testing tool to automate testing of Wicket components.
public void testDictionaryPanelOnSelenium() {
openSelenium(createFactory());
getSelenium().type("query", "ca");
getSelenium().click("submit");
getSelenium().waitForPageToLoad("5000");
String text = getSelenium().getHtmlText();
assertTrue(text.contains("kissa"));
assertTrue(text.contains("auto"));
}
See this test case for a more complete example. Windows users should propably go to Tools->Internet Options->Temporary Internet Files->Settings and check the "Every visit to the page" option. Otherwise IE caches the Selenium requests.
Usage:
Selenium integration contains Wicket specific methods to make it easier to do more robust assertions:
Component getComponent();
Component getComponent(String path);
ListItem getComponent(ListView list, int index);
Component getComponent(ListView list, int index, String pathInItem);
String id(String path);
Examples:
public void testSearchResults() {
openSelenium(createFactory());
getSelenium().type("query", "wicket");
getSelenium().click("submit");
getSelenium().waitForPageToLoad("5000");
ListView listView = (ListView) getComponent("result:listing");
// Assert that model contains correct values.
List> results = listView.getList();
assertEquals(Arrays.asList("wicket", "rocks"), results);
// Assert that HTML contains correct elements
for (Iterator
|