Example usage for com.vaadin.ui TextArea setMaxLength

List of usage examples for com.vaadin.ui TextArea setMaxLength

Introduction

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

Prototype

public void setMaxLength(int maxLength) 

Source Link

Document

Sets the maximum number of characters in the field.

Usage

From source file:com.lst.deploymentautomation.vaadin.popup.TodoAnnotation.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    LspsUI ui = (LspsUI) getUI();//from   www. j a  v a  2s . c  o  m
    setCaption(ui.getMessage("todo.annotationTitle"));

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    setContent(layout);

    Label help = new Label(ui.getMessage("todo.annotationHelp"));
    help.setStyleName("form-help");
    layout.addComponent(help);

    priorityField = new TextField(ui.getMessage("todo.priority"), priority);
    //TODO forbid negative priorities
    priorityField.setConverter(Integer.class);
    priorityField.setConversionError(ui.getMessage("app.invalidValueMessage"));
    priorityField.setNullRepresentation("");
    priorityField.setNullSettingAllowed(true);
    layout.addComponent(priorityField);

    TextArea notesField = new TextArea(ui.getMessage("todo.notes"), notes);
    notesField.setMaxLength(1024);
    notesField.setNullRepresentation("");
    priorityField.setNullSettingAllowed(true);
    notesField.setSizeFull();
    layout.addComponent(notesField);
    layout.setExpandRatio(notesField, 1);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    layout.addComponent(buttons);

    @SuppressWarnings("serial")
    Button submitButton = new Button(ui.getMessage("action.annotate"), new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            annotate();
        }
    });
    buttons.addComponent(submitButton);

    @SuppressWarnings("serial")
    Button cancelButton = new Button(ui.getMessage("action.cancel"), new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttons.addComponent(cancelButton);
}

From source file:fr.amapj.view.views.permanence.permanencerole.PermanenceRoleEditorPart.java

License:Open Source License

private void addFieldGeneral() {
    // Titre//w  w  w . j  a v  a  2 s.co  m
    setStepTitle("les informations gnrales");

    // Champ 1
    IValidator uniq = new UniqueInDatabaseValidator(PermanenceRole.class, "nom", dto.id);
    IValidator notNull = new NotNullValidator();
    addTextField("Nom", "nom", uniq, notNull);

    TextArea f = addTextAeraField("Description", "description");
    f.setMaxLength(20480);
    f.setHeight(5, Unit.CM);

}

From source file:fr.amapj.view.views.producteur.basicform.ProducteurEditorPart.java

License:Open Source License

private void addFieldGeneral() {
    // Titre//w w w  .ja  v  a2s .c om
    setStepTitle("les informations gnrales du producteur");

    // Champ 1
    IValidator uniq = new UniqueInDatabaseValidator(Producteur.class, "nom", producteurDTO.id);
    IValidator notNull = new NotNullValidator();
    addTextField("Nom", "nom", uniq, notNull);

    TextArea f = addTextAeraField("Description", "description");
    f.setMaxLength(20480);
    f.setHeight(5, Unit.CM);

}

From source file:fr.amapj.view.views.utilisateur.PopupEnvoiPasswordMasse.java

License:Open Source License

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

    //
    TextArea f = addTextAeraField("Texte du mail", "texteMail");
    f.setMaxLength(20480);
    f.setHeight(10, Unit.CM);

}

From source file:org.bubblecloud.ilves.comment.CommentAddComponent.java

License:Open Source License

/**
 * The default constructor which instantiates Vaadin
 * component hierarchy./*from   ww  w.  j  av  a 2  s . c  om*/
 */
public CommentAddComponent() {

    final User user = DefaultSiteUI.getSecurityProvider().getUserFromSession();

    final String contextPath = VaadinService.getCurrentRequest().getContextPath();
    final Site site = Site.getCurrent();

    final Company company = site.getSiteContext().getObject(Company.class);
    final EntityManager entityManager = site.getSiteContext().getObject(EntityManager.class);

    final Panel panel = new Panel(site.localize("panel-add-comment"));
    setCompositionRoot(panel);

    final VerticalLayout mainLayout = new VerticalLayout();
    panel.setContent(mainLayout);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    final TextArea commentMessageField = new TextArea(site.localize("field-comment-message"));
    mainLayout.addComponent(commentMessageField);
    commentMessageField.setWidth(100, Unit.PERCENTAGE);
    commentMessageField.setRows(3);
    commentMessageField.setMaxLength(255);

    final Button addCommentButton = new Button(site.localize("button-add-comment"));
    mainLayout.addComponent(addCommentButton);
    if (user == null) {
        commentMessageField.setEnabled(false);
        commentMessageField.setInputPrompt(site.localize("message-please-login-to-comment"));
        addCommentButton.setEnabled(false);
    }

    addCommentButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            final String commentMessage = commentMessageField.getValue();
            if (StringUtils.isEmpty(commentMessage)) {
                return;
            }
            final Comment comment = new Comment(company, user, contextPath, commentMessage);
            entityManager.getTransaction().begin();
            try {
                entityManager.persist(comment);
                entityManager.getTransaction().commit();
                commentMessageField.setValue("");
                if (commentListComponent != null) {
                    commentListComponent.refresh();
                }
            } finally {
                if (entityManager.getTransaction().isActive()) {
                    entityManager.getTransaction().rollback();
                }
            }
        }
    });

}

From source file:ru.codeinside.gses.activiti.ftarchive.MultilineFFT.java

License:Mozilla Public License

@Override
public Field createField(String taskId, String fieldId, String name, String value, PropertyNode node,
        boolean archive) {
    TextArea textField = new TextArea();
    String rows = node.getParams().get("rows");
    String columns = node.getParams().get("columns");
    textField.setRows(countOf(rows));//from   ww w .  j a v  a  2 s  .c o m
    textField.setColumns(countOf(columns));
    textField.setMaxLength(3995);
    FieldHelper.setTextBufferSink(taskId, fieldId, textField, node.isFieldWritable() && !archive,
            StringUtils.trimToEmpty(value));
    FieldHelper.setCommonFieldProperty(textField, node.isFieldWritable() && !archive, name,
            node.isFieldRequired());
    return textField;
}

From source file:ru.codeinside.gses.apservice.ApServiceForm.java

License:Mozilla Public License

private Form createForm() {
    final Form form = new Form();
    form.setCaption(" ?");
    form.setWidth("100%");

    TextArea field = new TextArea("?");
    field.setRequired(true);// w  ww. j  a  va  2 s . com
    field.setWidth("100%");
    field.setMaxLength(1500);
    form.addField(NAME, field);

    MaskedTextField code = new MaskedTextField("  ?", "# ### ### ### ### ### ###");
    code.setColumns(19);
    code.addValidator(new FilteredLongValidator("[_ ]",
            "     " + ApInfo.formatCode(Long.MAX_VALUE)));
    form.addField(CODE, code);

    ListSelect declarantTypes = new ListSelect(" ?");
    declarantTypes.setWidth("100%");
    declarantTypes.setHeight("50px");
    declarantTypes.setMultiSelect(true);
    LazyQueryContainer container = new LazyQueryContainer(new DeclarantTypeQueryDefinition(),
            new DeclarantTypeQueryFactory());
    declarantTypes.setContainerDataSource(container);
    declarantTypes.setItemCaptionPropertyId("value");
    declarantTypes.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    Flash.bind(DeclarantTypeChanged.class, container, "refresh");

    field.setRequired(true);
    field.setWidth("100%");
    field.setMaxLength(1500);
    form.addField(DeclarantServiceImpl.DECLARANT_TYPES, declarantTypes);

    Layout footer = form.getFooter();
    Button updateButton = createCreateButton();
    footer.addComponent(updateButton);
    ((HorizontalLayout) footer).setSpacing(true);
    return form;
}

From source file:ru.codeinside.gses.apservice.ApServiceForm.java

License:Mozilla Public License

private Form editForm() {
    final Form form = new Form();
    form.setCaption(" ?");
    form.setWidth("100%");
    TextField idField = new TextField(" ?");
    idField.setRequired(false);/*from   w  w w .  j  a  va  2 s .c  o  m*/
    idField.setEnabled(true);
    idField.setVisible(true);
    idField.setReadOnly(true);

    form.addField(ID, idField);
    TextArea field = new TextArea("?");
    field.setRequired(true);
    field.setWidth("100%");
    field.setMaxLength(1500);
    form.addField(NAME, field);

    MaskedTextField code = new MaskedTextField("  ?", "# ### ### ### ### ### ###");
    code.setColumns(19);
    code.addValidator(new FilteredLongValidator("[_ ]",
            "     " + ApInfo.formatCode(Long.MAX_VALUE)));
    form.addField(CODE, code);

    ListSelect declarantTypes = new ListSelect(" ?");
    declarantTypes.setWidth("100%");
    declarantTypes.setHeight("50px");
    declarantTypes.setMultiSelect(true);

    LazyQueryContainer container = new LazyQueryContainer(new DeclarantTypeQueryDefinition(),
            new DeclarantTypeQueryFactory());
    declarantTypes.setContainerDataSource(container);
    declarantTypes.setItemCaptionPropertyId("value");
    declarantTypes.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    Flash.bind(DeclarantTypeChanged.class, container, "refresh");

    field.setRequired(true);
    field.setWidth("100%");
    field.setMaxLength(1500);
    form.addField(DeclarantService.DECLARANT_TYPES, declarantTypes);

    Layout footer = form.getFooter();
    Button updateButton = createUpdateButton();
    Button cancelButton = createCancelButton(form);
    footer.addComponent(updateButton);
    footer.addComponent(cancelButton);
    ((HorizontalLayout) footer).setSpacing(true);
    return form;
}

From source file:ru.codeinside.gses.manager.ProcedureForm.java

License:Mozilla Public License

private Form buildCreateUpdateForm() {
    final Form form = new Form();
    TextField createTextField = createTextField("?", false, true);
    createTextField.setEnabled(false);/*  w  w  w .ja  v a  2 s.  c o m*/
    createTextField.setWidth("100%");
    form.addField(ID, createTextField);
    TextArea areaName = new TextArea("?");
    areaName.setRequired(true);
    areaName.setWidth("100%");
    areaName.setMaxLength(1500);
    form.addField(NAME, areaName);
    TextArea descriptionArea = new TextArea("?");
    descriptionArea.setWidth("100%");
    descriptionArea.setMaxLength(1500);
    form.addField(DESCRIPTION, descriptionArea);
    servicesComboBox = createServicesComboBox("?");
    servicesComboBox.setNullSelectionAllowed(false);
    form.addField(SERVICE_ID, servicesComboBox);
    MaskedTextField code = new MaskedTextField("  ?", "# ### ### ### ### ### ###");
    code.setColumns(19);
    code.addValidator(new FilteredLongValidator("[_ ]",
            "     " + ApInfo.formatCode(Long.MAX_VALUE)));
    form.addField(CODE, code);
    Layout footer = form.getFooter();
    ((HorizontalLayout) footer).setSpacing(true);
    footer.addComponent(createUpdateButton());
    footer.addComponent(createCancelButton());
    return form;
}