Example usage for com.vaadin.ui RichTextArea setHeight

List of usage examples for com.vaadin.ui RichTextArea setHeight

Introduction

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

Prototype

public void setHeight(float height, Unit unit);

Source Link

Document

Sets the height of the object.

Usage

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

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(2, 5);
    mainLayout.setMargin(true);/*from   w  ww .  j  a  v a 2  s  .  c o m*/
    mainLayout.setSpacing(true);

    emailNameTextField = new TextField();
    emailNameTextField.setWidth("500px");
    Label emailName = new Label("Your name: ");

    mainLayout.addComponent(emailName, 0, 0);
    mainLayout.addComponent(emailNameTextField, 1, 0);

    emailTextField = new TextField();
    emailTextField.setWidth("500px");
    emailTextField.setRequired(true);
    Label emailLbl = new Label("Your email: ");

    mainLayout.addComponent(emailLbl, 0, 1);
    mainLayout.addComponent(emailTextField, 1, 1);

    subjectTextField = new TextField();
    subjectTextField.setWidth("500px");
    subjectTextField.setRequired(true);
    Label subjectLbl = new Label("Subject: ");

    mainLayout.addComponent(subjectLbl, 0, 2);
    mainLayout.addComponent(subjectTextField, 1, 2);

    final RichTextArea contentArea = new RichTextArea();
    contentArea.setImmediate(true);
    contentArea.setWidth(500, Sizeable.Unit.PIXELS);
    contentArea.setHeight(200, Sizeable.Unit.PIXELS);
    Label contentLbl = new Label("Your feedback: ");

    mainLayout.addComponent(contentLbl, 0, 3);
    mainLayout.addComponent(contentArea, 1, 3);

    initDefaultData();

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

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

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    // Panel attachedFilepanel = new Panel();
    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setHeight("80px");
    contentLayout.setStyleName("noneBorder-panel");
    contentLayout.setSizeUndefined();

    contentLayout.addComponent(uploadExt);

    // attachedFilepanel.setContent(contentLayout);

    controlsLayout.addComponent(contentLayout);
    controlsLayout.setComponentAlignment(contentLayout, Alignment.BOTTOM_LEFT);
    controlsLayout.setExpandRatio(contentLayout, 1.0f);

    controlsLayout.setSpacing(true);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    FeedbackWindow.this.close();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

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

        @Override
        public void buttonClick(ClickEvent event) {
            String email = emailTextField.getValue().toString().trim();
            String subject = subjectTextField.getValue().toString().trim();
            if (!StringUtils.isValidEmail(email)) {
                NotificationUtil.showWarningNotification("The email is not valid, please check it again!");
                return;
            }
            if (!email.equals("") && !subject.equals("")) {
                ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class);
                List<File> listFile = attachments.getListFile();
                List<EmailAttachementSource> emailAttachmentSource = null;

                if (CollectionUtils.isNotEmpty(listFile)) {
                    emailAttachmentSource = new ArrayList<EmailAttachementSource>();
                    for (File file : listFile) {
                        emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                }

                String nameEmailFrom = emailNameTextField.getValue().toString().trim();
                nameEmailFrom = nameEmailFrom.equals("") ? email : nameEmailFrom;
                String toEmail = SiteConfiguration.getSendErrorEmail();

                FeedbackWindow.this.close();

                systemMailService.sendHTMLMail(email, nameEmailFrom,
                        Arrays.asList(new MailRecipientField(toEmail, toEmail)), null, null, subject,
                        contentArea.getValue().toString(), emailAttachmentSource);

            } else {
                NotificationUtil.showWarningNotification(
                        "The email field and subject field must be not empty! Please fulfil them before pressing enter button.");
            }
        }
    });
    sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 4, 1, 4);

    this.setContent(mainLayout);
}

From source file:fr.amapj.view.views.parametres.PopupSaisieParametres.java

License:Open Source License

private void addFieldPermanenceInfo() {
    // Titre// w w  w.  j a va 2  s.  c  om
    setStepTitle("module \"Gestion des permanences\"");

    // Champ 9
    addComboEnumField("Activation du module \"Gestion des permanences\"", "etatPlanningDistribution");

    addComboEnumField("Envoi d'un mail de rappel pour les permanences", "envoiMailRappelPermanence");

    addIntegerField("Dlai en jours entre la permanence et l'envoi du mail", "delaiMailRappelPermanence");

    addTextField("Titre du mail de rappel pour les permanences", "titreMailRappelPermanence");

    RichTextArea f = addRichTextAeraField("Contenu du mail de rappel pour les permanences",
            "contenuMailRappelPermanence");
    f.setHeight(8, Unit.CM);

}

From source file:fr.amapj.view.views.parametres.PopupSaisieParametres.java

License:Open Source License

private void addFieldMailPeriodique() {
    // Titre/* w ww  .ja  v  a 2s.com*/
    setStepTitle("Envoi d'un mail priodique (tous les mois)");

    // Champ 9
    addComboEnumField("Activation de l'envoi d'un mail priodique (tous les mois)", "envoiMailPeriodique");

    addIntegerField("Numro du jour dans le mois o le mail sera envoy", "numJourDansMois");

    addTextField("Titre du mail priodique", "titreMailPeriodique");

    RichTextArea f = addRichTextAeraField("Contenu du mail priodique", "contenuMailPeriodique");
    f.setHeight(8, Unit.CM);

}

From source file:fr.amapj.view.views.permanence.detailperiode.mail.PopupEnvoiMailPlanningPermanence.java

License:Open Source License

private void addFieldTexteMail() {
    // Titre//from ww  w.  j  av  a 2 s.co m
    setStepTitle("le texte du mail");

    //
    RichTextArea f = addRichTextAeraField("Texte du mail", "texte");
    f.setHeight(10, Unit.CM);

}

From source file:org.hip.vif.admin.groupadmin.ui.CompletionView.java

License:Open Source License

private RichTextArea createEditField(final String inContent, final int inHeight) {
    final RichTextArea outEditor = new RichTextArea();
    outEditor.setWidth("70%"); //$NON-NLS-1$
    outEditor.setHeight(inHeight, Unit.PIXELS);
    outEditor.setValue(inContent);// w w  w .j  a v  a 2  s  .  c om
    outEditor.setStyleName("vif-editor"); //$NON-NLS-1$
    return outEditor;
}

From source file:org.hip.vif.web.util.VIFViewHelper.java

License:Open Source License

/** Helper method to create a text field.
 *
 * @param inContent String the field's content
 * @param inWidth int the field width (in pixels)
 * @param inHeight int the field width (in pixels)
 * @param inValidator {@link Validator} the field's validator or <code>null</code>, if no validation is applied
 * @return {@link RichTextArea} */
public static RichTextArea createTextArea(final String inContent, final int inWidth, final int inHeight,
        final Validator inValidator) {
    final RichTextArea out = new RichTextArea();
    out.setValue(inContent);/*from  w ww.j  a v a 2s . co  m*/
    if (inValidator != null) {
        out.addValidator(inValidator);
    }
    out.setWidth(inWidth, Unit.PIXELS);
    out.setHeight(inHeight, Unit.PIXELS);
    out.setStyleName("vif-editor"); //$NON-NLS-1$
    return out;
}

From source file:org.ripla.web.demo.widgets.views.InputWidgetsView.java

License:Open Source License

public InputWidgetsView() {
    super();/*from ww  w .  j  ava  2  s  . co m*/

    final IMessages lMessages = Activator.getMessages();
    final VerticalLayout lLayout = initLayout(lMessages, "widgets.title.page.input"); //$NON-NLS-1$

    final HorizontalLayout lColumns = new HorizontalLayout();
    lColumns.setSpacing(true);
    lLayout.addComponent(lColumns);

    final VerticalLayout lCol1 = new VerticalLayout();
    lCol1.setSizeUndefined();
    lColumns.addComponent(lCol1);
    final VerticalLayout lCol2 = new VerticalLayout();
    lCol2.setSizeUndefined();
    lColumns.addComponent(lCol2);
    final VerticalLayout lCol3 = new VerticalLayout();
    lCol3.setSizeUndefined();
    lColumns.addComponent(lCol3);
    lColumns.setExpandRatio(lCol3, 1);

    // classic input fields
    lCol1.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.input.normal"))); //$NON-NLS-1$
    final TextField lTextField = new TextField();
    lTextField.setColumns(WIDTH_FIELD);
    lCol1.addComponent(lTextField);

    lCol1.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.input.prompt"))); //$NON-NLS-1$
    final TextField lTextField2 = new TextField();
    lTextField2.setInputPrompt(lMessages.getMessage("widgets.input.input.prompt")); //$NON-NLS-1$
    lTextField2.setColumns(WIDTH_FIELD);
    lCol1.addComponent(lTextField2);

    lCol1.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.input.password"))); //$NON-NLS-1$
    final PasswordField lPassword = new PasswordField();
    lPassword.setColumns(WIDTH_FIELD);
    lCol1.addComponent(lPassword);

    lCol1.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.date"))); //$NON-NLS-1$
    final PopupDateField lDate1 = new PopupDateField(lMessages.getMessage("widgets.input.popup.date")); //$NON-NLS-1$
    lDate1.setResolution(Resolution.DAY);
    lDate1.setDateFormat("dd. MMMM yyyy"); //$NON-NLS-1$
    lDate1.setWidth(160, Unit.PIXELS);
    lDate1.setValue(new java.util.Date());
    lCol1.addComponent(lDate1);

    // text areas
    lCol2.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.text.area"))); //$NON-NLS-1$
    final TextArea lArea = new TextArea();
    lArea.setColumns(WIDTH_AREA);
    lArea.setRows(7);
    lCol2.addComponent(lArea);

    lCol2.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.rich.text"))); //$NON-NLS-1$
    final RichTextArea lRichText = new RichTextArea();
    lRichText.setWidth(WIDTH_AREA, Unit.EM);
    lRichText.setHeight(15, Unit.EM);
    lCol2.addComponent(lRichText);

    // text input with filter
    final CountryContainer lCountries = new CountryContainer();
    lCol3.addComponent(getSubtitle(lMessages.getMessage("widgets.input.subtitle.input.filter"))); //$NON-NLS-1$
    final TextField lFilter = new TextField();
    lFilter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    lFilter.setTextChangeTimeout(200);
    lFilter.addTextChangeListener(new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(final TextChangeEvent inEvent) {
            lCountries.removeAllContainerFilters();
            lCountries.addContainerFilter(
                    new SimpleStringFilter(CountryContainer.PROPERTY_NAME, inEvent.getText(), true, true));
        }
    });
    lFilter.setWidth(FILTER_WIDTH, Unit.PIXELS);

    final Table lTable = new Table(null, lCountries);
    lTable.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
    lTable.setWidth(FILTER_WIDTH, Unit.PIXELS);
    lTable.setPageLength(18);

    lCol3.addComponent(lFilter);
    lCol3.addComponent(lTable);
}