Skip to content
l0rdn1kk0n edited this page Jul 27, 2012 · 7 revisions

Heading

Heading h1 to h6

The Heading component simply asserts the correct html tag h1 to h6. You can use the Heading component, which inherits from org.apache.wicket.markup.html.basic.Label:

Heading heading = new Heading("wicket-markup-id", Model.of("Heading Title"));
add(heading);

or use the HeadingBehavior:

Label heading = new Label("wicket-markup-id", Model.of("Heading Title"));
heading.add(new HeadingBehavior());
add(heading);

the associated markup has to be look like this:

<body>
    <h1 wicket:id='wicket-markup-id'>Heading Title</h1>
</body>

Code

Heading h1 to h6

The Code block transforms a pre or code html tag into a prettified version. It is also possible to add linenumbers with .addLineNumbers() or to choose the language with .language(CodeBehavior.Language.HTML)). If you don't want to show the first lines of code you can use the .from(int) method to define a start point.

Static Code Block

add(new Code("code-btn-group")
       .addLineNumbers()
       .language(CodeBehavior.Language.HTML));
<pre wicket:id="code-btn-group">
    &lt;div class="btn-group"&gt;
      &lt;button class="btn"&gt;1&lt;/button&gt;
      &lt;button class="btn"&gt;2&lt;/button&gt;
      &lt;button class="btn"&gt;3&lt;/button&gt;
    &lt;/div&gt;
</pre>

Dynamic Code Block

IModel<String> model = Model.of("" + 
    "<div class='btn-group'>" +
    "<button class='btn'></button>"
    ...
    "</div>"
);

add(new Code("code-btn-group", model)
       .addLineNumbers()
       .language(CodeBehavior.Language.HTML));
<pre wicket:id="code-btn-group">
</pre>

Label

Badge

Tooltip

ProgressBar

UpdatableProgressBar

Clone this wiki locally