List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private Component buildLoginForm() { final VerticalLayout loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined();//from w ww. j a va 2 s .c o m loginPanel.setSpacing(true); Responsive.makeResponsive(loginPanel); loginPanel.addStyleName("login-panel"); loginPanel.addComponent(buildLabels()); loginPanel.addComponent(buildFields()); return loginPanel; }
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private Component buildFields() { final VerticalLayout layout = new VerticalLayout(); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true);/*ww w .j ava 2s . co m*/ fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER); username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(ShortcutAction.KeyCode.ENTER); signin.focus(); final CheckBox checkBox = new CheckBox("Remember me", true); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { login(username.getValue(), password.getValue(), checkBox.getValue()); } }); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); layout.setSpacing(true); layout.addComponent(fields); layout.addComponent(checkBox); return layout; }
From source file:by.bigvova.views.UserView.UserView.java
License:Apache License
@Override public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) { setSizeFull();/*from w ww. j a va2 s . c o m*/ footerButtons.setSpacing(true); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); Label header = new Label("Meal table"); header.addStyleName(ValoTheme.LABEL_H1); layout.addComponent(header); layout.addComponent(mainGrid); layout.addComponent(footerButtons); layout.setExpandRatio(mainGrid, 1); setCompositionRoot(layout); }
From source file:ch.bfh.ti.soed.hs16.srs.green.view.MyUI.java
License:Open Source License
/** * Method which actually creates the whole UI. *///w w w.j av a 2 s . c o m @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.kandr3.view.MyUI.java
License:Open Source License
@Override protected void init(VaadinRequest vaadinRequest) { final VerticalLayout layout = new VerticalLayout(); final TextField name = new TextField(); name.setCaption("Type your name here:"); Button button = new Button("Click Me"); button.addClickListener(e -> {/* ww w. j a v a 2 s .c o m*/ layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!")); }); layout.addComponents(name, button); layout.setMargin(true); layout.setSpacing(true); setContent(layout); }
From source file:ch.bfh.ti.soed.hs16.srs.white.concept.AbstractTableView.java
License:Open Source License
@Override public Component load() { VerticalLayout usersLayout = new VerticalLayout(); List data = abstractTableController.getData(); usersLayout.addComponent(createHeader()); for (Object e : data) { Component itemView = createItemView(e); usersLayout.addComponent(itemView); }/* w w w . j a va 2 s . c o m*/ usersLayout.setMargin(true); usersLayout.setSpacing(true); return usersLayout; }
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();/*from w w w . j a v a2 s. co 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:com.antonjohansson.lprs.view.ErrorView.java
License:Apache License
private VerticalLayout layout() { VerticalLayout layout = new VerticalLayout(); layout.setCaption("Errors found when starting the application"); layout.setSpacing(true); layout.setWidthUndefined();//from w ww. j ava2 s .c o m return layout; }
From source file:com.antonjohansson.lprs.view.ServiceView.java
License:Apache License
private Layout requestTokenLayout() { username.setInputPrompt("Username"); username.setWidth(STANDARD_WIDTH, EM); captcha.setSize(NORMAL);//from w w w . j a va 2 s .c om captcha.setTheme(LIGHT); captcha.setType(IMAGE); requestToken.setCaption("Request token"); requestToken.setWidth(STANDARD_WIDTH, EM); requestToken.setEnabled(false); VerticalLayout layout = new VerticalLayout(); layout.addComponents(username, captcha, requestToken); layout.setMargin(true); layout.setSpacing(true); layout.setVisible(false); layout.setWidthUndefined(); return layout; }
From source file:com.antonjohansson.lprs.view.ServiceView.java
License:Apache License
private Layout useTokenLayout() { token.setInputPrompt("Token"); token.setWidth(STANDARD_WIDTH, EM);/*w w w. j a v a 2s. 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; }