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.anphat.list.ui.RolesSearchPanel.java
private void buildMainLayout() { setImmediate(true);// ww w . j av a2 s. co m setWidth("100%"); setHeight("-1px"); setMargin(true); setSpacing(true); buildSearchLayout(); addComponent(searchLayout); gridManyButton = new GridManyButton(new String[] { Constants.BUTTON_SEARCH, Constants.BUTTON_REFRESH }); btnSearch = gridManyButton.getBtnCommon().get(0); btnRefresh = gridManyButton.getBtnCommon().get(1); addComponent(gridManyButton); setComponentAlignment(gridManyButton, Alignment.MIDDLE_CENTER); tblRoles = new CommonTableFilterPanel(); tblRoles.setImmediate(true); tblRoles.setWidth("100%"); tblRoles.setHeight("-1px"); tblRoles.getHorizoltalLayout().setVisible(false); addComponent(tblRoles); }
From source file:com.anphat.list.ui.TreeObjects.java
private void buildMainLayout() { setImmediate(true);/*from w w w.j a va 2 s . c o m*/ setWidth("100%"); setHeight("-1px"); setMargin(true); setSpacing(true); objectParents = new ObjectsDTO(); objectParents.setName(TREE_NAME); objectParents.setObjectId("0"); objectParents.setObjectType(""); treeObjects = new TreeCommon(); addComponent(treeObjects); setComponentAlignment(treeObjects, Alignment.MIDDLE_CENTER); GridManyButton gridSaveButton = new GridManyButton( new String[] { Constants.BUTTON_SAVE, Constants.BUTTON_UPDATE }); btnSave = gridSaveButton.getBtnCommon().get(0); btnEdit = gridSaveButton.getBtnCommon().get(1); addComponent(gridSaveButton); }
From source file:com.anphat.statistics.ui.StatisticStaffPointUploadDialog.java
private GridLayout buildGridUpload() { uploadInfoLayout = new GridLayout(4, 1); CommonUtils.setBasicAttributeLayout(uploadInfoLayout, GRID_UPLOAD_CAPTION, true); uFileCommonInfo = new Upload(); uFileCommonInfo.setCaption(Constants.NULL); uFileCommonInfo.setWidth("100%"); uploadInfoLayout.addComponent(uFileCommonInfo, 0, 0, 1, 0); uploadInfoLayout.setComponentAlignment(uFileCommonInfo, Alignment.MIDDLE_CENTER); linkTemplate = new Link(LINK_CAPTION, FontAwesome.LINK); linkTemplate.setImmediate(true);/*from w w w . jav a2s .c o m*/ File file = new File(Constants.PATH_TEMPLATE + "Thong ke diem.xlsx"); FileDownloader downloader = new FileDownloader(file, "Thong ke diem.xlsx"); linkTemplate.setResource(downloader); uploadInfoLayout.addComponent(linkTemplate, 2, 0); return uploadInfoLayout; }
From source file:com.antonjohansson.managementcenter.core.web.welcome.WelcomeView.java
License:Apache License
public WelcomeView() { setSizeFull(); Component connect = buildConnectForm(); addComponent(connect); setComponentAlignment(connect, Alignment.MIDDLE_CENTER); }
From source file:com.assemblade.ui.views.LoginScreen.java
License:Apache License
public LoginScreen() { app = CatApplication.getInstance();/* www.j a v a2 s .c om*/ setSizeFull(); Panel loginPanel = new Panel("Login"); loginPanel.setWidth("400px"); LoginForm loginForm = new LoginForm(); loginForm.setUsernameCaption("Username: "); loginForm.setPasswordCaption("Password: "); loginForm.addListener(this); loginForm.setHeight("150px"); loginPanel.addComponent(loginForm); addComponent(loginPanel); setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); HorizontalLayout footer = new HorizontalLayout(); footer.setHeight("50px"); addComponent(footer); }
From source file:com.bellkenz.modules.PersonalInformation.java
public ComponentContainer personalInformation() { employeeInformationDAO = new EmployeeInformationDAO(getEmployeeId()); employeePersonalInformation = new EmployeePersonalInformation(); GridLayout glayout = new GridLayout(5, 9); glayout.setSpacing(true);// w w w.ja va2 s . c o m glayout.setMargin(true); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setSizeFull(); employeeImage = new Embedded(null, new ThemeResource("../myTheme/images/ronnie.jpg")); employeeImage.setImmediate(true); employeeImage.setWidth(90, Sizeable.UNITS_PIXELS); employeeImage.setHeight(90, Sizeable.UNITS_PIXELS); employeeImage.setStyleName("logo-img"); imagePanel.addComponent(employeeImage); glayout.addComponent(employeeImage, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); firstname = createTextField("Firstname: "); glayout.addComponent(firstname, 1, 0, 2, 0); final TextField middlename = createTextField("Middlename: "); glayout.addComponent(middlename, 3, 0); final TextField lastname = createTextField("Lastname: "); glayout.addComponent(lastname, 4, 0); final TextField houseNo = createTextField("No: "); houseNo.setWidth("40px"); glayout.addComponent(houseNo, 1, 1); final TextField street = createTextField("Street: "); street.setWidth("118"); glayout.addComponent(street, 2, 1); final TextField city = createTextField("City: "); glayout.addComponent(city, 3, 1); final TextField zipCode = createTextField("Zip Code:"); glayout.addComponent(zipCode, 4, 1); final TextField nickname = createTextField("Nickname: "); nickname.setWidth("90px"); glayout.addComponent(nickname, 0, 2); final TextField permanentAddress = createTextField("Permanent/Provincial Address: "); permanentAddress.setWidth("533px"); glayout.addComponent(permanentAddress, 1, 2, 4, 2); Button uploadPicture = new Button("Upload..."); uploadPicture.setWidth("100%"); uploadPicture.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeId == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, employeeImage, employeeId); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPicture, 0, 3); final TextField landline = createTextField("Landline #: "); glayout.addComponent(landline, 1, 3, 2, 3); final TextField mobileNo = createTextField("Mobile #: "); glayout.addComponent(mobileNo, 3, 3); final TextField age = createTextField("Age: "); glayout.addComponent(age, 4, 3); final TextField emailAddress = createTextField("Email Address: "); glayout.addComponent(emailAddress, 1, 4, 2, 4); final PopupDateField dob = (PopupDateField) createDateField("Date of Birth: "); glayout.addComponent(dob, 3, 4); final TextField height = createTextField("Height: "); glayout.addComponent(height, 4, 4); final ComboBox civilStatus = new ComboBox("Civil Status: "); civilStatus.setWidth("100%"); dropDownBoxList.populateCivilStatusList(civilStatus); glayout.addComponent(civilStatus, 1, 5, 2, 5); final ComboBox gender = new ComboBox("Gender: "); gender.setWidth("100%"); dropDownBoxList.populateGenderList(gender); glayout.addComponent(gender, 3, 5); final TextField weight = createTextField("Weigth: "); glayout.addComponent(weight, 4, 5); final TextField driversLicenseNo = createTextField("Drivers License: "); glayout.addComponent(driversLicenseNo, 1, 6, 2, 6); final TextField restrictionCode = createTextField("Restriction Code: "); glayout.addComponent(restrictionCode, 3, 6); final TextField religion = createTextField("Religion: "); glayout.addComponent(religion, 4, 6); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); glayout.addComponent(division, 1, 7, 2, 7); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); glayout.addComponent(department, 3, 7); final TextField position = createTextField("Position: "); glayout.addComponent(position, 4, 7); //glayout.setComponentAlignment(position, Alignment.BOTTOM_LEFT); Button transferButton = new Button("Transfer Employee"); transferButton.setWidth("100%"); transferButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select an Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window subWindow = transferEmployee(getEmployeeId(), division, department, position); if (subWindow.getParent() == null) { getWindow().addWindow(subWindow); } subWindow.setModal(true); subWindow.center(); } }); glayout.addComponent(transferButton, 1, 8, 2, 8); glayout.setComponentAlignment(transferButton, Alignment.BOTTOM_CENTER); if (employeeId != null) { epiList = employeeInformationDAO.employeePersonalInformation(); for (EmployeePersonalInformation epi : epiList) { final byte[] image = epi.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, epi.getFirstname() + ".jpg", getApplication()); imageResource.setCacheTime(0); employeeImage.setSource(imageResource); } firstname.setValue(epi.getFirstname()); middlename.setValue(epi.getMiddlename()); lastname.setValue(epi.getLastname()); houseNo.setValue(epi.getHouseNumber()); street.setValue(epi.getStreet()); city.setValue(epi.getStreet()); zipCode.setValue(epi.getZipCode()); nickname.setValue(epi.getNickname()); permanentAddress.setValue(epi.getPermanentAddress()); landline.setValue(epi.getLandlineNumber()); mobileNo.setValue(epi.getMobileNumber()); age.setValue(epi.getAge()); emailAddress.setValue(epi.getEmailAddress()); if (epi.getDob() != null) { dob.setValue(conUtil.parsingDate(epi.getDob())); } else { dob.setValue(null); } height.setValue(epi.getHeight()); if (epi.getCivilStatus() != null) { Object civilStatusId = civilStatus.addItem(); civilStatus.setItemCaption(civilStatusId, epi.getCivilStatus()); civilStatus.setValue(civilStatusId); } if (epi.getGender() != null) { Object genderId = gender.addItem(); gender.setItemCaption(genderId, epi.getGender()); gender.setValue(genderId); } weight.setValue(epi.getWeight()); driversLicenseNo.setValue(epi.getDriversLicense()); restrictionCode.setValue(epi.getRestrictionCode()); religion.setValue(epi.getReligion()); position.setValue(epi.getPosition()); Object divisionObjectId = division.addItem(); division.setItemCaption(divisionObjectId, epi.getDivision()); division.setValue(divisionObjectId); Object departmentObjectId = department.addItem(); department.setItemCaption(departmentObjectId, epi.getDepartment()); department.setValue(departmentObjectId); } } firstname.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { employeePersonalInformation.setFirstname(event.getProperty().getValue().toString()); } }); firstname.setImmediate(true); setInformation(employeePersonalInformation); return glayout; }
From source file:com.bsb.common.vaadin.embed.component.DevApplicationHeader.java
License:Apache License
/** * Creates an new instance with the specified {@link EmbedVaadinServer} * to manage./* w w w. j ava2 s. c o m*/ * * @param server the server to manage */ public DevApplicationHeader(final EmbedVaadinServer server) { final Button shutdown = new Button("shutdown"); shutdown.setStyleName(BaseTheme.BUTTON_LINK); shutdown.setDescription("Shutdown the embed server and close this tab"); addComponent(shutdown); setComponentAlignment(shutdown, Alignment.MIDDLE_CENTER); shutdown.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { // Stop the server in a separate thread. final Thread thread = new Thread(new Runnable() { public void run() { server.stop(); } }); // avoid that catalina's WebappClassLoader.clearReferencesThreads warns about the thread because it is // part of the web application being stopped. thread.setContextClassLoader(null); thread.start(); // Close the browser tab getWindow().executeJavaScript("close();"); } }); }
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();/* w w w . ja va2s. 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 av a2 s.co 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.cerebro.provevaadin.Start.java
public Start() { InputStream iniFile = VaadinServlet.getCurrent().getServletContext() .getResourceAsStream("/WEB-INF/shiro.ini"); if (iniFile == null) { logger.error("Il file Shiro.ini non esiste"); return;/*www. j ava 2 s . c o m*/ } else { logger.info("File presente"); } Ini ini = new Ini(); ini.load(iniFile); Factory<SecurityManager> factory = new IniSecurityManagerFactory(ini); SecurityManager securityManager = factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); HorizontalLayout root = new HorizontalLayout(); root.setWidth("800px"); root.setHeight("600px"); this.addComponent(root); this.setComponentAlignment(root, Alignment.MIDDLE_CENTER); FormLayout loginDiv = new FormLayout(); root.addComponent(loginDiv); username.focus(); errorMessage.setVisible(false); loginDiv.addComponents(username, password, rememberMe, login, errorMessage); login.addClickListener((Button.ClickEvent e) -> { logger.info("Pulsante: " + e.toString()); Subject currentUser = SecurityUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username.getValue(), password.getValue()); token.setRememberMe(rememberMe.getValue()); try { currentUser.login(token); if (currentUser.hasRole("firsttime")) { logger.info("Configurazione parametri del primo avvio"); getUI().setContent(new FirstTime()); } else { logger.info("Classe di gioco principale"); getUI().setContent(new Game()); VaadinService.reinitializeSession(VaadinService.getCurrentRequest()); } } catch (Exception ex) { logger.error("Errore nel login: " + ex.getMessage()); username.setValue(""); password.setValue(""); errorMessage.setVisible(true); } }); FormLayout signInForm = new FormLayout(); root.addComponent(signInForm); usernameSignIn.focus(); sesso.addItems("Maschio", "Femmina"); signInForm.addComponents(usernameSignIn, passwordSignIn, passwordConf, nome, cognome, sesso, eta, signIn); signIn.addClickListener((Button.ClickEvent event) -> { logger.info("Iscrizione al sito"); User utente = new User(); utente.setEmail(usernameSignIn.getValue()); utente.setPassword(passwordSignIn.getValue()); utente.setNomeUtente(nome.getValue()); utente.setCognomeUtente(cognome.getValue()); utente.setSessoUtente(sesso.getValue().toString()); utente.setDataNascitaUtente(eta.getValue()); SignIn signInWindow = new SignIn(utente); signInWindow.center(); UI.getCurrent().addWindow(signInWindow); }); }