List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment
@Override public void setComponentAlignment(Component childComponent, Alignment alignment)
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.topic.accounting.AccountingQuestionManager.java
License:LGPL
@Override public void startQuiz() { // Remove everything from the layout, save it for displaying after // clicking OK final Component[] components = new Component[getComponentCount()]; for (int i = 0; i < components.length; i++) { components[i] = getComponent(i); }/*from w w w . j a v a2s .com*/ removeAllComponents(); // Create first page VerticalLayout layout = new VerticalLayout(); addComponent(layout); Label label = new Label("Answer all the questions like you were working for \"Unternehmen XY\"", ContentMode.HTML); Button cont = new Button("Continue", e -> { removeAllComponents(); for (Component c : components) { addComponent(c); } super.startQuiz(); }); layout.addComponent(components[0]);// Title of the quiz layout.addComponent(label); layout.addComponent(cont); layout.setComponentAlignment(components[0], Alignment.MIDDLE_CENTER); }
From source file:au.org.scoutmaster.views.ContactView.java
@Override protected AbstractLayout getAdvancedSearchLayout() { final VerticalLayout advancedSearchLayout = new VerticalLayout(); advancedSearchLayout.setSpacing(true); final HorizontalLayout tagSearchLayout = new HorizontalLayout(); this.tagSearchField = new TagField("Search Tags", true); tagSearchLayout.addComponent(this.tagSearchField); tagSearchLayout.setSizeFull();//www .ja v a 2 s . com advancedSearchLayout.addComponent(tagSearchLayout); final HorizontalLayout stringSearchLayout = new HorizontalLayout(); stringSearchLayout.addComponent(this.searchField); stringSearchLayout.setWidth("100%"); advancedSearchLayout.addComponent(stringSearchLayout); final Button searchButton = new Button("Search"); final Action1<ClickEvent> searchClickAction = new SearchClickAction(); ButtonEventSource.fromActionOf(searchButton).subscribe(searchClickAction); advancedSearchLayout.addComponent(searchButton); advancedSearchLayout.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); return advancedSearchLayout; }
From source file:by.bigvova.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();/*from w w w . ja v a 2 s. com*/ userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); Label label = new Label("Name: User / Password: password"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); 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.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(label); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private VerticalLayout root() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();//from ww w . j av a2s . c om Component loginForm = buildLoginForm(); layout.addComponent(loginForm); layout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); return layout; }
From source file:ch.bfh.ti.soed.hs16.srs.black.view.loginView.LoginView.java
License:Open Source License
public LoginView() { usernameField = new TextField("Username"); usernameField.setIcon(FontAwesome.USER); usernameField.setWidth(12, Unit.EM); passwordField = new PasswordField("Password"); passwordField.setIcon(FontAwesome.KEY); passwordField.setWidth(12, Unit.EM); loginButton = new Button("Login"); loginButton.setWidth(5, Unit.EM);//from ww w .j a va 2 s . co m loginButton.addStyleName(ValoTheme.BUTTON_PRIMARY); signUpButton = new Button("Sign Up"); signUpButton.setWidth(6, Unit.EM); VerticalLayout layout = new VerticalLayout(); HorizontalLayout layoutButtons = new HorizontalLayout(loginButton, signUpButton); layoutButtons.setSpacing(true); Panel panel = new Panel("Login - Smart ReservationEntity System"); panel.setSizeUndefined(); layout.addComponent(panel); FormLayout content = new FormLayout(); content.addComponents(usernameField, passwordField, layoutButtons); content.setSizeFull(); content.setMargin(true); panel.setContent(content); setCompositionRoot(layout); layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); layout.setMargin(new MarginInfo(true, false, false, false)); }
From source file:ch.bfh.ti.soed.hs16.srs.black.view.signUpView.SignUpView.java
License:Open Source License
public SignUpView() { usernameField = new TextField("Username"); usernameField.setIcon(FontAwesome.USER); usernameField.setWidth(12, Unit.EM); passwordField = new PasswordField("Password"); passwordField.setIcon(FontAwesome.KEY); passwordField.setWidth(12, Unit.EM); passwordFieldRepeat = new PasswordField("Repeat Password"); passwordFieldRepeat.setIcon(FontAwesome.KEY); passwordFieldRepeat.setWidth(12, Unit.EM); addUserButton = new Button("Add New User"); addUserButton.setWidth(12, Unit.EM); goBackButton = new Button("Back"); VerticalLayout layout = new VerticalLayout(); Panel panel = new Panel("Sign Up - Smart ReservationEntity System"); panel.setSizeUndefined();// w ww. j av a2s .com layout.addComponent(panel); FormLayout content = new FormLayout(); content.addComponents(usernameField, passwordField, passwordFieldRepeat, addUserButton); content.setSizeUndefined(); content.setMargin(true); VerticalLayout formAndBack = new VerticalLayout(content, goBackButton); formAndBack.setMargin(true); panel.setContent(formAndBack); setCompositionRoot(layout); layout.setComponentAlignment(panel, Alignment.MIDDLE_CENTER); layout.setMargin(new MarginInfo(true, false, false, false)); }
From source file:com.aaron.mbpet.views.users.UserEditor.java
License:Apache License
public UserEditor(Item personItem, String lableText, boolean mode) { this.editMode = mode; // this.setModal(true); center();/*from w ww . j a v a 2 s.c o m*/ setResizable(true); setClosable(true); setModal(true); // setSizeUndefined(); setWidth(25, Unit.EM); this.currsessionuser = ((MbpetUI) UI.getCurrent()).getSessionUser(); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); this.personItem = personItem; editorForm = new Form(); editorForm.setFormFieldFactory(this); editorForm.setBuffered(true); editorForm.setImmediate(true); editorForm.setItemDataSource(personItem, Arrays.asList("firstname", "lastname", "email", "username", "password", "organization")); //buttons saveButton = new Button("Save", this); saveButton.setClickShortcut(KeyCode.ENTER); cancelButton = new Button("Cancel", this); saveButton.addStyleName(ValoTheme.BUTTON_PRIMARY); HorizontalLayout buttons = new HorizontalLayout(); buttons.setWidth("100%"); buttons.addComponents(saveButton, cancelButton); buttons.setComponentAlignment(saveButton, Alignment.BOTTOM_LEFT); buttons.setComponentAlignment(cancelButton, Alignment.BOTTOM_RIGHT); // editorForm.getFooter().addComponent(buttons); // editorForm.getFooter().addComponent(cancelButton); layout.addComponent(new Label("<h3>" + lableText + "</h3>", ContentMode.HTML)); layout.addComponent(editorForm); layout.setComponentAlignment(editorForm, Alignment.MIDDLE_CENTER); layout.addComponent(buttons); setContent(layout); //editorForm setCaption(buildCaption()); }
From source file:com.bsb.samples.vaadin.wizard.core.WizardSampleApplication.java
License:Apache License
@Override public void init() { final VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull();//from w w w. j a va 2s .c om mainLayout.setMargin(true); final Wizard wizard = new Wizard(); wizard.addStep(new FirstStep(), "First"); wizard.addStep(new FinalStep(), "Final"); wizard.setWidth(800, Sizeable.UNITS_PIXELS); wizard.setHeight(600, Sizeable.UNITS_PIXELS); mainLayout.addComponent(wizard); mainLayout.setComponentAlignment(wizard, Alignment.MIDDLE_CENTER); final Window mainWindow = new Window("Wizard Sample"); mainWindow.setContent(mainLayout); setMainWindow(mainWindow); }
From source file:com.cavisson.gui.dashboard.components.controls.Dragging.java
License:Apache License
private List<Component> createComponents() { final List<Component> components = new ArrayList<Component>(); final Label label = new Label("This is a long text block that will wrap."); label.setWidth("120px"); components.add(label);/*from w ww .j a va2 s. c o m*/ final Embedded image = new Embedded("", new ThemeResource("../runo/icons/64/document.png")); components.add(image); final CssLayout documentLayout = new CssLayout(); documentLayout.setWidth("19px"); for (int i = 0; i < 5; ++i) { final Embedded e = new Embedded(null, new ThemeResource("../runo/icons/16/document.png")); e.setHeight("16px"); e.setWidth("16px"); documentLayout.addComponent(e); } components.add(documentLayout); final VerticalLayout buttonLayout = new VerticalLayout(); final Button button = new Button("Button"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { Notification.show("Button clicked"); } }); buttonLayout.addComponent(button); buttonLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER); components.add(buttonLayout); return components; }
From source file:com.cms.utils.CommonUtils.java
public static Panel addOg2Panel(OptionGroup og, String caption, String height) { og.setWidth("100%"); og.setHeight("-1px"); og.setImmediate(true);//from w w w. j a v a2 s. c o m og.setMultiSelect(true); VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined(); layout.setImmediate(true); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(og); layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT); Panel panel = new Panel(); if (!DataUtil.isStringNullOrEmpty(caption)) { panel.setCaption(caption); } panel.setWidth("100%"); panel.setImmediate(true); if (!DataUtil.isStringNullOrEmpty(height)) { panel.setHeight(height); } else { panel.setHeight("200px"); } panel.addStyleName(Runo.PANEL_LIGHT); panel.setContent(layout); return panel; }