Gii,

>>      and if my RoundCornerBorder.getWidth().equals("100%") then I
>> want to strip away the "wicket-width" tag but not its body. The problem

didn't I send you the code already? It hasn't changed much recently.
The "Label" will not print it's tag, but the body only.

Juergen

/*
 * $Id:$
 * $Revision:$
 * $Date:$
 *
 * ====================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License 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.
 */
package com.voicetribe.contrib.i18nDynamator;

import wicket.markup.ComponentTag;
import wicket.markup.MarkupStream;
import wicket.markup.html.basic.Label;
import wicket.model.IModel;

/**
 * This component is like Label, except that it will strip the XML tag  
 * <span ..> and </span> from output stream. It will write the body
 * only.
 * 
 * @author Juergen Donnerstag
 */
public class DynLabel extends Label
{
        /**
     * Constructor that uses the provided [EMAIL PROTECTED] IModel}as its model.
All components have
     * names. A component's name cannot be null.
     * 
     * @param name The non-null name of this component
     * @param model
     */
    public DynLabel(String name, IModel model)
    {
        super(name, model);
    }

    /**
     * Renders this component. But do not print <span ..> and </span>
     */
    protected void onRender()
    {
        // Get the current markup.
        MarkupStream markupStream = findMarkupStream();
        
        // Get mutable copy of next tag
        final ComponentTag tag = markupStream.getTag().mutable();

        // open tag
        markupStream.next();

        // Render body using original tag type so implementors
        // of handleBody will know if the tag has a body or not
        onComponentTagBody(markupStream, tag);

        // close tag
        markupStream.next();
    }
}


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to