List of usage examples for com.vaadin.ui Alignment TOP_CENTER
Alignment TOP_CENTER
To view the source code for com.vaadin.ui Alignment TOP_CENTER.
Click Source Link
From source file:gms.demo.service.presentation.ui.MainUI.java
License:Open Source License
private void initLoginContent() { loginForm.setCaption("Login:"); loginForm.setDescription("<br/>This application does not use your SSO or LDAP " + "passwords. So don't go giving me all your " + "login info."); loginForm.addField("user", new TextField("User:")); loginForm.addField("pass", new PasswordField("Password:")); loginForm.getFooter().addComponent(loginButton); loginButton.addListener(this); // a panel will make this look a little nicer Panel loginPanel = new Panel(); loginPanel.addComponent(loginForm);/*from w ww .ja va2 s . c o m*/ loginPanel.setWidth(24f, Sizeable.UNITS_EM); loginPanel.setHeight(20f, Sizeable.UNITS_EM); // add the components to a root layout and center it loginLayout = new VerticalLayout(); loginLayout.addComponent(loginPanel); // this will keep the form near the top of the page loginLayout.setMargin(true); loginLayout.setComponentAlignment(loginPanel, Alignment.TOP_CENTER); // this would center it on the page // loginLayout.setSizeFull(); // loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_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 ww. ja va2 s. co 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 w w . 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:kn.uni.gis.ui.AdminWindow.java
License:Apache License
private Component loginComponent() { final VerticalLayout layout = new VerticalLayout(); final PasswordField passwordField = new PasswordField("Old Hunters Age"); passwordField.setWidth("-1px"); passwordField.setHeight("-1px"); passwordField.focus();//w ww. j a va 2 s . com Button button_2 = new Button(); button_2.setCaption("Login"); button_2.setImmediate(false); button_2.setWidth("-1px"); button_2.setHeight("-1px"); button_2.addListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (password.equals(passwordField.getValue())) { AdminWindow.this.removeComponent(layout); AdminWindow.this.addComponent(createTable()); } else { AdminWindow.this.showNotification("Wrong age!"); } } }); layout.addComponent(passwordField); layout.addComponent(button_2); layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER); layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER); return layout; }
From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java
License:Open Source License
public AdminAuthView() { setSizeFull();/* w w w . ja v a2 s .c o m*/ VerticalLayout header = new VerticalLayout(); header.setSizeFull(); HorizontalLayout content = new HorizontalLayout(); content.setSizeFull(); addComponents(header, content); setExpandRatio(header, 1); setExpandRatio(content, 6); welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>"); welcomeText.setContentMode(ContentMode.HTML); welcomeText.setSizeUndefined(); header.addComponent(welcomeText); header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER); Panel controlPanel = new Panel("Administrator control panel"); controlPanel.setSizeUndefined(); Panel addCoordPanel = new Panel("Create a new coordinator"); addCoordPanel.setSizeUndefined(); Panel messagesPanel = new Panel("Administrator messages"); messagesPanel.setWidth("580px"); Table adminMessagesTable = new Table(); adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource()); adminMessagesTable.setColumnWidth("inputEvent", 180); adminMessagesTable.setSizeFull(); VerticalLayout controlLayout = new VerticalLayout(controlPanel); controlLayout.setSizeFull(); controlLayout.setMargin(false); controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER); VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel); coordOperationsLayout.setSizeFull(); coordOperationsLayout.setMargin(false); coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER); /******************************************/ coordOperationsLayout.setVisible(true); // main layout in the middle addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator" /******************************************/ HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel); VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable); messagesExternalLayout.setSizeFull(); messagesExternalLayout.setMargin(false); messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER); messagesInternalLayout.setMargin(false); messagesInternalLayout.setSizeFull(); messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER); messagesPanel.setContent(messagesInternalLayout); TextField idCoordAdd = new TextField(); TextField loginCoord = new TextField(); PasswordField pwdCoord = new PasswordField(); Label idCaptionAdd = new Label("ID"); Label loginCaption = new Label("Login"); Label pwdCaption = new Label("Password"); idCaptionAdd.setSizeUndefined(); idCoordAdd.setSizeUndefined(); loginCaption.setSizeUndefined(); loginCoord.setSizeUndefined(); pwdCaption.setSizeUndefined(); pwdCoord.setSizeUndefined(); Button validateNewCoord = new Button("Validate"); validateNewCoord.setClickShortcut(KeyCode.ENTER); validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY); GridLayout addCoordinatorLayout = new GridLayout(2, 4); addCoordinatorLayout.setSpacing(true); addCoordinatorLayout.setMargin(true); addCoordinatorLayout.setSizeFull(); addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption, pwdCoord); addCoordinatorLayout.addComponent(validateNewCoord, 1, 3); addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT); addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT); addCoordPanel.setContent(addCoordinatorLayout); content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER); content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER); content.setExpandRatio(controlLayout, 20); content.setExpandRatio(coordOperationsLayout, 10); content.setExpandRatio(messagesExternalLayout, 28); Button addCoordinator = new Button("Add coordinator"); Button deleteCoordinator = new Button("Delete coordinator"); addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE); logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE); VerticalLayout buttons = new VerticalLayout(); buttons.setMargin(true); buttons.setSpacing(true); buttons.setSizeFull(); buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); controlPanel.setContent(buttons); buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn); /******* DELETE COORDINATOR PANEL BEGIN *********/ Label idCaptionDel = new Label("ID"); TextField idCoordDel = new TextField(); Panel delCoordPanel = new Panel("Delete a coordinator"); coordOperationsLayout.addComponent(delCoordPanel); delCoordPanel.setVisible(false); coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER); delCoordPanel.setSizeUndefined(); GridLayout delCoordinatorLayout = new GridLayout(2, 2); delCoordinatorLayout.setSpacing(true); delCoordinatorLayout.setMargin(true); delCoordinatorLayout.setSizeFull(); Button deleteCoordBtn = new Button("Delete"); deleteCoordBtn.setClickShortcut(KeyCode.ENTER); deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY); delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel); delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1); delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT); delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT); delCoordPanel.setContent(delCoordinatorLayout); /******* DELETE COORDINATOR PANEL END *********/ /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/ addCoordinator.addClickListener(event -> { if (!addCoordPanel.isVisible()) { delCoordPanel.setVisible(false); addCoordPanel.setVisible(true); idCoordAdd.focus(); } else addCoordPanel.setVisible(false); }); deleteCoordinator.addClickListener(event -> { if (!delCoordPanel.isVisible()) { addCoordPanel.setVisible(false); delCoordPanel.setVisible(true); idCoordDel.focus(); } else delCoordPanel.setVisible(false); }); /************************************************* MAIN BUTTONS LOGIC END *************************************************/ /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/ validateNewCoord.addClickListener(event -> { String currentURL = Page.getCurrent().getLocation().toString(); int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName); String iCrashURL = currentURL.substring(0, strIndexCreator); String googleShebang = "#!"; String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang; try { sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())), new DtLogin(new PtString(loginCoord.getValue())), new DtPassword(new PtString(pwdCoord.getValue()))); // open new browser tab with the newly created coordinator console... // "_blank" instructs the browser to open a new tab instead of a new window... // unhappily not all browsers interpret it correctly, // some versions of some browsers might still open a new window instead (notably Firefox)! Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank"); } catch (Exception e) { e.printStackTrace(); } idCoordAdd.setValue(""); loginCoord.setValue(""); pwdCoord.setValue(""); idCoordAdd.focus(); }); /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/ /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/ deleteCoordBtn.addClickListener(event -> { IcrashSystem sys = IcrashSystem.getInstance(); try { sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue()))); } catch (Exception e) { e.printStackTrace(); } idCoordDel.setValue(""); idCoordDel.focus(); }); /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/ }
From source file:me.uni.emuseo.view.login.LoginView.java
License:Open Source License
public LoginView() { this.setSizeFull(); Label titleLabel = new Label("<h1>e<strong>Museo</strong></h1>", ContentMode.HTML); loginLayout = new LoginLayout(); addComponent(titleLabel);/*from w w w .j a v a2s. c om*/ addComponent(loginLayout); titleLabel.setWidth(150, Unit.PIXELS); setExpandRatio(titleLabel, 0); setExpandRatio(loginLayout, 1); setComponentAlignment(titleLabel, Alignment.BOTTOM_CENTER); setComponentAlignment(loginLayout, Alignment.TOP_CENTER); }
From source file:me.uni.emuseo.view.menu.MenuStartLayout.java
License:Open Source License
public MenuStartLayout() { Label welcome = new Label("Witaj w systemie"); Label systemName = new Label("<h1>e<strong>Museo</strong></h1>", ContentMode.HTML); addComponent(welcome);/* ww w . j a v a 2s . c om*/ addComponent(systemName); setComponentAlignment(welcome, Alignment.BOTTOM_CENTER); setComponentAlignment(systemName, Alignment.TOP_CENTER); welcome.setSizeUndefined(); systemName.setSizeUndefined(); setWidth(100, Unit.PERCENTAGE); setHeight(60, Unit.PERCENTAGE); }
From source file:net.gvcc.jgoffice.MainUI.java
License:Open Source License
public void initLayoutAfterLogin() { mainLayout.addComponent(getCommandBar()); mainLayout.addComponent(getMainPanel()); mainLayout.addComponent(getFooterBar()); mainLayout.setComponentAlignment(getMainPanel(), Alignment.TOP_CENTER); mainLayout.setComponentAlignment(getCommandBar(), Alignment.TOP_CENTER); mainLayout.setComponentAlignment(getFooterBar(), Alignment.TOP_CENTER); mainLayout.setExpandRatio(getMainPanel(), 1.0f); mainLayout.setHeight("100%"); mainLayout.setImmediate(false);/*from w w w . java 2 s. c o m*/ getMainPanel().setWidth(MAINPANEL_WIDTH); getMainPanel().setHeight(MAINPANEL_HEIGHT); getMainPanel().setStyleName("g-jgoffice-module"); getCommandBar().setApplicationTitle(""); getCommandBar().setWidth(MAINPANEL_WIDTH); getFooterBar().setWidth(MAINPANEL_WIDTH); mainNavigator = new Navigator(this, getMainPanel()); mainNavigator.setErrorView(new ErrorPage()); UI.getCurrent().setNavigator(mainNavigator); getMainNavigator().addView("EmptyView", new EmptyView()); // FIXME We load all the available modules. We need a better solution!!! for (IViewRegistration viewRegistration : viewRegistrations) { viewRegistration.addViews(getMainNavigator()); } setWidth("100%"); setHeight("100%"); setContent(mainLayout); getCommandBar().searchComponent.addForm(this); }
From source file:no.uib.probe.csf.pr.touch.view.core.SearchingField.java
/** * Default constructor to initialize the main attributes. *//*from w w w . j a va 2 s .c o m*/ public SearchingField() { this.setSpacing(true); this.setHeightUndefined(); HorizontalLayout searchFieldContainerLayout = new HorizontalLayout(); searchFieldContainerLayout.setWidthUndefined(); searchFieldContainerLayout.setHeight(100, Unit.PERCENTAGE); searchFieldContainerLayout.setSpacing(true); TextField searchField = new TextField(); searchField.setDescription("Search proteins by name or accession"); searchField.setImmediate(true); searchField.setWidth(100, Unit.PIXELS); searchField.setHeight(18, Unit.PIXELS); searchField.setInputPrompt("Search..."); searchFieldContainerLayout.addComponent(searchField); searchField.setTextChangeTimeout(1500); searchField.setStyleName(ValoTheme.TEXTFIELD_SMALL); searchField.addStyleName(ValoTheme.TEXTFIELD_TINY); final Button b = new Button(); searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY); searchField.addShortcutListener(new Button.ClickShortcut(b, ShortcutListener.KeyCode.ENTER)); VerticalLayout searchingBtn = new VerticalLayout(); searchingBtn.setWidth(22, Unit.PIXELS); searchingBtn.setHeight(18, Unit.PIXELS); searchingBtn.setStyleName("tablesearchingbtn"); searchFieldContainerLayout.addComponent(searchingBtn); searchFieldContainerLayout.setComponentAlignment(searchingBtn, Alignment.TOP_CENTER); this.addComponent(searchFieldContainerLayout); this.setComponentAlignment(searchFieldContainerLayout, Alignment.TOP_CENTER); searchingCommentLabel = new Label(); searchingCommentLabel.setWidth(100, Unit.PERCENTAGE); searchingCommentLabel.setHeight(23, Unit.PIXELS); searchingCommentLabel.addStyleName(ValoTheme.LABEL_BOLD); searchingCommentLabel.addStyleName(ValoTheme.LABEL_SMALL); searchingCommentLabel.addStyleName(ValoTheme.LABEL_TINY); this.addComponent(searchingCommentLabel); this.setComponentAlignment(searchingCommentLabel, Alignment.TOP_CENTER); searchingBtn.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> { b.click(); }); searchField.addTextChangeListener((FieldEvents.TextChangeEvent event) -> { SearchingField.this.textChanged(event.getText()); }); b.addClickListener((Button.ClickEvent event) -> { SearchingField.this.textChanged(searchField.getValue()); }); }
From source file:org.activiti.explorer.ui.form.FormPropertiesComponent.java
License:Apache License
protected void initForm() { form = new Form(); form.setSizeFull(); addComponent(form); setComponentAlignment(form, Alignment.TOP_CENTER); }