List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:net.pkhsolutions.pecsapp.ui.MainUI.java
License:Open Source License
@Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout);// w w w . j a va 2s. c om Navigator navigator = new Navigator(this, layout); navigator.addProvider(viewProvider); }
From source file:net.sf.gazpachoquest.questionnaires.views.login.OldLoginView.java
License:Open Source License
public OldLoginView() { setSizeFull();/*from w w w . ja va 2 s.c om*/ // Language bar in the top-right corner for selecting // invitation interface language final HorizontalLayout languageBar = new HorizontalLayout(); languageBar.setHeight("50px"); // addComponent(languageBar); // setComponentAlignment(languageBar, Alignment.TOP_RIGHT); // Allow selecting a language. We are in a constructor of a // CustomComponent, so preselecting the current // language of the application can not be done before // this (and the selection) component are attached to // the application. final ComboBox languageSelector = new ComboBox("Select a language") { @Override public void attach() { super.attach(); // setValue(getLocale()); } }; // for (int i=0; i<locales.length; i++) { String locale = "es"; languageSelector.addItem(locale); languageSelector.setItemCaption(locale, "espaol"); // Automatically select the current locale // if (locales[i].equals(getLocale())) languageSelector.setValue(locale); // } // Create the invitation input field invitationTextField = new TextField("Invitation key:"); invitationTextField.setWidth("300px"); invitationTextField.setRequired(true); invitationTextField.setInputPrompt("Your questionnair invitation key (eg. 12345678)"); invitationTextField.setInvalidAllowed(false); // Create login button enterButton = new Button("Enter", this); // Add both to a panel VerticalLayout fields = new VerticalLayout(languageSelector, invitationTextField, enterButton); fields.setCaption("Please enter your invitation key to access the questionnair"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, false)); fields.setSizeUndefined(); // The view root layout VerticalLayout viewLayout = new VerticalLayout(fields); viewLayout.setSizeFull(); viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); viewLayout.setStyleName(Reindeer.LAYOUT_BLUE); setCompositionRoot(viewLayout); }
From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java
License:Open Source License
@Override public void enter(ViewChangeEvent event) { logger.debug("Entering {} view ", QuestionnaireView.NAME); addStyleName(Reindeer.LAYOUT_BLUE);/*from w ww .j av a 2s . c om*/ addStyleName("questionnaires"); WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); Integer screenWidth = webBrowser.getScreenWidth(); Integer heightWidth = webBrowser.getScreenHeight(); logger.debug("Browser screen settings {} x {}", screenWidth, heightWidth); if (heightWidth <= 480) { renderingMode = RenderingMode.QUESTION_BY_QUESTION; } // centralLayout.addStyleName("questionnaires"); // new Responsive(centralLayout); RespondentAccount respondent = (RespondentAccount) VaadinServletService.getCurrentServletRequest() .getUserPrincipal(); if (respondent.hasPreferredLanguage()) { preferredLanguage = Language.fromString(respondent.getPreferredLanguage()); } else { preferredLanguage = Language.fromLocale(webBrowser.getLocale()); } questionnaireId = respondent.getGrantedquestionnaireIds().iterator().next(); logger.debug("Trying to fetch questionnair identified with id = {} ", questionnaireId); QuestionnaireDefinitionDTO definition = questionnaireResource.getDefinition(questionnaireId); sectionInfoVisible = definition.isSectionInfoVisible(); QuestionnairePageDTO page = questionnaireResource.getPage(questionnaireId, renderingMode, preferredLanguage, NavigationAction.ENTERING); logger.debug("Displaying page {}/{} with {} questions", page.getMetadata().getNumber(), page.getMetadata().getCount(), page.getQuestions().size()); questionsLayout = new VerticalLayout(); update(page); Label questionnaireTitle = new Label(definition.getLanguageSettings().getTitle()); questionnaireTitle.addStyleName(Reindeer.LABEL_H1); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setMargin(true); mainLayout.addComponent(questionnaireTitle); mainLayout.addComponent(questionsLayout); // Add the responsive capabilities to the components Panel centralLayout = new Panel(); centralLayout.setContent(mainLayout); centralLayout.setSizeFull(); centralLayout.getContent().setSizeUndefined(); Responsive.makeResponsive(questionnaireTitle); setCompositionRoot(centralLayout); setSizeFull(); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java
License:Apache License
private Component getUserManagementTab() { VerticalLayout vl = new VerticalLayout(); HorizontalSplitPanel split = new HorizontalSplitPanel(); vl.addComponent(split);/* ww w . ja va2s .c o m*/ //Create left side Tree users = new Tree(); //Menu VerticalLayout main = new VerticalLayout(); main.addComponent(users); HorizontalLayout hl = new HorizontalLayout(); Button addUser = new Button(TRANSLATOR.translate("add.user")); addUser.addClickListener(listener -> { VMUserServer user = new VMUserServer(new VmUser()); split.setSecondComponent(new UserComponent(user, true)); }); hl.addComponent(addUser); main.addComponent(hl); split.setFirstComponent(main); VMUserServer.getVMUsers().forEach(user -> { if (!Objects.equals(user.getId(), ((VMUI) UI.getCurrent()).getUser().getId())) { users.addItem(user.getEntity()); users.setItemCaption(user.getEntity(), user.toString()); users.setItemIcon(user.getEntity(), VaadinIcons.USER); users.setChildrenAllowed(user.getEntity(), false); } }); users.addValueChangeListener((Property.ValueChangeEvent event) -> { VmUser user = (VmUser) users.getValue(); split.setSecondComponent(new UserComponent(new VMUserServer(user), true)); }); vl.setSizeFull(); return vl; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java
License:Apache License
private Component getConfigurableTab() { VerticalLayout vl = new VerticalLayout(); ComboBox options = new ComboBox(); options.addItem(ISSUE_TYPE);/* ww w . j a v a2 s. c o m*/ options.setItemCaption(ISSUE_TYPE, TRANSLATOR.translate(ISSUE_TYPE)); options.addItem(ISSUE_RESOLUTION); options.setItemCaption(ISSUE_RESOLUTION, TRANSLATOR.translate(ISSUE_RESOLUTION)); options.addItem(REQUIREMENT_TYPE); options.setItemCaption(REQUIREMENT_TYPE, TRANSLATOR.translate(REQUIREMENT_TYPE)); options.setTextInputAllowed(false); options.addValueChangeListener((Property.ValueChangeEvent event) -> { Component nextComp = null; if (options.getValue() != null) { switch ((String) options.getValue()) { case ISSUE_TYPE: nextComp = displayIssueTypes(); break; case ISSUE_RESOLUTION: nextComp = displayIssueResolutions(); break; case REQUIREMENT_TYPE: nextComp = displayRequirementTypes(); break; default: //Do nothing } } if (nextComp != null) { vl.removeAllComponents(); vl.addComponent(options); vl.addComponent(nextComp); } }); vl.addComponent(options); vl.setSizeFull(); return vl; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.notification.NotificationScreenProvider.java
License:Apache License
@Override public Component getContent() { VerticalLayout vs = new VerticalLayout(); //On top put a list of notifications BeanItemContainer<Notification> container = new BeanItemContainer<>(Notification.class); ValidationManagerUI.getInstance().getUser().getNotificationList().forEach(n -> { container.addBean(n);//from ww w.j a v a 2 s . com }); // Unable to use VerticalSplitPanel as I hoped. // See: https://github.com/vaadin/framework/issues/9460 // VerticalSplitPanel vs = new VerticalSplitPanel(); // vs.setSplitPosition(25, Sizeable.Unit.PERCENTAGE); TextArea text = new TextArea(TRANSLATOR.translate("general.text")); text.setWordwrap(true); text.setReadOnly(true); text.setSizeFull(); Grid grid = new Grid(TRANSLATOR.translate("general.notifications"), container); grid.setColumns("notificationType", "author", "creationDate", "archieved"); if (container.size() > 0) { grid.setHeightMode(HeightMode.ROW); grid.setHeightByRows(container.size() > 5 ? 5 : container.size()); } GridCellFilter filter = new GridCellFilter(grid); filter.setBooleanFilter("archieved", new GridCellFilter.BooleanRepresentation(VaadinIcons.CHECK, TRANSLATOR.translate("general.yes")), new GridCellFilter.BooleanRepresentation(VaadinIcons.CLOSE, TRANSLATOR.translate("general.no"))); filter.setDateFilter("creationDate", new SimpleDateFormat(VMSettingServer.getSetting("date.format").getStringVal()), true); grid.sort("creationDate"); Column nt = grid.getColumn("notificationType"); nt.setHeaderCaption(TRANSLATOR.translate("notification.type")); nt.setConverter(new Converter<String, NotificationType>() { @Override public NotificationType convertToModel(String value, Class<? extends NotificationType> targetType, Locale locale) throws Converter.ConversionException { for (NotificationType n : new NotificationTypeJpaController( DataBaseManager.getEntityManagerFactory()).findNotificationTypeEntities()) { if (Lookup.getDefault().lookup(InternationalizationProvider.class).translate(n.getTypeName()) .equals(value)) { return n; } } return null; } @Override public String convertToPresentation(NotificationType value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException { return Lookup.getDefault().lookup(InternationalizationProvider.class) .translate(value.getTypeName()); } @Override public Class<NotificationType> getModelType() { return NotificationType.class; } @Override public Class<String> getPresentationType() { return String.class; } }); Column author = grid.getColumn("author"); author.setConverter(new UserToStringConverter()); author.setHeaderCaption(TRANSLATOR.translate("notification.author")); Column creation = grid.getColumn("creationDate"); creation.setHeaderCaption(TRANSLATOR.translate("creation.time")); Column archive = grid.getColumn("archieved"); archive.setHeaderCaption(TRANSLATOR.translate("general.archived")); archive.setConverter(new Converter<String, Boolean>() { @Override public Boolean convertToModel(String value, Class<? extends Boolean> targetType, Locale locale) throws Converter.ConversionException { return value.equals(TRANSLATOR.translate("general.yes")); } @Override public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException { return value ? TRANSLATOR.translate("general.yes") : TRANSLATOR.translate("general.no"); } @Override public Class<Boolean> getModelType() { return Boolean.class; } @Override public Class<String> getPresentationType() { return String.class; } }); grid.setSelectionMode(SelectionMode.SINGLE); grid.setSizeFull(); ContextMenu menu = new ContextMenu(grid, true); menu.addItem(TRANSLATOR.translate("notification.mark.unread"), (MenuItem selectedItem) -> { Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow(); if (selected != null) { NotificationServer ns = new NotificationServer((Notification) selected); ns.setAcknowledgeDate(null); try { ns.write2DB(); ((VMUI) UI.getCurrent()).updateScreen(); ((VMUI) UI.getCurrent()).showTab(getComponentCaption()); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } } }); menu.addItem(TRANSLATOR.translate("notification.archive"), (MenuItem selectedItem) -> { Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow(); if (selected != null) { NotificationServer ns = new NotificationServer((Notification) selected); ns.setArchieved(true); try { ns.write2DB(); ((VMUI) UI.getCurrent()).updateScreen(); ((VMUI) UI.getCurrent()).showTab(getComponentCaption()); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } } }); grid.addSelectionListener(selectionEvent -> { // Get selection from the selection model Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow(); if (selected != null) { text.setReadOnly(false); Notification n = (Notification) selected; text.setValue(n.getContent()); text.setReadOnly(true); if (n.getAcknowledgeDate() != null) { try { //Mark as read NotificationServer ns = new NotificationServer((Notification) n); ns.setAcknowledgeDate(new Date()); ns.write2DB(); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } } } }); vs.addComponent(grid); vs.addComponent(text); vs.setSizeFull(); vs.setId(getComponentCaption()); return vs; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.template.TemplateScreenProvider.java
License:Apache License
private Component getLeftComponent() { Panel p = new Panel(); VerticalLayout layout = new VerticalLayout(); templates.setNullSelectionAllowed(true); templates.setWidth(100, Sizeable.Unit.PERCENTAGE); BeanItemContainer<Template> container = new BeanItemContainer<>(Template.class, new TemplateJpaController(DataBaseManager.getEntityManagerFactory()).findTemplateEntities()); templates.setContainerDataSource(container); templates.getItemIds().forEach(id -> { Template temp = ((Template) id); templates.setItemCaption(id, TRANSLATOR.translate(temp.getTemplateName())); });/* w w w .jav a 2s . c o m*/ templates.addValueChangeListener(event -> { hs.setSecondComponent(getRightComponent()); }); templates.setNullSelectionAllowed(false); templates.setWidth(100, Sizeable.Unit.PERCENTAGE); layout.addComponent(templates); HorizontalLayout hl = new HorizontalLayout(); Button create = new Button(TRANSLATOR.translate("general.add")); create.addClickListener(listener -> { displayTemplateCreateWizard(); }); hl.addComponent(create); Button copy = new Button(TRANSLATOR.translate("general.copy")); copy.addClickListener(listener -> { displayTemplateCopyWizard(); }); hl.addComponent(copy); Button delete = new Button(TRANSLATOR.translate("general.delete")); delete.addClickListener(listener -> { displayTemplateDeleteWizard(); }); hl.addComponent(delete); templates.addValueChangeListener(listener -> { if (templates.getValue() != null) { Template t = (Template) templates.getValue(); delete.setEnabled(t.getId() >= 1_000); copy.setEnabled(t.getTemplateNodeList().size() > 0); } }); layout.addComponent(hl); layout.setSizeFull(); p.setContent(layout); p.setSizeFull(); return p; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.project.GAMPStep.java
License:Apache License
@Override public Component getContent() { VerticalLayout vl = new VerticalLayout(); Label text = new Label(); text.setSizeFull();/*from ww w .j av a 2 s .c o m*/ text.setEnabled(false); text.setValue(TRANSLATOR.translate("template.gamp5.disclaimer")); getCategory().removeAllItems(); switch (wizard.getType()) { case "general.software": //Load SW options getCategory().addItem("template.gamp5.sw.cat1"); getCategory().addItem("template.gamp5.sw.cat3"); getCategory().addItem("template.gamp5.sw.cat4"); getCategory().addItem("template.gamp5.sw.cat5"); break; default: //Load HW options getCategory().addItem("template.gamp5.hw.cat1"); getCategory().addItem("template.gamp5.hw.cat2"); } wizard.translateSelect(getCategory()); vl.addComponent(getCategory()); vl.addComponent(text); vl.setSizeFull(); return vl; }
From source file:nl.arnovanoort.vaadintest6.MyVaadinApplication.java
License:Apache License
private VerticalLayout createMainLayout() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addComponent(createToolbar()); layout.addComponent(horizontalSplit); /* Allocate all available extra space to the horizontal split panel */ layout.setExpandRatio(horizontalSplit, 1); return layout; }
From source file:nl.kpmg.lcm.ui.Application.java
License:Apache License
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("Local Catalog Manager"); final VerticalLayout root = new VerticalLayout(); root.setSizeFull(); root.setMargin(true);/*www .j a v a 2 s . c om*/ root.setSpacing(true); setContent(root); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); Label logo = new Label("LCM"); logo.addStyleName("logo"); logo.setWidthUndefined(); navigationBar.addComponent(logo); navigationBar.addComponent(createNavigationButton("Metadata", MetadataOverviewViewImpl.VIEW_NAME)); navigationBar.addComponent(createNotImplementedButton("Analytics")); navigationBar.addComponent(createNavigationButton("Transfer", TransferViewImpl.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("Administration", AdministrationViewImpl.VIEW_NAME)); navigationBar.addComponent(createLogoutButton("Logout")); root.addComponent(navigationBar); final Panel viewContainer = new Panel(); viewContainer.setSizeFull(); root.addComponent(viewContainer); root.setExpandRatio(viewContainer, 1.0f); navigator = new Navigator(this, viewContainer); navigator.addProvider(viewProvider); navigator.navigateTo("login"); }