001    /*
002     *  Copyright 2012 GWT-Bootstrap
003     *
004     *  Licensed under the Apache License, Version 2.0 (the "License");
005     *  you may not use this file except in compliance with the License.
006     *  You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     *  Unless required by applicable law or agreed to in writing, software
011     *  distributed under the License is distributed on an "AS IS" BASIS,
012     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     *  See the License for the specific language governing permissions and
014     *  limitations under the License.
015     */
016    package com.github.gwtbootstrap.client.ui.base;
017    
018    import com.google.gwt.dom.client.Element;
019    import com.google.gwt.i18n.shared.DirectionEstimator;
020    import com.google.gwt.user.client.ui.Label;
021    
022    /**
023     * {@link com.google.gwt.user.client.ui.InlineLabel InlineLabel} without the GWT
024     * CSS Styles.
025     * 
026     * @since 2.0.4.0
027     * 
028     * @author Dominik Mayer
029     * @author ohashi keisuke
030     */
031    public class InlineLabel extends com.google.gwt.user.client.ui.InlineLabel {
032    
033            /**
034             * Creates an empty widget.
035             */
036            public InlineLabel() {
037                    super();
038                    setStyleName("");
039            }
040    
041            /**
042             * Creates a widget with the specified text.
043             * 
044             * @param text
045             *            the new widget's text
046             */
047            public InlineLabel(String text) {
048                    this();
049                    setText(text);
050            }
051    
052            /**
053             * Creates a label with the specified text and direction.
054             * 
055             * @param text
056             *            the new label's text
057             * @param dir
058             *            the text's direction. Note: {@code Direction.DEFAULT} means
059             *            direction should be inherited from the widget's parent
060             *            element.
061             */
062            public InlineLabel(String text,
063                    Direction dir) {
064                    this();
065                    setText(text, dir);
066            }
067    
068            /**
069             * Creates a label with the specified text and a default direction
070             * estimator.
071             * 
072             * @param text
073             *            the new label's text
074             * @param directionEstimator
075             *            A DirectionEstimator object used for automatic direction
076             *            adjustment. For convenience,
077             *            {@link Label#DEFAULT_DIRECTION_ESTIMATOR} can be used.
078             */
079            public InlineLabel(String text,
080                    DirectionEstimator directionEstimator) {
081                    this();
082                    setDirectionEstimator(directionEstimator);
083                    setText(text);
084            }
085    
086            /**
087             * This constructor may be used by subclasses to explicitly use an existing
088             * element. This element must be either a <div> <span> element.
089             * 
090             * @param element
091             *            the element to be used
092             */
093            protected InlineLabel(Element element) {
094                    // super(element) also asserts that element is either a <div> or
095                    // <span>.
096                    super(element);
097            }
098    }