2012-12-31

My Wicket Cheat-sheet

>> (09:44:54 AM) selckin: is there an easy way to make it concatinate a bunch of javascript/css resources into one link? >> (09:46:37 AM) martin-g: I use wro4j for that

Basics

new ExternalLink("id", "href", "label")

Switch off HTML escaping: Component#setEscapeModelStrings( false )

Don't print wrapper HTML element: Component#setRenderBodyOnly( true )

Development / deployment Wicket mode

<context-param>
        <param-name>configuration</param-name>
        <param-value>deployment/development</param-value>
</context-param>
********************************************************************
*** WARNING: Wicket is running in DEVELOPMENT mode.              ***
***                               ^^^^^^^^^^^                    ***
*** Do NOT deploy to your live server(s) without changing this.  ***
*** See Application#getConfigurationType() for more information. ***
********************************************************************

Setting / changing attributes

label1.add(
  new AttributeModifier("class", true, new Model() {
    Object getObject(Component comp) {
      return Math.random()>0.5 ? "SomeClass" : "AnotherClass";
    }
  });

0