List of usage examples for com.vaadin.server Responsive makeResponsive
public static void makeResponsive(Component... components)
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue/* w ww .java 2s.c o m*/ */ @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:info.magnolia.configuration.app.overview.toolbar.ToolbarViewImpl.java
License:Open Source License
@Inject public ToolbarViewImpl() { Responsive.makeResponsive(this); addStyleName("toolbar-layout"); setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); setSpacing(true);/*from w ww .jav a 2 s . c o m*/ setMargin(new MarginInfo(true, false, true, false)); setWidth("100%"); initFilterInputProperties(moduleFilterSelect); initFilterInputProperties(definitionTypeFilterSelect); initFilterInputProperties(nameField); initFilterInputProperties(onlyIncludeDefinitionsWithErrorsCheckBox); initFilterInputProperties(onlyIncludeFileBasedDefinitions); groupBySelect.setHeight("25px"); moduleFilterSelect.setHeight("25px"); definitionTypeFilterSelect.setHeight("25px"); groupBySelect.setWidth("160px"); groupBySelect.setNullSelectionAllowed(false); for (ConfigOverviewView.DefinitionAggregationType type : ConfigOverviewView.DefinitionAggregationType .values()) { groupBySelect.addItem(type); } groupBySelect.setValue(ConfigOverviewView.DefinitionAggregationType.registry); groupBySelect.addValueChangeListener(groupByChangeListener); groupByLayout.setSizeUndefined(); filterLayout.setSizeUndefined(); groupByLayout.addComponent(decorateComponent("Group by:", groupBySelect)); ; filterLayout.addComponent(decorateComponent("Module:", moduleFilterSelect)); filterLayout.addComponent(decorateComponent("Type:", definitionTypeFilterSelect)); filterLayout.addComponent(decorateComponent("Name:", nameField)); filterLayout.addComponent(decorateComponent("Invalid:", onlyIncludeDefinitionsWithErrorsCheckBox)); filterLayout.addComponent(decorateComponent("File-based:", onlyIncludeFileBasedDefinitions)); moduleFilterSelect.setInputPrompt("All modules"); definitionTypeFilterSelect.setInputPrompt("All types"); nameField.setInputPrompt("Any name"); groupByLayout.addStyleName("entry"); groupByLayout.setMargin(true); filterLayout.addStyleName("entry"); filterLayout.setSpacing(true); filterLayout.setMargin(true); addComponent(groupByLayout); final Component filterWrapper = decorateComponent("Filter:", filterLayout); addComponent(filterWrapper); addComponent(showFileButton); addComponent(openJcrConfig); setExpandRatio(openJcrConfig, 1f); }
From source file:info.magnolia.configuration.app.problem.toolbar.ProblemToolbarViewImpl.java
License:Open Source License
@Inject public ProblemToolbarViewImpl(SimpleTranslator i18n) { this.i18n = i18n; Responsive.makeResponsive(this); addStyleName("toolbar-layout"); setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); setSpacing(true);/*from w w w .j av a 2s. c om*/ setMargin(new MarginInfo(true, false, true, false)); setWidth("100%"); initGroupByLayout(); iniSearchField(); }
From source file:lv.polarisit.demosidemenu.ValoThemeUI.java
License:Apache License
@Override protected void init(final VaadinRequest request) { if (request.getParameter("test") != null) { testMode = true;// w ww .jav a 2 s.c o m if (browserCantRenderFontsConsistently()) { getPage().getStyles().add(".v-app.v-app.v-app {font-family: Sans-Serif;}"); } } if (getPage().getWebBrowser().isIE() && getPage().getWebBrowser().getBrowserMajorVersion() == 9) { menu.setWidth("320px"); } // Show .v-app-loading valo-menu-badge // try { // Thread.sleep(2000); // } catch (InterruptedException e) { // e.printStackTrace(); // } if (!testMode) { Responsive.makeResponsive(this); } getPage().setTitle("Valo Theme Test"); setContent(root); root.setWidth("100%"); root.addMenu(buildMenu()); navigator = new Navigator(this, viewDisplay); navigator.addView("MessageView", MessageView.class); navigator.addView("MessageView1", MessageView1.class); /* navigator.addView("labels", Labels.class); navigator.addView("buttons-and-links", ButtonsAndLinks.class); navigator.addView("textfields", TextFields.class); navigator.addView("datefields", DateFields.class); navigator.addView("comboboxes", ComboBoxes.class); navigator.addView("checkboxes", CheckBoxes.class); navigator.addView("sliders", Sliders.class); navigator.addView("menubars", MenuBars.class); navigator.addView("panels", Panels.class); navigator.addView("trees", Trees.class); navigator.addView("tables", Tables.class); navigator.addView("splitpanels", SplitPanels.class); navigator.addView("tabs", Tabsheets.class); navigator.addView("accordions", Accordions.class); navigator.addView("colorpickers", ColorPickers.class); navigator.addView("selects", NativeSelects.class); navigator.addView("calendar", CalendarTest.class); navigator.addView("forms", Forms.class); navigator.addView("popupviews", PopupViews.class); navigator.addView("dragging", Dragging.class); */ final String f = Page.getCurrent().getUriFragment(); if (f == null || f.equals("")) { navigator.navigateTo("MessageView"); } //navigator.setErrorView(CommonParts.class); navigator.addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(final ViewChangeEvent event) { return true; } @Override public void afterViewChange(final ViewChangeEvent event) { for (final Iterator<Component> it = menuItemsLayout.iterator(); it.hasNext();) { it.next().removeStyleName("selected"); } for (final Entry<String, String> item : menuItems.entrySet()) { if (event.getViewName().equals(item.getKey())) { for (final Iterator<Component> it = menuItemsLayout.iterator(); it.hasNext();) { final Component c = it.next(); if (c.getCaption() != null && c.getCaption().startsWith(item.getValue())) { c.addStyleName("selected"); break; } } break; } } menu.removeStyleName("valo-menu-visible"); } }); }
From source file:me.uni.emuseo.EMuseoUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { WrappedSession session = request.getWrappedSession(); HttpSession httpSession = ((WrappedHttpSession) session).getHttpSession(); ServletContext servletContext = httpSession.getServletContext(); applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); securityContext = SecurityContextHolder.getContext(); authenticationManager = applicationContext.getBean(AuthManager.class); getPage().setTitle(PAGE_TITLE);/* ww w .j av a 2 s.c o m*/ Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); navigator = new EMuseoNavigator(this, this, authenticationManager); navigator.addView(Permissions.LOGIN_VIEW, LoginView.class); navigator.addView(Permissions.MENU_VIEW, MenuView.class); }
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 . ja v a 2 s . com*/ 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:org.bubblecloud.ilves.site.view.valo.DefaultValoView.java
License:Apache License
/** * {@inheritDoc}// w w w.ja va 2s .com */ @Override protected void initializeComponents() { final AbstractComponent contentComponent = getComponent("content"); final AbstractComponent footerComponent = getComponent("footer"); if (Page.getCurrent().getWebBrowser().isIE() && Page.getCurrent().getWebBrowser().getBrowserMajorVersion() == 9) { menu.setWidth("320px"); } Responsive.makeResponsive(UI.getCurrent()); setWidth("100%"); addMenu(buildMenu()); getContentContainer().addComponent(contentComponent); if (footerComponent != null) { getContentContainer().addComponent(footerComponent); } }
From source file:org.bubblecloud.ilves.site.view.valo.ValoLayout.java
License:Apache License
public ValoLayout() { setSizeFull();/*from w w w .j a v a 2 s. co m*/ menuArea.setPrimaryStyleName("valo-menu"); contentArea.setPrimaryStyleName("valo-content"); contentArea.addStyleName("v-scrollable"); contentArea.setSizeFull(); Responsive.makeResponsive(contentArea); addComponents(menuArea, contentArea); setExpandRatio(contentArea, 1); }
From source file:org.bubblecloud.ilves.ui.anonymous.login.LoginFlowlet.java
License:Apache License
@SuppressWarnings("serial") @Override//from w w w .j a v a2 s . c om public void initialize() { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); final Company company = getSite().getSiteContext().getObject(Company.class); if (company.isOpenIdLogin()) { final VerticalLayout mainPanel = new VerticalLayout(); mainPanel.setCaption(getSite().localize("header-open-id-login")); layout.addComponent(mainPanel); final HorizontalLayout openIdLayout = new HorizontalLayout(); mainPanel.addComponent(openIdLayout); openIdLayout.setMargin(new MarginInfo(false, false, true, false)); openIdLayout.setSpacing(true); final String returnViewName = "openidlogin"; final Map<String, String> urlIconMap = OpenIdUtil.getOpenIdProviderUrlIconMap(); for (final String url : urlIconMap.keySet()) { openIdLayout.addComponent(OpenIdUtil.getLoginButton(url, urlIconMap.get(url), returnViewName)); } } try { final CustomLayout loginFormLayout = new CustomLayout( JadeUtil.parse("/VAADIN/themes/ilves/layouts/login.jade")); Responsive.makeResponsive(loginFormLayout); loginFormLayout.setCaption(getSite().localize("header-email-and-password-login")); layout.addComponent(loginFormLayout); } catch (final IOException e) { throw new SiteException("Error loading login form.", e); } if (company.isSelfRegistration()) { final Button registerButton = new Button(getSite().localize("button-register") + " >>"); registerButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getFlow().forward(RegisterFlowlet.class); } }); layout.addComponent(registerButton); } if (company.isEmailPasswordReset()) { final Button forgotPasswordButton = new Button(getSite().localize("button-forgot-password") + " >>"); forgotPasswordButton.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { getFlow().forward(ForgotPasswordFlowlet.class); } }); layout.addComponent(forgotPasswordButton); } final Panel panel = new Panel(); panel.setSizeUndefined(); panel.setContent(layout); setViewContent(panel); }
From source file:org.eclipse.hawkbit.ui.AbstractHawkbitUI.java
License:Open Source License
@Override protected void init(final VaadinRequest vaadinRequest) { LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId()); if (pushStrategy != null) { pushStrategy.init(getUI());// ww w.j a v a2s .co m } addDetachListener(this); SpringContextHelper.setContext(context); Responsive.makeResponsive(this); addStyleName(ValoTheme.UI_WITH_MENU); setResponsive(Boolean.TRUE); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull(); HawkbitCommonUtil.initLocalization(this, uiProperties.getLocalization(), i18n); dashboardMenu.init(); dashboardMenu.setResponsive(true); final VerticalLayout contentVerticalLayout = new VerticalLayout(); contentVerticalLayout.setSizeFull(); contentVerticalLayout.setStyleName("main-content"); contentVerticalLayout.addComponent(buildHeader()); contentVerticalLayout.addComponent(buildViewTitle()); final Panel content = buildContent(); contentVerticalLayout.addComponent(content); contentVerticalLayout.setExpandRatio(content, 1); rootLayout.addComponent(dashboardMenu); rootLayout.addComponent(contentVerticalLayout); rootLayout.setExpandRatio(contentVerticalLayout, 1); setContent(rootLayout); final Navigator navigator = new Navigator(this, content); navigator.addViewChangeListener(new ViewChangeListener() { private static final long serialVersionUID = 1L; @Override public boolean beforeViewChange(final ViewChangeEvent event) { return true; } @Override public void afterViewChange(final ViewChangeEvent event) { final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName()); dashboardMenu.postViewChange(new PostViewChangeEvent(view)); if (view == null) { viewTitle.setCaption(null); return; } viewTitle.setCaption(view.getDashboardCaptionLong()); notificationUnreadButton.setCurrentView(event.getNewView()); } }); navigator.setErrorView(errorview); navigator.addProvider(new ManagementViewProvider()); setNavigator(navigator); navigator.addView(EMPTY_VIEW, new Navigator.EmptyView()); if (UI.getCurrent().getErrorHandler() == null) { UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler()); } LOG.info("Current locale of the application is : {}", getLocale()); }