List of usage examples for com.vaadin.ui TabSheet addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:org.openeos.services.ui.vaadin.internal.OpenWindowCommand.java
License:Apache License
@Override public void menuSelected(MenuItem selectedItem) { if (windowComponent == null) windowComponent = windowFactory.createWindowComponent(window, application); final TabSheet tabSheet = application.getConcreteApplication().getMainTabSheet(); tabSheet.addListener(new ComponentContainer.ComponentDetachListener() { private static final long serialVersionUID = 1L; @Override/*from w ww.ja va 2s.c om*/ public void componentDetachedFromContainer(ComponentDetachEvent event) { if (event.getDetachedComponent() == windowComponent) { windowComponent = null; tabSheet.removeListener(this); } } }); Tab tab = tabSheet.addTab(windowComponent, window.getName()); tab.setClosable(true); tab.setDescription(window.getDescription()); tabSheet.setSelectedTab(tab); }
From source file:ro.zg.netcell.vaadin.action.UserActionListHandler.java
License:Apache License
@Override public void handle(final ActionContext actionContext) throws Exception { ComponentContainer displayArea = actionContext.getTargetContainer(); displayArea.removeAllComponents();// w w w . java2 s . c om UserActionList ual = (UserActionList) actionContext.getUserAction(); final OpenGroupsApplication app = actionContext.getApp(); final Entity entity = actionContext.getEntity(); final TabSheet actionsTabSheet = new TabSheet(); actionsTabSheet.addStyleName(Reindeer.TABSHEET_MINIMAL); // actionsTabSheet.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); actionsTabSheet.addStyleName(OpenGroupsStyles.USER_ACTIONS_TABSHEET); // final CssLayout contentArea = new CssLayout(); // contentArea.setWidth("100%"); // contentArea.setStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); // displayArea.addComponent(contentArea); /* add listener */ actionsTabSheet.addListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabSheet = event.getTabSheet(); AbstractComponentContainer selectedTabContent = (AbstractComponentContainer) tabSheet .getSelectedTab(); UserAction ua = (UserAction) selectedTabContent.getData(); if (entity != null) { Deque<String> desiredActionsQueue = entity.getState().getDesiredActionTabsQueue(); /* * if a desired action exists, it will be set afterwards, otherwise allow the first action from the * list to be selected by default */ if (desiredActionsQueue.size() != 0) { String nextAction = desiredActionsQueue.peek(); if (nextAction.equals(ua.getActionName())) { /* remove action from the queue */ desiredActionsQueue.remove(); } else { /* * if this action does not match with the next desired action, do nothing */ return; } } else { entity.getState().resetPageInfo(); } } if (ua instanceof UserActionList) { // selectedTabContent.removeStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); // contentArea.setWidth("100%"); // contentArea.setMargin(false); // selectedTabContent.setMargin(false); ua.executeHandler(entity, app, selectedTabContent, false, actionContext); } else { // selectedTabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); // contentArea.setWidth("99.5%"); // contentArea.setMargin(true); // selectedTabContent.setMargin(true); // selectedTabContent.setWidth("100%"); if (entity != null) { entity.getState().setCurrentTabAction(ua); entity.getState().setCurrentTabActionContainer(selectedTabContent); entity.getState().setCurrentActionsPath(ua.getFullActionPath()); // entity.getState().getDesiredActionTabsQueue().clear(); // entity.getState().resetPageInfoForCurrentAction(); actionContext.getWindow().setFragmentToEntity(entity); } ua.executeHandler(entity, app, selectedTabContent, false, actionContext); } } }); /* add the tabsheet to the target component */ // List<String> currentUserTypes = getCurrentUserTypes(entity, app); Map<String, ComponentContainer> actionPathContainers = new HashMap<String, ComponentContainer>(); List<UserAction> actionsList = new ArrayList<UserAction>(ual.getActions().values()); for (UserAction cua : actionsList) { /* display only the actions that the user is allowed to see */ // if (!cua.allowRead(currentUserTypes)) { if (!cua.isVisible(actionContext)) { continue; } CssLayout tabContent = new CssLayout(); if (cua instanceof UserActionList) { // tabContent.setMargin(false); // contentArea.setMargin(false); // tabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); // tabContent.setWidth("100%"); } else { // tabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); tabContent.setMargin(true); // contentArea.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); // contentArea.setMargin(true); } tabContent.addStyleName(OpenGroupsStyles.USER_ACTION_CONTENT_PANE); actionPathContainers.put(cua.getActionName(), tabContent); tabContent.setData(cua); actionsTabSheet.addTab(tabContent, cua.getDisplayName(), null); } displayArea.addComponent(actionsTabSheet); if (entity != null) { Deque<String> desiredActionsQueue = entity.getState().getDesiredActionTabsQueue(); if (desiredActionsQueue.size() != 0) { // System.out.println("desired actions: " + // entity.getState().getDesiredActionsPath()); // System.out.println("full url: "+app.getFullUrl()); /* select the tab specified by the next desired action */ actionsTabSheet.setSelectedTab(actionPathContainers.get(desiredActionsQueue.peek())); } } }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
@Override public void init() { setUser(Flash.login());//ww w . j a v a 2 s. c o m setTheme("custom"); TabSheet t = new TabSheet(); t.addStyleName(Reindeer.TABSHEET_MINIMAL); t.setSizeFull(); t.setCloseHandler(new DelegateCloseHandler()); UserInfoPanel.addClosableToTabSheet(t, getUser().toString()); TreeTableOrganization treeTableOrganization = new TreeTableOrganization(); CrudNews showNews = new CrudNews(); table = treeTableOrganization.getTreeTable(); Tab orgsTab = t.addTab(treeTableOrganization, ""); t.setSelectedTab(orgsTab); t.addTab(new GroupTab(), ""); GwsSystemTab systemTab = new GwsSystemTab(); t.addTab(systemTab, " ??"); t.addListener(systemTab); GwsLazyTab gwsLazyTab = new GwsLazyTab(); t.addTab(gwsLazyTab, "? ??"); t.addListener(gwsLazyTab); t.addTab(createEmployeeWidget(), ""); RefreshableTab settings = createSettings(); t.addTab(settings, "??"); t.addListener(settings); Component businessCalendar = createBusinessCalendar(); t.addTab(businessCalendar, "? "); LogTab logTab = new LogTab(); t.addListener(logTab); t.addTab(logTab, ""); t.addTab(showNews, "??"); t.addTab(registryTab(), "?"); setMainWindow(new Window( getUser() + " | | -" + Activator.getContext().getBundle().getVersion(), t)); AdminServiceProvider.get().createLog(Flash.getActor(), "Admin application", (String) getUser(), "login", null, true); }
From source file:ru.codeinside.adm.ui.AdminApp.java
License:Mozilla Public License
private Component createEmployeeWidget() { final TabSheet tabSheet = new TabSheet(); tabSheet.addStyleName(Reindeer.TABSHEET_MINIMAL); tabSheet.setSizeFull();//from w ww. j av a 2 s .c o m tabSheet.addTab(new EmployeeWidget(false, table), "?"); tabSheet.addTab(new EmployeeWidget(true, table), ""); tabSheet.addListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) { EmployeeWidget currentTab = (EmployeeWidget) tabSheet.getSelectedTab(); currentTab.refreshList(); } }); return tabSheet; }
From source file:ru.codeinside.gses.webui.Workplace.java
License:Mozilla Public License
public Workplace(String login, Set<Role> roles, boolean production) { TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull();//w w w. ja v a 2 s .com tabSheet.setStyleName(Reindeer.TABSHEET_BORDERLESS); tabSheet.setCloseHandler(new DelegateCloseHandler()); if (!production) { new MemoryUsage(tabSheet); } UserInfoPanel.addClosableToTabSheet(tabSheet, login); if (roles.contains(Role.Executor)) { TabChanger archiveChanger = new TabChanger(tabSheet); archiveChanger.set(ArchiveFactory.create(), "?"); TabChanger executorChanger = new TabChanger(tabSheet); executorChanger.set(ExecutorFactory.create(executorChanger, tabSheet), "?"); } if (roles.contains(Role.Declarant)) { new TabChanger(tabSheet).set(DeclarantFactory.create(), " ?"); } if (roles.contains(Role.Supervisor) || roles.contains(Role.SuperSupervisor)) { new TabChanger(tabSheet).set(new SupervisorWorkplace(), " ??"); } if (roles.contains(Role.SuperSupervisor)) { new TabChanger(tabSheet).set(new TaskManager(), "?? ??"); } if (roles.contains(Role.Manager)) { new TabChanger(tabSheet).set(new ManagerWorkplace(), " "); } if (roles.contains(Role.Executor) || roles.contains(Role.Declarant) || roles.contains(Role.Supervisor) || roles.contains(Role.SuperSupervisor)) { SmevTasksPanel smevTasksPanel = new SmevTasksPanel(); tabSheet.addTab(smevTasksPanel, " "); tabSheet.addListener(smevTasksPanel); } setCompositionRoot(tabSheet); setSizeFull(); }