List of usage examples for com.vaadin.ui HorizontalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java
License:Open Source License
/** * Method which actually creates the whole UI. *//* ww w . ja v a2 s . c om*/ @Override protected void init(VaadinRequest vaadinRequest) { VerticalLayout layout = new VerticalLayout(); Panel panel = new Panel("Login"); panel.setSizeUndefined(); FormLayout content = new FormLayout(); userName = new TextField("Username"); content.addComponent(userName); PasswordField password = new PasswordField("Password"); content.addComponent(password); Button login = new Button("Login"); register = new Button("Register"); CheckBox askBox = new CheckBox("Are you a Roommanager?"); login.setStyleName(Reindeer.BUTTON_SMALL); login.setWidth("86px"); register.setStyleName(Reindeer.BUTTON_SMALL); register.setWidth("86px"); askBox.setStyleName(Reindeer.BUTTON_SMALL); HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.addComponent(login); hl.addComponent(register); hl.addComponent(askBox); content.addComponent(hl); content.setSizeUndefined(); content.setMargin(true); panel.setContent(content); login.addClickListener(e -> { System.out.println(userName.getValue()); System.out.println(password.getValue()); try { if (controller.login(userName.getValue(), password.getValue()) || userName.equals(userName.getValue()) && password.equals(password.getValue())) { setContent(new ReservationUI()); } } catch (Throwable e1) { e1.printStackTrace(); } }); register.addClickListener(e -> { try { Role x = askBox.getValue() ? Role.ROOMMANAGER : Role.CUSTOMER; controller.register(userName.getValue(), password.getValue(), x); } catch (Throwable e1) { e1.printStackTrace(); } }); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(panel); setContent(layout); }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.LogInView.java
License:Open Source License
@Override public Component load() { final VerticalLayout formContainer = new VerticalLayout(); formContainer.setStyleName("login-form"); formContainer.setWidthUndefined();/* ww w . jav a2s. c o m*/ fieldMail.setCaption("Type your mail here:"); fieldMail.setStyleName("textfield-form"); fieldMail.setTabIndex(1); fieldMail.focus(); fieldPassword.setCaption("Type your password here:"); fieldPassword.setTabIndex(2); fieldPassword.setStyleName("textfield-form"); btnLogin.setClickShortcut(ShortcutAction.KeyCode.ENTER); btnLogin.setTabIndex(3); btnLogin.addClickListener(e -> { switch (logInController.login()) { case ADMIN: AbstractView adminView = new AdminView(); ApplicationController appController = ApplicationController.getInstance(); appController.loadView(adminView); break; case USER: // Load the user view here default: break; } }); btnLogin.setStyleName("button-center"); btnLogin.setTabIndex(4); btnLogin.setWidth("91px"); btnRegister.addClickListener(e -> { RegistrationView rView = new RegistrationView(this); ApplicationController applicationController = ApplicationController.getInstance(); applicationController.loadView(rView); }); btnRegister.setStyleName("button-center"); btnRegister.setWidth("91px"); labelMessage.setStyleName("horizontal-center"); labelMessage.setSizeUndefined(); final HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.addComponents(btnLogin, btnRegister); layoutButtons.setStyleName("horizontal-center"); layoutButtons.setMargin(true); layoutButtons.setSpacing(true); formContainer.addComponents(fieldMail, fieldPassword, layoutButtons, labelMessage); formContainer.setMargin(true); formContainer.setSpacing(true); Responsive.makeResponsive(formContainer); return formContainer; }
From source file:ch.bfh.ti.soed.hs16.srs.white.view.RegistrationView.java
License:Open Source License
@Override public Component load() { final VerticalLayout layout = new VerticalLayout(); layout.setStyleName("registration-form"); fieldFirstName.setStyleName("textfield-form"); fieldLastName.setStyleName("textfield-form"); fieldEmail.setStyleName("textfield-form"); fieldConfirmEmail.setStyleName("textfield-form"); fieldPassword.setStyleName("textfield-form"); fieldConfirmPassword.setStyleName("textfield-form"); btnSubmit.setStyleName("button-center"); btnSubmit.setWidth("91px"); btnSubmit.addClickListener(e -> registrationController.register()); btnCancel.setStyleName("button-center"); btnCancel.setWidth("91px"); btnCancel.addClickListener(e -> registrationController.goBack(getLastView())); final HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.addComponents(btnSubmit, btnCancel); layoutButtons.setStyleName("horizontal-center"); layoutButtons.setMargin(true);/*from w w w . ja va2s . c om*/ layoutButtons.setSpacing(true); labelMessage.setStyleName("horizontal-center"); labelMessage.setSizeUndefined(); layout.addComponents(fieldFirstName, fieldLastName, fieldEmail, fieldConfirmEmail, fieldPassword, fieldConfirmPassword, layoutButtons, labelMessage); return layout; }
From source file:ch.wscr.management.ui.view.MemberView.java
/** * Kopfzeile fr das Grid erstellen/* w w w.j a v a2 s . c o m*/ * * @param grid das Grid dem die Kopfzeile hinzugefgt werden soll */ private void setHeaderRow(final Grid grid) { // TODO Erstellung neuer Mitglieder muss noch optimiert werden final Button addMember = new Button("Neu", clickEvent -> { BeanItem<Member> beanItem = memberBeanItemContainer.addItem(new Member()); grid.setEditorEnabled(true); //grid.editItem(beanItem); }); addMember.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); addMember.setIcon(FontAwesome.PLUS_CIRCLE); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSizeFull(); buttonLayout.setSpacing(true); buttonLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); buttonLayout.addComponent(addMember); HeaderRow headerRow = grid.prependHeaderRow(); headerRow.join("memberId", "lastName", "firstName", "adrStreet", "adrPostalCode", "adrCity", "adrCountry", "birthDate", "driverLicense"); headerRow.getCell("lastName").setComponent(buttonLayout); }
From source file:ch.wscr.management.ui.view.MemberView.java
/** * Header der View erstellen//from w w w .j ava2 s .co m * * @return der Header */ private Component buidViewHeader() { HorizontalLayout header = new HorizontalLayout(); header.setWidth(100f, Unit.PERCENTAGE); header.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); header.setSpacing(true); Label title = new Label("Mitgliederverwaltung"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H1); header.addComponent(title); Label gap = new Label(); gap.setWidth(10, Unit.PIXELS); header.addComponent(gap); header.setExpandRatio(title, 1); return header; }
From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java
License:Open Source License
private Component getSubmitLayout() { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); submitButton = getButton(SUBMIT_CAPTION); submitButton.addClickListener(getSubmitButtonClickListener()); buttonLayout.addComponent(submitButton); resetButton = getButton(RESET_CAPTION); resetButton.addClickListener(getResetClickListener()); buttonLayout.addComponent(resetButton); return buttonLayout; }
From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java
License:Open Source License
private Component getProgressLayout() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); status = new Label(""); layout.addComponent(this.status); progress = new ProgressBar(); progress.setEnabled(false);/*from w ww.j a va 2 s . co m*/ progress.setVisible(false); layout.addComponent(progress); return layout; }
From source file:com.adonis.ui.menu.Menu.java
public Menu(PersonService personService, VehicleService vehicleService, Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); setPersonsCrudProperties(personService); setVehiclesCrudProperties(vehicleService); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true); Label title = new Label("Vehicle manager"); title.addStyleName(ValoTheme.LABEL_H1); title.setSizeUndefined();/*from w w w . j a va2 s .c om*/ Image image = new Image(null, new ThemeResource("img/car.png")); image.setStyleName(ValoTheme.MENU_LOGO); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item // HorizontalLayout logoutLayout = new HorizontalLayout(); // logoutLayout.addStyleName(ValoTheme.MENU_ITEM); // logoutLayout.setSpacing(false); // // MenuBar logoutMenu = new MenuBar(); // logoutMenu.setStyleName(VALO_MENUITEMS); // logoutMenu.addItem("Logout", new MenuBar.Command() { // // @Override // public void menuSelected(MenuBar.MenuItem selectedItem) { // VaadinSession.getCurrent().getSession().invalidate(); // Page.getCurrent().reload(); // } // }); // // logoutMenu.addStyleName("user-menu"); // Image logout = new Image(null, new ThemeResource("img/logout.png")); // logoutLayout.addComponent(logout, 0); // logoutLayout.addComponent(logoutMenu, 1); // menuPart.addComponent(logoutLayout); // button for toggling the visibility of the menu when on a small screen showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); // showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); addStyleName("backImage"); }
From source file:com.ahmed.vaadinone.ui.PersonForm.java
public PersonForm() { addField("First Name", new TextField("First Name")); addField("Last Name", new TextField("Last Name")); HorizontalLayout footer = new HorizontalLayout(); footer.setSpacing(true); footer.addComponent(save);/* ww w . j av a2s . com*/ footer.addComponent(cancel); setFooter(footer); }
From source file:com.antonjohansson.lprs.view.ServiceView.java
License:Apache License
private Layout useTokenLayout() { token.setInputPrompt("Token"); token.setWidth(STANDARD_WIDTH, EM);//from w w w . ja v a 2 s .c om useToken.setCaption("Next"); backFromUseToken.setCaption("Back"); HorizontalLayout buttons = new HorizontalLayout(useToken, backFromUseToken); buttons.setSpacing(true); VerticalLayout layout = new VerticalLayout(); layout.addComponents(greeting, token, buttons); layout.setMargin(true); layout.setSpacing(true); layout.setVisible(false); layout.setWidthUndefined(); return layout; }