List of usage examples for com.vaadin.ui TabSheet getSelectedTab
public Component getSelectedTab()
From source file:br.com.anteros.mobileserver.app.form.TableForm.java
License:Apache License
public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabsheet = event.getTabSheet(); Tab tab = tabsheet.getTab(tabsheet.getSelectedTab()); if (tab != null) { buttons.removeComponent(buttonsFields); buttons.removeComponent(buttonsParameters); buttons.removeComponent(btnOk);/*from ww w .j av a2 s.c o m*/ buttons.removeComponent(btnCancel); if (tab.getCaption().equals("Campos")) { buttons.addComponent(buttonsFields); buttons.setExpandRatio(buttonsFields, 1); } else { buttons.addComponent(buttonsParameters); buttons.setExpandRatio(buttonsParameters, 1); } buttons.addComponent(btnOk); buttons.addComponent(btnCancel); buttons.setComponentAlignment(btnOk, Alignment.MIDDLE_RIGHT); buttons.setComponentAlignment(btnCancel, Alignment.MIDDLE_RIGHT); } }
From source file:ch.bfh.due1.srs.views.ReservationView.java
License:Open Source License
public ReservationView(Navigator navigator, RoomController roomController, ReservationController reservationController) { this.roomController = roomController; this.reservationController = reservationController; // setSizeFull(); addComponent(this.tabsheet); // Button button = new Button("Go to Room List View", new // Button.ClickListener() { // @Override/* w w w . j av a 2 s. c o m*/ // public void buttonClick(ClickEvent event) { // navigator.navigateTo(RoomListView.VIEWNAME); // } // }); // addComponent(button); // setComponentAlignment(button, Alignment.MIDDLE_CENTER); this.tabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { // Find the tab sheet TabSheet tabsheet = event.getTabSheet(); // Find the tab (it's a layout) Layout tab = (Layout) tabsheet.getSelectedTab(); // Get the tab caption from the tab object String roomName = tabsheet.getTab(tab).getCaption(); // Fill the tab content tab.removeAllComponents(); // Create table for selected room table = createTimeSlotTable(roomName); tab.addComponent(table); } }); }
From source file:com.jiangyifen.ec2.ui.LoginLayout.java
/** * ??????RoleType.manager//from w ww . j a va 2 s.c o m * @param roleType */ public void switchAccountView(RoleType roleType) { app.getMainWindow().removeAllComponents(); app.getMainWindow().addComponent(ec2LoginLayout); TabSheet tabSheet = ec2LoginLayout.getLoginTabSheet(); if (roleType.equals(RoleType.manager)) { tabSheet.setSelectedTab(1); } else if (roleType.equals(RoleType.csr)) { tabSheet.setSelectedTab(0); } LoginLayout loginLayout = (LoginLayout) tabSheet.getSelectedTab(); loginLayout.getUsernameTextField().setValue(loginUser.getUsername()); loginLayout.getPasswordTextField().setValue(loginUser.getPassword()); if (roleType.equals(RoleType.csr)) { loginLayout.getExtenNoField().setValue(exten); } loginLayout.loginClick(); }
From source file:com.oodrive.nuage.webui.VvrManagerUi.java
License:Apache License
/** * Initialize VVRs representation.//from w w w .j a va2 s . co m * * @param jmxHandler */ private final void initVvrManagerUi(final JmxHandler jmxHandler) { // Create Model for vvrManager vvrManagerModel = jmxHandler.createVvrManagerModel(); // Vvr representation vvrsTabsheet = new TabSheet(); vvrManagerLayout.addComponent(vvrsTabsheet); // Sheet 0 create new VVR final VerticalLayout lastLayout = new VerticalLayout(); lastLayout.setWidth("100%"); lastLayout.setHeight(lastLayoutHeight); vvrsTabsheet.addTab(lastLayout, "+"); // Add a sheet for each vvr final Set<UUID> vvrUuidList = vvrManagerModel.getVvrs(); for (final UUID vvrUuid : vvrUuidList) { addVvr(vvrUuid); } // Window to create a new vvr (display on the last tabsheet) final VvrCreateWindow createWindow = new VvrCreateWindow(new PostProcessing() { @Override public void execute() { // After creation select the first tab vvrsTabsheet.setSelectedTab(0); } }); vvrsTabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { @Override public void selectedTabChange(final SelectedTabChangeEvent event) { final TabSheet tabsheet = event.getTabSheet(); final String caption = tabsheet.getTab(tabsheet.getSelectedTab()).getCaption(); if (caption.equals("+")) { createWindow.add(vvrManagerModel); } else { // Remove window if another tab is selected createWindow.remove(); } } }); // If no other tab, display creation window (+ tab can not be selected) if (vvrUuidList.isEmpty()) { createWindow.add(vvrManagerModel); } }
From source file:com.skysql.manager.ui.TabbedPanel.java
License:Open Source License
/** * Instantiates a new tabbed panel.//from w w w . j a v a2 s . c om * * @param session the session */ public TabbedPanel(VaadinSession session) { this.session = session; // Set another root layout for the middle panels section. tabsheet = new TabSheet(); tabsheet.setImmediate(true); tabsheet.setSizeFull(); // INFO TAB panelInfo = new PanelInfo(); tabsheet.addTab(panelInfo).setCaption("Info"); currentTab = panelInfo; // CONTROL TAB panelControl = new PanelControl(); tabsheet.addTab(panelControl).setCaption("Control"); // BACKUP TAB panelBackup = new PanelBackup(); panelBackup.setImmediate(true); tabsheet.addTab(panelBackup).setCaption("Backups"); // TOOLS TAB // SystemInfo systemInfo = session.getAttribute(SystemInfo.class); // LinkedHashMap<String, String> properties = systemInfo.getCurrentSystem().getProperties(); // String EIP = properties.get(SystemInfo.PROPERTY_EIP); // String MONyog = properties.get(SystemInfo.PROPERTY_MONYOG); // String phpUrl = properties.get(SystemInfo.PROPERTY_PHPMYADMIN); // if ((EIP != null && MONyog != null) || phpUrl != null) { // panelTools = new PanelTools(); // panelTools.setImmediate(true); // tabsheet.addTab(panelTools).setCaption("Tools"); // } // ADD LISTENERS TO TABS tabsheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { public void selectedTabChange(SelectedTabChangeEvent event) { final TabSheet source = (TabSheet) event.getSource(); if (source == tabsheet) { Component selectedTab = source.getSelectedTab(); if (selectedTab != currentTab) { if (currentTab instanceof PanelInfo) { ((PanelInfo) currentTab).stopRefresh(); } currentTab = selectedTab; refresh(); } } } }); }
From source file:com.vphakala.VaadinUI.java
@Override protected void init(VaadinRequest request) { customerTab = new CustomerUI(customerService); subscriberTab = new SubscriberUI(subscriberService); mainLayout = new TabSheet(); mainLayout.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabsheet = event.getTabSheet(); Layout tab = (Layout) tabsheet.getSelectedTab(); if (tab == subscriberTab) { subscriberTab.setUIFields(customerTab.getEmail().getValue()); } else if (tab == customerTab) { // no action needed } else { Notification.show("*** shit happens ***"); }/*from ww w . j av a2 s . co m*/ } }); mainLayout.addTab(customerTab); mainLayout.addTab(subscriberTab); setContent(mainLayout); }
From source file:edu.vcu.csbc.vahmpexplorer.main.VaHMPExplorer.java
@Override public void selectedTabChange(SelectedTabChangeEvent event) { TabSheet tabSheet = event.getTabSheet(); Tab tab = tabSheet.getTab(tabSheet.getSelectedTab()); if (tab != null) { // getMainWindow().showNotification("Selected " + tab.getCaption() + " tab"); }//w ww . j ava2 s. c o m }
From source file:facs.components.BookAdmin.java
License:Open Source License
public BookAdmin(User user) { Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); System.out.println(ft.format(dNow) + " INFO Calendar Admin accessed! - User: " + LiferayAndVaadinUtils.getUser().getScreenName()); Label infoLabel = new Label( DBManager.getDatabaseInstance().getUserNameByUserID(LiferayAndVaadinUtils.getUser().getScreenName()) + " " + LiferayAndVaadinUtils.getUser().getScreenName()); infoLabel.addStyleName("h4"); String buttonRefreshTitle = "Refresh"; Button refresh = new Button(buttonRefreshTitle); refresh.setIcon(FontAwesome.REFRESH); refresh.setSizeFull();/*from w w w . j a va 2 s. c om*/ refresh.setDescription("Click here to reload the data from the database!"); refresh.addStyleName(ValoTheme.BUTTON_FRIENDLY); String buttonUpdateTitle = "Update"; Button updateUser = new Button(buttonUpdateTitle); updateUser.setIcon(FontAwesome.WRENCH); updateUser.setSizeFull(); updateUser.setDescription("Click here to update your user role and group!"); userDevice = new ListSelect("Select a device"); userDevice.addItems(DBManager.getDatabaseInstance().getDeviceNames()); userDevice.setRows(6); userDevice.setNullSelectionAllowed(false); userDevice.setSizeFull(); userDevice.setImmediate(true); /* * userDevice.addValueChangeListener(e -> Notification.show("Device:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userGroup = new ListSelect("Select a user group"); userGroup.addItems(DBManager.getDatabaseInstance().getUserGroups()); userGroup.setRows(6); userGroup.setNullSelectionAllowed(false); userGroup.setSizeFull(); userGroup.setImmediate(true); /* * userGroup.addValueChangeListener(e -> Notification.show("User Group:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ userRole = new ListSelect("Select a user role"); userRole.addItems(DBManager.getDatabaseInstance().getUserRoles()); userRole.setRows(6); userRole.setNullSelectionAllowed(false); userRole.setSizeFull(); userRole.setImmediate(true); /* * userRole.addValueChangeListener(e -> Notification.show("User Role:", * String.valueOf(e.getProperty().getValue()), Type.TRAY_NOTIFICATION)); */ refresh.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496269L; @Override public void buttonClick(ClickEvent event) { refreshDataSources(); } }); updateUser.addClickListener(new ClickListener() { private static final long serialVersionUID = -3610721151565496909L; @Override public void buttonClick(ClickEvent event) { try { if (userDevice.getValue().equals(null) || userRole.getValue().equals(null) || userGroup.getValue().equals(null)) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); // System.out.println("Device: "+userDevice.getValue()+" Group: "+userGroup.getValue()+" Role: "+userRole.getValue()); } else { DBManager.getDatabaseInstance().getShitDone( DBManager.getDatabaseInstance().getUserRoleIDbyDesc(userRole.getValue().toString()), DBManager.getDatabaseInstance() .getUserIDbyLDAPID(LiferayAndVaadinUtils.getUser().getScreenName()), DBManager.getDatabaseInstance() .getDeviceIDByName(userDevice.getValue().toString())); DBManager.getDatabaseInstance().getShitDoneAgain( DBManager.getDatabaseInstance() .getUserGroupIDByName(userGroup.getValue().toString()), LiferayAndVaadinUtils.getUser().getScreenName()); } } catch (Exception e) { showErrorNotification("Something's missing!", "Please make sure that you selected a Device, a Role and a Group! Each list has to have one highligthed option.'."); } refreshDataSources(); } }); // only admins are allowed to see the admin panel ;) if (!DBManager.getDatabaseInstance() .getUserAdminPanelAccessByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName()).equals("1")) { VerticalLayout errorLayout = new VerticalLayout(); infoLabel.setValue("ACCESS DENIED"); errorLayout.addComponent(infoLabel); showErrorNotification("Access Denied!", "Sorry, you're not allowed to see anything here, at least your username told us so. Do you need assistance? Please contact 'info@qbic.uni-tuebingen.de'."); setCompositionRoot(errorLayout); return; } this.setCaption("Admin"); final TabSheet bookAdmin = new TabSheet(); bookAdmin.addStyleName(ValoTheme.TABSHEET_FRAMED); bookAdmin.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS); ArrayList<String> deviceNames = new ArrayList<String>(); deviceNames = DBManager.getDatabaseInstance().getDeviceNames(); bookAdmin.addTab(awaitingRequestsGrid()); for (int i = 0; i < deviceNames.size(); i++) { bookAdmin.addTab(newDeviceGrid(deviceNames.get(i))); } bookAdmin.addTab(deletedBookingsGrid()); bookAdmin.addSelectedTabChangeListener(new SelectedTabChangeListener() { /** * */ private static final long serialVersionUID = 8987818794404251063L; @Override public void selectedTabChange(SelectedTabChangeEvent event) { userDevice.select(bookAdmin.getSelectedTab().getCaption()); userRole.select(DBManager.getDatabaseInstance() .getUserGroupDescriptionByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName(), DBManager .getDatabaseInstance().getDeviceIDByName(bookAdmin.getSelectedTab().getCaption()))); userGroup.select(DBManager.getDatabaseInstance() .getUserRoleNameByLDAPId(LiferayAndVaadinUtils.getUser().getScreenName())); } }); gridLayout.setWidth("100%"); // add components to the grid layout // gridLayout.addComponent(infoLabel, 0, 0, 3, 0); gridLayout.addComponent(bookAdmin, 0, 1, 5, 1); gridLayout.addComponent(refresh, 0, 2); gridLayout.addComponent(userDevice, 0, 4, 1, 4); gridLayout.addComponent(userRole, 2, 4, 3, 4); gridLayout.addComponent(userGroup, 4, 4, 5, 4); gridLayout.addComponent(updateUser, 0, 5, 5, 5); gridLayout.setSizeFull(); gridLayout.setSpacing(true); setCompositionRoot(gridLayout); /* * JavaScript to update the Grid try { JDBCConnectionPool connectionPool = new * SimpleJDBCConnectionPool("com.mysql.jdbc.Driver", * "jdbc:mysql://localhost:8889/facs_facility", "facs", "facs"); QueryDelegate qd = new * FreeformQuery("select * from facs_facility", connectionPool, "id"); final SQLContainer c = * new SQLContainer(qd); bookAdmin.setContainerDataSource(c); } * * JavaScript.getCurrent().execute("setInterval(function(){refreshTable();},5000);"); * JavaScript.getCurrent().addFunction("refreshTable", new JavaScriptFunction() { * * @Override public void call(JsonArray arguments) { // TODO Auto-generated method stub * * } }); */ }
From source file:fr.univlorraine.mondossierweb.MainUI.java
License:Apache License
/** * Cration des onglets pour l'enseignant */// ww w . j a v a 2 s .c o m private void ajoutOngletRecherche() { tabSheetEnseignant.setSizeFull(); //Onglet recherche rapide tabSheetEnseignant.addTab(rechercheRapideView, applicationContext.getMessage("mainUI.rechercherapide.title", null, getLocale()), FontAwesome.SEARCH); viewEnseignantTab.put(rechercheRapideView.NAME, 0); //Onglet recherche arborescente tabSheetEnseignant.addTab(rechercheArborescenteView, applicationContext.getMessage("mainUI.recherchearbo.title", null, getLocale()), FontAwesome.SITEMAP); viewEnseignantTab.put(rechercheArborescenteView.NAME, 1); //Onglet favoris tabSheetEnseignant.addTab(favorisView, "Favoris", FontAwesome.STAR_O); viewEnseignantTab.put(favorisView.NAME, 2); //On gre le changement d'onglet effectu par l'utilisateur tabSheetEnseignant.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { public void selectedTabChange(SelectedTabChangeEvent event) { //On rcupre le tabSheet TabSheet tabsheet = event.getTabSheet(); //On rcupre la vue afficher View vue = (View) tabsheet.getSelectedTab(); //Si l'utilisateur veut afficher la vue des favoris if (vue instanceof FavorisView) { //On initialise la vue favorisView.init(); } //Si l'utilisateur veut afficher la vue de la liste des inscrits if (vue instanceof ListeInscritsView) { //On refresh la vue listeInscritsView.refresh(); } //Si l'utilisateur veut afficher la vue de la recherche arborescente if (vue instanceof RechercheArborescenteView) { //On refresh la vue rechercheArborescenteView.refresh(); } } }); //Ajout de l'onglet contenant la liste des inscrits addTabListeInscrits(); //Ajout du tabSheet dans le layout layoutOngletRecherche.addComponent(tabSheetEnseignant); //On passe le layout en sizeFull layoutOngletRecherche.setSizeFull(); //Le tabSheet prend toute la place disponible dans le layout layoutOngletRecherche.setExpandRatio(tabSheetEnseignant, 1); }
From source file:org.eclipse.hawkbit.ui.rollout.rollout.AddUpdateRolloutWindowLayout.java
License:Open Source License
private static int getPositionOfSelectedTab(final TabSheet tabSheet) { return tabSheet.getTabPosition(tabSheet.getTab(tabSheet.getSelectedTab())); }