List of usage examples for com.vaadin.ui HorizontalLayout setSizeUndefined
@Override public void setSizeUndefined()
From source file:de.symeda.sormas.ui.user.UsersView.java
License:Open Source License
public HorizontalLayout createFilterBar() { HorizontalLayout filterLayout = new HorizontalLayout(); filterLayout.setMargin(false);//from ww w.j a va2s . co m filterLayout.setSpacing(true); filterLayout.setSizeUndefined(); filterLayout.addStyleName(CssStyles.VSPACE_3); activeFilter = new ComboBox(); activeFilter.setWidth(200, Unit.PIXELS); activeFilter.setInputPrompt(I18nProperties.getPrefixCaption(UserDto.I18N_PREFIX, UserDto.ACTIVE)); activeFilter.addItems(ACTIVE_FILTER, INACTIVE_FILTER); activeFilter.addValueChangeListener(e -> { criteria.active(ACTIVE_FILTER.equals(e.getProperty().getValue()) ? Boolean.TRUE : INACTIVE_FILTER.equals(e.getProperty().getValue()) ? Boolean.FALSE : null); navigateTo(criteria); }); filterLayout.addComponent(activeFilter); userRolesFilter = new ComboBox(); userRolesFilter.setWidth(200, Unit.PIXELS); userRolesFilter.setInputPrompt(I18nProperties.getPrefixCaption(UserDto.I18N_PREFIX, UserDto.USER_ROLES)); userRolesFilter.addItems(UserRole.getAssignableRoles(UserProvider.getCurrent().getUserRoles())); userRolesFilter.addValueChangeListener(e -> { criteria.userRole((UserRole) e.getProperty().getValue()); navigateTo(criteria); }); filterLayout.addComponent(userRolesFilter); searchField = new TextField(); searchField.setWidth(200, Unit.PIXELS); searchField.setNullRepresentation(""); searchField.setInputPrompt(I18nProperties.getString(Strings.promptUserSearch)); searchField.setImmediate(true); searchField.addTextChangeListener(e -> { criteria.freeText(e.getText()); grid.reload(); }); filterLayout.addComponent(searchField); return filterLayout; }
From source file:edu.nps.moves.mmowgli.components.Footer.java
License:Open Source License
@Override public void initGui() { setWidth(FOOTER_W);// w w w . j a va 2s. c om setHeight("130px"); //room for fouo butt//FOOTER_H); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(FOOTER_W); mainAbsLay.setHeight(FOOTER_H); addComponent(mainAbsLay, FOOTER_OFFSET_POS); MediaLocator medLoc = ((Mmowgli2UI) UI.getCurrent()).getMediaLocator(); Embedded back = new Embedded(null, medLoc.getFooterBackground()); mainAbsLay.addComponent(back, "top:0px;left:0px"); HorizontalLayout outerHorLay = new HorizontalLayout(); addComponent(outerHorLay, "top:45px;left:0px"); outerHorLay.setWidth(FOOTER_W); HorizontalLayout innerHorLay = new HorizontalLayout(); innerHorLay.setSpacing(true); outerHorLay.addComponent(innerHorLay); outerHorLay.setComponentAlignment(innerHorLay, Alignment.MIDDLE_CENTER); Label sp; innerHorLay.addComponent(aboutButt); innerHorLay.addComponent(pingPushLab = new HtmlLabel()); pingPushLab.setWidth("7px"); innerHorLay.addComponent(creditsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(faqsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(fixesButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(glossaryButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(reportsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(termsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(troubleButt); troubleButt.addStyleName("m-red-text"); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(twitterButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(videosButt); GameLinks gl = GameLinks.getTL(); if (gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech")) { ; // This is a hack, but I don't want to pollute the db with a bogus boolean...this is a special case just for these folks. } else { HorizontalLayout hl = new HorizontalLayout(); Label lab = null; hl.addComponent(lab = new HtmlLabel("Build " + MMOWGLI_BUILD_ID)); lab.addStyleName("m-footer-servername"); //small text lab.setDescription(Mmowgli2UI.getGlobals().getVaadinSessionCookie()); hl.addComponent(lab = new HtmlLabel(" Vaadin " + VAADIN_BUILD_VERSION)); lab.addStyleName("m-footer-servername"); //small text hl.addComponent(lab = new HtmlLabel(" " + AppMaster.instance().getServerName())); lab.addStyleName("m-footer-servername"); //small text hl.setSizeUndefined(); mainAbsLay.addComponent(hl, "bottom:3px;right:15px;"); } fouoLink = Footer.buildFouoNoticeTL(); addComponent(fouoLink, "top:92px;left:365px"); fouoLink.setVisible(Game.getTL().isShowFouo()); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreement.java
License:Open Source License
public RegistrationPageAgreement(Button.ClickListener listener) { super(listener); super.initGui(); setTitleString(getTitle()); //"User Agreement 1"); contentVLayout.setSpacing(true);/*from w ww. j av a 2 s.co m*/ Label lab = new HtmlLabel(getLabelText()); //"First, please confirm your willingness to meet game requirements. I also confirm that I am at least 18 years of age."); lab.addStyleName(topLabelStyle); contentVLayout.addComponent(lab); HorizontalLayout hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); String readUrl = getReadUrlTL(); if (readUrl != null) { Link readLink = new Link("Read", new ExternalResource(getReadUrlTL())); //REGISTRATIONCONSENTURL)); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); hlayout.setComponentAlignment(readLink, Alignment.MIDDLE_LEFT); } lab = new HtmlLabel(getReadLabel()); //"<i>Consent to Participate in Anonymous Survey</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); hlayout.setComponentAlignment(lab, Alignment.TOP_LEFT); contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("98%"); //"100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); // Mmowgli2UI.getGlobals().mediaLocator().decorateDialogRejectButton(rejectButt); rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); //Mmowgli2UI.getGlobals().mediaLocator().decorateDialogAcceptAndContinueButton(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageAgreementCombo.java
License:Open Source License
public RegistrationPageAgreementCombo(Button.ClickListener listener) { super(listener); super.initGui(); setTitleString("User Agreement"); contentVLayout.setSpacing(true);/*w w w. j a v a 2 s. c om*/ Label lab = new Label("I confirm my willingness to meet game requirements:"); lab.addStyleName(topLabelStyle); contentVLayout.addComponent(lab); // First contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space contentVLayout.addComponent(lab = new HtmlLabel( "First, I confirm that I am at least 18 years of age, I have been informed of risks<br/>and benefits, and I consent to participate.")); lab.addStyleName(labelStyle); HorizontalLayout hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); // First read hlayout.addComponent(lab = new HtmlLabel(" ")); lab.setHeight("10px"); GameLinks gl = GameLinks.getTL(); Link readLink = new Link("Read", new ExternalResource(gl.getInformedConsentLink())); //REGISTRATIONCONSENTURL)); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); lab = new HtmlLabel("<i>Informed Consent to Participate in Research</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); // Second contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space lab = new HtmlLabel( "Second, I understand that <b style='color:red;'>no classified or sensitive information can be<br/>posted</b> to the game since participation is open. Violation of this policy may<br/>lead to serious consequences."); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); hlayout = new HorizontalLayout(); contentVLayout.addComponent(hlayout); hlayout.setSpacing(true); hlayout.setWidth("100%"); hlayout.addStyleName(labelStyle); // Second read hlayout.addComponent(lab = new HtmlLabel(" ")); readLink = new Link("Read", new ExternalResource(gl.getUserAgreementLink())); readLink.setTargetName("_agreements"); readLink.setTargetBorder(BorderStyle.DEFAULT); readLink.setDescription("Opens in new window/tab"); hlayout.addComponent(readLink); readLink.setSizeUndefined(); lab = new HtmlLabel("<i>Department of Defense Social Media User Agreement</i>"); lab.setSizeUndefined(); hlayout.addComponent(lab); hlayout.setSizeUndefined(); // Third contentVLayout.addComponent(lab = new Label()); lab.setHeight("5px"); // space lab = new HtmlLabel( "Third, the official language of the MMOWGLI game is English. Other languages<br/>are not supported in order to ensure that player postings are appropriate."); lab.addStyleName(labelStyle); contentVLayout.addComponent(lab); contentVLayout.addComponent(lab = new Label()); lab.setHeight("15px"); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); contentVLayout.addComponent(hl); hl.addComponent(lab = new Label()); lab.setWidth("20px"); NativeButton rejectButt = new NativeButton(); hl.addComponent(rejectButt); rejectButt.setStyleName("m-rejectNoThanksButton"); //new way rejectButt.addClickListener(new RejectListener()); hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton continueButt = new NativeButton(); hl.addComponent(continueButt); continueButt.setStyleName("m-acceptAndContinueButton"); // new way continueButt.addClickListener(new MyContinueListener()); continueButt.setClickShortcut(KeyCode.ENTER); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
HorizontalLayout makeCheckRow(Button butt) { HorizontalLayout hl = new HorizontalLayout(); hl.setSizeUndefined(); hl.addStyleName("m-userprofile-linkbuttons"); hl.setMargin(false);/* w ww . j a va 2s . c o m*/ hl.setSpacing(false); if (checkMarkRes == null) checkMarkRes = Mmowgli2UI.getGlobals().getMediaLocator().getCheckMark12px(); Embedded embedded = new Embedded(null, checkMarkRes); embedded.setWidth("12px"); if (butt == buildsButt) embedded.setVisible(false); hl.addComponent(embedded); hl.addComponent(butt); hl.setExpandRatio(butt, 1.0f); return hl; }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
private void createTab_Sites() { VerticalLayout tab_site = new VerticalLayout(); tab_site.setCaption("Sites"); tabsheet.addTab(tab_site);//from w w w . jav a 2 s .c o m Panel p_project = new Panel("Create a sites"); p_project.setWidth("400"); HorizontalLayout hor_sites = new HorizontalLayout(); hor_sites.addComponent(sites_tree); final VerticalLayout project_browser4Sites = new VerticalLayout(); hor_sites.addComponent(project_browser4Sites); tab_site.addComponent(hor_sites); htmlView_Project(project_browser4Sites, "Structural"); sites_tree.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 7237016481874141615L; public void valueChange(ValueChangeEvent event) { if (!sites_tree.hasChildren(sites_tree.getValue())) { if (sites_tree.getValue() != null) htmlView_Project(project_browser4Sites, sites_tree.getValue().toString()); } } }); sites_tree.setImmediate(true); Button newRealEstate_button = new Button("Create", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String realEstate_name = site_textField.getValue(); if (realEstate_name != null && realEstate_name.length() > 0) { marmotta_sparql.create_RealEstate(realEstate_name); listSites(); } } }); HorizontalLayout newproject_layout = new HorizontalLayout(); newproject_layout.setSizeUndefined(); site_textField.setImmediate(true); newproject_layout.addComponent(site_textField); newproject_layout.addComponent(newRealEstate_button); newproject_layout.setSpacing(true); p_project.setContent(newproject_layout); tab_site.addComponent(p_project); Button removeRealEstate_button = new Button("Remove the selected site", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { TreeNode realEstate = (TreeNode) sites_tree.getValue(); if (realEstate != null) { //Only real estates Object parent = sites_tree.getParent(realEstate); if (parent == null) { marmotta_sparql.remove_RealEstate(realEstate.getInternal_name()); listSites(); } } } }); tab_site.addComponent(removeRealEstate_button); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
@SuppressWarnings("deprecation") private void createTab_Datasets() { VerticalLayout tab_datasets = new VerticalLayout(); tab_datasets.setCaption("Data sets"); tabsheet.addTab(tab_datasets);// w w w .j a va 2 s. com tab_datasets.addComponent(datasets_tree); Link void_link = new Link("Void description of the data sets", new ExternalResource("http://drumbeat.cs.hut.fi/void.ttl")); tab_datasets.addComponent(void_link); Panel p_model = new Panel("Upload and convert an IFC file"); p_model.setWidth("900"); tab_datasets.addComponent(p_model); HorizontalLayout hor1 = new HorizontalLayout(); hor1.setSizeFull(); // Use all available space hor1.setMargin(true); p_model.setContent(hor1); VerticalLayout upload_selections = new VerticalLayout(); hor1.addComponent(upload_selections); upload_selections.addComponent(sites_tree_4upload); VerticalLayout upload_panels = new VerticalLayout(); hor1.addComponent(upload_panels); Panel p_model_file = new Panel("Upload a file"); p_model_file.setWidth("400"); upload_panels.addComponent(p_model_file); Panel p_model_url = new Panel("Upload from a URL"); p_model_url.setWidth("400"); upload_panels.addComponent(p_model_url); // Create the upload with a caption and set receiver later Upload upload = new Upload("Select a file and press Upload", drumbeat_fileReceiver); upload.addSucceededListener(drumbeat_fileReceiver); upload.addFailedListener(drumbeat_fileReceiver); p_model_file.setContent(upload); url_textField.setImmediate(true); Button button = new Button("Upload from the URL", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { drumbeat_fileReceiver.receiveFileFromURL(url_textField.getValue()); } }); HorizontalLayout url_upload = new HorizontalLayout(); url_upload.setSizeUndefined(); url_upload.addComponent(url_textField); url_upload.addComponent(button); url_upload.setSpacing(true); p_model_url.setContent(url_upload); bim_projects_selection.setInvalidAllowed(false); bim_projects_selection.setNullSelectionAllowed(false); bim_projects_selection.setNewItemsAllowed(false); bim_projects_selection.setWidth("400"); final VerticalLayout project_browser = new VerticalLayout(); bim_projects_selection.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; public void valueChange(ValueChangeEvent event) { if (bim_projects_selection.getValue() != null) { htmlView_BIMProject(project_browser, bim_projects.get(bim_projects_selection.getValue())); } } }); tab_datasets.addComponent(bim_projects_selection); tab_datasets.addComponent(project_browser); }
From source file:fr.univlorraine.mondossierweb.views.AdressesView.java
License:Apache License
/** * Initialise la vue//from www .j av a 2 s . co m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { removeAllComponents(); /* 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); if (MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { FormLayout formAdresseAnnuelleLayout = new FormLayout(); formAdresseAnnuelleLayout.setSpacing(true); formAdresseAnnuelleLayout.setMargin(true); Panel panelAdresseAnnuelle = new Panel( applicationContext.getMessage(NAME + ".adresseannuelle.title", null, getLocale()) + " " + MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAnnee()); String captionAdresseAnnuelle = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseAnnuelle = new Label(); formatLabel(fieldAdresseAnnuelle, captionAdresseAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse1()); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle); String annuelle2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse3()); if (annuelle2 != null) { Label fieldAdresseAnnuelle2 = new Label(); formatLabel(fieldAdresseAnnuelle2, null, annuelle2); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle2); } String captionVilleAnnuelle = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleAnnuelle = new Label(); formatLabel(fieldVilleAnnuelle, captionVilleAnnuelle, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getVille())); formAdresseAnnuelleLayout.addComponent(fieldVilleAnnuelle); String captionPaysAnnuelle = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysAnnuelle = new Label(); formatLabel(fieldPaysAnnuelle, captionPaysAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getPays()); formAdresseAnnuelleLayout.addComponent(fieldPaysAnnuelle); String captionTelephoneAnnuelle = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneAnnuelle = new Label(); formatLabel(fieldTelephoneAnnuelle, captionTelephoneAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getNumerotel()); formAdresseAnnuelleLayout.addComponent(fieldTelephoneAnnuelle); panelAdresseAnnuelle.setContent(formAdresseAnnuelleLayout); HorizontalLayout adresseAnnuelleGlobalLayout = new HorizontalLayout(); adresseAnnuelleGlobalLayout.setSizeUndefined(); adresseAnnuelleGlobalLayout.setStyleName("firstitembox"); adresseAnnuelleGlobalLayout.addComponent(panelAdresseAnnuelle); adresseAnnuelleGlobalLayout.setExpandRatio(panelAdresseAnnuelle, 1); idLayout.addComponent(adresseAnnuelleGlobalLayout); } if (MainUI.getCurrent().getEtudiant().getAdresseFixe() != null) { FormLayout formAdresseFixeLayout = new FormLayout(); formAdresseFixeLayout.setSpacing(true); formAdresseFixeLayout.setMargin(true); Panel panelAdresseFixe = new Panel( applicationContext.getMessage(NAME + ".adressefixe.title", null, getLocale())); String captionAdresseFixe = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseFixe = new Label(); formatLabel(fieldAdresseFixe, captionAdresseFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse1()); formAdresseFixeLayout.addComponent(fieldAdresseFixe); String adfixe2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse3()); if (adfixe2 != null) { Label fieldAdresseFixe2 = new Label(); formatLabel(fieldAdresseFixe2, null, adfixe2); formAdresseFixeLayout.addComponent(fieldAdresseFixe2); } String captionVilleFixe = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleFixe = new Label(); formatLabel(fieldVilleFixe, captionVilleFixe, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getVille())); formAdresseFixeLayout.addComponent(fieldVilleFixe); String captionPaysFixe = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysFixe = new Label(); formatLabel(fieldPaysFixe, captionPaysFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getPays()); formAdresseFixeLayout.addComponent(fieldPaysFixe); String captionTelephoneFixe = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneFixe = new Label(); formatLabel(fieldTelephoneFixe, captionTelephoneFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getNumerotel()); formAdresseFixeLayout.addComponent(fieldTelephoneFixe); panelAdresseFixe.setContent(formAdresseFixeLayout); HorizontalLayout adresseFixeGlobalLayout = new HorizontalLayout(); adresseFixeGlobalLayout.setSizeUndefined(); adresseFixeGlobalLayout.setStyleName("itembox"); adresseFixeGlobalLayout.addComponent(panelAdresseFixe); adresseFixeGlobalLayout.setExpandRatio(panelAdresseFixe, 1); idLayout.addComponent(adresseFixeGlobalLayout); } addComponent(globalLayout); if (userController.isEtudiant() && configController.isModificationAdressesAutorisee() && MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSizeFull(); btnLayout.setSpacing(true); Button btnModifAdresses = new Button( applicationContext.getMessage(NAME + ".bouton.modifieradresses", null, getLocale())); btnModifAdresses.setStyleName(ValoTheme.BUTTON_PRIMARY); btnModifAdresses.setIcon(FontAwesome.EDIT); btnModifAdresses.addClickListener(e -> { ModificationAdressesWindow maw = new ModificationAdressesWindow( MainUI.getCurrent().getEtudiant()); maw.addCloseListener(f -> { init(); }); UI.getCurrent().addWindow(maw); }); btnLayout.addComponent(btnModifAdresses); btnLayout.setComponentAlignment(btnModifAdresses, Alignment.MIDDLE_LEFT); addComponent(btnLayout); } } }
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue/*from w w w . j av a 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
private Component decorateComponent(String caption, Component toWrap) { final HorizontalLayout result = new HorizontalLayout(); result.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); result.setSpacing(true);//w ww.j a va2 s.c o m result.setSizeUndefined(); final Label captionLabel = new Label(caption); captionLabel.setSizeUndefined(); captionLabel.addStyleName("caption-label"); result.addComponent(captionLabel); result.addComponent(toWrap); return result; }