Java 类com.google.gwt.user.client.ui.TabBar 实例源码

项目:firefly    文件:Toolbar.java   
public void onSelection(SelectionEvent<Integer> ise) {
    TabBar tb = (TabBar) ise.getSource();
    int idx = tb.getSelectedTab();
    if (idx == cSelIdx) {
        tb.selectTab(-1, false);
        dropdown.close();
    } else {
        if (!tb.equals(leftToolbar)) {
            leftToolbar.selectTab(-1, false);
        }
        if (!tb.equals(centerToolbar)) {
            centerToolbar.selectTab(-1, false);
        }
        if (!tb.equals(rightToolbar)) {
            rightToolbar.selectTab(-1, false);
        }

        TabHolder th = findTab(idx, tb);
        if (th != null) {
            th.button.activate();
        }
    }
    buttonClicked = false;
}
项目:firefly    文件:Toolbar.java   
public void addButton(Button button, Align align, int idx, String width) {
    TTabBar tb = align == Align.LEFT ? leftToolbar : align == Align.CENTER ? centerToolbar : rightToolbar;
    idx = idx < 0 || idx > tb.getTabCount() ? tb.getTabCount() : idx;
    tb.insertTab(button.asWidget(), idx);
    TabBar.Tab t = tb.getTab(idx);
    tabs.put(button.getName(), new TabHolder(t, button, tb));
    width = StringUtils.isEmpty(width) ? defaultWidth : width;
    GwtUtil.setStyle(button.asWidget(), "minWidth", width);
}
项目:firefly    文件:Toolbar.java   
public String getSelectedCommand() {
    String retval= null;
    for (Map.Entry<String,TabHolder> entry : tabs.entrySet()) {
        TabHolder th= entry.getValue();
        int idx= th.tabBar.getSelectedTab();
        if (idx>-1) {
            TabBar.Tab testTab= th.tabBar.getTab(idx);
            if (testTab==th.tab)  retval= entry.getKey();
        }
    }
    return retval;
}
项目:firefly    文件:Toolbar.java   
private int indexOf(TabBar bar, TabBar.Tab tab) {
    if (bar != null) {
        for (int i = 0; i < bar.getTabCount(); i++) {
            if (bar.getTab(i).equals(tab)) {
                return i;
            }
        }
    }
    return -1;
}
项目:firefly    文件:Toolbar.java   
private TabHolder findTab(int idx, TabBar tb) {
    TabBar.Tab tab = tb.getTab(idx);
    if (tab != null) {
        for (TabHolder th : tabs.values()) {
            if (th.tab.equals(tab)) {
                return th;
            }
        }
    }
    return null;
}
项目:firefly    文件:Toolbar.java   
public void onBeforeSelection(BeforeSelectionEvent<Integer> bse) {
    buttonClicked = true;
    TabBar tb = (TabBar) bse.getSource();
    cSelIdx = tb.getSelectedTab();
    int selIdx = bse.getItem();
    TabHolder th = findTab(selIdx, tb);
    if (!th.button.isUseDropdown()) {
        th.button.activate();
        bse.cancel();
    } else {
        dropdown.clearHeaderBar();
    }
}
项目:gerrit    文件:RelatedChanges.java   
private void initTabBar() {
  TabBar tabBar = getTabBar();
  tabBar.addSelectionHandler(
      new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
          if (selectedTab >= 0) {
            tabs.get(selectedTab).registerKeys(false);
          }
          selectedTab = event.getSelectedItem();
          tabs.get(selectedTab).registerKeys(true);
        }
      });

  for (Tab tabInfo : Tab.values()) {
    RelatedChangesTab panel = new RelatedChangesTab(tabInfo);
    add(panel, tabInfo.defaultTitle);
    tabs.add(panel);

    TabBar.Tab tab = tabBar.getTab(tabInfo.ordinal());
    tab.setWordWrap(false);
    ((Composite) tab).setTitle(tabInfo.tooltip);

    setTabEnabled(tabInfo, false);
  }
  getTab(Tab.RELATED_CHANGES).setShowIndirectAncestors(true);
  getTab(Tab.CHERRY_PICKS).setShowBranches(true);
  getTab(Tab.SAME_TOPIC).setShowBranches(true);
  getTab(Tab.SAME_TOPIC).setShowProjects(true);
  getTab(Tab.SAME_TOPIC).setShowSubmittable(true);
  getTab(Tab.SUBMITTED_TOGETHER).setShowBranches(true);
  getTab(Tab.SUBMITTED_TOGETHER).setShowProjects(true);
  getTab(Tab.SUBMITTED_TOGETHER).setShowSubmittable(true);
}
项目:qafe-platform    文件:SetPropertyHandler.java   
private void handleDisplayName(UIObject uiObject, BuiltInComponentGVO builtInComponentGVO,
        String value) {
    if (uiObject instanceof HasDataGridMethods) {
        HasDataGridMethods hasDataGridMethods = (HasDataGridMethods)uiObject;
        String uuid = builtInComponentGVO.getComponentIdUUID();
        if (uuid != null) {
            boolean containsColumn = uuid.contains(".");
            if (containsColumn) {
                String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", "");
                hasDataGridMethods.setColumnLabel(columnId, value);
            }
        }
    } else if (uiObject instanceof PushButton) {
        ((PushButton)uiObject).getUpFace().setText(value);
        ((PushButton)uiObject).getDownFace().setText(value);
    } else if (uiObject instanceof HasText) {
        HasText t = (HasText)uiObject;
        t.setText(value);
    } else if (uiObject instanceof VerticalPanel) {
        VerticalPanel vp = (VerticalPanel)uiObject;
        Widget tabPanelWidget = vp.getParent().getParent().getParent();
        if (tabPanelWidget instanceof TabPanel) {
            TabPanel tp = (TabPanel)tabPanelWidget;
            TabBar tb = tp.getTabBar();
            int tabCount =tp.getWidgetCount();
            for (int i=0;i < tabCount;i++){
                Widget w = tp.getWidget(i);
                if (w == vp){
                    tb.setTabText(i, value);
                }
            }
        }
    } else if (uiObject instanceof QWindowPanel) {
        QWindowPanel p = (QWindowPanel) uiObject;
        p.setCaption(value);
    }
}
项目:hexa.tools    文件:Ribbon.java   
public TabBar( Callback callback )
{
    this.callback = callback;

    Element div = DOM.createDiv();

    setElement( div );

    setStylePrimaryName( "RibbonTab" );

    clear = DOM.createDiv();
    clear.getStyle().setProperty( "clear", "both" );
    div.appendChild( clear );

    addDomHandler( new ClickHandler()
    {
        @Override
        public void onClick( ClickEvent event )
        {
            Element tgt = event.getNativeEvent().getEventTarget().cast();
            if( tgt.getParentElement() != getElement() )
                return;

            int index = DOM.getChildIndex( getElement(), tgt );
            if( index >= getTabCount() )
                return;

            selectTab( index );
        }
    }, ClickEvent.getType() );
}
项目:document-management-system    文件:TabWorkspaceExample.java   
@Override
public void setTab(TabBar tabBar, int tabIndex) {
    // TODO Auto-generated method stub

}
项目:document-management-system    文件:TabWorkspace.java   
@Override
public void setTab(TabBar tabBar, int tabIndex) {
    this.tabBar = tabBar;
    this.tabIndex = tabIndex;
}
项目:document-management-system    文件:TabWorkspace.java   
/**
 * Tab Workspace
 */
public TabWorkspace() {
    widgetExtensionList = new ArrayList<TabWorkspaceExtension>();
    workHandlerExtensionList = new ArrayList<WorkspaceHandlerExtension>();
    tabBar = new TabBar();
    tabBar.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            int index = indexCorrectedChangeViewIndex(event.getSelectedItem().intValue());

            switch (index) {
                case UIDockPanelConstants.DESKTOP:
                    Main.get().mainPanel.setView(UIDockPanelConstants.DESKTOP);
                    if (Main.get().activeFolderTree != null) { // On start up is null
                        Main.get().activeFolderTree.centerActulItemOnScroll(); // Center the actual item every time
                    }
                    break;

                case UIDockPanelConstants.SEARCH:
                    Main.get().mainPanel.setView(UIDockPanelConstants.SEARCH);
                    break;

                case UIDockPanelConstants.DASHBOARD:
                    Main.get().mainPanel.setView(UIDockPanelConstants.DASHBOARD);
                    break;

                case UIDockPanelConstants.ADMINISTRATION:
                    Main.get().mainPanel.setView(UIDockPanelConstants.ADMINISTRATION);
                    break;

                default:
                    Main.get().mainPanel.setView(index);
                    break;
            }

            fireEvent(HasWorkspaceEvent.STACK_CHANGED);
            tabVisited[index] = true;
        }
    });

    initWidget(tabBar);
}
项目:ephesoft    文件:Header.java   
public TabBar getTabBar() {
    return this.tabBar;
}
项目:firefly    文件:Toolbar.java   
TabHolder(TabBar.Tab tab, Button button, TTabBar tabBar) {
    this.tab = tab;
    this.button = button;
    this.tabBar = tabBar;
}
项目:hexa.tools    文件:Ribbon.java   
public Ribbon( RibbonDef conf, final RibbonCallback callback )
{
    this.callback = callback;
    m_conf = conf;

    FlowPanel panel = new FlowPanel();

    m_tabBar = new TabBar( new TabBar.Callback()
    {
        @Override
        public void onSelection( int index )
        {
            m_tabPanel.setWidget( m_tabs.get( index ) );
        }
    } );
    panel.add( m_tabBar );

    m_tabPanel = new SimplePanel();
    panel.add( m_tabPanel );

    /*
     * Definition of the Ribbon
     */

    m_tabs = new ArrayList<Widget>();
    for( int i = 0; i < conf.tabs.size(); i++ )
    {
        m_tabBar.addTab( conf.tabs.get( i ).name );

        final ButtonBar bar = new ButtonBar();
        for( int j = 0; j < conf.tabs.get( i ).buttons.size(); j++ )
        {
            final Object obj = conf.tabs.get( i ).buttons.get( j ).obj;

            Button button = new Button( conf.tabs.get( i ).buttons.get( j ).name, new ClickHandler()
            {
                @Override
                public void onClick( ClickEvent event )
                {
                    callback.onRibbonChange( obj );
                }
            } );

            bar.addButton( button, obj );
        }
        m_tabs.add( bar );
    }

    initWidget( panel );
    panel.setSize( "100%", "100%" );

    setStyleName( "Ribbon" );
    m_tabPanel.setStyleName( "RibbonPanel" );

    if( m_tabBar.getTabCount() > 0 )
        m_tabBar.selectTab( 0 );
}
项目:document-management-system    文件:HasWorkspaceExtension.java   
public abstract void setTab(TabBar tabBar, int tabIndex);