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() 

Source Link

Document

Creates an empty Label.

Usage

From source file:com.esofthead.mycollab.vaadin.ui.DefaultReadViewLayout.java

License:Open Source License

private ComponentContainer buildHeader(String title) {
    MHorizontalLayout header = new MHorizontalLayout().withWidth("100%");

    this.titleLbl = new Label();
    this.titleLbl.setStyleName("headerName");

    header.with(titleLbl).expand(titleLbl);

    if (StringUtils.isBlank(title)) {
        this.setTitle("Undefined");
    } else {/*from   w  w w .  j  a v a2 s. c  om*/
        this.setTitle(title);
    }
    return header;
}

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   w  w w  .j  a v  a2  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 a v a2s  .  c  o 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);//from w  ww  . j  av  a2 s.  com

    if (StringUtils.isNotBlank(value)) {
        label.setValue(value);
    } 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 {//from w  ww.  j  a  va 2s  .  c  o  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 {/*from   ww w .j  a v  a2  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 {//from   w w  w . ja  va 2 s.  c  o  m
        l.setValue(AppContext.formatPrettyTime(date));
        l.setDescription(AppContext.formatDate(date));
    }
    return l;
}

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

License:Open Source License

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

    if (value != null) {
        double d = value.doubleValue();
        d = Math.round(d * 100);//from w w  w .  java 2s.co  m
        d = d / 100;
        label.setValue(d + "");
    } else {
        label.setValue("");
    }

    return label;
}

From source file:com.esofthead.mycollab.vaadin.ui.MassUpdateWindow.java

License:Open Source License

protected ComponentContainer buildButtonControls() {
    MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true).withStyleName("addNewControl")
            .withWidth("100%");

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

                @Override//from  w  ww.j  a  v a 2 s.c om
                public void buttonClick(ClickEvent event) {
                    updateForm.commit();
                    massUpdateCommand.massUpdate(beanItem);
                    MassUpdateWindow.this.close();
                }
            });
    updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    updateBtn.setIcon(FontAwesome.SAVE);

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

        @Override
        public void buttonClick(ClickEvent event) {
            MassUpdateWindow.this.close();
        }
    });
    closeBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    Label spacing = new Label();
    controlsLayout.with(spacing, updateBtn, closeBtn).alignAll(Alignment.MIDDLE_RIGHT).expand(spacing);
    return controlsLayout;
}

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

License:Open Source License

public DateFormatField(final String initialFormat) {
    this.dateFormat = initialFormat;
    dateInput = new TextField(null, initialFormat);
    dateInput.setImmediate(true);//from   w w w .j  av a 2 s  . c  o  m
    dateInput.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.EAGER);
    now = new DateTime();
    dateExample = new Label();
    dateFormatInstance = DateTimeFormat.forPattern(dateFormat);
    dateExample.setValue("(" + dateFormatInstance.print(now) + ")");
    dateExample.setWidthUndefined();
    dateInput.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(FieldEvents.TextChangeEvent event) {
            try {
                String newFormat = event.getText();
                dateFormatInstance = DateTimeFormat.forPattern(newFormat);
                dateExample.setValue("(" + dateFormatInstance.print(now) + ")");
            } catch (Exception e) {
                NotificationUtil.showErrorNotification("Invalid format");
                dateInput.setValue(initialFormat);
                dateFormatInstance = DateTimeFormat.forPattern(initialFormat);
                dateExample.setValue("(" + dateFormatInstance.print(now) + ")");
            }
        }
    });
}