Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.TabBar


 
    /**
     * Builds the dialog's tab bar.
     */
    private void buildTabBar() {
      tabs = new TabBar();
      tabs.addTab("Starred Documents");
      tabs.addTab("All Documents");
      tabs.selectTab(0);
      tabs.setWidth("100%");
      tabs.addSelectionHandler(new SelectionHandler<Integer>(){
View Full Code Here


public class TabBarExample implements EntryPoint {

  public void onModuleLoad() {
    // Create a tab bar with three items.
    TabBar bar = new TabBar();
    bar.addTab("foo");
    bar.addTab("bar");
    bar.addTab("baz");

    // Hook up a tab listener to do something when the user selects a tab.
    bar.addSelectionHandler(new SelectionHandler<Integer>() {
      public void onSelection(SelectionEvent<Integer> event) {
        // Let the user know what they just did.
        Window.alert("You clicked tab " + event.getSelectedItem());
      }
    });

    // Just for fun, let's disallow selection of 'bar'.
    bar.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
      public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
        if (event.getItem().intValue() == 1) {
          event.cancel();
        }
      }
View Full Code Here

              }};
            
          int tabsWidht = 0;
          for(int row=0;row<tabsNum;row++){
                
                  TabBar tab = new TabBar();
                 
                  tabsPanel.add(tab);
                  tab.addSelectionHandler(handler);
                
                  for(int item=0;item<itemsOnTabBar;item++){
                      if((row*itemsOnTabBar+item)<tabLabels.length)
                           tab.addTab(tabLabels[row*itemsOnTabBar+item]);
                  }
                  if(tabsWidht<tab.getOffsetWidth())
                      tabsWidht = tab.getOffsetWidth();
          }
        
          data.setWidth("100%");
          data.addStyleName("gwt-TabPanelBottom");
          phoneBookPanel.add(tabsPanel);
View Full Code Here

          int activeNavBarNum = -1 ;
          for(int wig = 0; wig<tabsPanel.getWidgetCount();wig++){
            
              try {
                            
                  TabBar tb = (TabBar) tabsPanel.getWidget(wig);
                            
                  if(!activeTabBar.equals(tb))
                      tb.selectTab(-1);
                  else
                      activeNavBarNum = wig;
                    
              }
              catch (Exception e) {
View Full Code Here

        tabBar = new DecoratedTabBar();
      } else {
        tabBar = new DecoratedBottomTabBar();
      }
    } else {
      tabBar = new TabBar();
    }

    deck.addStyleName(DEFAULT_STYLENAME + "Bottom");
    if (!decorateBody) {
      deck.addStyleName("gwt-TabPanelBottom"); // use GWT's TabPanel style
View Full Code Here

  public String serialize(IVkWidget widget)
  {
    StringBuffer buffer = new StringBuffer("{");
    buffer.append("widgetName:'").append(widget.getWidgetName()).append("'");
    buffer.append(",style:'").append(VkDesignerUtil.getCssText((Widget) widget)).append("'");
    TabBar tabBar =  (VkDecoratedTabBar)widget;
    serializeAttributes(buffer, tabBar);
    buffer.append(",tabs:[");
    for(int i = 0; i < tabBar.getTabCount(); i++)
    {
      buffer.append("{html:").append("'").append(tabBar.getTabHTML(i)).append("',");
      buffer.append("enabled:").append(tabBar.isTabEnabled(i)).append("},");
    }
    if(buffer.charAt(buffer.length() - 1) == ',')
      buffer.deleteCharAt(buffer.length() - 1);
    buffer.append("]").append(",selectedTab:").append(tabBar.getSelectedTab());
    buffer.append(",children:[").append("]}");
    return buffer.toString();
  }
View Full Code Here

      buffer.append(",'" ).append(HasVkSelectionHandler.NAME).append("':").append("'")
        .append(((HasVkEventHandler)widgetSource).getPriorJs(HasVkSelectionHandler.NAME).replace("'", "\\'")).append("'");
  }
  @Override
  public void buildWidget(JSONObject jsonObj, Widget parent) {
    TabBar tabBar = (TabBar)parent;
    JSONArray tabsArray = jsonObj.get("tabs").isArray();
    addAttributes(jsonObj, parent);
    for(int i = 0; i < tabsArray.size(); i++)
    {
      JSONObject tab = tabsArray.get(i).isObject();
      tabBar.addTab(tab.get("html").isString().stringValue(), true);
      tabBar.setTabEnabled(tabBar.getTabCount() - 1, tab.get("enabled").isBoolean().booleanValue());
    }
    int selectedTab = (int) jsonObj.get("selectedTab").isNumber().doubleValue();
    if(selectedTab > -1)
      tabBar.selectTab(selectedTab);
  }
View Full Code Here

  {
    StringBuffer buffer = new StringBuffer("{");
    buffer.append("widgetName:'").append(widget.getWidgetName()).append("'");
    buffer.append(",style:'").append(VkDesignerUtil.getCssText((Widget) widget)).append("'");
    serializeAttributes(buffer, (Widget) widget);
    TabBar tabBar =  (TabBar)widget;
    buffer.append(",tabs:[");
    for(int i = 0; i < tabBar.getTabCount(); i++)
    {
      buffer.append("{html:").append("'").append(tabBar.getTabHTML(i)).append("',");
      buffer.append("enabled:").append(tabBar.isTabEnabled(i)).append("},");
    }
    if(buffer.charAt(buffer.length() - 1) == ',')
      buffer.deleteCharAt(buffer.length() - 1);
    buffer.append("]").append(",selectedTab:").append(tabBar.getSelectedTab());
    buffer.append(",children:[").append("]}");
    return buffer.toString();
  }
View Full Code Here

      buffer.append(",'" ).append(HasVkSelectionHandler.NAME).append("':").append("'")
        .append(((HasVkEventHandler)widgetSource).getPriorJs(HasVkSelectionHandler.NAME).replace("'", "\\'")).append("'");
  }
  @Override
  public void buildWidget(JSONObject jsonObj, Widget parent) {
    TabBar tabBar = (TabBar)parent;
    JSONArray tabsArray = jsonObj.get("tabs").isArray();
    addAttributes(jsonObj, parent);
    for(int i = 0; i < tabsArray.size(); i++)
    {
      JSONObject tab = tabsArray.get(i).isObject();
      tabBar.addTab(tab.get("html").isString().stringValue(), true);
      tabBar.setTabEnabled(tabBar.getTabCount() - 1, tab.get("enabled").isBoolean().booleanValue());
    }
    int selectedTab = (int) jsonObj.get("selectedTab").isNumber().doubleValue();
    if(selectedTab > -1)
      tabBar.selectTab(selectedTab);
  }
View Full Code Here

   *
   * @param constants the constants
   */
  public ContentWidget(CwConstants constants) {
    this.constants = constants;
    tabBar = new TabBar();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.TabBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.