001    package net.sf.jolene.dom;
002    
003    import net.sf.jolene.constants.Tags;
004    
005    /**
006     * A lable in an html document.
007     *
008     * @author Dan Howard
009     * @since Oct 19, 2003
010     */
011    public final class Label extends HTMLElement {
012    
013        /**
014         * Default constructor.
015         */
016        public Label() {
017            tag = Tags.label;
018        }
019    
020    
021        /**
022         * Returns a clone of the label object.
023         *
024         * @return Label object.
025         */
026        @Override
027        public Label clone() {
028            return (Label) super.clone();
029        }
030    
031        /**
032         * Sets the value of the label. Same as setText.
033         * @param value text value of the label.
034         */
035        @Override
036        public void setValue(String value) {
037            super.setValue(value);
038            setContent(value);
039        }
040    
041    
042        /**
043         * Renders the label.
044         *
045         * @return The label as a html string.
046         */
047        @Override
048        public String toString() {
049    
050            if (swapWith != null) {
051                return swapWith.toString();
052            }
053    
054            if (!isRenderable() && !log.isDebugEnabled()) {
055                return "";
056            }
057    
058            return super.toString() + getContent() + "</" + tag + '>';
059        }
060    }