View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.common.ui.client.widgets.impl;
17  
18  import org.kuali.student.common.ui.client.widgets.KSTabPanelAbstract;
19  
20  import com.google.gwt.event.logical.shared.SelectionHandler;
21  import com.google.gwt.user.client.ui.DecoratedTabPanel;
22  import com.google.gwt.user.client.ui.TabBar;
23  import com.google.gwt.user.client.ui.Widget;
24  
25  public class KSTabPanelImpl extends KSTabPanelAbstract {
26  
27      private final DecoratedTabPanel panel = new DecoratedTabPanel();
28  
29      public KSTabPanelImpl() {
30          super();
31          panel.addStyleName("KS-Tab-Panel");
32          TabBar tabBar = panel.getTabBar();
33          tabBar.addStyleName("KS-Tab-Panel-BarItem");
34          initWidget(panel);
35      }
36  
37      @Override
38      public void addTab(Widget w, String tabText){
39          panel.add(w, tabText);
40      }
41  
42      @Override
43      public void addTab(Widget w, Widget tab){
44          panel.add(w, tab);
45      }
46  
47      @Override
48      public boolean removeTab(int index) {
49          return panel.remove(index);
50      }
51  
52      @Override
53      public void removeTab(Widget widget) {
54          panel.remove(widget);
55      }
56  
57      @Override
58      public void selectTab(int index) {
59          panel.selectTab(index);
60      }
61  
62      @Override
63      public int getTabCount() {
64          return panel.getWidgetCount();
65      }
66  
67      @Override
68      public void addStyleName(String style) {
69          panel.addStyleName(style);
70      }
71  
72  
73      @Override
74      public void addSelectionHandler(SelectionHandler<Integer> handler) {
75          panel.addSelectionHandler(handler);
76      }
77  
78      @Override
79      public int getWidgetIndex(Widget widget) {
80          return panel.getWidgetIndex(widget);
81      }
82  }