-
Notifications
You must be signed in to change notification settings - Fork 162
Block Elements
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>
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.
add(new Code("code-btn-group")
.addLineNumbers()
.language(CodeBehavior.Language.HTML));
<pre wicket:id="code-btn-group">
<div class="btn-group">
<button class="btn">1</button>
<button class="btn">2</button>
<button class="btn">3</button>
</div>
</pre>
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>
Copyright 2012 AgileCoders.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.