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:ac.uk.icl.dell.vaadin.glycanbuilder.ImportStructureFromStringDialog.java
License:Open Source License
private void layoutComponents() { layout.addComponent(sequenceInputField); layout.addComponent(importTypeSelectField); layout.addComponent(ok);/*from w w w .jav a 2 s .co m*/ layout.setComponentAlignment(sequenceInputField, Alignment.TOP_CENTER); layout.setComponentAlignment(importTypeSelectField, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(ok, Alignment.BOTTOM_CENTER); }
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
@Override public void recieveSelectionUpdate(double x, double y, double width, double height, boolean mouseMoved) { final Residue selectedResidue = theCanvas.getCurrentResidue(); theCanvas.selectIntersectingRectangles(x, y, width, height, mouseMoved); if (theCanvas.getCurrentResidue() != null && selectedResidue == theCanvas.getCurrentResidue() && selectedResidue.isRepetition()) { final Window window = new Window("Repeatition options"); WeeLayout layout = new WeeLayout(org.vaadin.weelayout.WeeLayout.Direction.VERTICAL); final TextField minRep = new TextField("Minimum"); final TextField maxRep = new TextField("Maximum"); NativeButton okBut = new NativeButton("Ok"); NativeButton cancelBut = new NativeButton("Cancel"); minRep.setImmediate(true);/*from www .j a v a 2s . co m*/ maxRep.setImmediate(true); minRep.setValue(String.valueOf(selectedResidue.getMinRepetitions())); maxRep.setValue(String.valueOf(selectedResidue.getMaxRepetitions())); okBut.addListener(new ClickListener() { private static final long serialVersionUID = -408364885359729326L; @Override public void buttonClick(ClickEvent event) { String minRepNum = (String) minRep.getValue(); String maxRepNum = (String) maxRep.getValue(); boolean valid = true; try { Integer.parseInt(minRepNum); Integer.parseInt(maxRepNum); } catch (NumberFormatException ex) { valid = false; } if (valid) { selectedResidue.setMinRepetitions((String) minRep.getValue()); selectedResidue.setMaxRepetitions((String) maxRep.getValue()); theCanvas.documentUpdated(); } getWindow().removeWindow(window); } }); cancelBut.addListener(new ClickListener() { private static final long serialVersionUID = -657746118918366530L; @Override public void buttonClick(ClickEvent event) { getWindow().removeWindow(window); } }); layout.addComponent(minRep, Alignment.TOP_CENTER); layout.addComponent(maxRep, Alignment.MIDDLE_CENTER); WeeLayout buttonLayout = new WeeLayout(Direction.HORIZONTAL); buttonLayout.addComponent(okBut, Alignment.TOP_CENTER); buttonLayout.addComponent(cancelBut, Alignment.TOP_CENTER); layout.addComponent(buttonLayout, Alignment.BOTTOM_CENTER); window.center(); window.getContent().addComponent(layout); window.getContent().setSizeUndefined(); window.setSizeUndefined(); getWindow().addWindow(window); } }
From source file:annis.gui.CitationWindow.java
License:Apache License
public CitationWindow(String query, Set<String> corpora, int contextLeft, int contextRight) { super("Citation"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);/*from w ww . j a va 2 s . c o m*/ wLayout.setSizeFull(); String url = Helper.generateCitation(query, corpora, contextLeft, contextRight, null, 0, 10); TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ChameleonTheme.TEXTFIELD_BIG); txtCitation.addStyleName("citation"); txtCitation.setValue(url); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btOk = new Button("OK"); btOk.addListener((Button.ClickListener) this); btOk.setSizeUndefined(); wLayout.addComponent(btOk); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btOk, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("200px"); }
From source file:annis.gui.components.ExceptionDialog.java
License:Apache License
public ExceptionDialog(Throwable ex, String caption) { this.cause = ex; Preconditions.checkNotNull(ex);/* www.j a v a 2 s .co m*/ layout = new VerticalLayout(); setContent(layout); layout.setWidth("100%"); layout.setHeight("-1"); if (caption == null) { setCaption("Unexpected error"); } else { setCaption(caption); } Label lblInfo = new Label("An unexpected error occured.<br />The error message was:", ContentMode.HTML); lblInfo.setHeight("-1px"); lblInfo.setWidth("100%"); layout.addComponent(lblInfo); lblInfo.addStyleName("exception-message-caption"); String message = ex.getMessage(); if (message == null || message.isEmpty()) { message = "<no message>"; } Label lblMessage = new Label(message); lblMessage.addStyleName("exception-message-content"); lblMessage.setHeight("-1px"); lblMessage.setWidth("100%"); layout.addComponent(lblMessage); actionsLayout = new HorizontalLayout(); actionsLayout.addStyleName("exception-dlg-details"); actionsLayout.setWidth("100%"); actionsLayout.setHeight("-1px"); layout.addComponent(actionsLayout); btDetails = new Button("Show Details", this); btDetails.setStyleName(BaseTheme.BUTTON_LINK); actionsLayout.addComponent(btDetails); btReportBug = new Button("Report Problem", this); btReportBug.setStyleName(BaseTheme.BUTTON_LINK); btReportBug.setVisible(false); btReportBug.setIcon(FontAwesome.ENVELOPE_O); UI ui = UI.getCurrent(); if (ui instanceof AnnisUI) { btReportBug.setVisible(((AnnisUI) ui).canReportBugs()); } actionsLayout.addComponent(btReportBug); actionsLayout.setComponentAlignment(btDetails, Alignment.TOP_LEFT); actionsLayout.setComponentAlignment(btReportBug, Alignment.TOP_RIGHT); lblStacktrace = new Label(Helper.convertExceptionToMessage(ex), ContentMode.PREFORMATTED); detailsPanel = new Panel(lblStacktrace); detailsPanel.setWidth("100%"); detailsPanel.setHeight("300px"); detailsPanel.setVisible(false); lblStacktrace.setSizeUndefined(); lblStacktrace.setVisible(true); layout.addComponent(detailsPanel); btClose = new Button("OK", this); layout.addComponent(btClose); layout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); layout.setExpandRatio(detailsPanel, 0.0f); layout.setExpandRatio(actionsLayout, 1.0f); }
From source file:annis.gui.ShareQueryReferenceWindow.java
License:Apache License
public ShareQueryReferenceWindow(DisplayedResultQuery query, boolean shorten) { super("Query reference link"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);// w ww .j a v a 2 s. co m wLayout.setSizeFull(); wLayout.setMargin(true); Label lblInfo = new Label( "<p style=\"font-size: 18px\" >" + "<strong>Share your query:</strong> " + "1. Copy the generated link 2. Share this link with your peers. " + "</p>", ContentMode.HTML); wLayout.addComponent(lblInfo); wLayout.setExpandRatio(lblInfo, 0.0f); String shortURL = "ERROR"; if (query != null) { URI url = Helper.generateCitation(query.getQuery(), query.getCorpora(), query.getLeftContext(), query.getRightContext(), query.getSegmentation(), query.getBaseText(), query.getOffset(), query.getLimit(), query.getOrder(), query.getSelectedMatches()); if (shorten) { shortURL = Helper.shortenURL(url); } else { shortURL = url.toASCIIString(); } } TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtCitation.addStyleName("shared-text"); txtCitation.setValue(shortURL); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btClose = new Button("Close"); btClose.addClickListener((Button.ClickListener) this); btClose.setSizeUndefined(); wLayout.addComponent(btClose); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("300px"); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.MainUI.java
License:LGPL
public MainUI() { // Make the web-app large setSizeFull();//from w w w . j av a 2s. c o m // Set the layout for the bottom // Create a 3rd party licence button with a click listener final Button licences = new Button("Lizenzen"); licences.addClickListener(new ClickListener() { private static final long serialVersionUID = 32642854872179636L; @Override public void buttonClick(ClickEvent event) { LogHelper.logInfo("Opened LicenceWindow"); LicenceWindow licenceWindow = new LicenceWindow(); licenceWindow.addCloseListener(new CloseListener() { private static final long serialVersionUID = 7874342882437355680L; @Override public void windowClose(CloseEvent e) { event.getButton().setEnabled(true); } }); getUI().addWindow(licenceWindow); // Disable sender event.getButton().setEnabled(false); } }); Label copyright = new HtmlLabel( "<i> Reisisoft & JKU 2014 - " + new GregorianCalendar().get(Calendar.YEAR) + "</i>"); /* Button openLog = new Button("Open Log", (ClickListener) event -> { Navigator navigator = getUI().getNavigator(); assert navigator != null; navigator.navigateTo(Views.Log.toString()); });*/ // Add the flowLayout at position 1 (second element) -> centered // Add everthing to flowlayout GridLayout southLayout = new GridLayout(3, 1); southLayout.setWidth("100%"); southLayout.addComponent(licences, 0, 0); // southLayout.addComponent(openLog, 1, 0); southLayout.addComponent(copyright, 2, 0); // Add southlayout to the main Layout addComponent(southLayout); setComponentAlignment(southLayout, Alignment.BOTTOM_CENTER); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.MainUI.java
License:LGPL
public MainUI() { // Make the web-app large setSizeFull();//ww w .jav a 2 s.co m // Set the layout for the bottom // Create a 3rd party licence button with a click listener final Button licences = new Button("Show 3rd party licences"); licences.addClickListener(new ClickListener() { private static final long serialVersionUID = 32642854872179636L; @Override public void buttonClick(ClickEvent event) { LogHelper.logInfo("Opened LicenceWindow"); LicenceWindow licenceWindow = new LicenceWindow(); licenceWindow.addCloseListener(new CloseListener() { private static final long serialVersionUID = 7874342882437355680L; @Override public void windowClose(CloseEvent e) { event.getButton().setEnabled(true); } }); getUI().addWindow(licenceWindow); // Disable sender event.getButton().setEnabled(false); } }); Label copyright = new HtmlLabel( "<i> Reisisoft 2014 - " + new GregorianCalendar().get(Calendar.YEAR) + "</i>"); Button openLog = new Button("Open Log", (ClickListener) event -> { Navigator navigator = getUI().getNavigator(); assert navigator != null; navigator.navigateTo(Views.Log.toString()); }); // Add the flowLayout at position 1 (second element) -> centered // Add everthing to flowlayout GridLayout southLayout = new GridLayout(3, 1); southLayout.setWidth("100%"); southLayout.addComponent(licences, 0, 0); southLayout.addComponent(openLog, 1, 0); southLayout.addComponent(copyright, 2, 0); // Add southlayout to the main Layout addComponent(southLayout); setComponentAlignment(southLayout, Alignment.BOTTOM_CENTER); }
From source file:by.bigvova.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();// www . j a v a 2 s . c om userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); Label label = new Label("Name: User / Password: password"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); 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.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(label); 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(); }
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);//from w w w. j a va 2 s . c om 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.dungnv.streetfood.ui.TwinColumnUI.java
public final void init() { setMargin(true);//from w w w . j a v a 2 s . c o m setSpacing(true); setWidth(100f, Unit.PERCENTAGE); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setSpacing(true); hLayout.setWidth(100f, Unit.PERCENTAGE); addComponent(hLayout); msLeft = new MultiSelectUI(searchField); msLeft.setWidth(100.0f, Unit.PERCENTAGE); hLayout.addComponent(msLeft); hLayout.setExpandRatio(msLeft, .45f); VerticalLayout vButtonLayout = new VerticalLayout(); vButtonLayout.setSpacing(true); hLayout.addComponent(vButtonLayout); hLayout.setExpandRatio(vButtonLayout, .1f); hLayout.setComponentAlignment(vButtonLayout, Alignment.BOTTOM_CENTER); btnLeftAll = new Button(); btnLeftAll.setWidth(100f, Unit.PERCENTAGE); btnLeftAll.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); vButtonLayout.addComponent(btnLeftAll); btnLeft = new Button(); btnLeft.setWidth(100f, Unit.PERCENTAGE); btnLeft.setIcon(FontAwesome.ANGLE_LEFT); vButtonLayout.addComponent(btnLeft); btnRight = new Button(); btnRight.setWidth(100f, Unit.PERCENTAGE); btnRight.setIcon(FontAwesome.ANGLE_RIGHT); vButtonLayout.addComponent(btnRight); btnRightAll = new Button(); btnRightAll.setWidth(100f, Unit.PERCENTAGE); btnRightAll.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); vButtonLayout.addComponent(btnRightAll); msRight = new MultiSelectUI(searchField); msRight.setWidth(100.0f, Unit.PERCENTAGE); hLayout.addComponent(msRight); hLayout.setExpandRatio(msRight, .45f); HorizontalLayout hlButtonFooter = new HorizontalLayout(); hlButtonFooter.setSpacing(true); addComponent(hlButtonFooter); setComponentAlignment(hlButtonFooter, Alignment.BOTTOM_RIGHT); btnSave = new Button(BundleUtils.getLanguage("lbl.save"), FontAwesome.SAVE); hlButtonFooter.addComponent(btnSave); btnCancel = new Button(BundleUtils.getLanguage("lbl.cancel"), FontAwesome.BAN); hlButtonFooter.addComponent(btnCancel); }