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 java.util.ArrayList;
019    import java.util.List;
020    
021    import com.google.gwt.user.client.ui.IsWidget;
022    
023    /**
024     * DropdownTab for {@link TabPanel}
025     * @author ohashi keisuke
026     * @since 2.0.4.0
027     *
028     */
029    public class DropdownTab extends Dropdown {
030        
031        private List<Tab> tabList = new ArrayList<Tab>();
032        
033        /**
034         * Create empty dropdownTab
035         */
036        public DropdownTab() {
037            super();
038        }
039        
040        /**
041         * Create a dropdownTab with caption(tag text)
042         * @param caption tag text
043         */
044        public DropdownTab(String caption) {
045            super(caption);
046        }
047        
048        /**
049         * {@inheritDoc}
050         */
051        @Override
052        public void add(IsWidget child) {
053            if (child instanceof Tab) {
054                Tab tab = (Tab)child;
055                getTabList().add(tab);
056            }
057            
058            super.add(child);
059        }
060    
061        /**
062         * Get TabList
063         * @return tabList tabList
064         */
065        public List<Tab> getTabList() {
066            return tabList;
067        }
068    
069    }