List of usage examples for com.vaadin.ui TabSheet addStyleName
@Override public void addStyleName(String style)
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue/* w ww . jav a 2 s . com*/ */ @PostConstruct public void init() { LOG.debug(userController.getCurrentUserName() + " EtatCivilView"); //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())) { if (MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { LOG.debug(userController.getCurrentUserName() + " init EtatCivilView"); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); /* Generalites */ FormLayout formGeneralitesLayout = new FormLayout(); formGeneralitesLayout.setSpacing(true); formGeneralitesLayout.setMargin(true); Panel panelGeneralites = new Panel( applicationContext.getMessage(NAME + ".generalites.title", null, getLocale())); String captionNumDossier = applicationContext.getMessage(NAME + ".numdossier.title", null, getLocale()); Label fieldNumDossier = new Label(); formatLabel(fieldNumDossier, captionNumDossier, MainUI.getCurrent().getEtudiant().getCod_etu()); formGeneralitesLayout.addComponent(fieldNumDossier); String captionNNE = applicationContext.getMessage(NAME + ".nne.title", null, getLocale()); Label fieldNNE = new Label(); formatLabel(fieldNNE, captionNNE, MainUI.getCurrent().getEtudiant().getCod_nne()); formGeneralitesLayout.addComponent(fieldNNE); String captionNom = applicationContext.getMessage(NAME + ".nom.title", null, getLocale()); Label fieldNom = new Label(); formatLabel(fieldNom, captionNom, MainUI.getCurrent().getEtudiant().getNom()); formGeneralitesLayout.addComponent(fieldNom); String captionMail = applicationContext.getMessage(NAME + ".mail.title", null, getLocale()); Label mailLabel = new Label(); mailLabel.setCaption(captionMail); String mail = MainUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); } mailLabel.setSizeFull(); formGeneralitesLayout.addComponent(mailLabel); String captionNationalite = applicationContext.getMessage(NAME + ".nationalite.title", null, getLocale()); Label fieldNationalite = new Label(); formatLabel(fieldNationalite, captionNationalite, MainUI.getCurrent().getEtudiant().getNationalite()); formGeneralitesLayout.addComponent(fieldNationalite); String captionDateNaissance = applicationContext.getMessage(NAME + ".naissance.title", null, getLocale()); Label fieldDateNaissance = new Label(); formatLabel(fieldDateNaissance, captionDateNaissance, MainUI.getCurrent().getEtudiant().getDatenaissance()); formGeneralitesLayout.addComponent(fieldDateNaissance); String captionLieuNaissance = applicationContext.getMessage(NAME + ".lieunaissance.title", null, getLocale()); Label fieldLieuNaissance = new Label(); formatLabel(fieldLieuNaissance, captionLieuNaissance, MainUI.getCurrent().getEtudiant().getLieunaissance()); formGeneralitesLayout.addComponent(fieldLieuNaissance); String captionDepNaissance = applicationContext.getMessage(NAME + ".depnaissance.title", null, getLocale()); Label fieldDepNaissance = new Label(); formatLabel(fieldDepNaissance, captionDepNaissance, MainUI.getCurrent().getEtudiant().getDepartementnaissance()); formGeneralitesLayout.addComponent(fieldDepNaissance); panelGeneralites.setContent(formGeneralitesLayout); HorizontalLayout generalitesGlobalLayout = new HorizontalLayout(); generalitesGlobalLayout.setSizeUndefined(); generalitesGlobalLayout.setStyleName("firstitembox"); generalitesGlobalLayout.addComponent(panelGeneralites); generalitesGlobalLayout.setExpandRatio(panelGeneralites, 1); idLayout.addComponent(generalitesGlobalLayout); /* Bac */ Panel panelBac = new Panel(applicationContext.getMessage(NAME + ".bac.title", null, getLocale())); //Si plusieurs bac if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() > 1) { panelBac.setCaption(applicationContext.getMessage(NAME + ".bacs.title", null, getLocale())); TabSheet bacTabSheet = new TabSheet(); VerticalLayout vBacLayout = new VerticalLayout(); vBacLayout.setSizeFull(); bacTabSheet.setSizeFull(); bacTabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED); for (BacEtatCivil bec : MainUI.getCurrent().getEtudiant().getListeBac()) { FormLayout tabBacLayout = new FormLayout(); tabBacLayout.setSizeFull(); tabBacLayout.setMargin(false); ajouterBacToView(tabBacLayout, bec); bacTabSheet.addTab(tabBacLayout, bec.getCod_bac(), FontAwesome.GRADUATION_CAP); } vBacLayout.addComponent(bacTabSheet); panelBac.setContent(vBacLayout); } else { //Si un seul bac FormLayout formBacLayout = new FormLayout(); formBacLayout.setSizeFull(); if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() == 1) { formBacLayout.setSpacing(true); formBacLayout.setMargin(true); ajouterBacToView(formBacLayout, MainUI.getCurrent().getEtudiant().getListeBac().get(0)); } panelBac.setContent(formBacLayout); } HorizontalLayout bacGlobalLayout = new HorizontalLayout(); bacGlobalLayout.setSizeUndefined(); bacGlobalLayout.setStyleName("itembox"); bacGlobalLayout.addComponent(panelBac); bacGlobalLayout.setExpandRatio(panelBac, 1); idLayout.addComponent(bacGlobalLayout); /* Info de contact */ panelContact = new Panel(applicationContext.getMessage(NAME + ".contact.title", null, getLocale())); renseignerPanelContact(); globalLayout.addComponent(panelContact); addComponent(globalLayout); } else { /* Erreur */ addComponent(new BasicErreurMessageLayout(applicationContext)); } } }
From source file:gov.osti.doecode.RepositoryForm.java
/** * Create a basic form UI for editing software metadata information. * //from w ww. ja v a 2s . c o m * @param ui link to the MyUI parent UI */ public RepositoryForm(MyUI ui) { this.ui = ui; setSizeUndefined(); agentGrid.setColumns("firstName", "lastName", "email"); agentGrid.setHeightMode(HeightMode.ROW); agentGrid.setHeightByRows(8); idGrid.setColumns("relationType", "identifierType", "value"); idGrid.setHeightMode(HeightMode.ROW); idGrid.setHeightByRows(8); idForm = new IdentifierForm(this); agentForm = new AgentForm(this); TabSheet tabs = new TabSheet(); tabs.addStyleName(ValoTheme.TABSHEET_FRAMED); tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); addComponent(tabs); HorizontalLayout main = new HorizontalLayout(); main.setSpacing(true); main.setMargin(true); FormLayout left = new FormLayout(); FormLayout right = new FormLayout(); countryCode.addItems(countryCodes); left.addComponents(url, loadButton, name, openSource, siteOwnershipCode, acronym, doi, countryCode); right.addComponents(keywords, rights, license, operatingSystem, siteAccessionNumber, otherRequirements); loadButton.addClickListener(e -> { try { SoftwareRepository repo = Reader.loadRepository("doecode"); setSoftwareRepository(repo); } catch (IOException ex) { setComponentError(new UserError("Unable to load: " + ex.getMessage())); } }); main.addComponents(left, right); tabs.addTab(main, "Metadata"); Button agentAddButton = new Button("New"); agentAddButton.setStyleName(BaseTheme.BUTTON_LINK); agentAddButton.setIcon(FontAwesome.PLUS); agentAddButton.addClickListener(e -> { agentForm.setAgent(new Agent()); }); VerticalLayout innerAgent = new VerticalLayout(agentAddButton, agentGrid); innerAgent.setSizeUndefined(); HorizontalLayout agentLayout = new HorizontalLayout(innerAgent, agentForm); agentLayout.setSpacing(true); agentLayout.setMargin(true); tabs.addTab(agentLayout, "Agents"); Button idAddButton = new Button("New"); idAddButton.setIcon(FontAwesome.PLUS); idAddButton.setStyleName(BaseTheme.BUTTON_LINK); idAddButton.setSizeUndefined(); idAddButton.addClickListener(e -> { idForm.setIdentifier(new Identifier()); }); VerticalLayout innerId = new VerticalLayout(idAddButton, idGrid); HorizontalLayout idTab = new HorizontalLayout(innerId, idForm); idTab.setSpacing(true); idTab.setMargin(true); tabs.addTab(idTab, "Identifiers"); agentGrid.addSelectionListener(e -> { if (!e.getSelected().isEmpty()) { Agent agent = (Agent) e.getSelected().iterator().next(); agentForm.setAgent(agent); System.out.println("Selected " + agent.getFirstName()); } }); idGrid.addSelectionListener(e -> { if (!e.getSelected().isEmpty()) { Identifier identifier = (Identifier) e.getSelected().iterator().next(); idForm.setIdentifier(identifier); } }); }
From source file:org.accelerators.activiti.admin.ui.MainView.java
License:Open Source License
public MainView(AdminApp application) { // Set application this.app = application; // Setup main layout setStyleName(Reindeer.LAYOUT_WHITE); setMargin(false);/*from w w w .j a v a 2 s. c o m*/ setSpacing(false); setSizeFull(); // Add header GridLayout header = new GridLayout(2, 1); header.setWidth("100%"); header.setHeight("34px"); addComponent(header); // Add header styles header.addStyleName(Consts.HEADER); header.addStyleName("header"); header.setSpacing(true); // Add title to header GridLayout logoGrid = new GridLayout(1, 1); header.addComponent(logoGrid, 0, 0); header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT); Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png")); logoImage.setType(Embedded.TYPE_IMAGE); logoImage.addStyleName("header-image"); logoGrid.addComponent(logoImage, 0, 0); logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER); // Add logout button to header GridLayout logoutGrid = new GridLayout(2, 1); Label userLabel = new Label("Signed in as: " + app.getUser().toString()); userLabel.addStyleName("user"); logout.setStyleName(Reindeer.BUTTON_LINK); logout.addStyleName("logout"); logoutGrid.addComponent(userLabel, 0, 0); logoutGrid.addComponent(logout, 1, 0); header.addComponent(logoutGrid, 1, 0); header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT); // Create tab sheet TabSheet tabs = new TabSheet(); tabs.setSizeFull(); // Add tab styles tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS); tabs.addStyleName(Reindeer.LAYOUT_WHITE); // Add task view tab tabs.addTab(new UserTab(app)); tabs.addTab(new GroupTab(app)); // Add tab sheet to layout addComponent(tabs); setExpandRatio(tabs, 1.0F); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); addComponent(footerText); setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); }
From source file:org.activiti.administrator.ui.MainView.java
License:Apache License
public MainView(AdminApp application) { // Set application this.app = application; // Setup main layout setStyleName(Reindeer.LAYOUT_WHITE); setMargin(false);/* w w w . ja va2s. co m*/ setSpacing(false); setSizeFull(); // Create tab sheet TabSheet tabs = new TabSheet(); tabs.setSizeFull(); // Add tab styles tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS); tabs.addStyleName(Reindeer.LAYOUT_WHITE); // Add task view tab tabs.addTab(new UserTab(app)); tabs.addTab(new GroupTab(app)); // Add tab sheet to layout addComponent(tabs); setExpandRatio(tabs, 1.0F); // Add footer text Label footerText = new Label(app.getMessage(Messages.Footer)); footerText.setSizeUndefined(); footerText.setStyleName(Reindeer.LABEL_SMALL); footerText.addStyleName("footer"); addComponent(footerText); setComponentAlignment(footerText, Alignment.BOTTOM_CENTER); }
From source file:org.jumpmind.vaadin.ui.common.CommonUiUtils.java
License:Open Source License
public static void styleTabSheet(TabSheet tabSheet) { tabSheet.setSizeFull();/* ww w .ja v a 2s . c om*/ tabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED); tabSheet.addStyleName(ValoTheme.TABSHEET_COMPACT_TABBAR); tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); }
From source file:org.opennms.features.vaadin.config.SnmpCollectionAdminApplication.java
License:Open Source License
@Override public void init(VaadinRequest request) { if (dataCollectionDao == null) throw new RuntimeException("dataCollectionDao cannot be null."); TabSheet tabs = new TabSheet(); tabs.addStyleName("light"); tabs.setSizeFull();//from www . ja v a2 s . c o m tabs.addTab(new SnmpCollectionPanel(dataCollectionDao, new SimpleLogger())); tabs.addTab(new DataCollectionGroupAdminPanel(dataCollectionDao)); setContent(tabs); }
From source file:org.opennms.features.vaadin.datacollection.DataCollectionGroupPanel.java
License:Open Source License
/** * Instantiates a new data collection group panel. * * @param dataCollectionConfigDao the OpenNMS Data Collection Configuration DAO * @param group the data collection group object * @param logger the logger object//from www .ja v a 2 s . com * @param existingFile the existing file */ public DataCollectionGroupPanel(final DataCollectionConfigDao dataCollectionConfigDao, final DatacollectionGroup group, final Logger logger, final File existingFile) { this.existingFile = existingFile; setCaption("Data Collection"); addStyleName("light"); // Data Collection Group - Main Fields groupName.setPropertyDataSource(new ObjectProperty<String>(group.getName())); groupName.setNullSettingAllowed(false); groupName.setImmediate(true); if (isExistingGroup()) { // If we allow to rename an existing group, we should modify the SNMP Collection as well groupName.setEnabled(false); } boolean mibGroupEditable = !(isExistingGroup() && ResourceTypeUtils.isStoreByGroup()); resourceTypes = new ResourceTypePanel(dataCollectionConfigDao, group, logger); groups = new GroupPanel(dataCollectionConfigDao, group, logger, mibGroupEditable); systemDefs = new SystemDefPanel(dataCollectionConfigDao, group, logger); // Button Toolbar final HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addComponent(new Button("Save Data Collection File", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { processDataCollection(dataCollectionConfigDao, logger); } })); toolbar.addComponent(new Button("Cancel", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { cancel(); logger.info("Data collection processing has been canceled"); } })); // Tab Panel final TabSheet tabs = new TabSheet(); tabs.addStyleName("light"); tabs.setSizeFull(); tabs.addTab(resourceTypes, "Resource Types"); tabs.addTab(groups, "MIB Groups"); tabs.addTab(systemDefs, "System Definitions"); // Main Layout final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSpacing(true); mainLayout.setMargin(true); mainLayout.addComponent(toolbar); mainLayout.addComponent(groupName); mainLayout.addComponent(tabs); mainLayout.setComponentAlignment(toolbar, Alignment.MIDDLE_RIGHT); setContent(mainLayout); }
From source file:org.vaadin.addon.twitter.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Responsive.makeResponsive(this); CssLayout info = new CssLayout(); info.setStyleName("tw-docs"); info.addComponent(markdown.get(0));/*from w ww.j av a 2s . c om*/ TabSheet tabSheet = new TabSheet(); tabSheet.setStyleName("tw-demo-tab"); tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); tabSheet.setSizeFull(); tabSheet.addTab(new TimelineDemo()).setCaption("Timeline"); tabSheet.addTab(new TweetDemo()).setCaption("Single Tweet"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Follow)).setCaption("Follow Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Share)).setCaption("Share Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Hashtag)).setCaption("Hashtag Button"); tabSheet.addTab(new ButtonDemo(TweetButton.Type.Mention)).setCaption("Mention Button"); tabSheet.addSelectedTabChangeListener(event -> { Component old = info.getComponent(0); Component newComp = markdown.get(tabSheet.getTabPosition(tabSheet.getTab(tabSheet.getSelectedTab()))); info.replaceComponent(old, newComp); }); final MHorizontalLayout layout = new MHorizontalLayout(info, tabSheet).withExpand(info, 4) .withExpand(tabSheet, 6).withFullWidth().withFullHeight().withMargin(false).withSpacing(true); setContent(new MPanel(layout).withFullWidth().withFullHeight().withStyleName(ValoTheme.PANEL_WELL, "root-container")); }
From source file:org.vaadin.spinkit.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { TabSheet tabSheet = new TabSheet(); tabSheet.setSizeFull();//w ww. ja v a 2 s .c o m tabSheet.addStyleName(ValoTheme.TABSHEET_CENTERED_TABS); tabSheet.addTab(spinnersContainer()).setCaption("Spinners"); tabSheet.addTab(spinnerSizesContainer()).setCaption("Sizes"); tabSheet.addTab(spinnersContainer("greenspin")).setCaption("Themed Spinners"); tabSheet.addTab(new RichText().withMarkDown(getClass().getResourceAsStream("source.md"))) .setCaption("Source code"); //layout.addComponent(tabSheet); //layout.expand(tabSheet); RichText info = new RichText().withMarkDown(getClass().getResourceAsStream("about.md")); MVerticalLayout layout = new MVerticalLayout().withMargin(true).with(info).expand(tabSheet).withFullHeight() .withFullWidth(); //layout.setExpandRatio(info, 1); //layout.setExpandRatio(tabSheet, 4); setContent(layout); }
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();/* ww w . jav a 2s. c o m*/ 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())); } } }