Example usage for com.vaadin.ui Alignment BOTTOM_CENTER

List of usage examples for com.vaadin.ui Alignment BOTTOM_CENTER

Introduction

In this page you can find the example usage for com.vaadin.ui Alignment BOTTOM_CENTER.

Prototype

Alignment BOTTOM_CENTER

To view the source code for com.vaadin.ui Alignment BOTTOM_CENTER.

Click Source Link

Usage

From source file:org.apache.usergrid.chop.webapp.view.log.LogLayout.java

License:Apache License

private void addRefreshButton() {
    Button button = new Button("Refresh");
    button.setWidth("100px");
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            loadData();//from w ww. ja v  a  2 s  . co m
        }
    });
    addComponent(button);
    setComponentAlignment(button, Alignment.BOTTOM_CENTER);
    this.setExpandRatio(button, 0.05f);

}

From source file:org.apache.usergrid.chop.webapp.view.runner.RunnersLayout.java

License:Apache License

private void addRefreshButton() {

    Button button = new Button("Refresh");
    button.setWidth("100px");

    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            loadData();//from  w  w  w. java  2 s.c  o  m
        }
    });

    addComponent(button);
    this.setComponentAlignment(button, Alignment.BOTTOM_CENTER);
}

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

License:Open Source License

private void collectKeyCertificateInfo() throws CAProviderException {
    final Window principalWindow = new Window("Specify Certificate Details");
    principalWindow.setPositionX(200);/*from   ww  w .  j  a  v a  2  s. c  om*/
    principalWindow.setPositionY(100);
    principalWindow.setWidth("600px");
    principalWindow.setHeight("500px");
    principalWindow.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        public void windowClose(CloseEvent e) {
            parentApplication.getMainWindow().removeWindow(principalWindow);

        }
    });

    VerticalLayout vl = new VerticalLayout();
    final PrincipalComponent pc = new PrincipalComponent();
    Principal parentPrincipal = new Principal(provider.getCACertificate().getSubjectX500Principal());
    pc.init(new Principal(parentPrincipal, provider.getRuleMap()));
    vl.addComponent(pc);
    HorizontalLayout passLayout = new HorizontalLayout();
    vl.addComponent(passLayout);
    final TextField pass1 = new TextField("Private key/keystore passphrase");
    pass1.setSecret(true);
    final TextField pass2 = new TextField();
    pass2.setSecret(true);
    passLayout.addComponent(pass1);
    passLayout.addComponent(pass2);
    passLayout.setComponentAlignment(pass1, Alignment.BOTTOM_CENTER);
    passLayout.setComponentAlignment(pass2, Alignment.BOTTOM_CENTER);

    final OptionGroup type = new OptionGroup("Bundle Type");
    type.addItem(BundleType.OPENSSL);
    type.addItem(BundleType.PKCS12);
    type.addItem(BundleType.JKS);
    type.setValue(BundleType.OPENSSL);
    vl.addComponent(type);

    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.addComponent(new Button("Create", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (pass1.getValue().equals(pass2.getValue())) {
                try {
                    createKeyCertificatePair(pc.toPrincipal(), (String) pass1.getValue(),
                            (BundleType) type.getValue());
                    parentApplication.getMainWindow().removeWindow(principalWindow);
                } catch (Exception e) {
                    logger.severe(e.getMessage());
                    parentApplication.getMainWindow().showNotification(
                            "An error prevented the correct creation of the key/certificate pair",
                            Notification.TYPE_ERROR_MESSAGE);
                }
            } else {
                parentApplication.getMainWindow().showNotification("Passphrases do not match",
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    }));
    buttonsLayout.addComponent(new Button("Cancel", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            parentApplication.getMainWindow().removeWindow(principalWindow);
        }
    }));

    vl.addComponent(buttonsLayout);
    principalWindow.setContent(vl);
    parentApplication.getMainWindow().addWindow(principalWindow);
}

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

License:Open Source License

public void init(final Button.ClickListener clickListener) {

    VerticalLayout mainLayout = new VerticalLayout();
    principal.init(new Principal());

    mainLayout.addComponent(//ww w  . j ava  2  s .c  o m
            new Label("There is currently no CA correctly setup, please enter details to setup a new CA"));

    mainLayout.addComponent(principal);

    HorizontalLayout passwordLayout = new HorizontalLayout();

    final TextField pass1 = new TextField("CA Secret Key passphrase");
    pass1.setSecret(true);
    final TextField pass2 = new TextField();
    pass2.setSecret(true);

    passwordLayout.addComponent(pass1);
    passwordLayout.addComponent(pass2);
    passwordLayout.setComponentAlignment(pass1, Alignment.BOTTOM_CENTER);
    passwordLayout.setComponentAlignment(pass2, Alignment.BOTTOM_CENTER);

    mainLayout.addComponent(passwordLayout);

    Button okButton = new Button("Ok", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (pass1.getValue().equals(pass2.getValue())) {
                passphrase = (String) pass1.getValue();
                clickListener.buttonClick(event);
            } else {
                parentApplication.getMainWindow().showNotification("Passphrases must match",
                        Notification.TYPE_ERROR_MESSAGE);
            }

        }
    });

    mainLayout.addComponent(okButton);

    setCompositionRoot(mainLayout);
}

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

/**
 * Constructs an {@link UploadSettingsWindow}.
 * /* 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.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);/* ww w.j a v  a  2s  .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.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);/* ww w  .ja va 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.common.ConfirmationDialog.java

License:Open Source License

/**
 * Constructor for configuring confirmation dialog.
 * // w w w  . j  ava  2s  .c o  m
 * @param caption
 *            the dialog caption.
 * @param question
 *            the question.
 * @param okLabel
 *            the Ok button label.
 * @param cancelLabel
 *            the cancel button label.
 * @param callback
 *            the callback.
 * @param icon
 *            the icon of the dialog
 * @param id
 *            the id of the confirmation dialog
 * @param tab
 *            ConfirmationTab which contains more information about the
 *            action which has to be confirmed, e.g. maintenance window
 * @param mapCloseToCancel
 *            Flag indicating whether or not the close event on the
 *            enclosing window should be mapped to a cancel event.
 */
public ConfirmationDialog(final String caption, final String question, final String okLabel,
        final String cancelLabel, final ConfirmationDialogCallback callback, final Resource icon,
        final String id, final ConfirmationTab tab, final boolean mapCloseToCancel) {
    window = new Window(caption);
    if (!StringUtils.isEmpty(id)) {
        window.setId(id);
    }
    window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

    if (icon != null) {
        window.setIcon(icon);
    }

    okButton = createOkButton(okLabel);

    final Button cancelButton = createCancelButton(cancelLabel);
    if (mapCloseToCancel) {
        window.addCloseListener(e -> {
            if (!isImplicitClose) {
                cancelButton.click();
            }
        });
    }
    window.setModal(true);
    window.addStyleName(SPUIStyleDefinitions.CONFIRMBOX_WINDOW_STYLE);
    if (this.callback == null) {
        this.callback = callback;
    }
    final VerticalLayout vLayout = new VerticalLayout();
    if (question != null) {
        vLayout.addComponent(createConfirmationQuestion(question));
    }
    if (tab != null) {
        vLayout.addComponent(tab);
    }

    final HorizontalLayout hButtonLayout = createButtonLayout(cancelButton);
    hButtonLayout.addStyleName("marginTop");
    vLayout.addComponent(hButtonLayout);
    vLayout.setComponentAlignment(hButtonLayout, Alignment.BOTTOM_CENTER);

    window.setContent(vLayout);
    window.setResizable(false);
}

From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java

License:Open Source License

protected void buildLayout() {
    final HorizontalLayout dropHintLayout = new HorizontalLayout();
    if (hasCountMessage()) {
        dropHintLayout.addComponent(getCountMessageLabel());
    }//w w w.  j a  v a 2  s .  com
    final HorizontalLayout hLayout = new HorizontalLayout();
    hLayout.setId(UIComponentIdProvider.ACTION_BUTTON_LAYOUT);
    hLayout.setSpacing(true);
    hLayout.setSizeUndefined();
    if (deleteWrapper != null) {
        hLayout.addComponent(deleteWrapper);
        hLayout.setComponentAlignment(deleteWrapper, Alignment.BOTTOM_LEFT);
    }
    if (noActionBtn != null) {
        hLayout.addComponent(noActionBtn);
        hLayout.setComponentAlignment(noActionBtn, Alignment.BOTTOM_LEFT);
    }
    if (bulkUploadStatusButton != null) {
        hLayout.addComponent(bulkUploadStatusButton);
        hLayout.setComponentAlignment(bulkUploadStatusButton, Alignment.BOTTOM_LEFT);
    }
    if (dropHintLayout.getComponentCount() > 0) {
        addComponent(dropHintLayout);
        setComponentAlignment(dropHintLayout, Alignment.BOTTOM_CENTER);
    }
    if (hLayout.getComponentCount() > 0) {
        addComponent(hLayout);
        setComponentAlignment(hLayout, Alignment.BOTTOM_CENTER);
    }
    setStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
    setWidth("100%");
}

From source file:org.eclipse.hawkbit.ui.common.grid.AbstractGridComponentLayout.java

License:Open Source License

/**
 * Layouts header, grid and optional footer.
 */// w w  w .  j a  va  2s  .  c  om
protected void buildLayout() {
    setSizeFull();
    setSpacing(true);
    setMargin(false);
    setStyleName("group");
    final VerticalLayout gridHeaderLayout = new VerticalLayout();
    gridHeaderLayout.setSizeFull();
    gridHeaderLayout.setSpacing(false);
    gridHeaderLayout.setMargin(false);

    gridHeaderLayout.setStyleName("table-layout");
    gridHeaderLayout.addComponent(gridHeader);

    gridHeaderLayout.setComponentAlignment(gridHeader, Alignment.TOP_CENTER);
    gridHeaderLayout.addComponent(grid);
    gridHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER);
    gridHeaderLayout.setExpandRatio(grid, 1.0F);

    addComponent(gridHeaderLayout);
    setComponentAlignment(gridHeaderLayout, Alignment.TOP_CENTER);
    setExpandRatio(gridHeaderLayout, 1.0F);
    if (hasFooterSupport()) {
        final Layout footerLayout = getFooterSupport().createFooterMessageComponent();
        addComponent(footerLayout);
        setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER);
    }

}