Example usage for com.vaadin.ui RichTextArea RichTextArea

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

Introduction

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

Prototype

public RichTextArea() 

Source Link

Document

Constructs an empty RichTextArea with no caption.

Usage

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

License:Open Source License

public InputWidgetsView() {
    super();//from  ww w.  j a  va  2 s.  c  o 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);
}

From source file:ro.zg.netcell.vaadin.action.FormGenerator.java

License:Apache License

private Field getFieldForType(String uiType) {
    if (uiType == null) {
        return new TextField();
    }//from w ww .j  a v  a2  s . co  m
    if (uiType.equals("richtextarea")) {
        return new RichTextArea();
    }
    if (uiType.equals("checkbox")) {
        return new CheckBox();
    }
    if (uiType.equals("combobox")) {
        return new ComboBox();
    }
    if (uiType.equals("date")) {
        final DateField df = new DateField();
        df.setResolution(DateField.RESOLUTION_DAY);
        return df;
    }
    return new TextField();
}

From source file:ro.zg.netcell.vaadin.DefaultFormFieldFactory.java

License:Apache License

@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
    String paramUiType = paramsUiType.get((String) propertyId).getUiType().toString();
    if (paramUiType.startsWith("TEXTAREA_50")) {
        Field f = new RichTextArea();
        f.setCaption(DefaultFieldFactory.createCaptionByPropertyId(propertyId));
        f.setSizeFull();/*from  w  w  w.  ja  va  2  s. c om*/
        return f;
    }
    Field f = DefaultFieldFactory.get().createField(item, propertyId, uiContext);
    if (paramUiType.startsWith("TEXTAREA_5")) {
        f.setSizeFull();
    }
    return f;
}