Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setComponentAlignment.

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:org.balisunrise.vaadin.components.header.LoginWindow.java

License:Open Source License

private void init() {
    setWidth("360px");
    setHeight("280px");
    setCaption("Entrar");
    setResizable(false);//from  w w  w  .j  av  a2 s  .c om
    setModal(true);

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    setContent(layout);

    userName = new TextField("Login");
    userName.setWidth("90%");
    layout.addComponent(userName);
    layout.setComponentAlignment(userName, Alignment.TOP_CENTER);

    password = new TextField("Senha");
    password.setWidth("90%");
    layout.addComponent(password);
    layout.setComponentAlignment(password, Alignment.TOP_CENTER);

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth("90%");
    buttonsLayout.setSpacing(true);
    layout.addComponent(buttonsLayout);
    layout.setComponentAlignment(buttonsLayout, Alignment.TOP_CENTER);

    confirm = new Button("Entrar");
    confirm.addClickListener(this::confirm);
    confirm.setWidth("100%");
    buttonsLayout.addComponent(confirm);

    cancel = new Button("Cancelar");
    cancel.addClickListener(this::cancel);
    cancel.setWidth("100%");
    buttonsLayout.addComponent(cancel);
}

From source file:org.bitpimp.VaadinCurrencyConverter.MyVaadinApplication.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    // Set the window or tab title
    getPage().setTitle("Yahoo Currency Converter");

    // Create the content root layout for the UI
    final FormLayout content = new FormLayout();
    content.setMargin(true);//  w  w  w.  j  ava 2  s.  c  o  m
    final Panel panel = new Panel(content);
    panel.setWidth("500");
    panel.setHeight("400");
    final VerticalLayout root = new VerticalLayout();
    root.addComponent(panel);
    root.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
    root.setSizeFull();
    root.setMargin(true);

    setContent(root);

    content.addComponent(new Embedded("",
            new ExternalResource("https://vaadin.com/vaadin-theme/images/vaadin/vaadin-logo-color.png")));
    content.addComponent(new Embedded("",
            new ExternalResource("http://images.wikia.com/logopedia/images/e/e4/YahooFinanceLogo.png")));

    // Display the greeting
    final Label heading = new Label("<b>Simple Currency Converter " + "Using YQL/Yahoo Finance Service</b>",
            ContentMode.HTML);
    heading.setWidth(null);
    content.addComponent(heading);

    // Build the set of fields for the converter form
    final TextField fromField = new TextField("From Currency", "AUD");
    fromField.setRequired(true);
    fromField.addValidator(new StringLengthValidator(CURRENCY_CODE_REQUIRED, 3, 3, false));
    content.addComponent(fromField);

    final TextField toField = new TextField("To Currency", "USD");
    toField.setRequired(true);
    toField.addValidator(new StringLengthValidator(CURRENCY_CODE_REQUIRED, 3, 3, false));
    content.addComponent(toField);

    final TextField resultField = new TextField("Result");
    resultField.setEnabled(false);
    content.addComponent(resultField);

    final TextField timeField = new TextField("Time");
    timeField.setEnabled(false);
    content.addComponent(timeField);

    final Button submitButton = new Button("Submit", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // Do the conversion
            final String result = converter.convert(fromField.getValue().toUpperCase(),
                    toField.getValue().toUpperCase());
            if (result != null) {
                resultField.setValue(result);
                timeField.setValue(new Date().toString());
            }
        }
    });
    content.addComponent(submitButton);

    // Configure the error handler for the UI
    UI.getCurrent().setErrorHandler(new DefaultErrorHandler() {
        @Override
        public void error(com.vaadin.server.ErrorEvent event) {
            // Find the final cause
            String cause = "<b>The operation failed :</b><br/>";
            Throwable th = Throwables.getRootCause(event.getThrowable());
            if (th != null)
                cause += th.getClass().getName() + "<br/>";

            // Display the error message in a custom fashion
            content.addComponent(new Label(cause, ContentMode.HTML));

            // Do the default error handling (optional)
            doDefault(event);
        }
    });
}

From source file:org.casbah.ui.CasbahMainComponent.java

License:Open Source License

public void init() throws CasbahException {
    VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();//  w  w  w.ja va 2 s  .  c o  m
    Embedded banner = new Embedded(null, new ClassResource("/images/casbah.png", parentApplication));

    rootLayout.addComponent(banner);
    rootLayout.setComponentAlignment(banner, Alignment.MIDDLE_CENTER);

    tabSheet = new TabSheet();

    configView = new ConfigComponent(parentApplication, provider, casbahConfiguration);
    configView.init();
    tabSheet.addTab(configView, "Configuration", null);

    caView = new MainCAView(provider, parentApplication);
    caView.init();
    tabSheet.addTab(caView, "Certificate Authority", null);

    certView = new IssuedCertificateList(parentApplication, provider);
    certView.init();
    tabSheet.addTab(certView, "Issued Certificates", null);

    tabSheet.setWidth("1024px");

    rootLayout.addComponent(tabSheet);
    rootLayout.setComponentAlignment(tabSheet, Alignment.TOP_CENTER);

    Label footer = new Label("Copyright 2010 - Marco Sandrini - CASBaH is released under the"
            + "<a href=\"http://www.gnu.org/licenses/agpl-3.0-standalone.html\"> Affero GPL License v.3</a>"
            + " - Source Code is available through <a href=\"http://github.com/nessche/CASBaH/archives/master\">Github</a>",
            Label.CONTENT_XHTML);
    footer.setSizeUndefined();
    rootLayout.addComponent(footer);
    rootLayout.setComponentAlignment(footer, Alignment.TOP_CENTER);

    setSizeFull();
    setCompositionRoot(rootLayout);
}

From source file:org.diretto.web.richwebclient.view.sections.ContactSection.java

License:Open Source License

@Override
public synchronized void addComponents() {
    if (!componentsAdded) {
        GridLayout mainLayout = new GridLayout(2, 1);
        addComponent(mainLayout);//w  w w  .  ja  v a2 s.  c o m
        setExpandRatio(mainLayout, 1.0f);

        VerticalLayout contactDetailsLayout = new VerticalLayout();
        contactDetailsLayout.setStyleName(Reindeer.LAYOUT_BLACK);
        contactDetailsLayout.setWidth("280px");
        contactDetailsLayout.setMargin(true);
        contactDetailsLayout.setSpacing(true);

        contactDetailsLayout.addComponent(StyleUtils.getLabelH2("Contact Details"));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Project Team"));
        contactDetailsLayout.addComponent(StyleUtils.getLabel("Benjamin Erb & Tobias Schlecht"));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Address"));
        contactDetailsLayout
                .addComponent(StyleUtils.getLabel("Institute of Media Informatics, Ulm University"));
        contactDetailsLayout.addComponent(StyleUtils.getLabel("James-Franck-Ring, 89073 Ulm, Germany"));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Project Website"));
        contactDetailsLayout
                .addComponent(new Link("www.diretto.org", new ExternalResource("http://www.diretto.org/")));
        contactDetailsLayout.addComponent(StyleUtils.getVerticalSpaceSmall());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("GitHub Profile"));
        contactDetailsLayout.addComponent(
                new Link("github.com/diretto", new ExternalResource("https://github.com/diretto")));
        contactDetailsLayout.addComponent(StyleUtils.getVerticalSpaceSmall());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Twitter Account"));
        contactDetailsLayout.addComponent(new Link("twitter.com/diretto_project",
                new ExternalResource("http://twitter.com/diretto_project")));
        contactDetailsLayout.addComponent(StyleUtils.getHorizontalLine());
        contactDetailsLayout.addComponent(StyleUtils.getLabelBold("Email Address"));
        contactDetailsLayout.addComponent(
                new Link("diretto@googlegroups.com", new ExternalResource("mailto:diretto@googlegroups.com")));

        mainLayout.addComponent(contactDetailsLayout);

        VerticalLayout wrapperLayout = new VerticalLayout();
        wrapperLayout.setWidth("600px");
        wrapperLayout.setMargin(false, true, false, true);

        VerticalLayout termsOfUseLayout = new VerticalLayout();
        termsOfUseLayout.setWidth("520px");
        termsOfUseLayout.setMargin(true);
        termsOfUseLayout.setSpacing(true);

        termsOfUseLayout.addComponent(StyleUtils.getLabelH2("Terms of Use"));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Terms"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "By accessing this website, you are agreeing to be bound by these website <i>Terms of Use</i>, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this web site are protected by applicable copyright and trade mark law."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Use License"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "Permission is granted to temporarily download one copy of the materials (information or software) on this website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not:<br /><br />"
                        + "&bull;&nbsp;&nbsp;modify or copy the materials<br />"
                        + "&bull;&nbsp;&nbsp;use the materials for any commercial purpose, or for any public display<br />"
                        + "&bull;&nbsp;&nbsp;attempt to decompile or reverse engineer any software contained on this website<br />"
                        + "&bull;&nbsp;&nbsp;remove any copyright or other proprietary notations from the materials<br />"
                        + "&bull;&nbsp;&nbsp;transfer the materials to another person or any other server<br />"
                        + "<br />This license shall automatically terminate if you violate any of these restrictions and may be terminated by the <i>diretto</i> Project Team at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Disclaimer"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The materials on this website are provided <i>as is</i>. The <i>diretto</i> Project Team makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, the <i>diretto</i> Project Team does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Internet website or otherwise relating to such materials or on any sites linked to this site."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Limitations"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "In no event shall the <i>diretto</i> Project Team be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on this website, even if the <i>diretto</i> Project Team has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you. "));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Revisions and Errata"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The materials appearing on this website could include technical, typographical, or photographic errors. The <i>diretto</i> Project Team does not warrant that any of the materials on its website are accurate, complete, or current. The <i>diretto</i> Project Team may make changes to the materials contained on its website at any time without notice. The <i>diretto</i> Project Team does not, however, make any commitment to update the materials. "));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Links"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The <i>diretto</i> Project Team has not reviewed all of the sites linked to its Internet website and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by the <i>diretto</i> Project Team of the site. Use of any such linked website is at the user's own risk. "));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Site Terms of Use Modifications"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "The <i>diretto</i> Project Team may revise these terms of use for its website at any time without notice. By using this website you are agreeing to be bound by the then current version of these <i>Terms of Use</i>."));
        termsOfUseLayout.addComponent(StyleUtils.getHorizontalLine());
        termsOfUseLayout.addComponent(StyleUtils.getLabelBold("Governing Law"));
        termsOfUseLayout.addComponent(StyleUtils.getLabelHTML(
                "Any claim relating to this website shall be governed by the laws of <i>Germany</i> without regard to its conflict of law provisions. General terms and conditions are applicable to the use of this website."));

        wrapperLayout.addComponent(termsOfUseLayout);
        wrapperLayout.setComponentAlignment(termsOfUseLayout, Alignment.TOP_CENTER);
        mainLayout.addComponent(wrapperLayout);

        componentsAdded = true;
    }
}

From source file:org.diretto.web.richwebclient.view.windows.UploadSettingsWindow.java

/**
 * Constructs an {@link UploadSettingsWindow}.
 * /*from w  w  w  .  j a  v a 2 s.  c o  m*/
 * @param mainWindow The corresponding {@code MainWindow}
 * @param uploadSection The corresponding {@code UploadSection}
 * @param fileInfo The {@code FileInfo} object
 * @param mediaType The {@code MediaType} of the file
 * @param uploadSettings The corresponding {@code UploadSettings}
 * @param otherFiles The names of the other upload files
 */
public UploadSettingsWindow(final MainWindow mainWindow, final UploadSection uploadSection, FileInfo fileInfo,
        MediaType mediaType, UploadSettings uploadSettings, List<String> otherFiles) {
    super("Upload Settings");

    this.mainWindow = mainWindow;

    setModal(true);
    setStyleName(Reindeer.WINDOW_BLACK);
    setWidth("940px");
    setHeight((((int) mainWindow.getHeight()) - 160) + "px");
    setResizable(false);
    setClosable(false);
    setDraggable(false);
    setPositionX((int) (mainWindow.getWidth() / 2.0f) - 470);
    setPositionY(126);

    wrapperLayout = new HorizontalLayout();
    wrapperLayout.setSizeFull();
    wrapperLayout.setMargin(true, true, true, true);
    addComponent(wrapperLayout);

    mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setSpacing(true);

    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setWidth("100%");
    mainLayout.addComponent(titleLayout);

    HorizontalLayout leftTitleLayout = new HorizontalLayout();
    titleLayout.addComponent(leftTitleLayout);
    titleLayout.setComponentAlignment(leftTitleLayout, Alignment.MIDDLE_LEFT);

    Label fileNameLabel = StyleUtils.getLabelH2(fileInfo.getName());
    leftTitleLayout.addComponent(fileNameLabel);
    leftTitleLayout.setComponentAlignment(fileNameLabel, Alignment.MIDDLE_LEFT);

    Label bullLabel = StyleUtils.getLabelHTML(
            "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
    leftTitleLayout.addComponent(bullLabel);
    leftTitleLayout.setComponentAlignment(bullLabel, Alignment.MIDDLE_LEFT);

    Label titleLabel = StyleUtils.getLabelHTML("<b>Title</b>&nbsp;&nbsp;&nbsp;");
    leftTitleLayout.addComponent(titleLabel);
    leftTitleLayout.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT);

    final TextField titleField = new TextField();
    titleField.setMaxLength(50);
    titleField.setWidth("100%");
    titleField.setImmediate(true);

    if (uploadSettings != null && uploadSettings.getTitle() != null) {
        titleField.setValue(uploadSettings.getTitle());
    }

    titleField.focus();
    titleField.setCursorPosition(((String) titleField.getValue()).length());

    titleLayout.addComponent(titleField);
    titleLayout.setComponentAlignment(titleField, Alignment.MIDDLE_RIGHT);

    titleLayout.setExpandRatio(leftTitleLayout, 0);
    titleLayout.setExpandRatio(titleField, 1);

    mainLayout.addComponent(StyleUtils.getHorizontalLine());

    GridLayout topGridLayout = new GridLayout(2, 3);
    topGridLayout.setColumnExpandRatio(0, 1.0f);
    topGridLayout.setColumnExpandRatio(1, 0.0f);
    topGridLayout.setWidth("100%");
    topGridLayout.setSpacing(true);
    mainLayout.addComponent(topGridLayout);

    Label descriptionLabel = StyleUtils.getLabelBold("Description");
    topGridLayout.addComponent(descriptionLabel, 0, 0);

    final TextArea descriptionArea = new TextArea();
    descriptionArea.setSizeFull();
    descriptionArea.setImmediate(true);

    if (uploadSettings != null && uploadSettings.getDescription() != null) {
        descriptionArea.setValue(uploadSettings.getDescription());
    }

    topGridLayout.addComponent(descriptionArea, 0, 1);

    VerticalLayout tagsWrapperLayout = new VerticalLayout();
    tagsWrapperLayout.setHeight("30px");
    tagsWrapperLayout.setSpacing(false);
    topGridLayout.addComponent(tagsWrapperLayout, 0, 2);

    HorizontalLayout tagsLayout = new HorizontalLayout();
    tagsLayout.setWidth("100%");
    tagsLayout.setSpacing(true);

    Label tagsLabel = StyleUtils.getLabelBoldHTML("Tags&nbsp;");
    tagsLabel.setSizeUndefined();
    tagsLayout.addComponent(tagsLabel);
    tagsLayout.setComponentAlignment(tagsLabel, Alignment.MIDDLE_LEFT);

    addTagField = new TextField();
    addTagField.setImmediate(true);
    addTagField.setInputPrompt("Enter new Tag");

    addTagField.addShortcutListener(new ShortcutListener(null, KeyCode.ENTER, new int[0]) {
        private static final long serialVersionUID = -4767515198819351723L;

        @Override
        public void handleAction(Object sender, Object target) {
            if (target == addTagField) {
                addTag();
            }
        }
    });

    tagsLayout.addComponent(addTagField);
    tagsLayout.setComponentAlignment(addTagField, Alignment.MIDDLE_LEFT);

    tabSheet = new TabSheet();

    tabSheet.setStyleName(Reindeer.TABSHEET_SMALL);
    tabSheet.addStyleName("view");

    tabSheet.addListener(new ComponentDetachListener() {
        private static final long serialVersionUID = -657657505471281795L;

        @Override
        public void componentDetachedFromContainer(ComponentDetachEvent event) {
            tags.remove(tabSheet.getTab(event.getDetachedComponent()).getCaption());
        }
    });

    Button addTagButton = new Button("Add", new Button.ClickListener() {
        private static final long serialVersionUID = 5914473126402594623L;

        @Override
        public void buttonClick(ClickEvent event) {
            addTag();
        }
    });

    addTagButton.setStyleName(Reindeer.BUTTON_DEFAULT);

    tagsLayout.addComponent(addTagButton);
    tagsLayout.setComponentAlignment(addTagButton, Alignment.MIDDLE_LEFT);

    Label spaceLabel = StyleUtils.getLabelHTML("");
    spaceLabel.setSizeUndefined();
    tagsLayout.addComponent(spaceLabel);
    tagsLayout.setComponentAlignment(spaceLabel, Alignment.MIDDLE_LEFT);

    tagsLayout.addComponent(tabSheet);
    tagsLayout.setComponentAlignment(tabSheet, Alignment.MIDDLE_LEFT);
    tagsLayout.setExpandRatio(tabSheet, 1.0f);

    tagsWrapperLayout.addComponent(tagsLayout);
    tagsWrapperLayout.setComponentAlignment(tagsLayout, Alignment.TOP_LEFT);

    if (uploadSettings != null && uploadSettings.getTags() != null && uploadSettings.getTags().size() > 0) {
        for (String tag : uploadSettings.getTags()) {
            addTagField.setValue(tag);

            addTag();
        }
    }

    Label presettingLabel = StyleUtils.getLabelBold("Presetting");
    topGridLayout.addComponent(presettingLabel, 1, 0);

    final TwinColSelect twinColSelect;

    if (otherFiles != null && otherFiles.size() > 0) {
        twinColSelect = new TwinColSelect(null, otherFiles);
    } else {
        twinColSelect = new TwinColSelect();
    }

    twinColSelect.setWidth("400px");
    twinColSelect.setRows(10);
    topGridLayout.addComponent(twinColSelect, 1, 1);
    topGridLayout.setComponentAlignment(twinColSelect, Alignment.TOP_RIGHT);

    Label otherFilesLabel = StyleUtils
            .getLabelSmallHTML("Select the files which should get the settings of this file as presetting.");
    otherFilesLabel.setSizeUndefined();
    topGridLayout.addComponent(otherFilesLabel, 1, 2);
    topGridLayout.setComponentAlignment(otherFilesLabel, Alignment.MIDDLE_CENTER);

    mainLayout.addComponent(StyleUtils.getHorizontalLine());

    final UploadGoogleMap googleMap;

    if (uploadSettings != null && uploadSettings.getTopographicPoint() != null) {
        googleMap = new UploadGoogleMap(mediaType, 12, uploadSettings.getTopographicPoint().getLatitude(),
                uploadSettings.getTopographicPoint().getLongitude(), MapType.HYBRID);
    } else {
        googleMap = new UploadGoogleMap(mediaType, 12, 48.42255269321401d, 9.956477880477905d, MapType.HYBRID);
    }

    googleMap.setWidth("100%");
    googleMap.setHeight("300px");
    mainLayout.addComponent(googleMap);

    mainLayout.addComponent(StyleUtils.getHorizontalLine());

    GridLayout bottomGridLayout = new GridLayout(3, 3);
    bottomGridLayout.setSizeFull();
    bottomGridLayout.setSpacing(true);
    mainLayout.addComponent(bottomGridLayout);

    Label licenseLabel = StyleUtils.getLabelBold("License");
    bottomGridLayout.addComponent(licenseLabel, 0, 0);

    final TextArea licenseArea = new TextArea();
    licenseArea.setWidth("320px");
    licenseArea.setHeight("175px");
    licenseArea.setImmediate(true);

    if (uploadSettings != null && uploadSettings.getLicense() != null) {
        licenseArea.setValue(uploadSettings.getLicense());
    }

    bottomGridLayout.addComponent(licenseArea, 0, 1);

    final Label startTimeLabel = StyleUtils.getLabelBold("Earliest possible Start Date");
    startTimeLabel.setSizeUndefined();
    bottomGridLayout.setComponentAlignment(startTimeLabel, Alignment.TOP_CENTER);
    bottomGridLayout.addComponent(startTimeLabel, 1, 0);

    final InlineDateField startTimeField = new InlineDateField();
    startTimeField.setImmediate(true);
    startTimeField.setResolution(InlineDateField.RESOLUTION_SEC);

    boolean currentTimeAdjusted = false;

    if (uploadSettings != null && uploadSettings.getTimeRange() != null
            && uploadSettings.getTimeRange().getStartDateTime() != null) {
        startTimeField.setValue(uploadSettings.getTimeRange().getStartDateTime().toDate());
    } else {
        currentTimeAdjusted = true;

        startTimeField.setValue(new Date());
    }

    bottomGridLayout.setComponentAlignment(startTimeField, Alignment.TOP_CENTER);
    bottomGridLayout.addComponent(startTimeField, 1, 1);

    final CheckBox exactTimeCheckBox = new CheckBox("This is the exact point in time.");
    exactTimeCheckBox.setImmediate(true);
    bottomGridLayout.setComponentAlignment(exactTimeCheckBox, Alignment.TOP_CENTER);
    bottomGridLayout.addComponent(exactTimeCheckBox, 1, 2);

    final Label endTimeLabel = StyleUtils.getLabelBold("Latest possible Start Date");
    endTimeLabel.setSizeUndefined();
    bottomGridLayout.setComponentAlignment(endTimeLabel, Alignment.TOP_CENTER);
    bottomGridLayout.addComponent(endTimeLabel, 2, 0);

    final InlineDateField endTimeField = new InlineDateField();
    endTimeField.setImmediate(true);
    endTimeField.setResolution(InlineDateField.RESOLUTION_SEC);

    if (uploadSettings != null && uploadSettings.getTimeRange() != null
            && uploadSettings.getTimeRange().getEndDateTime() != null) {
        endTimeField.setValue(uploadSettings.getTimeRange().getEndDateTime().toDate());
    } else {
        endTimeField.setValue(startTimeField.getValue());
    }

    bottomGridLayout.setComponentAlignment(endTimeField, Alignment.TOP_CENTER);
    bottomGridLayout.addComponent(endTimeField, 2, 1);

    if (!currentTimeAdjusted && ((Date) startTimeField.getValue()).equals((Date) endTimeField.getValue())) {
        exactTimeCheckBox.setValue(true);

        endTimeLabel.setEnabled(false);
        endTimeField.setEnabled(false);
    }

    exactTimeCheckBox.addListener(new ValueChangeListener() {
        private static final long serialVersionUID = 7193545421803538364L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if ((Boolean) event.getProperty().getValue()) {
                endTimeLabel.setEnabled(false);
                endTimeField.setEnabled(false);
            } else {
                endTimeLabel.setEnabled(true);
                endTimeField.setEnabled(true);
            }
        }
    });

    mainLayout.addComponent(StyleUtils.getHorizontalLine());

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setMargin(true, false, false, false);
    buttonLayout.setSpacing(false);

    HorizontalLayout uploadButtonLayout = new HorizontalLayout();
    uploadButtonLayout.setMargin(false, true, false, false);

    uploadButton = new Button("Upload File", new Button.ClickListener() {
        private static final long serialVersionUID = 8013811216568950479L;

        @Override
        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {
            String titleValue = titleField.getValue().toString().trim();
            Date startTimeValue = (Date) startTimeField.getValue();
            Date endTimeValue = (Date) endTimeField.getValue();
            boolean exactTimeValue = (Boolean) exactTimeCheckBox.getValue();

            if (titleValue.equals("")) {
                ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Title Field",
                        StyleUtils.getLabelHTML("A title entry is required."));

                mainWindow.addWindow(confirmWindow);
            } else if (titleValue.length() < 5 || titleValue.length() > 50) {
                ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Title Field", StyleUtils
                        .getLabelHTML("The number of characters of the title has to be between 5 and 50."));

                mainWindow.addWindow(confirmWindow);
            } else if (!exactTimeValue && startTimeValue.after(endTimeValue)) {
                ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Date Entries",
                        StyleUtils.getLabelHTML("The second date has to be after the first date."));

                mainWindow.addWindow(confirmWindow);
            } else if (startTimeValue.after(new Date())
                    || (!exactTimeValue && endTimeValue.after(new Date()))) {
                ConfirmWindow confirmWindow = new ConfirmWindow(mainWindow, "Date Entries",
                        StyleUtils.getLabelHTML("The dates are not allowed to be in the future."));

                mainWindow.addWindow(confirmWindow);
            } else {
                disableButtons();

                String descriptionValue = descriptionArea.getValue().toString().trim();
                String licenseValue = licenseArea.getValue().toString().trim();
                TopographicPoint topographicPointValue = googleMap.getMarkerPosition();
                Collection<String> presettingValues = (Collection<String>) twinColSelect.getValue();

                if (exactTimeValue) {
                    endTimeValue = startTimeValue;
                }

                TimeRange timeRange = new TimeRange(new DateTime(startTimeValue), new DateTime(endTimeValue));

                UploadSettings uploadSettings = new UploadSettings(titleValue, descriptionValue, licenseValue,
                        new Vector<String>(tags), topographicPointValue, timeRange);

                mainWindow.removeWindow(event.getButton().getWindow());

                requestRepaint();

                uploadSection.upload(uploadSettings, new Vector<String>(presettingValues));
            }
        }
    });

    uploadButton.setStyleName(Reindeer.BUTTON_DEFAULT);
    uploadButtonLayout.addComponent(uploadButton);
    buttonLayout.addComponent(uploadButtonLayout);

    HorizontalLayout cancelButtonLayout = new HorizontalLayout();
    cancelButtonLayout.setMargin(false, true, false, false);

    cancelButton = new Button("Cancel", new Button.ClickListener() {
        private static final long serialVersionUID = -2565870159504952913L;

        @Override
        public void buttonClick(ClickEvent event) {
            disableButtons();

            mainWindow.removeWindow(event.getButton().getWindow());

            requestRepaint();

            uploadSection.cancelUpload();
        }
    });

    cancelButton.setStyleName(Reindeer.BUTTON_DEFAULT);
    cancelButtonLayout.addComponent(cancelButton);
    buttonLayout.addComponent(cancelButtonLayout);

    cancelAllButton = new Button("Cancel All", new Button.ClickListener() {
        private static final long serialVersionUID = -8578124709201789182L;

        @Override
        public void buttonClick(ClickEvent event) {
            disableButtons();

            mainWindow.removeWindow(event.getButton().getWindow());

            requestRepaint();

            uploadSection.cancelAllUploads();
        }
    });

    cancelAllButton.setStyleName(Reindeer.BUTTON_DEFAULT);
    buttonLayout.addComponent(cancelAllButton);

    mainLayout.addComponent(buttonLayout);
    mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_CENTER);

    wrapperLayout.addComponent(mainLayout);
}

From source file:org.eclipse.emf.ecp.controls.vaadin.internal.ReferenceListVaadinRenderer.java

License:Open Source License

@Override
public void renderList(VerticalLayout layout) {
    composedAdapterFactory = new ComposedAdapterFactory(
            new AdapterFactory[] { new CustomReflectiveItemProviderAdapterFactory(),
                    new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE) });
    adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(composedAdapterFactory);
    createLinkColumn();/*  w ww .  j a  v a  2s .c  o  m*/
    bindTable();
    layout.addComponent(getToolbar());
    layout.addComponent(getTable());
    layout.setData(getTable());
    layout.setComponentAlignment(getToolbar(), Alignment.TOP_RIGHT);
}

From source file:org.eclipse.emf.ecp.view.table.vaadin.TableRendererVaadin.java

License:Open Source License

@Override
protected VerticalLayout render() {
    final VTableControl control = getVElement();
    final ViewModelContext viewContext = getViewModelContext();
    final Iterator<Setting> iterator = control.getDomainModelReference().getIterator();
    if (!iterator.hasNext()) {
        return null;
    }// w w  w .  j a  v  a 2 s.  c o m
    setting = iterator.next();

    final VerticalLayout layout = new VerticalLayout();
    table = createTable();
    layout.setData(table);

    setVisibleColumns(control, viewContext);

    bindTable(setting, table);

    if (control.isReadonly()) {
        layout.addComponent(table);
        return layout;
    }

    final HorizontalLayout horizontalLayout = createButtonBar();

    layout.addComponent(horizontalLayout);
    layout.setComponentAlignment(horizontalLayout, Alignment.TOP_RIGHT);
    layout.addComponent(table);

    return layout;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadDropAreaLayout.java

License:Open Source License

private VerticalLayout createDropAreaLayout() {
    final VerticalLayout dropAreaLayout = new VerticalLayout();
    final Label dropHereLabel = new Label(i18n.getMessage(UIMessageIdProvider.LABEL_DROP_AREA_UPLOAD));
    dropHereLabel.setWidth(null);//from www.  j  a v a2 s .  c  om

    final Label dropIcon = new Label(FontAwesome.ARROW_DOWN.getHtml(), ContentMode.HTML);
    dropIcon.addStyleName("drop-icon");
    dropIcon.setWidth(null);

    dropAreaLayout.addComponent(dropIcon);
    dropAreaLayout.setComponentAlignment(dropIcon, Alignment.TOP_CENTER);
    dropAreaLayout.addComponent(dropHereLabel);
    dropAreaLayout.setComponentAlignment(dropHereLabel, Alignment.TOP_CENTER);

    uploadButtonLayout.setWidth(null);
    uploadButtonLayout.addStyleName("upload-button");
    dropAreaLayout.addComponent(uploadButtonLayout);
    dropAreaLayout.setComponentAlignment(uploadButtonLayout, Alignment.BOTTOM_CENTER);

    dropAreaLayout.setSizeFull();
    dropAreaLayout.setStyleName("upload-drop-area-layout-info");
    dropAreaLayout.setSpacing(false);
    return dropAreaLayout;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout.java

License:Open Source License

private static VerticalLayout createDropAreaLayout() {
    final VerticalLayout dropAreaLayout = new VerticalLayout();
    final Label dropHereLabel = new Label("Drop files to upload");
    dropHereLabel.setWidth(null);/*from ww  w. j  av a  2  s.  c o m*/

    final Label dropIcon = new Label(FontAwesome.ARROW_DOWN.getHtml(), ContentMode.HTML);
    dropIcon.addStyleName("drop-icon");
    dropIcon.setWidth(null);

    dropAreaLayout.addComponent(dropIcon);
    dropAreaLayout.setComponentAlignment(dropIcon, Alignment.BOTTOM_CENTER);
    dropAreaLayout.addComponent(dropHereLabel);
    dropAreaLayout.setComponentAlignment(dropHereLabel, Alignment.TOP_CENTER);
    dropAreaLayout.setSizeFull();
    dropAreaLayout.setStyleName("upload-drop-area-layout-info");
    dropAreaLayout.setSpacing(false);
    return dropAreaLayout;
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadResultWindow.java

License:Open Source License

private void createLayout() {
    final HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeUndefined();/*from  w w w . j av  a2s. c o  m*/
    footer.addStyleName("confirmation-window-footer");
    footer.setSpacing(true);
    footer.setMargin(false);
    footer.addComponents(closeBtn);
    footer.setComponentAlignment(closeBtn, Alignment.TOP_CENTER);

    final VerticalLayout uploadResultDetails = new VerticalLayout();
    uploadResultDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
    uploadResultDetails.addStyleName("confirmation-popup");
    uploadResultDetails.addComponent(uploadResultTable);
    uploadResultDetails.setComponentAlignment(uploadResultTable, Alignment.MIDDLE_CENTER);
    uploadResultDetails.addComponent(footer);
    uploadResultDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);

    uploadResultsWindow = new Window();
    uploadResultsWindow.setContent(uploadResultDetails);
    uploadResultsWindow.setResizable(Boolean.FALSE);
    uploadResultsWindow.setClosable(Boolean.FALSE);
    uploadResultsWindow.setDraggable(Boolean.TRUE);
    uploadResultsWindow.setModal(true);
    uploadResultsWindow.setCaption(SPUILabelDefinitions.UPLOAD_RESULT);
    uploadResultsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}