Example usage for com.vaadin.ui CssLayout CssLayout

List of usage examples for com.vaadin.ui CssLayout CssLayout

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:com.mycollab.vaadin.web.ui.AbstractBeanPagedList.java

License:Open Source License

public AbstractBeanPagedList(IBeanList.RowDisplayHandler<T> rowDisplayHandler, int defaultNumberSearchItems) {
    this.defaultNumberSearchItems = defaultNumberSearchItems;
    this.rowDisplayHandler = rowDisplayHandler;
    listContainer = new CssLayout();
    listContainer.setWidth("100%");
    this.addComponent(listContainer);
    this.setExpandRatio(listContainer, 1.0f);
    this.addStyleName(WebThemes.SCROLLABLE_CONTAINER);
    queryHandler = buildQueryHandler();/*from w w w .  j a va2s  .  co  m*/
}

From source file:com.mycollab.vaadin.web.ui.AbstractPreviewItemComp.java

License:Open Source License

private void initContent() {
    previewForm = initPreviewForm();/*from ww w  .  j  a v  a  2s.  co m*/
    actionControls = createButtonControls();
    if (actionControls != null) {
        header.with(actionControls).withAlign(actionControls, Alignment.TOP_RIGHT);
    }

    MCssLayout contentWrapper = new MCssLayout().withFullWidth().withStyleName(WebThemes.CONTENT_WRAPPER);

    if (previewLayout == null)
        previewLayout = new DefaultReadViewLayout("");

    contentWrapper.addComponent(previewLayout);

    if (isDisplaySideBar) {
        RightSidebarLayout bodyContainer = new RightSidebarLayout();
        bodyContainer.setSizeFull();

        bodyContent = new MVerticalLayout(previewForm).withSpacing(false).withMargin(false).withFullWidth();
        bodyContainer.setContent(bodyContent);
        sidebarContent = new MVerticalLayout().withWidth("250px").withStyleName("readview-sidebar");
        bodyContainer.setSidebar(sidebarContent);
        previewLayout.addBody(bodyContainer);
    } else {
        CssLayout bodyContainer = new CssLayout();
        bodyContainer.setSizeFull();
        bodyContainer.addStyleName("readview-body-wrap");
        bodyContent = new MVerticalLayout().withSpacing(false).withFullWidth().withMargin(false)
                .with(previewForm);
        bodyContainer.addComponent(bodyContent);
        previewLayout.addBody(bodyContainer);
    }

    this.addComponent(contentWrapper);
}

From source file:com.mycollab.vaadin.web.ui.AttachmentDisplayComponent.java

License:Open Source License

private void addAttachmentRow(final Content attachment) {
    String docName = attachment.getPath();
    int lastIndex = docName.lastIndexOf("/");
    if (lastIndex != -1) {
        docName = docName.substring(lastIndex + 1, docName.length());
    }/*from   w  w w . j av  a  2s.  c o  m*/

    final AbsoluteLayout attachmentLayout = new AbsoluteLayout();
    attachmentLayout.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    attachmentLayout.setHeight(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_HEIGHT);
    attachmentLayout.setStyleName("attachment-block");

    CssLayout thumbnailWrap = new CssLayout();
    thumbnailWrap.setSizeFull();
    thumbnailWrap.setStyleName("thumbnail-wrap");

    Link thumbnail = new Link();
    if (StringUtils.isBlank(attachment.getThumbnail())) {
        thumbnail.setIcon(FileAssetsUtil.getFileIconResource(attachment.getName()));
    } else {
        thumbnail.setIcon(VaadinResourceFactory.getResource(attachment.getThumbnail()));
    }

    if (MimeTypesUtil.isImageType(docName)) {
        thumbnail.setResource(VaadinResourceFactory.getResource(attachment.getPath()));
        new Fancybox(thumbnail).setPadding(0).setVersion("2.1.5").setEnabled(true).setDebug(true);
    }

    Div contentTooltip = new Div().appendChild(new Span().appendText(docName).setStyle("font-weight:bold"));
    Ul ul = new Ul().appendChild(new Li().appendText(UserUIContext.getMessage(FileI18nEnum.OPT_SIZE_VALUE,
            FileUtils.getVolumeDisplay(attachment.getSize())))).setStyle("line-height:1.5em");
    ul.appendChild(new Li().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_LAST_MODIFIED,
            UserUIContext.formatPrettyTime(attachment.getLastModified().getTime()))));
    contentTooltip.appendChild(ul);
    thumbnail.setDescription(contentTooltip.write());
    thumbnail.setWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH);
    thumbnailWrap.addComponent(thumbnail);

    attachmentLayout.addComponent(thumbnailWrap, "top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 0;");

    MCssLayout attachmentNameWrap = new MCssLayout()
            .withWidth(WebUIConstants.DEFAULT_ATTACHMENT_THUMBNAIL_WIDTH).withStyleName("attachment-name-wrap");

    Label attachmentName = new ELabel(docName).withStyleName(UIConstants.TEXT_ELLIPSIS);
    attachmentNameWrap.addComponent(attachmentName);
    attachmentLayout.addComponent(attachmentNameWrap, "bottom: 0px; left: 0px; right: 0px; z-index: 1;");

    MButton trashBtn = new MButton("", clickEvent -> {
        ConfirmDialogExt.show(UI.getCurrent(),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                UserUIContext.getMessage(GenericI18Enum.CONFIRM_DELETE_ATTACHMENT),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                    if (confirmDialog.isConfirmed()) {
                        ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.class);
                        attachmentService.removeResource(attachment.getPath(), UserUIContext.getUsername(),
                                true, MyCollabUI.getAccountId());
                        ((ComponentContainer) attachmentLayout.getParent()).removeComponent(attachmentLayout);
                    }
                });
    }).withIcon(FontAwesome.TRASH_O).withStyleName("attachment-control");
    attachmentLayout.addComponent(trashBtn, "top: 9px; left: 9px; z-index: 1;");

    MButton downloadBtn = new MButton().withIcon(FontAwesome.DOWNLOAD).withStyleName("attachment-control");
    FileDownloader fileDownloader = new FileDownloader(
            VaadinResourceFactory.getInstance().getStreamResource(attachment.getPath()));
    fileDownloader.extend(downloadBtn);
    attachmentLayout.addComponent(downloadBtn, "right: 9px; top: 9px; z-index: 1;");
    this.addComponent(attachmentLayout);
}

From source file:com.mycollab.vaadin.web.ui.MailFormWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);// w  ww .  j a va 2 s  .  c o  m
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
        for (String mail : lstMail) {
            if (StringUtils.isNotBlank(mail)) {
                if (mail.indexOf("<") > -1) {
                    String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
                    if (strMail != null && !strMail.equalsIgnoreCase("null")) {

                    }
                } else {

                }
            }
        }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);

    MButton sendBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL), clickEvent -> {
        if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) {
            NotificationUtil.showErrorNotification(
                    "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
            return;
        }
        if (UserUIContext.getUser().getEmail() != null && UserUIContext.getUser().getEmail().length() > 0) {
            ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class);

            List<File> listFile = attachments.files();
            List<AttachmentSource> attachmentSource = null;
            if (listFile != null && listFile.size() > 0) {
                attachmentSource = new ArrayList<>();
                for (File file : listFile) {
                    attachmentSource.add(new FileAttachmentSource(file));
                }
            }

            systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(),
                    UserUIContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(),
                    tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(),
                    subject.getValue(), noteArea.getValue(), attachmentSource, true);
            close();
        } else {
            NotificationUtil
                    .showErrorNotification("Your email is empty value, please fulfil it before sending email!");
        }
    }).withIcon(FontAwesome.SEND).withStyleName(WebThemes.BUTTON_ACTION);

    MHorizontalLayout controlsLayout = new MHorizontalLayout(attachments, cancelBtn, sendBtn)
            .expand(attachments).withFullWidth();
    mainLayout.addComponent(controlsLayout, 0, 2);
    this.setContent(mainLayout);
}

From source file:com.mycollab.vaadin.web.ui.NotificationComponent.java

License:Open Source License

private Component buildComponentFromNotification(AbstractNotification item) {
    final MHorizontalLayout wrapper = new MHorizontalLayout();
    wrapper.setData(item);/*from   ww  w .  ja  v  a2  s.c o  m*/
    wrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);

    if (item instanceof NewUpdateAvailableNotification) {
        final NewUpdateAvailableNotification notification = (NewUpdateAvailableNotification) item;
        Span spanEl = new Span();
        spanEl.appendText(
                UserUIContext.getMessage(ShellI18nEnum.OPT_HAVING_NEW_VERSION, notification.getVersion()));
        ELabel lbl = ELabel.html(FontAwesome.INFO_CIRCLE.getHtml() + " " + spanEl.write()).withFullWidth();
        CssLayout lblWrapper = new CssLayout();
        lblWrapper.addComponent(lbl);
        wrapper.addComponent(lblWrapper);
        wrapper.expand(lblWrapper);
        if (UserUIContext.isAdmin()) {
            MButton upgradeBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPGRADE),
                    clickEvent -> {
                        UI.getCurrent().addWindow(new UpgradeConfirmWindow(notification.getVersion(),
                                notification.getManualDownloadLink(), notification.getInstallerFile()));
                        NotificationComponent.this.setPopupVisible(false);
                    }).withStyleName(UIConstants.BLOCK);
            wrapper.addComponent(upgradeBtn);
        }
    } else if (item instanceof RequestUploadAvatarNotification) {
        wrapper.addComponent(new Label(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + UserUIContext.getMessage(ShellI18nEnum.OPT_REQUEST_UPLOAD_AVATAR), ContentMode.HTML));
        MButton uploadAvatarBtn = new MButton(UserUIContext.getMessage(ShellI18nEnum.ACTION_UPLOAD_AVATAR),
                clickEvent -> {
                    EventBusFactory.getInstance()
                            .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" }));
                    NotificationComponent.this.setPopupVisible(false);
                }).withStyleName(UIConstants.BLOCK);
        wrapper.add(uploadAvatarBtn);
    } else if (item instanceof SmtpSetupNotification) {
        MButton smtpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SETUP), clickEvent -> {
            EventBusFactory.getInstance()
                    .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" }));
            NotificationComponent.this.setPopupVisible(false);
        }).withStyleName(UIConstants.BLOCK);
        Label lbl = ELabel.html(FontAwesome.EXCLAMATION_TRIANGLE.getHtml() + " "
                + UserUIContext.getMessage(ShellI18nEnum.ERROR_NO_SMTP_SETTING));
        MCssLayout lblWrapper = new MCssLayout(lbl);
        wrapper.with(lblWrapper, smtpBtn).expand(lblWrapper);
    } else {
        LOG.error("Do not render notification " + item);
    }
    return wrapper;
}

From source file:com.mycollab.vaadin.web.ui.VerticalTabsheet.java

License:Open Source License

public VerticalTabsheet() {
    CssLayout contentLayout = new CssLayout();
    new Restrain(contentLayout).setMinHeight("100%");

    navigatorWrapper = new CssLayout();
    navigatorWrapper.setStyleName("navigator-wrap");
    navigatorContainer = new VerticalLayout();
    navigatorWrapper.addComponent(navigatorContainer);

    contentWrapper = new VerticalLayout();
    contentWrapper.setStyleName("container-wrap");
    new Restrain(contentWrapper).setMinHeight("100%");

    tabContainer = new VerticalLayout();
    contentWrapper.addComponent(tabContainer);
    new Restrain(tabContainer).setMinHeight("100%");

    contentLayout.addComponent(navigatorWrapper);
    contentLayout.addComponent(contentWrapper);

    this.setCompositionRoot(contentLayout);
    this.setStyleName(TABSHEET_STYLENAME);
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java

License:Open Source License

private Layout createToolbarFormattingElements() {
    CssLayout wrapper = new CssLayout();
    wrapper.addStyleName("toolbar-elements");
    wrapper.addStyleName("toolbar-formatting");

    for (int i = 0; i < 4; i++) {
        Button addButton = new Button(null, new Button.ClickListener() {
            @Override/*  w ww .  j  a va 2s . c o  m*/
            public void buttonClick(Button.ClickEvent event) {
                notImplemented();
            }
        });
        addButton.setStyleName("toolbar-formatting-button");
        ThemeResource tableResource = new ThemeResource("img/placeholder.png");
        addButton.setIcon(tableResource);

        wrapper.addComponent(addButton);
    }

    return wrapper;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java

License:Open Source License

private Layout createToolbarContentElements() {
    ThemeResource placeHolder = new ThemeResource("img/placeholder.png");
    CssLayout wrapper = new CssLayout();
    wrapper.addStyleName("toolbar-elements");
    Button addTableButton = new Button("table", new Button.ClickListener() {
        @Override//from   ww  w .  j  a  v a 2 s  .c  om
        public void buttonClick(Button.ClickEvent event) {
            notImplemented();
        }
    });
    addTableButton.setStyleName("ax-shape-button");
    ThemeResource tableResource = new ThemeResource("img/table.png");
    addTableButton.setIcon(tableResource);

    wrapper.addComponent(addTableButton);

    Button addRuleButton = new Button("rule", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            notImplemented();
        }
    });
    addRuleButton.setStyleName("ax-shape-button");
    addRuleButton.setIcon(placeHolder);

    wrapper.addComponent(addRuleButton);

    Button addParagraphButton = new Button("section", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            listener.createSection("Section");
        }
    });
    addParagraphButton.setStyleName("ax-shape-button");
    ThemeResource sectionResource = new ThemeResource("img/section_sign.gif");
    addParagraphButton.setIcon(sectionResource);

    wrapper.addComponent(addParagraphButton);

    Button addPullQuoteButton = new Button("pullquote", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            notImplemented();
        }
    });
    addPullQuoteButton.setStyleName("ax-shape-button");
    addPullQuoteButton.setIcon(placeHolder);

    wrapper.addComponent(addPullQuoteButton);
    return wrapper;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.bodyeditor.BodyEditorViewImpl.java

License:Open Source License

private Layout createToolbarAssetsElements() {
    final CssLayout wrapper = new CssLayout();
    wrapper.addStyleName("toolbar-elements");

    final Button addPhotographButton = new Button("photograph");
    addPhotographButton.addClickListener(new Button.ClickListener() {
        @Override/*from  w w w. j av  a 2 s. c  o  m*/
        public void buttonClick(Button.ClickEvent event) {
            listener.openMediaGallery();
        }
    });
    addPhotographButton.setStyleName("ax-shape-button");
    ThemeResource sectionResource = new ThemeResource("img/photograph.png");
    addPhotographButton.setIcon(sectionResource);
    wrapper.addComponent(addPhotographButton);

    List<String> assetElements = Arrays.asList(new String[] { "video", "poll", "related link", "iFrame" });
    for (String name : assetElements) {
        Button addButton = new Button(name, new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                notImplemented();
            }
        });
        addButton.setStyleName("ax-shape-button");
        ThemeResource tableResource = new ThemeResource("img/placeholder.png");
        addButton.setIcon(tableResource);

        wrapper.addComponent(addButton);
    }

    return wrapper;
}

From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.navigation.NavigationViewImpl.java

License:Open Source License

public NavigationViewImpl() {
    for (ViewType type : ViewType.values()) {
        CssLayout navigationControl = new CssLayout();
        navigationControl.addStyleName("navigationControl");
        navigationControl.addStyleName(type.getNavigationStyle());
        navigationControls.put(type, navigationControl);
        addComponent(navigationControl);
        navigationControl.addLayoutClickListener(navigationClickListener);
    }//  w ww.j av a  2 s  . co  m
}