use of com.haulmont.cuba.web.gui.ManagedMainTabSheetMode in project cuba by cuba-platform.
the class WebAppWorkArea method createTabbedModeContainer.
protected HasTabSheetBehaviour createTabbedModeContainer() {
Configuration configuration = beanLocator.get(Configuration.NAME);
WebConfig webConfig = configuration.getConfig(WebConfig.class);
if (webConfig.getMainTabSheetMode() == MainTabSheetMode.DEFAULT) {
CubaMainTabSheet cubaTabSheet = new CubaMainTabSheet();
tabbedContainer = cubaTabSheet;
cubaTabSheet.setDragMode(LayoutDragMode.CLONE);
cubaTabSheet.setDropHandler(new TabSheetReorderingDropHandler());
Action.Handler actionHandler = createTabSheetActionHandler(cubaTabSheet);
cubaTabSheet.addActionHandler(actionHandler);
cubaTabSheet.setCloseOthersHandler(this::closeOtherTabWindows);
cubaTabSheet.setCloseAllTabsHandler(this::closeAllTabWindows);
cubaTabSheet.addSelectedTabChangeListener(event -> {
fireTabChangedEvent(tabbedContainer.getTabSheetBehaviour());
reflectTabChangeToUrl(event.isUserOriginated());
});
} else {
CubaManagedTabSheet cubaManagedTabSheet = new CubaManagedTabSheet();
ManagedMainTabSheetMode tabSheetMode = configuration.getConfig(WebConfig.class).getManagedMainTabSheetMode();
cubaManagedTabSheet.setMode(CubaManagedTabSheet.Mode.valueOf(tabSheetMode.name()));
tabbedContainer = cubaManagedTabSheet;
cubaManagedTabSheet.setDragMode(LayoutDragMode.CLONE);
cubaManagedTabSheet.setDropHandler(new TabSheetReorderingDropHandler());
Action.Handler actionHandler = createTabSheetActionHandler(cubaManagedTabSheet);
cubaManagedTabSheet.addActionHandler(actionHandler);
cubaManagedTabSheet.setCloseOthersHandler(this::closeOtherTabWindows);
cubaManagedTabSheet.setCloseAllTabsHandler(this::closeAllTabWindows);
cubaManagedTabSheet.addSelectedTabChangeListener(event -> {
fireTabChangedEvent(tabbedContainer.getTabSheetBehaviour());
reflectTabChangeToUrl(event.isUserOriginated());
});
}
tabbedContainer.setHeight(100, Sizeable.Unit.PERCENTAGE);
tabbedContainer.setStyleName(TABBED_CONTAINER_STYLENAME);
tabbedContainer.addStyleName(ValoTheme.TABSHEET_FRAMED);
tabbedContainer.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
return tabbedContainer;
}
Aggregations