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:ed.cracken.pos.ui.seller.SellerView.java
public SellerView() { summary = SellSummaryTo.builder().count(BigDecimal.ZERO).total(BigDecimal.ZERO).build(); setSizeFull();/*from www. j a va 2 s . com*/ addStyleName("crud-view"); viewLogic = new SellerLogic(this); paymentView = new SellerPaymentView(); grid = new SellerGrid(); grid.addSelectionListener((SelectionEvent event) -> { viewLogic.editItem(grid.getSelectedRow()); }); VerticalLayout barAndGridLayout = new VerticalLayout(); HorizontalLayout foot; barAndGridLayout.addComponent(createTopBar()); barAndGridLayout.addComponent(grid); barAndGridLayout.addComponent(foot = createFooter()); barAndGridLayout.setMargin(true); barAndGridLayout.setSpacing(true); barAndGridLayout.setSizeFull(); barAndGridLayout.setExpandRatio(grid, 1); barAndGridLayout.setStyleName("crud-main-layout"); barAndGridLayout.setComponentAlignment(foot, Alignment.TOP_CENTER); addComponent(barAndGridLayout); addComponent(sellItemForm = new SellItemForm(viewLogic)); }
From source file:edu.kit.dama.ui.admin.administration.user.MembershipRoleEditorWindow.java
License:Apache License
/** * Get the main layout./*w w w.j a va 2 s . c om*/ * * @return The main layout. */ private GridLayout getMainLayout() { if (mainPanel == null) { String id = "mainPanel"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2); builder.addComponent(getMembershipsTable(), 0, 0); Label l = new Label( "To update the membership role of the selected group(s) select the new role below and click <i>'Apply New Role'</i>. The new role is limited by the user's maximum role.", ContentMode.HTML); Label spacer = new Label("<br/>", ContentMode.HTML); Button closeButton = new Button("Close"); closeButton.addClickListener((event) -> { close(); }); VerticalLayout actionLayout = new VerticalLayout(l, spacer, getRoleComboBox(), getCommitChangeButton()); actionLayout.setComponentAlignment(l, Alignment.TOP_CENTER); actionLayout.setComponentAlignment(getRoleComboBox(), Alignment.TOP_RIGHT); actionLayout.setComponentAlignment(getCommitChangeButton(), Alignment.TOP_RIGHT); actionLayout.setComponentAlignment(getCommitChangeButton(), Alignment.TOP_RIGHT); actionLayout.setSpacing(true); actionLayout.setSizeFull(); builder.addComponent(actionLayout, 1, 0); builder.addComponent(closeButton, Alignment.BOTTOM_RIGHT, 1, 1, 1, 1); mainPanel = builder.getLayout(); mainPanel.setId(DEBUG_ID_PREFIX + id); mainPanel.setSizeFull(); mainPanel.setColumnExpandRatio(0, .7f); mainPanel.setColumnExpandRatio(1, .3f); mainPanel.setRowExpandRatio(0, .99f); mainPanel.setRowExpandRatio(1, .01f); mainPanel.setSpacing(true); mainPanel.setMargin(true); updateMainPanel(); } return mainPanel; }
From source file:edu.kit.dama.ui.admin.administration.usergroup.GroupMembershipEditorWindow.java
License:Apache License
private GridLayout getMainLayout() throws AuthorizationException, UnsupportedEnumException { if (mainPanel == null) { String id = "mainPanel"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); UIUtils7.GridLayoutBuilder builder = new UIUtils7.GridLayoutBuilder(2, 2); //add table and exclude button builder.addComponent(getMembersTable(), 0, 0).addComponent(getExcludeMembersButton(), Alignment.BOTTOM_LEFT, 0, 1, 1, 1); Label l = new Label( "To add members select them in the list below and click <i>'Add Member(s)'</i>. To exclude members select them in the table and click <i>'Exclude Member(s)'</i>", ContentMode.HTML); Button closeButton = new Button("Close"); closeButton.addClickListener((event) -> { close();//from www.j a va 2 s . co m }); VerticalLayout actionLayout = new VerticalLayout(l, getUserSelector(), getAddMembersButton()); actionLayout.setComponentAlignment(l, Alignment.TOP_CENTER); actionLayout.setComponentAlignment(getUserSelector(), Alignment.TOP_RIGHT); actionLayout.setComponentAlignment(getAddMembersButton(), Alignment.TOP_RIGHT); actionLayout.setExpandRatio(getUserSelector(), 1.0f); actionLayout.setSpacing(true); actionLayout.setSizeFull(); builder.addComponent(actionLayout, 1, 0, 1, 1).addComponent(closeButton, Alignment.BOTTOM_RIGHT, 1, 1, 1, 1); mainPanel = builder.getLayout(); mainPanel.setId(DEBUG_ID_PREFIX + id); mainPanel.setSizeFull(); mainPanel.setColumnExpandRatio(0, .7f); mainPanel.setColumnExpandRatio(1, .3f); mainPanel.setRowExpandRatio(0, .99f); mainPanel.setRowExpandRatio(1, .01f); mainPanel.setSpacing(true); mainPanel.setMargin(true); updateMainPanel(); } return mainPanel; }
From source file:edu.kit.dama.ui.admin.AdminUIMainView.java
License:Apache License
/** * Setup the login form including its logic. *///w w w .j ava 2 s. c om private void setupLoginForm(AbstractLoginComponent.AUTH_MODE type, String pendingAuth, VaadinRequest request) { ComboBox authSelection = new ComboBox(); authSelection.setWidth("400px"); authSelection.setNullSelectionAllowed(false); authSelection.setStyleName("auth_selection"); Label spacer = new Label("<br/>", ContentMode.HTML); spacer.setWidth("400px"); String orcidClientId = DataManagerSettings.getSingleton() .getStringProperty(OrcidLoginComponent.ORCID_CLIENT_ID_PROPERTY, null); String orcidClientSecret = DataManagerSettings.getSingleton() .getStringProperty(OrcidLoginComponent.ORCID_CLIENT_SECRET_PROPERTY, null); /// String b2AccessClientId = DataManagerSettings.getSingleton().getStringProperty(B2AccessLoginComponent.B2ACCESS_CLIENT_ID_PROPERTY, null); // String b2AccessClientSecret = DataManagerSettings.getSingleton().getStringProperty(B2AccessLoginComponent.B2ACCESS_CLIENT_SECRET_PROPERTY, null); List<AbstractLoginComponent> components = new ArrayList<>(); if (orcidClientId != null && !orcidClientId.equals("ORCID_CLIENT_ID") && orcidClientSecret != null && !orcidClientSecret.equals("ORCID_CLIENT_SECRET")) { components.add(new OrcidLoginComponent()); } /*B2Access is currently not supported. if (b2AccessClientId != null && b2AccessClientSecret != null) { components.add(new B2AccessLoginComponent()); }*/ components.add(new EmailPasswordLoginComponent()); loginComponents = components.toArray(new AbstractLoginComponent[] {}); //default login component has index 0 loginComponent = loginComponents[0]; for (AbstractLoginComponent component : loginComponents) { //add new login component authSelection.addItem(component.getLoginIdentifier()); authSelection.setItemCaption(component.getLoginIdentifier(), component.getLoginLabel()); if (pendingAuth != null && pendingAuth.equals(component.getLoginIdentifier())) { //login or registration process in pending, continue process loginComponent = component; try { switch (type) { case REGISTRATION: loginComponent.doRegistration(request); break; default: loginComponent.doLogin(request); break; } } catch (UnauthorizedAccessAttemptException ex) { //failed to continue auth...cancel. String message = "Failed to continue pending " + (AbstractLoginComponent.AUTH_MODE.LOGIN.equals(type) ? "login" : "registration") + " for authentication #" + pendingAuth + "."; LOGGER.error(message, ex); UIComponentTools.showError(message); VaadinSession.getCurrent().setAttribute("auth_pending", null); VaadinSession.getCurrent().setAttribute("registration_pending", null); loginComponent.reset(); } } } authSelection.select(loginComponent.getLoginIdentifier()); authSelection.addValueChangeListener((Property.ValueChangeEvent event) -> { String value = (String) event.getProperty().getValue(); if (value != null) { for (AbstractLoginComponent component : loginComponents) { if (value.equals(component.getLoginIdentifier())) { loginForm.replaceComponent(loginComponent, component); loginComponent = component; } } } }); loginForm = new VerticalLayout(authSelection, spacer, loginComponent); loginForm.setComponentAlignment(authSelection, Alignment.TOP_CENTER); loginForm.setComponentAlignment(spacer, Alignment.TOP_CENTER); loginForm.setComponentAlignment(loginComponent, Alignment.TOP_CENTER); }
From source file:edu.kit.dama.ui.admin.login.AbstractLoginComponent.java
License:Apache License
/** * Basic initialization of components.//from w ww .j a va 2s . c o m */ private void initializeLayout() { registrationFormView.setWidth("400px"); loginButton = new Button("Login"); loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); loginButton.setWidth("100px"); loginButton.addClickListener(this); registerButton = new Button("Register"); registerButton.setWidth("100px"); registerButton.addClickListener(this); mainLayout = new UIUtils7.GridLayoutBuilder(2, 2).addComponent(getLoginForm(), 0, 0, 2, 1) .addComponent(registerButton, 0, 1, 1, 1).addComponent(loginButton, 1, 1, 1, 1).getLayout(); mainLayout.setComponentAlignment(getLoginForm(), Alignment.TOP_CENTER); mainLayout.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT); mainLayout.setSpacing(true); mainLayout.setMargin(false); mainLayout.setComponentAlignment(registerButton, Alignment.BOTTOM_LEFT); VerticalLayout vLayout = new VerticalLayout(mainLayout); vLayout.setImmediate(true); vLayout.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(vLayout); }
From source file:edu.kit.dama.ui.admin.workflow.DataWorkflowBasePropertiesLayout.java
License:Apache License
public DataWorkflowBasePropertiesLayout() { LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ..."); setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1)); setSizeFull();//from w ww. j a va 2s . c om setMargin(true); setSpacing(true); setCaption("TASK CONFIGURATION"); setColumns(4); setRows(6); //first row addComponent(getNameField(), 0, 0); addComponent(getVersionField(), 1, 0); addComponent(getContactBox(), 2, 0); addComponent(getGroupBox(), 3, 0); //second row addComponent(getApplicationPackageUrlField(), 0, 1, 1, 1); addComponent(getApplicationArgumentsField(), 2, 1); //addComponent(getCheckBoxesLayout(), 3, 1, 3, 2); //add placeholder only addComponent(new VerticalLayout(), 3, 1, 3, 2); Label l = new Label("* Changing fields with a red border will update the version of the associated task."); l.addStyleName("red-text"); addComponent(l, 0, 2, 2, 2); l.setHeight("12px"); setComponentAlignment(l, Alignment.TOP_CENTER); // addComponent(getKeywordsField(), 0, 3, 2, 3); // addComponent(getDescriptionArea(), 0, 4, 2, 5); Button addPropertyButton = new Button(); addPropertyButton.setIcon(new ThemeResource(IconContainer.ADD)); addPropertyButton.addClickListener((Button.ClickEvent event) -> { addPropertyComponent.reset(); addPropertyComponent.showWindow(); }); HorizontalLayout layout = new HorizontalLayout(getEnvironmentPropertiesSelect(), addPropertyButton); layout.setComponentAlignment(getEnvironmentPropertiesSelect(), Alignment.TOP_LEFT); layout.setComponentAlignment(addPropertyButton, Alignment.BOTTOM_RIGHT); layout.setSizeFull(); layout.setExpandRatio(getEnvironmentPropertiesSelect(), .95f); layout.setExpandRatio(addPropertyButton, .05f); addComponent(layout, 3, 3, 3, 5); //add popup to layout addPropertyComponent = new AddEnvironmentPropertyComponent(this); //set dummy row height to 0 setColumnExpandRatio(0, 0.2f); setColumnExpandRatio(1, 0.15f); setColumnExpandRatio(2, 0.2f); setColumnExpandRatio(3, 0.25f); setRowExpandRatio(5, 1f); }
From source file:edu.kit.dama.ui.commons.util.PaginationLayout.java
License:Apache License
/** * Fill the pagination listing based on a specific query to obtain valid * objects.// ww w .j a v a2 s. c o m */ private void renderPage() { //obtain the objects of this page (5 entries per page are shown) int start = currentPage * entriesPerPage; //initialize page panel and layout page = new Panel(); page.setCaption(caption); page.setImmediate(true); page.setIcon(icon); VerticalLayout pageLayout = new VerticalLayout(); pageLayout.setMargin(true); pageLayout.setImmediate(true); pageLayout.setSizeUndefined(); page.setSizeFull(); List<C> entries; if (overallEntries > 0) { AbstractComponent header = callback.renderHeader(); if (header != null) { pageLayout.addComponent(header); pageLayout.setComponentAlignment(header, Alignment.TOP_LEFT); } entries = callback.getEntries(this, start); //add all objects of this page int objectIdx = 1; for (C entry : entries) { AbstractComponent renderedEntry = callback.renderEntry(entry, start + objectIdx); pageLayout.addComponent(renderedEntry); pageLayout.setComponentAlignment(renderedEntry, Alignment.TOP_CENTER); Label spacer = new Label("<hr/>", Label.CONTENT_XHTML); spacer.setHeight("3px"); spacer.setWidth("100%"); pageLayout.addComponent(spacer); pageLayout.setComponentAlignment(spacer, Alignment.TOP_CENTER); objectIdx++; } //if there are less than 'entriesPerPage' entries, add a 'filler' to keep the actual items on top of the layout if (objectIdx < entriesPerPage) { Label filler = new Label(); pageLayout.addComponent(filler); pageLayout.setExpandRatio(filler, 1.0f); } } else { //nothing visible Label filler = new Label("No entries available"); pageLayout.addComponent(filler); pageLayout.setExpandRatio(filler, 1.0f); } page.setContent(pageLayout); }
From source file:edu.kit.dama.ui.repo.MyVaadinUI.java
License:Apache License
/** * Build the reference view. This view is used to show digital object * information directly via URL without accessing the search interface. * * @param pIdentifier The identifier of the object to query for. */// ww w .j a va 2 s. co m private void buildRefView(String pIdentifier) { if (pIdentifier == null) { Label error = new Label("<h3>No object identifier (pid) provided in URL.<h3>", ContentMode.HTML); mainLayout = new VerticalLayout(error); return; } try { //in ref view we use the dummy context as references should be accessible publicly but without write permissions IAuthorizationContext ctx = getDummyContext(); DigitalObject object = DigitalObjectPersistenceHelper.getDigitalObjectByIdentifier(pIdentifier, ctx); if (object == null || !object.isVisible()) { Label error = new Label( "<h3>The object '" + pIdentifier + "' seems to be temporarily not available.<h3>", ContentMode.HTML); mainLayout = new VerticalLayout(error); } else { EntryRenderPanel rp = new EntryRenderPanel(null, object, ctx); mainLayout = new VerticalLayout(rp); mainLayout.setComponentAlignment(rp, Alignment.TOP_CENTER); rp.setWidth("1024px"); rp.setHeight("768px"); } } catch (UnauthorizedAccessAttemptException ex) { Label error = new Label("<h3>The object with the identifier '" + pIdentifier + "' seems to be no longer publicly accessible.<h3>", ContentMode.HTML); mainLayout = new VerticalLayout(error); } setContent(mainLayout); }
From source file:edu.kit.dama.ui.repo.MyVaadinUI.java
License:Apache License
/** * Build the search view and execute the provided query immediately. * * @param pQuery The query to execute or null if an empty view should be * shown./*from w ww . j av a 2s . c om*/ */ private void buildSearchView(String pQuery) { loginButton.setWidth("70px"); loginButton.setStyleName(BaseTheme.BUTTON_LINK); logoutButton.setWidth("70px"); logoutButton.setStyleName(BaseTheme.BUTTON_LINK); adminButton.setWidth("70px"); adminButton.setStyleName(BaseTheme.BUTTON_LINK); logoutButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { loggedInUser = UserData.NO_USER; refreshMainLayout(); } }); adminButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Page.getCurrent() .open(DataManagerSettings.getSingleton().getStringProperty( DataManagerSettings.GENERAL_BASE_URL_ID, "http://localhost:8889/BaReDemo") + "/admin", "_blank"); } }); searchField = UIUtils7.factoryTextField(null, "Search for..."); searchField.setWidth("920px"); searchField.setHeight("60px"); searchField.addStyleName("searchField"); paginationPanel = new PaginationPanel(this); paginationPanel.setSizeFull(); paginationPanel.setAllEntries(new LinkedList<DigitalObjectId>()); searchProvider = new FulltextElasticSearchProvider( DataManagerSettings.getSingleton() .getStringProperty(DataManagerSettings.ELASTIC_SEARCH_DEFAULT_CLUSTER_ID, "KITDataManager"), DataManagerSettings.getSingleton() .getStringProperty(DataManagerSettings.ELASTIC_SEARCH_DEFAULT_HOST_ID, "localhost"), DataManagerSettings.getSingleton().getStringProperty( DataManagerSettings.ELASTIC_SEARCH_DEFAULT_INDEX_ID, ElasticsearchHelper.ELASTICSEARCH_TYPE), ElasticsearchHelper.ELASTICSEARCH_TYPE); NativeButton goButton = new NativeButton(); goButton.setIcon(new ThemeResource("img/24x24/search.png")); goButton.setWidth("60px"); goButton.setHeight("60px"); goButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { doSearch(); } }); goButton.setClickShortcut(KeyCode.ENTER); setupLoginForm(); loginForm.setWidth("320px"); loginForm.setHeight("150px"); final PopupView loginPopup = new PopupView(null, loginForm); loginPopup.setHideOnMouseOut(false); loginButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { //mainLayout.replaceComponent(searchLayout, loginForm); loginPopup.setPopupVisible(true); } }); Label filler = new Label(); memberLayout = new HorizontalLayout(filler, adminButton, loginButton, loginPopup); memberLayout.setComponentAlignment(loginButton, Alignment.TOP_RIGHT); memberLayout.setComponentAlignment(adminButton, Alignment.TOP_RIGHT); memberLayout.setComponentAlignment(loginPopup, Alignment.TOP_RIGHT); memberLayout.setExpandRatio(filler, 1.0f); memberLayout.setMargin(false); memberLayout.setSpacing(false); memberLayout.setWidth("100%"); memberLayout.setHeight("30px"); Label spacer = new Label("<hr/>", ContentMode.HTML); spacer.setHeight("20px"); searchLayout = new UIUtils7.GridLayoutBuilder(3, 4) .addComponent(searchField, Alignment.TOP_LEFT, 0, 0, 2, 1) .addComponent(goButton, Alignment.TOP_RIGHT, 2, 0, 1, 1).fillRow(spacer, 0, 1, 1) .addComponent(paginationPanel, Alignment.MIDDLE_CENTER, 0, 2, 3, 2).getLayout(); searchLayout.addStyleName("paper"); searchLayout.setSpacing(true); searchLayout.setMargin(true); paginationPanel.setWidth("980px"); //wrapper Label icon8Link = new Label("<a href=\"http://icons8.com\">Icons by icon8.com</a>", ContentMode.HTML); mainLayout = new VerticalLayout(memberLayout, searchLayout, icon8Link); mainLayout.setComponentAlignment(memberLayout, Alignment.TOP_CENTER); mainLayout.setComponentAlignment(searchLayout, Alignment.TOP_CENTER); mainLayout.setComponentAlignment(icon8Link, Alignment.BOTTOM_RIGHT); mainLayout.setExpandRatio(memberLayout, .05f); mainLayout.setExpandRatio(searchLayout, .93f); mainLayout.setExpandRatio(icon8Link, .02f); VerticalLayout fullscreen = new VerticalLayout(mainLayout); fullscreen.setComponentAlignment(mainLayout, Alignment.TOP_CENTER); fullscreen.setSizeFull(); setContent(fullscreen); mainLayout.setWidth("1024px"); mainLayout.setHeight("768px"); if (pQuery != null) { searchField.setValue(pQuery); doSearch(); } }
From source file:edu.nps.moves.mmowgli.components.Header.java
License:Open Source License
private void addBlogHeadlinesLink(String pos) { VerticalLayout vl = new VerticalLayout(); vl.setWidth("955px"); vl.addComponent(blogHeadlinesLink);/*from w w w . ja v a 2s. c o m*/ vl.setComponentAlignment(blogHeadlinesLink, Alignment.TOP_CENTER); addComponent(vl, pos); }