当前位置: 首页>>代码示例>>Java>>正文


Java CloseHandler类代码示例

本文整理汇总了Java中com.vaadin.ui.TabSheet.CloseHandler的典型用法代码示例。如果您正苦于以下问题:Java CloseHandler类的具体用法?Java CloseHandler怎么用?Java CloseHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloseHandler类属于com.vaadin.ui.TabSheet包,在下文中一共展示了CloseHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test2

import com.vaadin.ui.TabSheet.CloseHandler; //导入依赖的package包/类
@Test
public void test2() {
    FVerticalLayout c1 = new FVerticalLayout();
    FHorizontalLayout c2 = new FHorizontalLayout();
    FGridLayout c3 = new FGridLayout();
    FCssLayout c4 = new FCssLayout();
    FVerticalLayout c5 = new FVerticalLayout();

    FTabSheet tabSheet = new FTabSheet().withCaption("My TabSheet")
                                        .withSelectedTabChangeListener(event -> System.out.println("tab changed"))
                                        .withTab(c1)
                                        .withTab(c2, 0)
                                        .withTab(c3, "tab 3")
                                        .withTab(c4, "tab 4", VaadinIcons.ADD_DOCK)
                                        .withTab(c5, "tab 5", VaadinIcons.COMMENTS, 1)
                                        .withSelectedTab(0)
                                        .withTabsVisible(false)
                                        .withCloseHandler(new CloseHandler() {
                                            
                                            private static final long serialVersionUID = 6764130489982068799L;

                                            @Override
                                            public void onTabClose(TabSheet tabsheet, Component tabContent) {
                                                System.out.println("tab closed");
                                            }
                                        });

    tabSheet.removeComponent(c5);

    assertEquals("My TabSheet", tabSheet.getCaption());
    assertEquals(1, tabSheet.getListeners(SelectedTabChangeEvent.class).size());
    assertEquals(4, tabSheet.getComponentCount());
    assertEquals(c1, tabSheet.getTab(1).getComponent());
    assertEquals(c2, tabSheet.getTab(0).getComponent());
    assertEquals(c3, tabSheet.getTab(2).getComponent());
    assertEquals(c4, tabSheet.getTab(3).getComponent());
    assertNull(tabSheet.getTab(c5));
    assertEquals(c2, tabSheet.getSelectedTab());
    assertFalse(tabSheet.isTabCaptionsAsHtml());
    assertFalse(tabSheet.isTabsVisible());

}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:43,代码来源:FTabSheetTest.java

示例2: withCloseHandler

import com.vaadin.ui.TabSheet.CloseHandler; //导入依赖的package包/类
/**
 * Provide a custom {@link CloseHandler} for this TabSheet if you wish to
 * perform some additional tasks when a user clicks on a tabs close button,
 * e.g. show a confirmation dialogue before removing the tab.
 *
 * To remove the tab, if you provide your own close handler, you must call
 * {@link #removeComponent(Component)} yourself.
 *
 * The default CloseHandler for TabSheet will only remove the tab.
 *
 * @param handler
 *              the close handler
 * @return this for method chaining
 * @see TabSheet#setCloseHandler(CloseHandler)
 */
@SuppressWarnings("unchecked")
public default THIS withCloseHandler(CloseHandler handler) {
    ((TabSheet) this).setCloseHandler(handler);
    return (THIS) this;
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:21,代码来源:FluentTabSheet.java


注:本文中的com.vaadin.ui.TabSheet.CloseHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。