List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:fr.univlorraine.mondossierweb.views.NotesMobileView.java
License:Apache License
public void refresh() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { removeAllComponents();//from w w w . j ava 2 s .co m /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour if (userController.isEnseignant()) { returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToListeInscrits(); } if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); } //Titre Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNavBar.setStyleName("v-label-navbar"); navbar.addComponent(labelNavBar); navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER); navbar.setExpandRatio(labelNavBar, 1); //Significations if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { significationButton = new Button(); significationButton.setIcon(FontAwesome.INFO_CIRCLE); significationButton.setStyleName("v-nav-button"); significationButton.addClickListener(e -> { //afficher les significations SignificationsMobileWindow w = new SignificationsMobileWindow(false); UI.getCurrent().addWindow(w); }); navbar.addComponent(significationButton); navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT); } addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); List<Diplome> ldiplomes = MdwTouchkitUI.getCurrent().getEtudiant().getDiplomes(); if (ldiplomes != null && ldiplomes.size() > 0) { Panel diplomesPanel = new Panel( applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale())); diplomesPanel.setStyleName("centertitle-panel"); diplomesPanel.addStyleName("v-colored-panel-caption"); VerticalLayout diplomesLayout = new VerticalLayout(); for (Diplome diplome : ldiplomes) { Panel panelEnCours = null; panelEnCours = new Panel(diplome.getAnnee()); panelEnCours.setStyleName("v-panel-caption-centertitle-panel"); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); noteLayout.setSpacing(true); VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Label libelleButton = new Label(diplome.getLib_web_vdi()); libelleButton.setHeight("100%"); libelleButton.setWidth("100%"); libelleButton.addStyleName("label-centre"); //Appel de la window contenant le dtail des notes if (diplome.getResultats() != null && diplome.getResultats().size() > 0) { libelleLayout.addComponent(new Label("")); } libelleLayout.addComponent(libelleButton); libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER); HorizontalLayout notesessionLayout = new HorizontalLayout(); notesessionLayout.setSizeFull(); notesessionLayout.setSpacing(true); if (diplome.getResultats() != null && diplome.getResultats().size() > 0) { int i = 0; for (Resultat r : diplome.getResultats()) { i++; VerticalLayout resultatLayout = new VerticalLayout(); resultatLayout.setSizeFull(); Label session = new Label(r.getSession()); session.setStyleName("label-bold-with-bottom"); resultatLayout.addComponent(session); Label note = new Label(r.getNote()); resultatLayout.addComponent(note); Label resultat = new Label(r.getAdmission()); resultatLayout.addComponent(resultat); //Si c'est la dernire session if (i == diplome.getResultats().size()) { //On affiche les infos en gras note.setStyleName(ValoTheme.LABEL_BOLD); resultat.setStyleName(ValoTheme.LABEL_BOLD); } notesessionLayout.addComponent(resultatLayout); } } else { Label resultat = new Label("Aucun rsultat"); resultat.setStyleName(ValoTheme.LABEL_SMALL); notesessionLayout.addComponent(resultat); } noteLayout.addComponent(libelleLayout); noteLayout.addComponent(notesessionLayout); panelEnCours.setContent(noteLayout); diplomesLayout.addComponent(panelEnCours); } diplomesPanel.setContent(diplomesLayout); globalLayout.addComponent(diplomesPanel); } List<Etape> letapes = MdwTouchkitUI.getCurrent().getEtudiant().getEtapes(); if (letapes != null && letapes.size() > 0) { Panel elpsPanel = new Panel( applicationContext.getMessage(NAME + ".table.etapes", null, getLocale())); elpsPanel.setStyleName("centertitle-panel"); elpsPanel.addStyleName("v-colored-panel-caption"); VerticalLayout elpsLayout = new VerticalLayout(); for (Etape etape : letapes) { Panel panelEnCours = null; panelEnCours = new Panel(etape.getAnnee()); panelEnCours.setStyleName("v-panel-caption-centertitle-panel"); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); noteLayout.setSpacing(true); VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Button libelleButton = new Button(etape.getLibelle()); Utils.setButtonStyle(libelleButton); libelleButton.setHeight("100%"); libelleButton.setWidth("100%"); //Appel de la window contenant le dtail des notes prepareBoutonAppelDetailDesNotes(libelleButton, etape); if (etape.getResultats() != null && etape.getResultats().size() > 0) { libelleLayout.addComponent(new Label("")); } libelleLayout.addComponent(libelleButton); libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER); HorizontalLayout notesessionLayout = new HorizontalLayout(); notesessionLayout.setSizeFull(); notesessionLayout.setSpacing(true); if (etape.getResultats() != null && etape.getResultats().size() > 0) { int i = 0; for (Resultat r : etape.getResultats()) { i++; VerticalLayout resultatLayout = new VerticalLayout(); resultatLayout.setSizeFull(); Label session = new Label(r.getSession()); session.setStyleName("label-bold-with-bottom"); resultatLayout.addComponent(session); Label note = new Label(r.getNote()); resultatLayout.addComponent(note); Label resultat = new Label(r.getAdmission()); resultatLayout.addComponent(resultat); //Si c'est la dernire session if (i == etape.getResultats().size()) { //On affiche les infos en gras note.setStyleName(ValoTheme.LABEL_BOLD); resultat.setStyleName(ValoTheme.LABEL_BOLD); } notesessionLayout.addComponent(resultatLayout); } } else { Label resultat = new Label("Aucun rsultat"); resultat.setStyleName(ValoTheme.LABEL_SMALL); notesessionLayout.addComponent(resultat); } noteLayout.addComponent(libelleLayout); noteLayout.addComponent(notesessionLayout); panelEnCours.setContent(noteLayout); elpsLayout.addComponent(panelEnCours); } elpsPanel.setContent(elpsLayout); globalLayout.addComponent(elpsPanel); } addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.windows.HelpBasicWindow.java
License:Apache License
/** * Cre une fentre de confirmation// ww w . ja va 2s. c om * @param message * @param titre */ public HelpBasicWindow(String message, String titre, boolean displayLienContact) { /* Style */ setWidth(900, Unit.PIXELS); setModal(true); setResizable(false); setClosable(false); /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(false); setContent(layout); /* Titre */ setCaption(titre); // Lien de contact if (displayLienContact) { String mailContact = configController.getAssistanceContactMail(); if (StringUtils.hasText(mailContact)) { Button contactBtn = new Button( applicationContext.getMessage(NAME + ".btnContact", null, getLocale()), FontAwesome.ENVELOPE); contactBtn.addStyleName(ValoTheme.BUTTON_LINK); BrowserWindowOpener contactBwo = new BrowserWindowOpener("mailto:" + mailContact); contactBwo.extend(contactBtn); layout.addComponent(contactBtn); layout.setComponentAlignment(contactBtn, Alignment.TOP_RIGHT); } } /* Texte */ Label textLabel = new Label(message, ContentMode.HTML); layout.addComponent(textLabel); /* Boutons */ HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setWidth(100, Unit.PERCENTAGE); buttonsLayout.setSpacing(true); layout.addComponent(buttonsLayout); btnFermer.setCaption(applicationContext.getMessage("helpWindow.btnFermer", null, getLocale())); btnFermer.setIcon(FontAwesome.TIMES); btnFermer.addClickListener(e -> close()); buttonsLayout.addComponent(btnFermer); buttonsLayout.setComponentAlignment(btnFermer, Alignment.MIDDLE_RIGHT); /* Centre la fentre */ center(); }
From source file:fr.univlorraine.mondossierweb.views.windows.LoadingIndicatorWindow.java
License:Apache License
public LoadingIndicatorWindow() { super();//w w w. j a v a 2s . co m setModal(true); setDraggable(false); setResizable(false); setClosable(false); addStyleName("loadingIndicatorWindow"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); ProgressBar busyIndicator = new ProgressBar(); busyIndicator.setIndeterminate(true); layout.addComponent(busyIndicator); layout.setComponentAlignment(busyIndicator, Alignment.MIDDLE_CENTER); center(); }
From source file:gms.demo.service.presentation.ui.MainUI.java
License:Open Source License
private void initDefaultContent() { // add buttons to the main layout HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true);/* w w w . j a v a2 s . c o m*/ refreshButton.addListener(this); removeButton.addListener(this); clearAllButton.addListener(this); createNewButton.addListener(this); buttonLayout.addComponent(refreshButton); buttonLayout.addComponent(removeButton); buttonLayout.addComponent(clearAllButton); buttonLayout.addComponent(createNewButton); buttonLayout.setMargin(true); // add form for creating new entries, hidden at first cmiPanel = new CreateMemberInfoPanel(this); cmiPanel.setVisible(false); // add table that shows all the group masters mlPanel = new MasterListPanel(this); // set up logout button logoutButton.addListener(this); // add everything to main layout VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setMargin(true); mainLayout.setSizeUndefined(); mainLayout.addComponent(buttonLayout); mainLayout.addComponent(cmiPanel); mainLayout.addComponent(mlPanel); mainLayout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER); mainLayout.addComponent(logoutButton); mainLayout.setComponentAlignment(logoutButton, Alignment.BOTTOM_RIGHT); // add the main layout to a root layout and center it defaultLayout = new VerticalLayout(); defaultLayout.addComponent(mainLayout); defaultLayout.setComponentAlignment(mainLayout, Alignment.TOP_CENTER); }
From source file:gq.vaccum121.ui.LoginScreen.java
License:Apache License
private void initLayout() { FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();//from w ww .jav a2s .c o m userName = new TextField("Username"); passwordField = new PasswordField("Password"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeUndefined(); loginFailedLabel = new Label(); loginLayout.addComponent(loginFailedLabel); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loggedOutLabel = new Label("Good bye!"); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); loggedOutLabel.setSizeUndefined(); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(rootLayout); setSizeFull(); }
From source file:gui.views.LoginView.java
public void setUp() { // Ein Neuer Kommentar fr Git. this.setSizeFull(); final TextField userlogin = new TextField(); userlogin.setCaption("Username"); final PasswordField password = new PasswordField(); password.setCaption("Passwort"); VerticalLayout layout = new VerticalLayout(); layout.addComponent(userlogin);// w w w . java 2 s . c om layout.addComponent(password); Panel panel = new Panel("BitteLogin-Daten eingeben"); this.addComponent(panel); this.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); panel.setContent(layout); Button buttonLogin = new Button("Login", FontAwesome.SEARCH); layout.addComponent(buttonLogin); layout.setComponentAlignment(buttonLogin, Alignment.MIDDLE_CENTER); panel.setSizeUndefined(); buttonLogin.addClickListener(new ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String user = userlogin.getValue(); String pw = password.getValue(); LoginControl.controllogin(user, pw); } }); }
From source file:info.magnolia.ui.mediaeditor.field.image.ImageMediaField.java
License:Open Source License
@Override protected Component initContent() { addStyleName("image-media-field"); setSizeFull();/*from w w w .j a v a 2 s . c om*/ VerticalLayout mediaContentWrapper = new VerticalLayout(); mediaContentWrapper.addStyleName("media-wrapper"); mediaContentWrapper.setSizeFull(); fieldComponent = createImage(); mediaContentWrapper.addComponent(fieldComponent); mediaContentWrapper.setComponentAlignment(fieldComponent, Alignment.MIDDLE_CENTER); return mediaContentWrapper; }
From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java
License:Apache License
private void addInputField() { VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);//www. ja v a 2s . com layout.setWidth(100, UNITS_PERCENTAGE); loginPanel.addComponent(layout); Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be // attached to panels or windows textFieldPanel.addStyleName(PANEL_LIGHT); textFieldPanel.setContent(new VerticalLayout()); textFieldPanel.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(textFieldPanel); layout.setExpandRatio(textFieldPanel, 1.0f); Label labelUserName = new Label(i18nManager.getMessage(USER_NAME_TITLE)); labelUserName.addStyleName(LABEL_SMALL); userNameInputField = new TextField(); userNameInputField.setWidth(100, UNITS_PERCENTAGE); Label labelPassword = new Label(i18nManager.getMessage(PASSWORD_TITLE)); labelPassword.addStyleName(LABEL_SMALL); passwordInputField = new PasswordField(); passwordInputField.setWidth(100, UNITS_PERCENTAGE); textFieldPanel.addComponent(labelUserName); textFieldPanel.addComponent(userNameInputField); textFieldPanel.addComponent(labelPassword); textFieldPanel.addComponent(passwordInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { private static final long serialVersionUID = 6928598745792215505L; public void handleAction(Action action, Object sender, Object target) { login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString()); } public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ENTER, null) }; } }); Button loginButton = new Button(i18nManager.getMessage(LOGIN)); layout.addComponent(loginButton); layout.setComponentAlignment(loginButton, MIDDLE_LEFT); loginButton.addListener(new ClickListener() { private static final long serialVersionUID = 7781253151592188006L; public void buttonClick(ClickEvent event) { login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString()); } }); }
From source file:jp.primecloud.auto.ui.DialogConfirm.java
License:Open Source License
public DialogConfirm(String caption, String message, Buttons buttons, Layout optionLayout) { super(caption); setModal(true);/*from ww w . j a va 2 s . c om*/ setResizable(false); setClosable(false); setWidth("380px"); addStyleName("dialog-confirm"); setIcon(Icons.DLGWARNING.resource()); VerticalLayout layout = (VerticalLayout) getContent(); layout.setWidth("100%"); layout.setMargin(false, true, false, true); layout.setSpacing(false); if (message != null && message.length() > 0) { // ?"\n"?"\t"???????"PREFORMATTED"?? Label lbl; if (message.indexOf("\n") != -1 || message.indexOf("\t") != -1) { lbl = new Label(message, Label.CONTENT_PREFORMATTED); } else { lbl = new Label(message, Label.CONTENT_TEXT); } lbl.addStyleName("dialog-message"); layout.addComponent(lbl); } // ???? if (optionLayout != null) { optionLayout.addStyleName("dialog-confirm-option"); addComponent(optionLayout); layout.setComponentAlignment(optionLayout, Alignment.MIDDLE_CENTER); } HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); // okButton = new Button(ViewProperties.getCaption("button.ok"), this, "buttonClick"); okButton.setDescription(ViewProperties.getCaption("description.ok")); okButton.setData(Result.OK); // [Enter]?okButton okButton.setClickShortcut(KeyCode.ENTER); okButton.focus(); cancelButton = new Button(ViewProperties.getCaption("button.cancel"), this, "buttonClick"); cancelButton.setDescription(ViewProperties.getCaption("description.cancel")); cancelButton.setData(Result.Cancel); switch (buttons) { case OK: hl.addComponent(okButton); break; case OKCancel: hl.addComponent(okButton); hl.addComponent(cancelButton); break; case OKCancelConfirm: hl.addComponent(okButton); hl.addComponent(cancelButton); okButton.setEnabled(false); confirm = new ComboBox(); confirm.setWidth("200px"); confirm.setImmediate(true); confirm.addStyleName("dialog-confirm"); confirm.setInputPrompt(ViewProperties.getCaption("description.dialogConfirmComboBox")); confirm.addItem(ViewProperties.getCaption("field.dialogConfirmComboBox")); confirm.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (confirm.getValue() != null) { okButton.setEnabled(true); } else { okButton.setEnabled(false); } } }); layout.addComponent(confirm); layout.setComponentAlignment(confirm, Alignment.MIDDLE_CENTER); break; default: break; } layout.addComponent(hl); layout.setComponentAlignment(hl, Alignment.BOTTOM_CENTER); }
From source file:jp.primecloud.auto.ui.MainMenu.java
License:Open Source License
MainMenu(final Window mainWindow) { this.mainWindow = mainWindow; VerticalLayout layout = (VerticalLayout) getContent(); setSizeFull();/* w w w .j av a 2s . c o m*/ setStyleName("mainmenu"); addStyleName(Reindeer.PANEL_LIGHT); layout.setMargin(false); layout.setSpacing(true); layout.setSizeFull(); tree.setNullSelectionAllowed(false); final String[][] menus = new String[][] { new String[] { "MyCloud", "New", "Manage" }, new String[] { "Cloud?", "" } }; for (int i = 0; i < menus.length; i++) { String planet = (menus[i][0]); tree.addItem(planet); if (menus[i].length == 1) { // The planet has no moons so make it a leaf. tree.setChildrenAllowed(planet, false); } else { // Add children (moons) under the planets. for (int j = 1; j < menus[i].length; j++) { String moon = menus[i][j]; // Add the item as a regular item. tree.addItem(moon); // Set it to be a child. tree.setParent(moon, planet); // Make the moons look like leaves. tree.setChildrenAllowed(moon, false); } // Expand the subtree. tree.expandItemsRecursively(planet); } } layout.addComponent(tree); // VerticalLayout adlayout = new VerticalLayout(); adlayout.setSpacing(false); adlayout.setMargin(false); Label ad1 = new Label( "<a href='http://www.csk.com/systems/services/technology/index.html' target='_blank'><img width='147' alt='????' src='./VAADIN/themes/classy/images/technology_ttl.jpg'></a>"); ad1.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad1); Label ad2 = new Label( "<a href='http://www.csk.com/systems/services/technology/technology01.html' target='_blank'><img width='147' alt='??????????' src='./VAADIN/themes/classy/images/technology_menu1.jpg'></a>"); ad2.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad2); Label ad3 = new Label( "<a href='http://www.csk.com/systems/services/technology/technology02.html' target='_blank'><img width='147' alt='?????' src='./VAADIN/themes/classy/images/technology_menu2.jpg'></a>"); ad3.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad3); Label ad4 = new Label( "<a href='http://www.csk.com/systems/services/technology/technology03.html' target='_blank'><img width='147' alt='' src='./VAADIN/themes/classy/images/technology_menu3.jpg'></a>"); ad4.setContentMode(Label.CONTENT_XHTML); adlayout.addComponent(ad4); layout.addComponent(adlayout); layout.setComponentAlignment(adlayout, Alignment.MIDDLE_CENTER); // ?? ItemClickEvent.ItemClickListener listener = new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { String click = (String) event.getItemId(); if ("Manage".equals(click)) { showCloudEditWindow(); } else if ("New".equals(click)) { showCloudAddWindow(); } else if ("".equals(click)) { String url = Config.getProperty("zabbix.url"); mainWindow.open(new ExternalResource(url), "_blank"); } } }; tree.addListener(listener); // ??? showFirst(); }