How to use visural-wicket’s BeautyTipBehavior and dots in the component id

When we started to use visural-wicket (version 0.6.5) we experienced some problems with some tool tips. For whatever reason, the JavaScript behavior was not attached to some components. So all you got was the tool tip given from title attribute and that’s it.

The problem was that some ids contain a dot. jQuery interprets the ids as regular expression, so ids like userKey.username were not found.

The solution was to overwrite a method in our own ToolTip class and provide the super call with a component that has an escaped id.

public class ToolTip extends BeautyTipBehavior {
    private static final long serialVersionUID = 1L;

    public ToolTip(IModel<String> tipModel) {

     * (non-Javadoc)
     * @see com.visural.wicket.behavior.beautytips.BeautyTipBehavior#bind(org.apache.wicket.Component)
    public void bind(Component component) {
        final String fakeComponentId = component.getId().replace(".", "\\\\.");
        final Component fakeComponent = new Component(fakeComponentId) {
            private static final long serialVersionUID = 1L;

            protected void onRender(MarkupStream markupStream) {}

Posted in Dev

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Scroll To Top