List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
From source file:com.cms.component.CustomPageTable.java
public HorizontalLayout createControls(String pageSizeDefault) { this.pageSizeDefault = pageSizeDefault; separatorTotal.setImmediate(true);//w w w . j a va 2 s .c o m Label itemsPerPageLabel = new Label(BundleUtils.getString("common.table.numberRecord")); for (String numberSize : Constants.PAGE_SIZE_LIST) { itemsPerPageSelect.addItem(numberSize); } itemsPerPageSelect.setImmediate(true); itemsPerPageSelect.setNullSelectionAllowed(false); itemsPerPageSelect.setWidth("50px"); itemsPerPageSelect.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { setPageLength(Integer.valueOf(String.valueOf(event.getProperty().getValue()))); firePagedChangedEvent(); } }); itemsPerPageSelect.select(pageSizeDefault); Label pageLabel = new Label(BundleUtils.getString("common.table.page"), ContentMode.HTML); final TextField currentPageTextField = new TextField(); currentPageTextField.setValue(String.valueOf(getCurrentPage())); currentPageTextField.setConverter(Integer.class); currentPageTextField .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages())); Label separatorLabel = new Label(" / ", ContentMode.HTML); final Label totalPagesLabel = new Label(String.valueOf(getTotalAmountOfPages()), ContentMode.HTML); currentPageTextField.setStyleName(Reindeer.TEXTFIELD_SMALL); currentPageTextField.setImmediate(true); currentPageTextField.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -2255853716069800092L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { currentPageTextField.removeAllValidators(); currentPageTextField .addValidator(new IntegerRangeValidator("Wrong page number", 1, getTotalAmountOfPages())); if (Integer.valueOf(String.valueOf(currentPageTextField.getValue())) <= getTotalAmountOfPages()) { int page = Integer.valueOf(String.valueOf(currentPageTextField.getValue())); setCurrentPage(page); } } }); pageLabel.setWidth(null); currentPageTextField.setWidth("30px"); separatorLabel.setWidth(null); totalPagesLabel.setWidth(null); HorizontalLayout controlBar = new HorizontalLayout(); HorizontalLayout pageSize = new HorizontalLayout(); HorizontalLayout pageManagement = new HorizontalLayout(); final Button first = new Button("<<", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { setCurrentPage(0); } }); previous = new Button("<", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { previousPage(); } }); final Button next = new Button(">", new Button.ClickListener() { private static final long serialVersionUID = -1927138212640638452L; @Override public void buttonClick(Button.ClickEvent event) { nextPage(); } }); final Button last = new Button(">>", new Button.ClickListener() { private static final long serialVersionUID = -355520120491283992L; @Override public void buttonClick(Button.ClickEvent event) { setCurrentPage(getTotalAmountOfPages()); } }); first.setStyleName(Reindeer.BUTTON_LINK); previous.setStyleName(Reindeer.BUTTON_LINK); next.setStyleName(Reindeer.BUTTON_LINK); last.setStyleName(Reindeer.BUTTON_LINK); itemsPerPageLabel.addStyleName("pagedtable-itemsperpagecaption"); itemsPerPageSelect.addStyleName("pagedtable-itemsperpagecombobox"); pageLabel.addStyleName("pagedtable-pagecaption"); currentPageTextField.addStyleName("pagedtable-pagefield"); separatorLabel.addStyleName("pagedtable-separator"); separatorTotal.addStyleName("pagedtable-separator"); totalPagesLabel.addStyleName("pagedtable-total"); first.addStyleName("pagedtable-first"); previous.addStyleName("pagedtable-previous"); next.addStyleName("pagedtable-next"); last.addStyleName("pagedtable-last"); itemsPerPageLabel.addStyleName("pagedtable-label"); itemsPerPageSelect.addStyleName("pagedtable-combobox"); pageLabel.addStyleName("pagedtable-label"); currentPageTextField.addStyleName("pagedtable-label"); separatorLabel.addStyleName("pagedtable-label"); separatorTotal.addStyleName("pagedtable-label"); totalPagesLabel.addStyleName("pagedtable-label"); first.addStyleName("pagedtable-button"); previous.addStyleName("pagedtable-button"); next.addStyleName("pagedtable-button"); last.addStyleName("pagedtable-button"); pageSize.addComponent(itemsPerPageLabel); pageSize.addComponent(itemsPerPageSelect); Label separator = new Label(" / ", ContentMode.HTML); pageSize.addComponent(separator); pageSize.addComponent(separatorTotal); pageSize.setComponentAlignment(itemsPerPageLabel, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(itemsPerPageSelect, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(separator, Alignment.MIDDLE_LEFT); pageSize.setComponentAlignment(separatorTotal, Alignment.MIDDLE_LEFT); pageSize.setSpacing(true); pageManagement.addComponent(first); pageManagement.addComponent(previous); pageManagement.addComponent(pageLabel); pageManagement.addComponent(currentPageTextField); pageManagement.addComponent(separatorLabel); pageManagement.addComponent(totalPagesLabel); pageManagement.addComponent(next); pageManagement.addComponent(last); pageManagement.setComponentAlignment(first, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(previous, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(pageLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(currentPageTextField, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(separatorLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(totalPagesLabel, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(next, Alignment.MIDDLE_LEFT); pageManagement.setComponentAlignment(last, Alignment.MIDDLE_LEFT); pageManagement.setWidth(null); pageManagement.setSpacing(true); controlBar.addComponent(pageSize); controlBar.addComponent(pageManagement); controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_CENTER); controlBar.setWidth("100%"); controlBar.setExpandRatio(pageSize, 1); addListener(new PageChangeListener() { @Override public void pageChanged(PagedTableChangeEvent event) { int abc = event.getCurrentPage(); first.setEnabled(container.getStartIndex() > 0); previous.setEnabled(container.getStartIndex() > 0); next.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); last.setEnabled(container.getStartIndex() < container.getRealSize() - getPageLength()); currentPageTextField.setValue(String.valueOf(getCurrentPage())); totalPagesLabel.setValue(String.valueOf(getTotalAmountOfPages())); if (resizePage) { int lenght = getPageLength(); int a = lenght % 5; int b = lenght / 5; if (a != 0) { int pageLenght = 5 * (b + 1); itemsPerPageSelect.setValue(pageLenght); } } separatorTotal.setValue(String.valueOf(container.getRealSize())); } }); return controlBar; }
From source file:com.cms.ui.ChangPasswordUI.java
public ChangPasswordUI() { mainLayout.setImmediate(true);/*from www. j a va 2 s . c o m*/ mainLayout.setCaption(BundleUtils.getString("title.changPassword")); mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); setWidth("30.0%"); setHeight("-1px"); setModal(true); txtUserName = new TextField(); txtUserName.setWidth("100%"); txtUserName.setHeight("-1px"); txtUserName.setRequired(true); txtUserName.setCaption(BundleUtils.getString("userName")); txtUserName.setImmediate(false); mainLayout.addComponent(txtUserName); txtPasswordOld = new PasswordField(); txtPasswordOld.setWidth("100%"); txtPasswordOld.setHeight("-1px"); txtPasswordOld.setRequired(true); txtPasswordOld.setCaption(BundleUtils.getString("passwordOld")); txtPasswordOld.setImmediate(false); mainLayout.addComponent(txtPasswordOld); txtPasswordNew = new PasswordField(); txtPasswordNew.setWidth("100%"); txtPasswordNew.setHeight("-1px"); txtPasswordNew.setRequired(true); txtPasswordNew.setCaption(BundleUtils.getString("passwordNew")); txtPasswordNew.setImmediate(false); mainLayout.addComponent(txtPasswordNew); txtConfirmPasswordNew = new PasswordField(); txtConfirmPasswordNew.setWidth("100%"); txtConfirmPasswordNew.setHeight("-1px"); txtConfirmPasswordNew.setRequired(true); txtConfirmPasswordNew.setCaption(BundleUtils.getString("passwordConfirm")); txtConfirmPasswordNew.setImmediate(false); mainLayout.addComponent(txtConfirmPasswordNew); // captcha = new ReCaptcha("6Lfv5OoSAAAAAPEbWhNB0ERopfQpRxr8_5yncOmg", "6Lfv5OoSAAAAAHa4zmExf6w2ja3vm-8ABKgyepq-", // new ReCaptchaOptions() { // { // theme = "white"; // } // }); // mainLayout.addComponent(captcha); GridManyButton gridButton = new GridManyButton(new String[] { BundleUtils.getString("btn.changePassword"), BundleUtils.getString("common.button.cancel") }); btnChange = gridButton.getBtnCommon().get(0); // btnChange.setWidth("100%"); // btnChange.setHeight("-1px"); // btnChange.setCaption(BundleUtils.getString("btn.changePassword")); btnChange.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String userName = txtUserName.getValue(); if (userName == null || userName.equals("")) { Notification.show("Bn cha nhp tn ti khon", Notification.Type.ERROR_MESSAGE); return; } String passwordOld = txtPasswordOld.getValue(); if (passwordOld == null || passwordOld.equals("")) { Notification.show("Bn cha nhp mt khu c", Notification.Type.ERROR_MESSAGE); return; } String passwordNew = txtPasswordNew.getValue(); if (passwordNew == null || passwordNew.equals("")) { Notification.show("Bn cha nhp mt khu mi", Notification.Type.ERROR_MESSAGE); return; } String confirmPassword = txtConfirmPasswordNew.getValue(); if (confirmPassword == null || confirmPassword.equals("")) { Notification.show("Bn cha xc nhn mt khu mi", Notification.Type.ERROR_MESSAGE); return; } if (!passwordNew.equals(confirmPassword)) { Notification.show("Xc nhn cha chnh xc", Notification.Type.ERROR_MESSAGE); return; } Boolean check = checkLogIn(userName, passwordOld); if (!check) { Notification.show("Mt khu c cha chnh xc", Notification.Type.ERROR_MESSAGE); return; } StaffDTO staff = lstStaffDTO.get(0); staff.setPassword(DataUtil.md5(passwordNew)); String message = WSStaff.updateStaff(staff); if (!message.equals("SUCCESS")) { Notification.show("Thay i khng thnh cng", Notification.Type.ERROR_MESSAGE); return; } else { Notification.show("Thay i thnh cng"); close(); DashboardEventBus.post(new DashboardEvent.UserLoggedOutEvent()); } } }); btnChange.setImmediate(false); // buttonLayout.addComponent(btnChange); btnClose = gridButton.getBtnCommon().get(1); // btnChange.setWidth("100%"); // btnClose.setHeight("-1px"); // btnClose.setCaption(BundleUtils.getString("btn.close")); btnClose.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { close(); } }); // buttonLayout.addComponent(btnClose); mainLayout.addComponent(gridButton); mainLayout.setComponentAlignment(gridButton, Alignment.MIDDLE_CENTER); setContent(mainLayout); }
From source file:com.cms.utils.ConfirmWindown.java
public ConfirmWindown(String caption, String question, String yes, String no) { setCaption(caption);//from www .j a v a2 s.co m btnYes.setCaption(yes); btnYes.focus(); btnNo.setCaption(no); setModal(true); center(); buttonsLayout.addComponent(btnYes); buttonsLayout.setComponentAlignment(btnYes, Alignment.MIDDLE_CENTER); buttonsLayout.addComponent(btnNo); buttonsLayout.setComponentAlignment(btnNo, Alignment.MIDDLE_CENTER); layout.addComponent(new Label(question)); layout.addComponent(buttonsLayout); setContent(layout); layout.setMargin(true); buttonsLayout.setMargin(true); buttonsLayout.setWidth("100%"); setWidth("300px"); setHeight("160px"); setResizable(false); btnYes.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { decision.yes(event); close(); } }); btnNo.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { decision.no(event); close(); } }); addShortcutListener(new ShortcutListener("Close", ShortcutAction.KeyCode.ESCAPE, null) { @Override public void handleAction(Object sender, Object target) { close(); } }); UI.getCurrent().addWindow(this); }
From source file:com.cms.view.AppParams.java
License:Apache License
public AppParams() { //khoi tao/*w w w . java 2 s . c o m*/ appParamsForm = new SearchAppParamsForm(); appParamTablePanel = new CommonTableFilterPanel(); GridManyButton gridManyButton = new GridManyButton( new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH }); btnSearch = gridManyButton.getBtnCommon().get(0); btnRefresh = gridManyButton.getBtnCommon().get(1); //Them cac component vao panel // btnSearch = new Button(SEARCH); // btnRefresh = new Button(BundleUtils.getString("common.button.refresh")); // //Them cac component vao panel // HorizontalLayout horizontalLayout = new HorizontalLayout(); // horizontalLayout.setWidth("-1px"); // horizontalLayout.setHeight("-1px"); // btnSearch.setIcon(new ThemeResource(Constants.ICON.SEARCH)); // horizontalLayout.addComponent(btnSearch); // btnRefresh.setIcon(new ThemeResource(Constants.ICON.RESET)); // horizontalLayout.addComponent(btnRefresh); panelMain.setCaption(captionAppParamPanel); layoutMain.addComponent(appParamsForm); layoutMain.addComponent(gridManyButton); layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER); layoutMain.addComponent(appParamTablePanel); this.appParamsController = new ListAppParamsController(this); }
From source file:com.cms.view.CategoryListView.java
public CategoryListView() { layoutMain.setMargin(true);// w ww . j ava 2 s .c o m layoutMain.setSpacing(true); buildSearchLayout(); layoutMain.addComponent(searchLayout); panelMain.setCaption(BundleUtils.getString("title.CategoryList")); GridManyButton gridManyButton = new GridManyButton( new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH }); btnSearch = gridManyButton.getBtnCommon().get(0); btnRefresh = gridManyButton.getBtnCommon().get(1); layoutMain.addComponent(gridManyButton); layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER); tblCategoryList = new CommonTableFilterPanel(); tblCategoryList.setImmediate(true); tblCategoryList.setWidth("100%"); tblCategoryList.setHeight("-1px"); tblCategoryList.getHorizoltalLayout().setVisible(false); layoutMain.addComponent(tblCategoryList); // btnPrintBB.setEnabled(false); CategoryListController categoryListController = new CategoryListController(this); }
From source file:com.cms.view.ContractTemplateListView.java
public ContractTemplateListView() { layoutMain.setMargin(true);//from w w w. ja v a 2s.c o m layoutMain.setSpacing(true); buildSearchLayout(); layoutMain.addComponent(searchLayout); panelMain.setCaption(BundleUtils.getString("title.ContractTemplateList")); GridManyButton gridManyButton = new GridManyButton( new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH }); btnSearch = gridManyButton.getBtnCommon().get(0); btnRefresh = gridManyButton.getBtnCommon().get(1); layoutMain.addComponent(gridManyButton); layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER); tblContractTemplateList = new CommonTableFilterPanel(); tblContractTemplateList.setImmediate(true); tblContractTemplateList.setWidth("100%"); tblContractTemplateList.setHeight("-1px"); tblContractTemplateList.getHorizoltalLayout().setVisible(false); layoutMain.addComponent(tblContractTemplateList); // btnPrintBB.setEnabled(false); ContractTemplateListController contractTemplateListController = new ContractTemplateListController(this); }
From source file:com.cms.view.ListStaffDepartment.java
public ListStaffDepartment() { super(BundleUtils.getString("caption.title.listDept"), BundleUtils.getString("caption.title.listEmp")); mainLayout.setSplitPosition(30, Unit.PERCENTAGE); setCompositionRoot(mainLayout);//from w ww . jav a2 s .co m //khoi tao cac thanh phan //khoi tao form search searchDepartmentForm = new DepartmentSearchPanel(); //khoi tao table ui tblListDepartmentUI = new CommonTableFilterPanel(); //100316 NgocND6 chuyen quyen quan ly hang hoa btnTransferRoleCusts = new Button(TRANSFERROLE); btnTransferRoleCusts.setIcon(new ThemeResource("img/transfer_icon.png")); //them cac component vao layout GridLayout horizontalLayout = new GridLayout(2, 1); horizontalLayout.setWidth("-1px"); horizontalLayout.setMargin(true); horizontalLayout.setSpacing(true); //btn search btnSearchDept = new Button(Constants.BUTTON_SEARCH); btnSearchDept.setIcon(new ThemeResource(Constants.ICON.SEARCH)); horizontalLayout.addComponent(btnSearchDept, 0, 0); //btn refresh btnRefreshDept = new Button(Constants.BUTTON_REFRESH); btnRefreshDept.setIcon(new ThemeResource(Constants.ICON.RESET)); horizontalLayout.addComponent(btnRefreshDept, 1, 0); //add component leftLayout.addComponent(searchDepartmentForm); leftLayout.addComponent(horizontalLayout); leftLayout.addComponent(tblListDepartmentUI); leftLayout.setComponentAlignment(horizontalLayout, Alignment.MIDDLE_CENTER); leftLayout.setMargin(true); //===============right========================== searchStaffForm = new StaffSearchPanel(); //khoi tao table ui tblListStaffUI = new CommonTableFilterPanel(); btnAddMapStaffCustomer = new Button(BundleUtils.getString("staff.customer.map")); btnAddMapStaffCustomer.setDescription(BundleUtils.getString("staff.customer.map")); btnAddMapStaffCustomer.setIcon(new ThemeResource(Constants.ICON.IMPORT)); btnAssignRole = new Button(BundleUtils.getString("assign.roles.button")); btnAssignRole.setIcon(FontAwesome.ANCHOR); //them cac component vao layout GridLayout horizontalLayout2 = new GridLayout(3, 1); horizontalLayout2.setWidth("-1px"); horizontalLayout2.setMargin(true); horizontalLayout2.setSpacing(true); //NgocND6 tao layout de add button chuyen quyen cho nhan vien GridLayout gridLayout = new GridLayout(3, 1); gridLayout.setMargin(true); gridLayout.setSpacing(true); gridLayout.addComponent(btnAssignRole, 0, 0); // gridLayout.addComponent(btnAddMapStaffCustomer, 1, 0); gridLayout.addComponent(btnTransferRoleCusts, 2, 0); //Tam thoi an nut phan bo lai khach hang btnTransferRoleCusts.setVisible(false); //btn search emp btnSearchEmp = new Button(Constants.BUTTON_SEARCH); btnSearchEmp.setIcon(new ThemeResource(Constants.ICON.SEARCH)); horizontalLayout2.addComponent(btnSearchEmp, 0, 0); //btn refresh emp btnRefreshEmp = new Button(Constants.BUTTON_REFRESH); btnRefreshEmp.setIcon(new ThemeResource(Constants.ICON.RESET)); horizontalLayout2.addComponent(btnRefreshEmp, 1, 0); // //add component rightLayout.addComponent(searchStaffForm); rightLayout.addComponent(horizontalLayout2); rightLayout.addComponent(tblListStaffUI); rightLayout.setComponentAlignment(horizontalLayout2, Alignment.MIDDLE_CENTER); rightLayout.addComponent(gridLayout); rightLayout.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER); rightLayout.setMargin(true); //============= this.listDeptAndStaffController = new ListDeptAndStaffController(this); }
From source file:com.cms.view.ObjectsView.java
public ObjectsView() { layoutMain.setMargin(true);/*from ww w .j a v a 2 s . com*/ layoutMain.setSpacing(true); buildSearchLayout(); layoutMain.addComponent(searchLayout); panelMain.setCaption(BundleUtils.getString("title.Objects")); GridManyButton gridManyButton = new GridManyButton( new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH }); btnSearch = gridManyButton.getBtnCommon().get(0); btnRefresh = gridManyButton.getBtnCommon().get(1); layoutMain.addComponent(gridManyButton); layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER); tblObjects = new CommonTableFilterPanel(); tblObjects.setImmediate(true); tblObjects.setWidth("100%"); tblObjects.setHeight("-1px"); tblObjects.getHorizoltalLayout().setVisible(false); layoutMain.addComponent(tblObjects); // btnPrintBB.setEnabled(false); ObjectsController objectsController = new ObjectsController(this); }
From source file:com.cms.view.PriceInfoView.java
public PriceInfoView() { layoutMain.setMargin(true);/* w ww. j a va 2s. c o m*/ layoutMain.setSpacing(true); buildSearchLayout(); layoutMain.addComponent(searchLayout); panelMain.setCaption(BundleUtils.getString("title.PriceInfo")); GridManyButton gridManyButton = new GridManyButton(new String[]{Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH}); btnSearch = gridManyButton.getBtnCommon().get(0); btnRefresh = gridManyButton.getBtnCommon().get(1); layoutMain.addComponent(gridManyButton); layoutMain.setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER); tblPriceInfo = new CommonTableFilterPanel(); tblPriceInfo.setImmediate(true); tblPriceInfo.setWidth("100%"); tblPriceInfo.setHeight("-1px"); tblPriceInfo.getHorizoltalLayout().setVisible(false); layoutMain.addComponent(tblPriceInfo); // btnPrintBB.setEnabled(false); PriceInfoController priceInfoController = new PriceInfoController(this); }
From source file:com.cms.view.SearchCustomerFromTaxCode.java
private void buildTableGrid() { tblPanelCustomers = new CommonTableFilterPanel(); tblPanelCustomers.setToolbar(Boolean.FALSE); leftLayout.addComponent(tblPanelCustomers); btnCreateDoc = new Button("To hp ng", FontAwesome.WORDPRESS); btnCreateDoc.setEnabled(false);//from w w w.ja v a 2 s . co m leftLayout.addComponent(btnCreateDoc); leftLayout.setComponentAlignment(btnCreateDoc, Alignment.MIDDLE_CENTER); }