Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

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

Introduction

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

Prototype

Alignment MIDDLE_LEFT

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.ProfileReadViewImpl.java

License:Open Source License

private void displayUserAvatar() {
    this.userAvatar.removeAllComponents();
    final Image cropField = UserAvatarControlFactory
            .createUserAvatarEmbeddedComponent(AppContext.getUserAvatarId(), 100);
    userAvatar.addComponent(cropField);/*from   w w  w  .  jav a2s.  c  o  m*/

    this.avatarAndPass.removeAllComponents();
    avatarAndPass.addComponent(userAvatar);

    User user = formItem.getUser();

    final VerticalLayout basicLayout = new VerticalLayout();
    basicLayout.setSpacing(true);

    final HorizontalLayout userWrapper = new HorizontalLayout();

    final Label userName = new Label(AppContext.getSession().getDisplayName());
    userName.setStyleName("h1");
    userWrapper.addComponent(userName);

    final Button btnChangeBasicInfo = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    UI.getCurrent().addWindow(new BasicInfoChangeWindow(formItem.getUser()));
                }
            });
    btnChangeBasicInfo.setStyleName("link");
    HorizontalLayout btnChangeBasicInfoWrapper = new HorizontalLayout();
    btnChangeBasicInfoWrapper.setWidth("40px");
    btnChangeBasicInfoWrapper.addComponent(btnChangeBasicInfo);
    btnChangeBasicInfoWrapper.setComponentAlignment(btnChangeBasicInfo, Alignment.MIDDLE_RIGHT);
    userWrapper.addComponent(btnChangeBasicInfoWrapper);
    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);

    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY) + ": "
            + AppContext.formatDate(user.getDateofbirth())));
    basicLayout.addComponent(
            new MHorizontalLayout(new Label(AppContext.getMessage(UserI18nEnum.FORM_EMAIL) + ": "),
                    new LabelLink(user.getEmail(), "mailto:" + user.getEmail())));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE) + ": "
            + TimezoneMapper.getTimezone(user.getTimezone()).getDisplayName()));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE) + ": "
            + AppContext.getMessage(LangI18Enum.class, user.getLanguage())));

    HorizontalLayout passwordWrapper = new HorizontalLayout();
    passwordWrapper
            .addComponent(new Label(AppContext.getMessage(ShellI18nEnum.FORM_PASSWORD) + ": ***********"));

    final Button btnChangePassword = new Button("Change", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            UI.getCurrent().addWindow(new PasswordChangeWindow(formItem.user));
        }
    });
    btnChangePassword.setStyleName("link");
    HorizontalLayout btnChangePasswordWrapper = new HorizontalLayout();
    btnChangePasswordWrapper.setWidth("50px");
    btnChangePasswordWrapper.addComponent(btnChangePassword);
    btnChangePasswordWrapper.setComponentAlignment(btnChangePassword, Alignment.MIDDLE_RIGHT);
    passwordWrapper.addComponent(btnChangePasswordWrapper);
    basicLayout.addComponent(passwordWrapper);
    basicLayout.setComponentAlignment(passwordWrapper, Alignment.MIDDLE_LEFT);

    avatarAndPass.addComponent(basicLayout);
    avatarAndPass.setComponentAlignment(basicLayout, Alignment.TOP_LEFT);
    avatarAndPass.setExpandRatio(basicLayout, 1.0f);

    final UploadField avatarUploadField = new UploadField() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void updateDisplay() {
            byte[] imageData = (byte[]) this.getValue();
            String mimeType = this.getLastMimeType();
            if (mimeType.equals("image/jpeg")) {
                imageData = ImageUtil.convertJpgToPngFormat(imageData);
                if (imageData == null) {
                    throw new UserInvalidInputException("Do not support image format for avatar");
                } else {
                    mimeType = "image/png";
                }
            }

            if (mimeType.equals("image/png")) {
                EventBusFactory.getInstance()
                        .post(new ProfileEvent.GotoUploadPhoto(ProfileReadViewImpl.this, imageData));
            } else {
                throw new UserInvalidInputException(
                        "Upload file does not have valid image format. The supported formats are jpg/png");
            }
        }
    };
    avatarUploadField.addStyleName("upload-field");
    avatarUploadField.setButtonCaption(AppContext.getMessage(UserI18nEnum.BUTTON_CHANGE_AVATAR));
    avatarUploadField.setSizeUndefined();
    avatarUploadField.setFieldType(FieldType.BYTE_ARRAY);
    this.userAvatar.addComponent(avatarUploadField);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.NewUserAddedWindow.java

License:Open Source License

public NewUserAddedWindow(final SimpleUser user, String uncryptPassword) {
    super(AppContext.getMessage(UserI18nEnum.NEW));
    this.setModal(true);
    this.setResizable(false);
    this.setClosable(false);
    this.center();
    this.setWidth("600px");
    MVerticalLayout content = new MVerticalLayout();
    this.setContent(content);

    ELabel infoLbl = new ELabel(
            FontAwesome.CHECK_CIRCLE.getHtml()
                    + AppContext.getMessage(UserI18nEnum.OPT_NEW_USER_CREATED, user.getDisplayName()),
            ContentMode.HTML);//from  w  w w .j  a  v  a2  s  .c  o  m
    content.with(infoLbl);

    String signinInstruction = AppContext.getMessage(UserI18nEnum.OPT_SIGN_IN_MSG, AppContext.getSiteUrl(),
            AppContext.getSiteUrl());
    content.with(new MVerticalLayout(new Label(signinInstruction, ContentMode.HTML),
            new ELabel(AppContext.getMessage(ShellI18nEnum.FORM_EMAIL)).withStyleName(UIConstants.META_INFO),
            new Label("    " + user.getUsername()),
            new ELabel(AppContext.getMessage(ShellI18nEnum.FORM_PASSWORD)).withStyleName(UIConstants.META_INFO),
            new Label("    " + (uncryptPassword != null ? uncryptPassword
                    : AppContext.getMessage(UserI18nEnum.OPT_USER_SET_OWN_PASSWORD)))));

    Button sendEmailBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class);
                    if (!mailService.isMailSetupValid()) {
                        UI.getCurrent().addWindow(new GetStartedInstructionWindow(user));
                    } else {

                        NotificationUtil.showNotification(
                                AppContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_TITLE),
                                AppContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_MESSAGE));
                    }
                }
            });

    content.with(new ELabel(AppContext.getMessage(GenericI18Enum.HELP_SPAM_FILTER_PREVENT_MESSAGE))
            .withStyleName(UIConstants.META_INFO));

    Button createMoreUserBtn = new Button(AppContext.getMessage(UserI18nEnum.OPT_CREATE_ANOTHER_USER),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null));
                    close();
                }
            });
    createMoreUserBtn.addStyleName(UIConstants.BUTTON_LINK);

    Button doneBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_DONE), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null));
            close();
        }
    });
    doneBtn.addStyleName(UIConstants.BUTTON_ACTION);
    MHorizontalLayout buttonControls = new MHorizontalLayout(createMoreUserBtn, doneBtn).withFullWidth()
            .withAlign(createMoreUserBtn, Alignment.MIDDLE_LEFT).withAlign(doneBtn, Alignment.MIDDLE_RIGHT);
    content.with(buttonControls);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.RoleReadViewImpl.java

License:Open Source License

public RoleReadViewImpl() {
    super();/*w  w  w  . j  av  a 2s  .com*/
    this.setMargin(new MarginInfo(false, true, false, true));

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW);
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label headerText = new Label(FontAwesome.USERS.getHtml() + " Detail Role", ContentMode.HTML);
    headerText.setStyleName(UIConstants.HEADER_TEXT);

    header.with(headerText).expand(headerText);

    this.addComponent(header);

    this.previewForm = new AdvancedPreviewBeanForm<>();
    this.addComponent(this.previewForm);

    Layout controlButtons = createTopPanel();
    if (controlButtons != null) {
        header.addComponent(controlButtons);
    }
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.RoleSearchPanel.java

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW)
            .withWidth("100%").withSpacing(true).withMargin(new MarginInfo(true, false, true, false));
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    final Label searchtitle = new Label(
            FontAwesome.USERS.getHtml() + " " + AppContext.getMessage(RoleI18nEnum.VIEW_LIST_TITLE),
            ContentMode.HTML);/*w  w w . j  av  a2  s.  c  o  m*/
    searchtitle.setStyleName(UIConstants.HEADER_TEXT);
    layout.addComponent(searchtitle);
    layout.setExpandRatio(searchtitle, 1.0f);

    final Button createBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CREATE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new RoleEvent.GotoAdd(this, null));
                }
            });
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_ROLE));

    layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserReadViewImpl.java

License:Open Source License

public UserReadViewImpl() {
    super();/*w w w. j a va2s. co m*/
    this.addStyleName("userInfoContainer");
    this.userAvatar = new MVerticalLayout().withMargin(new MarginInfo(true, true, true, false))
            .withWidth("100%");
    this.userAvatar.setWidthUndefined();
    this.userAvatar.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    this.avatarAndPass = new HorizontalLayout();

    this.setMargin(new MarginInfo(false, true, false, true));

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW);
    header.with(avatarAndPass).withAlign(avatarAndPass, Alignment.MIDDLE_LEFT);
    this.addComponent(header);

    previewForm = new PreviewForm();
    this.addComponent(previewForm);

    Layout controlButtons = createTopPanel();
    if (controlButtons != null) {
        header.with(controlButtons).withAlign(controlButtons, Alignment.TOP_RIGHT);
    }
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserReadViewImpl.java

License:Open Source License

private void displayUserAvatar() {
    this.userAvatar.removeAllComponents();
    final Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100);
    userAvatar.addComponent(cropField);//from  w  ww.  j  a  v  a 2  s  .  co  m

    this.avatarAndPass.removeAllComponents();
    avatarAndPass.addComponent(userAvatar);

    final VerticalLayout basicLayout = new VerticalLayout();
    basicLayout.setSpacing(true);
    final HorizontalLayout userWrapper = new HorizontalLayout();

    String nickName = user.getNickname();

    final Label userName = new Label(
            user.getDisplayName() + (StringUtils.isEmpty(nickName) ? "" : (" ( " + nickName + " )")));
    userName.setStyleName("h1");
    userWrapper.addComponent(userName);

    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);

    Component role;
    if (user.getIsAccountOwner() != null && user.getIsAccountOwner() == Boolean.TRUE) {
        role = new DefaultViewField("Account Owner");
    } else {
        role = new LinkViewField(user.getRoleName(),
                AccountLinkBuilder.generatePreviewFullRoleLink(user.getRoleid()));
    }
    MHorizontalLayout roleWrapper = new MHorizontalLayout();
    roleWrapper.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_ROLE) + ": "));
    roleWrapper.addComponent(role);

    basicLayout.addComponent(roleWrapper);

    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY) + ": "
            + AppContext.formatDate(user.getDateofbirth())));
    basicLayout.addComponent(
            new MHorizontalLayout().add(new Label(AppContext.getMessage(UserI18nEnum.FORM_EMAIL) + ": "))
                    .add(new LabelLink(user.getEmail(), "mailto:" + user.getEmail())));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE) + ": "
            + TimezoneMapper.getTimezone(user.getTimezone()).getDisplayName()));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE) + ": "
            + AppContext.getMessage(LangI18Enum.class, user.getLanguage())));

    avatarAndPass.addComponent(basicLayout);
    avatarAndPass.setComponentAlignment(basicLayout, Alignment.TOP_LEFT);
    avatarAndPass.setExpandRatio(basicLayout, 1.0f);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserSearchPanel.java

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true)
            .withMargin(true);/*from  w w  w .  jav  a 2 s  .com*/

    final Label searchtitle = new Label("Users");
    searchtitle.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(searchtitle);
    layout.setComponentAlignment(searchtitle, Alignment.MIDDLE_LEFT);

    final Button createBtn = new Button("Invite", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null));
        }
    });
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER));

    layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}

From source file:com.esofthead.mycollab.module.user.ui.components.ImagePreviewCropWindow.java

License:Open Source License

public ImagePreviewCropWindow(final ImageSelectionCommand imageSelectionCommand, final byte[] imageData) {
    super("Preview and modify image");
    setModal(true);//from www  . jav  a 2 s  . co m
    setResizable(false);
    setWidth("700px");
    center();

    MVerticalLayout content = new MVerticalLayout();
    setContent(content);

    try {
        originalImage = ImageIO.read(new ByteArrayInputStream(imageData));
    } catch (IOException e) {
        throw new UserInvalidInputException("Invalid image type");
    }
    originalImage = ImageUtil.scaleImage(originalImage, 650, 650);

    MHorizontalLayout previewBox = new MHorizontalLayout().withSpacing(true)
            .withMargin(new MarginInfo(false, true, true, false)).withFullWidth();

    previewPhoto = new VerticalLayout();
    previewPhoto.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    previewPhoto.setWidth("100px");

    previewBox.with(previewPhoto).withAlign(previewPhoto, Alignment.TOP_LEFT);

    VerticalLayout previewBoxTitle = new VerticalLayout();
    previewBoxTitle.setMargin(new MarginInfo(false, true, false, true));
    Label lbPreview = new Label("<p style='margin: 0px;'><strong>To the bottom is what your profile photo will "
            + "look like.</strong></p>"
            + "<p style='margin-top: 0px;'>To make adjustment, you can drag around and resize the selection square below. "
            + "When you are happy with your photo, click the &ldquo;Accept&ldquo; button.</p>",
            ContentMode.HTML);
    previewBoxTitle.addComponent(lbPreview);

    MHorizontalLayout controlBtns = new MHorizontalLayout();
    controlBtns.setSizeUndefined();

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    close();
                }
            });
    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);

    Button acceptBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ACCEPT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    if (scaleImageData != null && scaleImageData.length > 0) {
                        try {
                            BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData));
                            imageSelectionCommand.process(image);
                            close();
                        } catch (IOException e) {
                            throw new MyCollabException("Error when saving user avatar", e);
                        }
                    }
                }
            });
    acceptBtn.setStyleName(UIConstants.BUTTON_ACTION);
    acceptBtn.setIcon(FontAwesome.CHECK);

    controlBtns.with(acceptBtn, cancelBtn).alignAll(Alignment.MIDDLE_LEFT);

    previewBoxTitle.addComponent(controlBtns);
    previewBoxTitle.setComponentAlignment(controlBtns, Alignment.TOP_LEFT);
    previewBox.with(previewBoxTitle).expand(previewBoxTitle);

    CssLayout cropBox = new CssLayout();
    cropBox.setWidth("100%");
    VerticalLayout currentPhotoBox = new VerticalLayout();
    Resource resource = new ByteArrayImageResource(ImageUtil.convertImageToByteArray(originalImage),
            "image/png");
    CropField cropField = new CropField(resource);
    cropField.setImmediate(true);
    cropField.setSelectionAspectRatio(1.0f);
    cropField.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            VCropSelection newSelection = (VCropSelection) event.getProperty().getValue();
            int x1 = newSelection.getXTopLeft();
            int y1 = newSelection.getYTopLeft();
            int x2 = newSelection.getXBottomRight();
            int y2 = newSelection.getYBottomRight();
            if (x2 > x1 && y2 > y1) {
                BufferedImage subImage = originalImage.getSubimage(x1, y1, (x2 - x1), (y2 - y1));
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                try {
                    ImageIO.write(subImage, "png", outStream);
                    scaleImageData = outStream.toByteArray();
                    displayPreviewImage();
                } catch (IOException e) {
                    LOG.error("Error while scale image: ", e);
                }
            }
        }
    });
    currentPhotoBox.setWidth("520px");
    currentPhotoBox.setHeight("470px");
    currentPhotoBox.addComponent(cropField);
    cropBox.addComponent(currentPhotoBox);

    content.with(previewBox, ELabel.hr(), cropBox);
    displayPreviewImage();
}

From source file:com.esofthead.mycollab.module.user.ui.components.LanguageSelectionField.java

License:Open Source License

@Override
protected Component initContent() {
    return new MHorizontalLayout(languageBox, languageCode).alignAll(Alignment.MIDDLE_LEFT);
}

From source file:com.esofthead.mycollab.reporting.CustomizeReportOutputWindow.java

License:Open Source License

public CustomizeReportOutputWindow(final String viewId, final String reportTitle, final Class<B> beanCls,
        final ISearchableService<S> searchableService, final VariableInjector<S> variableInjector) {
    super("Export");
    this.setModal(true);
    this.setWidth("1000px");
    this.setResizable(false);
    this.center();
    this.viewId = viewId;
    this.variableInjector = variableInjector;

    MVerticalLayout contentLayout = new MVerticalLayout();
    setContent(contentLayout);/*from  w w w.  j av a  2s.  co m*/

    final OptionGroup optionGroup = new OptionGroup();
    optionGroup.addStyleName("sortDirection");
    optionGroup.addItems(AppContext.getMessage(FileI18nEnum.CSV), AppContext.getMessage(FileI18nEnum.PDF),
            AppContext.getMessage(FileI18nEnum.EXCEL));
    optionGroup.setValue(AppContext.getMessage(FileI18nEnum.CSV));
    contentLayout.with(
            new MHorizontalLayout(ELabel.h3(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT)), optionGroup)
                    .alignAll(Alignment.MIDDLE_LEFT));

    contentLayout.with(ELabel.h3(AppContext.getMessage(GenericI18Enum.ACTION_SELECT_COLUMNS)));
    listBuilder = new ListBuilder();
    listBuilder.setImmediate(true);
    listBuilder.setColumns(0);
    listBuilder.setLeftColumnCaption(AppContext.getMessage(GenericI18Enum.OPT_AVAILABLE_COLUMNS));
    listBuilder.setRightColumnCaption(AppContext.getMessage(GenericI18Enum.OPT_VIEW_COLUMNS));
    listBuilder.setWidth(100, Sizeable.Unit.PERCENTAGE);
    listBuilder.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT);
    final BeanItemContainer<TableViewField> container = new BeanItemContainer<>(TableViewField.class,
            this.getAvailableColumns());
    listBuilder.setContainerDataSource(container);
    Iterator<TableViewField> iterator = getAvailableColumns().iterator();
    while (iterator.hasNext()) {
        TableViewField field = iterator.next();
        listBuilder.setItemCaption(field, AppContext.getMessage(field.getDescKey()));
    }
    final Collection<TableViewField> viewColumnIds = this.getViewColumns();
    listBuilder.setValue(viewColumnIds);
    contentLayout.with(listBuilder).withAlign(listBuilder, Alignment.TOP_CENTER);

    contentLayout.with(ELabel.h3(AppContext.getMessage(GenericI18Enum.ACTION_PREVIEW)));
    sampleTableDisplay = new Table();
    for (TableViewField field : getAvailableColumns()) {
        sampleTableDisplay.addContainerProperty(field.getField(), String.class, "",
                AppContext.getMessage(field.getDescKey()), null, Table.Align.LEFT);
        sampleTableDisplay.setColumnWidth(field.getField(), field.getDefaultWidth());
    }
    sampleTableDisplay.setWidth("100%");
    sampleTableDisplay.addItem(buildSampleData(), 1);
    sampleTableDisplay.setPageLength(1);
    contentLayout.with(sampleTableDisplay);
    filterColumns();

    listBuilder.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            filterColumns();
        }
    });

    Button resetBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_RESET),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    listBuilder.setValue(getDefaultColumns());
                    filterColumns();
                }
            });
    resetBtn.addStyleName(UIConstants.BUTTON_LINK);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);

    final Button exportBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    exportBtn.addStyleName(UIConstants.BUTTON_ACTION);
    OnDemandFileDownloader pdfFileDownloader = new OnDemandFileDownloader(new LazyStreamSource() {
        @Override
        protected StreamResource.StreamSource buildStreamSource() {
            return new StreamResource.StreamSource() {
                @Override
                public InputStream getStream() {
                    Collection<TableViewField> columns = (Collection<TableViewField>) listBuilder.getValue();
                    // Save custom table view def
                    CustomViewStoreService customViewStoreService = AppContextUtil
                            .getSpringBean(CustomViewStoreService.class);
                    CustomViewStore viewDef = new CustomViewStore();
                    viewDef.setSaccountid(AppContext.getAccountId());
                    viewDef.setCreateduser(AppContext.getUsername());
                    viewDef.setViewid(viewId);
                    viewDef.setViewinfo(FieldDefAnalyzer.toJson(new ArrayList<>(columns)));
                    customViewStoreService.saveOrUpdateViewLayoutDef(viewDef);

                    SimpleReportTemplateExecutor reportTemplateExecutor = new SimpleReportTemplateExecutor.AllItems<>(
                            reportTitle, new RpFieldsBuilder(columns), exportType, beanCls, searchableService);
                    ReportStreamSource streamSource = new ReportStreamSource(reportTemplateExecutor) {
                        @Override
                        protected void initReportParameters(Map<String, Object> parameters) {
                            parameters.put(SimpleReportTemplateExecutor.CRITERIA, variableInjector.eval());
                        }
                    };
                    return streamSource.getStream();
                }
            };
        }

        @Override
        public String getFilename() {
            String exportTypeVal = (String) optionGroup.getValue();
            if (AppContext.getMessage(FileI18nEnum.CSV).equals(exportTypeVal)) {
                exportType = ReportExportType.CSV;
            } else if (AppContext.getMessage(FileI18nEnum.EXCEL).equals(exportTypeVal)) {
                exportType = ReportExportType.EXCEL;
            } else {
                exportType = ReportExportType.PDF;
            }
            return exportType.getDefaultFileName();
        }
    });
    pdfFileDownloader.extend(exportBtn);

    MHorizontalLayout buttonControls = new MHorizontalLayout(resetBtn, cancelBtn, exportBtn);
    contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT);
}