Example usage for com.vaadin.ui Label Label

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

Introduction

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

Prototype

public Label(String text, ContentMode contentMode) 

Source Link

Document

Creates a new instance with the given text and content mode.

Usage

From source file:com.concur.ui.WebApp.java

License:Apache License

private Window createWindow() {
    FormLayout fl = new FormLayout();

    //        final SessionGuard sg = new SessionGuard();
    //        sg.setKeepalive(true);
    //        fl.addComponent(sg);

    fl.setSizeFull();//w ww .  jav a  2s .co  m
    fl.setMargin(true);
    fl.addComponent(new Label("<h2>ATS Tuple Store -- Demo App<h2/>", Label.CONTENT_XML));

    actionField = new NativeSelect("Action:");
    actionField.addItem("Authenticate");
    actionField.addItem("GetTuple");
    actionField.addItem("PutTuple");
    actionField.addItem("GetConfigurations");
    actionField.select("Authenticate");
    fl.addComponent(actionField);

    tokenField = new TextField("Authentication Token:");
    tokenField.setColumns(40);
    fl.addComponent(tokenField);

    tupleKeyField = new TextField("TupleKey:");
    tupleKeyField.setColumns(40);
    fl.addComponent(tupleKeyField);

    tupleDataArea = new TextArea("TupleData:");
    tupleDataArea.setColumns(40);
    tupleDataArea.setRows(5);
    fl.addComponent(tupleDataArea);

    Button b = new Button("Send Request");
    b.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            submit();
        }
    });

    fl.addComponent(b);

    final Window w = new Window("ATS Tuple Store -- DEMO");
    w.setContent(fl);
    return w;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildMessagePanel() {
    VerticalLayout verticalLayout = new VerticalLayout();
    UpdateRecoveryImpossibleCause cause = presenter.isUpdateWithRecoveryPossible();
    if (cause != null) {
        verticalLayout.addComponent(new Label(
                "<p style=\"color:red\">" + $("UpdateManagerViewImpl." + cause) + "</p>", ContentMode.HTML));
    } else {/*ww w. j  a  v  a  2  s . c o  m*/
        UpdateNotRecommendedReason updateNotRecommendedReason = presenter.getUpdateNotRecommendedReason();
        if (updateNotRecommendedReason != null) {
            verticalLayout.addComponent(new Label("<p style=\"color:red\">"
                    + $("UpdateManagerViewImpl." + updateNotRecommendedReason) + "</p>", ContentMode.HTML));
        }
    }
    final String exceptionDuringLastUpdate = presenter.getExceptionDuringLastUpdate();
    if (StringUtils.isNotBlank(exceptionDuringLastUpdate)) {
        verticalLayout.addComponent(new Label(
                "<p style=\"color:red\">" + $("UpdateManagerViewImpl.exceptionCausedByLastVersion") + "</p>",
                ContentMode.HTML));
        WindowButton windowButton = new WindowButton($("details"), $("details"),
                WindowConfiguration.modalDialog("90%", "90%")) {
            @Override
            protected Component buildWindowContent() {
                TextArea textArea = new TextArea();
                textArea.setSizeFull();
                textArea.setValue(exceptionDuringLastUpdate);
                return textArea;
            }
        };
        windowButton.addStyleName(ValoTheme.BUTTON_LINK);
        verticalLayout.addComponent(windowButton);
        verticalLayout.addComponent(new Label("<p style=\"color:red\">" + "" + "</p>", ContentMode.HTML));
    }
    return verticalLayout;
}

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildRestartRequiredPanel() {
    return new Label("<p style=\"color:red\">" + $("UpdateManagerViewImpl.restart") + "</p>", ContentMode.HTML);
}

From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java

License:Open Source License

@Override
public Component generateRow(final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false)
            .withWidth("100%").withStyleName("message");

    MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px");
    userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    ClickListener gotoUser = new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*  w  w  w  .jav a  2  s.co m*/
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser()));
        }
    };
    Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(),
            comment.getOwnerFullName());
    userAvatarBtn.addClickListener(gotoUser);
    userBlock.addComponent(userAvatarBtn);

    Button userName = new Button(comment.getOwnerFullName());
    userName.setStyleName("user-name");
    userName.addStyleName("link");
    userName.addStyleName(UIConstants.WORD_WRAP);
    userName.addClickListener(gotoUser);
    userBlock.addComponent(userName);
    layout.addComponent(userBlock);

    CssLayout rowLayout = new CssLayout();
    rowLayout.setStyleName("message-container");
    rowLayout.setWidth("100%");

    MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true)
            .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%")
            .withStyleName("message-header");
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label timePostLbl = new Label(
            AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(),
                    DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())),
            ContentMode.HTML);
    timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime()));

    timePostLbl.setSizeUndefined();
    timePostLbl.setStyleName("time-post");
    messageHeader.addComponent(timePostLbl);
    messageHeader.setExpandRatio(timePostLbl, 1.0f);

    // Message delete button
    Button msgDeleteBtn = new Button();
    msgDeleteBtn.setIcon(FontAwesome.TRASH_O);
    msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);
    messageHeader.addComponent(msgDeleteBtn);

    if (hasDeletePermission(comment)) {
        msgDeleteBtn.setVisible(true);
        msgDeleteBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                SiteConfiguration.getSiteName()),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                        AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClose(ConfirmDialog dialog) {
                                if (dialog.isConfirmed()) {
                                    CommentService commentService = ApplicationContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment.getId(), AppContext.getUsername(),
                                            AppContext.getAccountId());
                                    CommentRowDisplayHandler.this.owner.removeRow(layout);
                                }
                            }
                        });
            }
        });
    } else {
        msgDeleteBtn.setVisible(false);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new UrlDetectableLabel(comment.getComment());
    messageContent.setStyleName("message-body");
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true)
                .withWidth("100%").withStyleName("message-footer");
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.addComponent(attachmentDisplay);
        messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }

    layout.addComponent(rowLayout);
    layout.setExpandRatio(rowLayout, 1.0f);
    return layout;
}

From source file:com.esofthead.mycollab.common.ui.components.notification.NewUpdateNotification.java

License:Open Source License

@Override
public Component renderContent() {
    Span spanEl = new Span();
    spanEl.appendText("There is the new MyCollab version " + props.getProperty("version") + " . For the "
            + "enhancements and security purpose, you should upgrade to the latest version at ");

    A link = new A(props.getProperty("downloadLink"), "_blank");
    link.appendText("here");
    spanEl.appendChild(link);/* w  w w.j  ava  2 s .  com*/
    return new Label(FontAwesome.EXCLAMATION.getHtml() + " " + spanEl.write(), ContentMode.HTML);
}

From source file:com.esofthead.mycollab.common.ui.components.notification.RequestUploadAvatarNotification.java

License:Open Source License

@Override
public Component renderContent() {
    Span spanEl = new Span();
    spanEl.appendText("You haven't uploaded your avatar yet. Please upload it at ");

    A link = new A(AccountLinkGenerator.generateFullProfileLink(AppContext.getSiteUrl()));
    link.appendText("here");
    spanEl.appendChild(link);/* ww w  .jav a  2  s .  c  o  m*/
    return new Label(FontAwesome.EXCLAMATION.getHtml() + " " + spanEl.write(), ContentMode.HTML);
}

From source file:com.esofthead.mycollab.common.ui.components.notification.TimezoneNotification.java

License:Open Source License

@Override
public Component renderContent() {
    Span spanEl = new Span();
    spanEl.appendText("You haven't chosen preferred timezone. Please set it ");

    A link = new A(AccountLinkGenerator.generatePreviewFullUserLink(AppContext.getSiteUrl(),
            AppContext.getSession().getUsername()));
    link.appendText("here");
    spanEl.appendChild(link);/*from w  w w .ja va  2 s . c  om*/
    return new Label(FontAwesome.EXCLAMATION.getHtml() + " " + spanEl.write(), ContentMode.HTML);
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmActivityComponent.java

License:Open Source License

private Component buildAuditBlock(SimpleAuditLog auditLog) {
    List<AuditChangeItem> changeItems = auditLog.getChangeItems();
    if (CollectionUtils.isNotEmpty(changeItems)) {
        final MHorizontalLayout layout = new MHorizontalLayout()
                .withMargin(new MarginInfo(true, false, true, false)).withFullWidth().withStyleName("message");

        ProjectMemberBlock memberBlock = new ProjectMemberBlock(auditLog.getPosteduser(),
                auditLog.getPostedUserAvatarId(), auditLog.getPostedUserFullName());
        layout.addComponent(memberBlock);

        MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName("message-container");

        MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth();
        messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

        ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_MODIFIED_ITEM,
                auditLog.getPostedUserFullName(), AppContext.formatPrettyTime(auditLog.getPosteddate())),
                ContentMode.HTML).withDescription(AppContext.formatDateTime(auditLog.getPosteddate()));
        timePostLbl.setStyleName(UIConstants.META_INFO);
        messageHeader.with(timePostLbl).expand(timePostLbl);

        rowLayout.addComponent(messageHeader);

        for (int i = 0; i < changeItems.size(); i++) {
            AuditChangeItem item = changeItems.get(i);
            String fieldName = item.getField();

            DefaultFieldDisplayHandler fieldDisplayHandler = groupFormatter.getFieldDisplayHandler(fieldName);
            if (fieldDisplayHandler != null) {
                Span fieldBlock = new Span()
                        .appendText(AppContext.getMessage(fieldDisplayHandler.getDisplayName()))
                        .setCSSClass(UIConstants.BUTTON_BLOCK);
                Div historyDiv = new Div().appendChild(fieldBlock)
                        .appendText(fieldDisplayHandler.getFormat().toString(item.getOldvalue()))
                        .appendText(" " + FontAwesome.LONG_ARROW_RIGHT.getHtml() + " ")
                        .appendText(fieldDisplayHandler.getFormat().toString(item.getNewvalue()));
                rowLayout.addComponent(new Label(historyDiv.write(), ContentMode.HTML));
            }//from   ww  w .  j a v a  2 s.  co m
        }

        layout.with(rowLayout).expand(rowLayout);
        return layout;
    } else {
        return null;
    }
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmFollowersComp.java

License:Open Source License

public void displayFollowers(final V bean) {
    this.bean = bean;
    this.removeAllComponents();

    MHorizontalLayout header = new MHorizontalLayout();
    Label followerHeader = new Label(
            FontAwesome.EYE.getHtml() + " " + AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS),
            ContentMode.HTML);/*from   w  w  w  . j  a  v a  2s .  co  m*/
    followerHeader.setStyleName("info-hdr");
    header.addComponent(followerHeader);

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

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditWatchersWindow(bean);

                    }
                });
        editBtn.setStyleName("link");
        header.addComponent(editBtn);
    }

    this.addComponent(header);
    header.addComponent(new Label("/"));

    currentUserFollow = isUserWatching(bean);

    final Button toogleWatching = new Button("");
    toogleWatching.setStyleName("link");
    toogleWatching.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (currentUserFollow) {
                unfollowItem(AppContext.getUsername(), bean);
                currentUserFollow = false;
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
            } else {
                followItem(AppContext.getUsername(), bean);
                toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
                currentUserFollow = true;
            }

            updateTotalFollowers(bean);
        }
    });
    header.addComponent(toogleWatching);

    if (currentUserFollow) {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW));
    } else {
        toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW));
    }

    MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withWidth("100%");

    this.addComponent(layout);

    int totalFollowers = getTotalFollowers(bean);
    followersBtn = new Button(AppContext.getMessage(FollowerI18nEnum.OPT_NUM_FOLLOWERS, totalFollowers),
            new ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    if (hasReadPermission()) {
                        showEditWatchersWindow(bean);
                    }

                }
            });
    followersBtn.setStyleName("link");
    layout.addComponent(followersBtn);
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmListNoItemView.java

License:Open Source License

public CrmListNoItemView() {
    MVerticalLayout layout = new MVerticalLayout().withWidth("800px");
    layout.addStyleName("case-noitem");
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Label image = new Label(titleIcon().getHtml(), ContentMode.HTML);
    image.setSizeUndefined();//from w ww  .j a  v  a2 s.  c om
    layout.with(image).withAlign(image, Alignment.TOP_CENTER);

    Label title = new Label(titleMessage());
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label hintLabel = new Label(hintMessage());
    hintLabel.setWidthUndefined();
    layout.addComponent(hintLabel);

    Button btCreateContact = new Button(actionMessage(), actionListener());
    btCreateContact.setEnabled(hasPermission());

    MHorizontalLayout links = new MHorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
       * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     *
     * Button btImportContact = new Button("Import Cases", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     *
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     *
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     *
     *
     * links.addComponent(btImportContact);
     */

    layout.addComponent(links);
    this.with(layout).withAlign(layout, Alignment.TOP_CENTER);
}