Example usage for com.vaadin.ui Label setContentMode

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

Introduction

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

Prototype

public void setContentMode(ContentMode contentMode) 

Source Link

Document

Sets the content mode of the label.

Usage

From source file:com.esofthead.mycollab.vaadin.ui.form.field.DateTimeViewField.java

License:Open Source License

@Override
protected Component initContent() {
    final Label l = new Label();
    l.setWidth("100%");
    if (date == null) {
        l.setValue(" ");
        l.setContentMode(ContentMode.HTML);
    } else {/*from   ww  w  .j  av  a  2 s.c  o  m*/
        l.setValue(AppContext.formatDateTime(date));
    }
    return l;
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.DateViewField.java

License:Open Source License

@Override
protected Component initContent() {
    final Label l = new Label();
    l.setWidth("100%");
    if (date == null) {
        l.setValue(" ");
        l.setContentMode(ContentMode.HTML);
    } else {//from www.j av  a  2  s  . co m
        l.setValue(AppContext.formatDate(date));
    }
    return l;
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.DefaultViewField.java

License:Open Source License

@Override
protected Component initContent() {
    final Label label = new Label();
    label.setWidth("100%");
    label.setContentMode(contentMode);

    if (StringUtils.isNotBlank(value)) {
        label.setValue(value);/*from w  w w . ja  va 2s.  c  om*/
    } else {
        label.setValue("");
    }

    return label;
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.I18nFormViewField.java

License:Open Source License

@Override
protected Component initContent() {
    final Label label = new Label();
    label.setWidth("100%");
    label.setContentMode(ContentMode.TEXT);

    if (org.apache.commons.lang3.StringUtils.isNotBlank(key)) {
        try {//ww  w  . ja va 2  s.co m
            String value = AppContext.getMessage(enumClass, key);
            label.setValue(value);
        } catch (Exception e) {
            label.setValue("");
        }
    } else {
        label.setValue("");
    }

    return label;
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.PrettyDateTimeViewField.java

License:Open Source License

@Override
protected Component initContent() {
    final Label l = new Label();
    l.setWidth("100%");
    if (date == null) {
        l.setValue(" ");
        l.setContentMode(ContentMode.HTML);
    } else {/*  ww  w  . j av  a 2  s.c  om*/
        l.setValue(AppContext.formatPrettyTime(date));
        l.setDescription(AppContext.formatDateTime(date));
    }
    return l;
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.PrettyDateViewField.java

License:Open Source License

@Override
protected Component initContent() {
    final Label l = new Label();
    l.setWidth("100%");
    if (date == null) {
        l.setValue(" ");
        l.setContentMode(ContentMode.HTML);
    } else {/*w  w  w  .j a v  a2s . c  om*/
        l.setValue(AppContext.formatPrettyTime(date));
        l.setDescription(AppContext.formatDate(date));
    }
    return l;
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.RichTextViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (org.apache.commons.lang3.StringUtils.isBlank(value)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {/*from  ww w .j  av a  2  s . co m*/
        final Label link = new Label(StringUtils.formatRichText(value), ContentMode.HTML);
        link.setWidth("100%");
        return link;
    }
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.UrlLinkViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(url)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {/*from w ww . ja v  a2 s.com*/
        final Link link = new UrlLink(url);
        link.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return link;
    }
}

From source file:com.esofthead.mycollab.vaadin.ui.form.field.UrlSocialNetworkLinkViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(caption)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        lbl.setWidth("100%");
        return lbl;
    } else {/*from   w  w w  .ja va2 s. c  o  m*/
        linkAccount = (linkAccount == null) ? "" : linkAccount;
        final Link link = new SocialNetworkLink(caption, linkAccount);
        link.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
        return link;
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.field.UrlLinkViewField.java

License:Open Source License

@Override
protected Component initContent() {
    if (StringUtils.isBlank(url) || StringUtils.isBlank(caption)) {
        Label lbl = new Label(" ");
        lbl.setContentMode(ContentMode.HTML);
        return lbl;
    } else {//from  www .jav  a 2s  . co m
        final A link = new A(url).appendText(caption).setTarget("_blank");
        return new Label(link.write(), ContentMode.HTML);
    }
}