List of usage examples for com.vaadin.ui Alignment BOTTOM_CENTER
Alignment BOTTOM_CENTER
To view the source code for com.vaadin.ui Alignment BOTTOM_CENTER.
Click Source Link
From source file:com.etest.view.tq.TQCoverageUI.java
Window getPickWindow(Item item, String propertyId) { Window sub = new Window("Field Value: "); sub.setWidth("150px"); sub.setModal(true);//from w w w .j a v a2s. c om sub.center(); sub.setResizable(false); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true); TextField field = new CommonTextField("Enter Value..", "Enter a Value: "); v.addComponent(field); Button button = new Button("CLOSE"); button.setWidth("100%"); button.setIcon(FontAwesome.TASKS); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim()); if (!isNumeric) { return; } boolean isGreaterThanInTB = tq.isGreaterThanInTB(item, propertyId, field.getValue().trim()); if (isGreaterThanInTB) { Notification.show("Not allowed to exceed in total Items in Test Bank!", Notification.Type.ERROR_MESSAGE); return; } else { item.getItemProperty(CommonUtilities.replaceStringTBToPick(propertyId)) .setValue(CommonUtilities.convertStringToInt(field.getValue())); footer.getCell(CommonUtilities.replaceStringTBToPick(propertyId)).setText(String.valueOf( tq.calculateTotalPickItems(grid, CommonUtilities.replaceStringTBToPick(propertyId)))); } sub.close(); }); v.addComponent(button); v.setComponentAlignment(button, Alignment.BOTTOM_CENTER); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQCoverageUI.java
Window getMaxItemsWindow(Item item, double previousValue) { Window sub = new Window("Field Value: "); sub.setWidth("150px"); sub.setModal(true);//from ww w. j a va2 s .c o m sub.center(); sub.setResizable(false); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true); TextField field = new CommonTextField("Enter Value..", "Enter a Value: "); v.addComponent(field); Button button = new Button("CLOSE"); button.setWidth("100%"); button.setIcon(FontAwesome.TASKS); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim()); if (!isNumeric) { return; } item.getItemProperty("Max Items").setValue(CommonUtilities.convertStringToDouble(field.getValue())); if (tq.calculateTotalMaxItems(grid) == CommonUtilities .convertStringToDouble(totalItems.getValue().trim())) { footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid))); } else { item.getItemProperty("Max Items").setValue(previousValue); footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid))); ShowErrorNotification.warning("Total Max Items should be equal to Total Test Items"); return; } sub.close(); }); v.addComponent(button); v.setComponentAlignment(button, Alignment.BOTTOM_CENTER); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.foc.helpBook.HelpUI.java
License:Apache License
@Override public FocCentralPanel newWindow() { FocCentralPanel focCentralPanel = new FocCentralPanel(); focCentralPanel.fill();// w ww . ja v a2s. c om Label labelHelpContent = new Label(); labelHelpContent.setContentMode(ContentMode.HTML); String htmlContent = (String) FocWebApplication.getFocWebSession_Static().getParameter("HELP_CONTENT"); labelHelpContent.setValue(htmlContent); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); HorizontalLayout navigationLayout = new HorizontalLayout(); navigationLayout.setWidth("95%"); navigationLayout.addComponent(getPreviousPageButton()); navigationLayout.setComponentAlignment(getPreviousPageButton(), Alignment.BOTTOM_LEFT); navigationLayout.addComponent(getNextPageButton()); navigationLayout.setComponentAlignment(getNextPageButton(), Alignment.BOTTOM_RIGHT); mainLayout.addComponent(labelHelpContent); mainLayout.addComponent(navigationLayout); mainLayout.setComponentAlignment(navigationLayout, Alignment.BOTTOM_CENTER); focCentralPanel.addComponent(mainLayout); return focCentralPanel; }
From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java
License:Apache License
public static void applyAlignment(AbstractOrderedLayout layout, Component component, String alignment) { alignment = alignment.toLowerCase(); if (alignment.equals("right") || alignment.equals("middle_right")) { layout.setComponentAlignment(component, Alignment.MIDDLE_RIGHT); } else if (alignment.equals("left") || alignment.equals("middle_left")) { layout.setComponentAlignment(component, Alignment.MIDDLE_LEFT); } else if (alignment.equals("center") || alignment.equals("middle_center")) { layout.setComponentAlignment(component, Alignment.MIDDLE_CENTER); } else if (alignment.equals("top_right")) { layout.setComponentAlignment(component, Alignment.TOP_RIGHT); } else if (alignment.equals("top_left")) { layout.setComponentAlignment(component, Alignment.TOP_LEFT); } else if (alignment.equals("top_center")) { layout.setComponentAlignment(component, Alignment.TOP_CENTER); } else if (alignment.equals("bottom_right")) { layout.setComponentAlignment(component, Alignment.BOTTOM_RIGHT); } else if (alignment.equals("bottom_left")) { layout.setComponentAlignment(component, Alignment.BOTTOM_LEFT); } else if (alignment.equals("bottom_center")) { layout.setComponentAlignment(component, Alignment.BOTTOM_CENTER); }/*from w ww. jav a 2s . c o m*/ }
From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java
License:Apache License
public void showValidationLayout(boolean showBackButton, int position) { if (validationSettings != null && getValidationLayoutVisible()) { XMLView xmlView = getXMLView();/* w ww . ja v a2s .c o m*/ if (xmlView != null && xmlView.isHelpFileExist()) { validationSettings.setWithTips(true); } validationLayout = new FVValidationLayout((INavigationWindow) getNavigationWindow(), this, validationSettings, showBackButton); // if(!FocWebApplication.getInstanceForThread().isMobile()){ if (Globals.isValo()) { INavigationWindow navigationindow = getParentNavigationWindow(); if (navigationindow instanceof FocWebApplication) { ((FocWebApplication) navigationindow).replaceFooterLayout(validationLayout); // FocWebApplication focWebApplication = findAncestor(FocWebApplication.class); // if(focWebApplication != null){ // focWebApplication.replaceFooterLayout(validationLayout); } else { if (position == POSITION_UP) { addComponentAsFirst(validationLayout); } else { addComponent(validationLayout); } setComponentAlignment(validationLayout, Alignment.BOTTOM_CENTER); } } else { addComponentAsFirst(validationLayout); setComponentAlignment(validationLayout, Alignment.MIDDLE_CENTER); } // }else{ // validationLayout.setStyleName("transparent"); // FVValidationLayout bottomValidationLayout = new FVValidationLayout((INavigationWindow) getNavigationWindow(), this, validationSettings, showBackButton); // addComponent(bottomValidationLayout); // setComponentAlignment(bottomValidationLayout, Alignment.BOTTOM_RIGHT); // if(bottomValidationLayout.getDeleteButton(false) != null){ // bottomValidationLayout.getDeleteButton(false).setIcon(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_BLACK)); // } // } // setExpandRatio(validationLayout, 1); validationLayout.addValidationListener(this); //Adding a default tip for tables /* if(getXMLView() != null && getXMLView().getXmlViewKey() != null && (getXMLView().getXmlViewKey().getType() == IXMLViewConst.TYPE_TABLE || getXMLView().getXmlViewKey().getType() == IXMLViewConst.TYPE_TREE)){ if(getValidationLayout().getTipsButton(false) != null){ getValidationLayout().setTipMessage("Double click any row for more details."); } } */ } }
From source file:com.github.peholmst.springsecuritydemo.ui.CategoryBrowser.java
License:Apache License
/** * Creates the category browser component. */// w w w.ja va 2 s . c o m @SuppressWarnings("serial") private void createComponent() { categoryContainer = new CategoryContainer(getCategoryService()); categoryContainer.refresh(); /* * The tree will show all the categories returned from the category * service. */ categoryTree = new Tree(); { categoryTree.setSizeFull(); categoryTree.setContainerDataSource(categoryContainer); categoryTree.setItemCaptionPropertyId("name"); categoryTree.setImmediate(true); } /* * The form for editing categories is hidden by default and is shown * when the user clicks the edit or add button. */ categoryForm = new CategoryForm(); /* * The toolbar will be placed at the bottom of the browser and contains * buttons for refreshing the category tree, and adding, editing and * removing categories. */ final HorizontalLayout toolbar = new HorizontalLayout(); { /* * Button: Refresh the category browser */ refreshButton = new Button(); refreshButton.setIcon(new ThemeResource("icons/16/refresh.png")); refreshButton.setStyleName("small"); refreshButton.setDescription(getI18nProvider().getMessage("categories.refresh.descr")); refreshButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { actionRefresh(); } }); toolbar.addComponent(refreshButton); /* * Button: Add a new category. The currently selected category will * be used as parent. */ addButton = new Button(); addButton.setIcon(new ThemeResource("icons/16/add.png")); addButton.setStyleName("small"); addButton.setDescription(getI18nProvider().getMessage("categories.add.descr")); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { actionAdd(); } }); toolbar.addComponent(addButton); /* * Button: Edit the selected category */ editButton = new Button(); editButton.setIcon(new ThemeResource("icons/16/pencil.png")); editButton.setStyleName("small"); editButton.setDescription(getI18nProvider().getMessage("categories.edit.descr")); editButton.setEnabled(false); editButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { actionEdit(); } }); toolbar.addComponent(editButton); /* * Button: Delete the selected category */ deleteButton = new Button(); deleteButton.setIcon(new ThemeResource("icons/16/delete.png")); deleteButton.setStyleName("small"); deleteButton.setDescription(getI18nProvider().getMessage("categories.delete.descr")); deleteButton.setEnabled(false); deleteButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { actionDelete(); } }); toolbar.addComponent(deleteButton); /* * Button: Show/edit the access control list for the selected * category */ aclButton = new Button(); aclButton.setIcon(new ThemeResource("icons/16/lock_edit.png")); aclButton.setStyleName("small"); aclButton.setDescription(getI18nProvider().getMessage("categories.acl.descr")); aclButton.setEnabled(false); aclButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { actionACL(); } }); toolbar.addComponent(aclButton); /* * Button: Show the audit log for the selected category */ auditButton = new Button(); auditButton.setIcon(new ThemeResource("icons/16/key.png")); auditButton.setStyleName("small"); auditButton.setDescription(getI18nProvider().getMessage("categories.audit.descr")); auditButton.setEnabled(false); auditButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { actionAudit(); } }); toolbar.addComponent(auditButton); } /* * The browser layout contains the category tree and the toolbar. */ browserComponent = new VerticalLayout(); browserComponent.setSizeFull(); browserComponent.addComponent(categoryTree); browserComponent.addComponent(categoryForm.getComponent()); browserComponent.addComponent(toolbar); browserComponent.setExpandRatio(categoryTree, 1.0f); browserComponent.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER); /* * Register a listener that updates the enablement state every time the * selection changes. */ categoryTree.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { updateEnablementState(); Long newCategoryId = (Long) event.getProperty().getValue(); Category newCategory = null; if (newCategoryId != null) { BeanItem<Category> item = categoryContainer.getItem(newCategoryId); if (item != null) { newCategory = item.getBean(); } } fireCategorySelectionChanged(newCategory); } }); }
From source file:com.gmail.volodymyrdotsenko.cms.fe.vaadin.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { langRepo.findAll().forEach(e -> { langSet.add(e.getCode());//from ww w . java 2 s. co m }); lang = new ComboBox("Language", langSet); getPage().setTitle("CMS"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined(); loginForm.addComponent(userName = new TextField("Username")); userName.setRequired(true); loginForm.addComponent(passwordField = new PasswordField("Password")); passwordField.setRequired(true); loginForm.addComponent(rememberMe = new CheckBox("Remember me")); loginForm.addComponent(lang); lang.setRequired(true); lang.setNullSelectionAllowed(false); loginForm.addComponent(login = new Button("Login")); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(e -> { 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(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); String currentLang = getLocale().getLanguage(); if (langSet.contains(currentLang)) lang.select(currentLang); else lang.select("en"); }
From source file:com.jiangyifen.ec2.ui.LoginLayout.java
/** * ?/*from w w w .ja va2 s.c om*/ * * @param roleType ? */ public LoginLayout(RoleType roleType, Ec2LoginLayout ec2LoginLayout) { // ?? this.setSpacing(true); this.setMargin(true); this.roleType = roleType; this.ec2LoginLayout = ec2LoginLayout; userLoginService = SpringContextHolder.getBean("userLoginService"); userService = SpringContextHolder.getBean("userService"); // ?Cookie this.getCookies(); Panel loginPanel = new Panel(roleType.name().toUpperCase() + " LOGIN INTERFACE"); loginPanel.setWidth("380px"); loginPanel.setHeight("260px"); this.addComponent(loginPanel); this.setComponentAlignment(loginPanel, Alignment.BOTTOM_CENTER); // ? VerticalLayout panelContent = (VerticalLayout) loginPanel.getContent(); createLoginMainComponents(panelContent, roleType); // ??? (?, ?) createConflictManageWindow(); }
From source file:com.jorambarrez.PropertyPanel.java
License:Apache License
protected void initTrashIcon() { Embedded trashIcon = new Embedded(null, Images.MODELER_TRASH); trashIcon.setWidth(63, UNITS_PIXELS); trashIcon.setHeight(61, UNITS_PIXELS); trashIcon.setType(Embedded.TYPE_IMAGE); VerticalLayout trashLayout = new VerticalLayout(); trashLayout.setWidth(120, UNITS_PIXELS); trashLayout.setHeight(120, UNITS_PIXELS); trashLayout.addComponent(trashIcon); trashLayout.setComponentAlignment(trashIcon, Alignment.MIDDLE_CENTER); DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(trashLayout); dragAndDropWrapper.setDragStartMode(DragStartMode.NONE); dragAndDropWrapper.setSizeUndefined(); addComponent(dragAndDropWrapper);/* w w w.ja v a 2 s .c om*/ setComponentAlignment(dragAndDropWrapper, Alignment.BOTTOM_CENTER); dragAndDropWrapper.setDropHandler(new DropHandler() { private static final long serialVersionUID = 1L; public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } public void drop(DragAndDropEvent event) { WrapperTransferable wrapperTransferable = (WrapperTransferable) event.getTransferable(); Node srcNode = (Node) wrapperTransferable.getSourceComponent(); // TODO: use eventrouter! ModelerApp.get().getFlowEditor().removeNode(srcNode); } }); }
From source file:com.klwork.explorer.ui.base.AbstractSecondMainPage.java
License:Apache License
protected void addSelectComponent() { VerticalLayout secondMenuLayout = new VerticalLayout(); secondMenuLayout.addStyleName("sidebar"); secondMenuLayout.addStyleName("menu"); //secondMenuLayout.setMargin(new MarginInfo(true,false,false,false)); secondMenuLayout.setSpacing(true);//from www.ja v a 2s.c o m secondMenuLayout.setSizeFull(); HorizontalLayout tableHeadLayout = new HorizontalLayout(); tableHeadLayout.setStyleName("tableHead"); tableHeadLayout.setHeight("20px"); Label nameLabel = new Label("hello,word"); tableHeadLayout.addComponent(nameLabel); tableHeadLayout.setComponentAlignment(nameLabel, Alignment.BOTTOM_CENTER); secondMenuLayout.addComponent(tableHeadLayout); //secondMenuLayout.setExpandRatio(tableHeadLayout, 0.1f); //table AbstractSelect select = createSelectComponent(); secondMenuLayout.addComponent(select); secondMenuLayout.setExpandRatio(select, 1.0f); if (select != null) { grid.addComponent(secondMenuLayout, 0, 0); } }