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;
017    
018    import com.github.gwtbootstrap.client.ui.base.HasType;
019    import com.github.gwtbootstrap.client.ui.base.HtmlWidget;
020    import com.github.gwtbootstrap.client.ui.base.StyleHelper;
021    import com.github.gwtbootstrap.client.ui.constants.Constants;
022    import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
023    
024    /**
025     * ControlGroup is a form widget.
026     * <p>
027     * ControlGroup can include html and widget
028     * <h3>UiBinder Usage:</h3>
029     * 
030     * <pre>
031     * {@code
032     * <b:ControlGroup>
033     *      ControlGroup can include html and widgets<br/>
034     *      <b:Controls/>
035     *      <a href="#"></a>
036     * </b:ControlGroup>
037     * }
038     * </pre>
039     * </p>
040     * 
041     * @since 2.0.4.0
042     * 
043     * @author kokubo yusuke 
044     * @author ohashi keisuke
045     * 
046     * @see Controls
047     * @see Fieldset
048     * @see <a href="http://twitter.github.com/bootstrap/base-css.html#forms">Bootstrap documentation</a>
049     */
050    public class ControlGroup extends HtmlWidget implements HasType<ControlGroupType> {
051    
052            /**
053             * Creates a widget with  the html set..
054             * @param html content html
055             */
056            public ControlGroup(String html) {
057                    super("div", html);
058                    setStyleName(Constants.CONTROL_GROUP);
059            }
060    
061            /**
062             * Creates an empty widget.
063             */
064            public ControlGroup() {
065                    this("");
066            }
067            
068            /**
069             * {@inheritDoc}
070             */
071            public void setType(ControlGroupType type) {
072                    StyleHelper.changeStyle(this, type, ControlGroupType.class);
073            }
074    }