@@ -0,0 +1,2328 @@
+/**%0A * Copyright 2011 55 Minutes (http://www.55minutes.com)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage fiftyfive.wicket.basic;%0A%0Aimport org.apache.wicket.model.IModel;%0A%0A// TODO: unit test%0A%0A/**%0A * A label that renders its value using Java's %7B@code String.format()%7D.%0A * This is useful for printing numeric values, especially floating point.%0A * %3Cp%3E%0A * Example usage:%0A * %3Cpre class=%22example%22%3E%0A * &lt;span wicket:id=%22balance%22&gt;&lt;/span&gt;%0A * %0A * IModel&lt;BigDecimal&gt; balance = Model.of(new BigDecimal(%221.1%22));%0A * add(new FormattedLabel(%22balance%22, %22%25.2f%22, balance);%3C/pre%3E%0A * %3Cp%3E%0A * Output:%0A * %3Cpre class=%22example%22%3E%0A * &lt;span&gt;1.10&lt;/span&gt;%3C/pre%3E%0A *%0A * @since 2.0.4%0A */%0Apublic class FormattedLabel extends LabelWithPlaceholder%0A%7B%0A    private String _format;%0A    %0A    /**%0A     * Construct the label using an implied model.%0A     * %0A     * @param id The %7B@code wicket:id%7D in the markup.%0A     * @param format A Java %3Ca href=%22http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax%22%3Eformat string%3C/a%3E.%0A     */%0A    public FormattedLabel(String id, String format)%0A    %7B%0A        super(id);%0A        _format = format;%0A    %7D%0A%0A    /**%0A     * Construct the label using an explicit model.%0A     * %0A     * @param id The %7B@code wicket:id%7D in the markup.%0A     * @param format A Java %3Ca href=%22http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax%22%3Eformat string%3C/a%3E.%0A     * @param model The value to be formatted.%0A     */%0A    public FormattedLabel(String id, String format, IModel%3C?%3E model)%0A    %7B%0A        super(id, model);%0A        _format = format;%0A    %7D%0A    %0A    @Override%0A    protected String internalGetDefaultModelObjectAsString()%0A    %7B%0A        Object object = getDefaultModelObject();%0A        return object != null ? String.format(_format, object) : null;%0A    %7D%0A%7D%0A

Add new `FormattedLabel` component.