Wicket mounting in an OSGi environment

This page describes how to do page mounting in Wicket in an OSGi environment. A resource/page/etc. can be registered to Wicket’s WebApplication via a couple of ‘mount’ methods. This example only shows how to mount a page (to keep it simple) but can be extended for IRequestMapper/resource/package as well.

Continue reading Wicket mounting in an OSGi environment

Wicket and CKEditor in Internet Explorer

CKEditor was working properly in Internet Explorer while developing our Wicket application. After deployment to our demo server it wasn’t working anymore. We had no issues with FireFox/Chrome or Safari. First we thought it had to do with some timing issues but after a lot of debugging we found out the issue (and of course the solution 😉 ).

Continue reading Wicket and CKEditor in Internet Explorer

How to check whether Javascript is enabled in Wicket

It is possible, via Wicket, to gather a lot of information regarding the browser/system of your visitor. If you want this you can also turn on some extended information (like javascript is enabled) via the following code:

getRequestCycleSettings().setGatherExtendedBrowserInfo(true);

This method works via a redirect to the BrowserInfoPage and finally it goes to your ‘original’ page. Because of this it is possible that you see the BrowserInfoPage very shortly especially on slow computers/browsers or internet connections. But what if you don’t want this and only want to know whether Javascript is enabled? Please read on…

Continue reading How to check whether Javascript is enabled in Wicket

AjaxTabbedPanel – Store state when switching tabs

Normally when you switch tabs of an AjaxTabbedPanel it won’t store the state of all your input fields. If you do want this, without pressing a save button, you have to override the newLink(String linkId, final int index) method of the AjaxTabbedPanel class and use an AjaxSubmitLink instead of the default AjaxFallbackLink. Now all values will be stored in the model (not saved to the database).

Keep in mind that all Wicket validations will be validated, so we have to take care of the FeedbackPanel (refreshing) as well.

Continue reading AjaxTabbedPanel – Store state when switching tabs

AjaxTabbedPanel in combination with AjaxLazyLoadPanel

Wicket (extensions) offers a AjaxTabbedPanel to take care of your tabs. The constructor of the AjaxTabbedPanel expects a wicket id (obviously) and a list of ITabs. The implementation of this interface should return the panel via getPanel(String panelId) which will be the ‘actual’ tab. Out-of-the-box Wicket (extensions) offers an abstract implementation of this interface (AbstractTab).

What I want to achieve is that an AjaxIndicator (loading image) will be shown on the place were the actual panel will come till it is completely loaded. Especially when you have a lot of components to render this can be handy. See image below.

Example

Example

Continue reading AjaxTabbedPanel in combination with AjaxLazyLoadPanel

Hibernate SQL logging

When you turn on Hibernate’s SQL logging during Java development (e.g. log4j.logger.org.hibernate.SQL = debug, console), you won’t see values (only a ?) which will be/are used in a query.
e.g.

select this_.id as ID113_4_ ........ from INCOMINGMESSAGE ... where this_.STATUS=? and this_.FOO=?

Now turn on some extra logging (log4j.properties):

log4j.logger.org.hibernate.type = trace, console

Now you’ll see some extra information like the type (StringType / EnumType / etc.) and the value:

select this_.id as ID113_4_ ........ from INCOMINGMESSAGE ... where this_.STATUS=? and this_.FOO=?
DEBUG org.hibernate.type.EnumType  - Binding 'UNHANDLED' to parameter: 1
DEBUG org.hibernate.type.StringType  - Binding 'Bar' to parameter: 2

Note: When your application uses big queries then you’ll get a lot of extra logging\!