List of usage examples for com.vaadin.ui TabSheet.CloseHandler TabSheet.CloseHandler
TabSheet.CloseHandler
From source file:com.expressui.core.view.form.TypedForm.java
License:Open Source License
private void initializeOptionalTabs(VerticalLayout layout) { final Set<String> tabNames = getFormFieldSet().getTabNames(); menu = new LayoutContextMenu(layout); for (String tabName : tabNames) { TabSheet.Tab tab = getTabByName(tabName); if (getFormFieldSet().isTabOptional(tabName)) { tab.setClosable(true);// ww w. ja v a 2s.c om menu.addAction(uiMessageSource.getMessage("typedForm.add") + " " + tabName, this, "executeContextAction").setVisible(true); menu.addAction(uiMessageSource.getMessage("typedForm.remove") + " " + tabName, this, "executeContextAction").setVisible(false); setIsRequiredEnable(tabName, false); tab.setVisible(false); } tab.setDescription(uiMessageSource.getToolTip("typedForm.tab.toolTip")); } formTabSheet.setCloseHandler(new TabSheet.CloseHandler() { @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { String tabName = tabsheet.getTab(tabContent).getCaption(); String actionName = uiMessageSource.getMessage("typedForm.remove") + " " + tabName; executeContextAction(actionName); } }); }
From source file:com.purebred.core.view.FormComponent.java
License:Open Source License
private void initializeOptionalTabs(VerticalLayout layout) { final Set<String> tabNames = getFormFields().getTabNames(); menu = new LayoutContextMenu(layout); for (String tabName : tabNames) { TabSheet.Tab tab = getTabByName(tabName); if (getFormFields().isTabOptional(tabName)) { tab.setClosable(true);//w w w . j a v a2 s. c o m menu.addAction(uiMessageSource.getMessage("formComponent.add") + " " + tabName, this, "executeContextAction").setVisible(true); menu.addAction(uiMessageSource.getMessage("formComponent.remove") + " " + tabName, this, "executeContextAction").setVisible(false); setIsRequiredEnable(tabName, false); tab.setVisible(false); } tab.setDescription(uiMessageSource.getMessage("formComponent.tab.description")); } tabSheet.setCloseHandler(new TabSheet.CloseHandler() { @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { String tabName = tabsheet.getTab(tabContent).getCaption(); String actionName = uiMessageSource.getMessage("formComponent.remove") + " " + tabName; executeContextAction(actionName); } }); }