本文整理汇总了Java中com.google.gwt.user.client.ui.TabBar类的典型用法代码示例。如果您正苦于以下问题:Java TabBar类的具体用法?Java TabBar怎么用?Java TabBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabBar类属于com.google.gwt.user.client.ui包,在下文中一共展示了TabBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSelection
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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;
}
示例2: addButton
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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);
}
示例3: getSelectedCommand
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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;
}
示例4: indexOf
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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;
}
示例5: findTab
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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;
}
示例6: onBeforeSelection
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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();
}
}
示例7: initTabBar
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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);
}
示例8: handleDisplayName
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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);
}
}
示例9: TabBar
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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() );
}
示例10: setTab
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
@Override
public void setTab(TabBar tabBar, int tabIndex) {
// TODO Auto-generated method stub
}
示例11: setTab
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
@Override
public void setTab(TabBar tabBar, int tabIndex) {
this.tabBar = tabBar;
this.tabIndex = tabIndex;
}
示例12: TabWorkspace
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
/**
* 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);
}
示例13: getTabBar
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
public TabBar getTabBar() {
return this.tabBar;
}
示例14: TabHolder
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
TabHolder(TabBar.Tab tab, Button button, TTabBar tabBar) {
this.tab = tab;
this.button = button;
this.tabBar = tabBar;
}
示例15: Ribbon
import com.google.gwt.user.client.ui.TabBar; //导入依赖的package包/类
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 );
}