Example usage for com.vaadin.ui TextArea setRows

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

Introduction

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

Prototype

public void setRows(int rows) 

Source Link

Document

Sets the number of rows in the text area.

Usage

From source file:com.klwork.explorer.project.MyCalendarView.java

License:Apache License

private void initFormFields(Layout formLayout, Class<? extends CalendarEvent> eventClass) {
    //WW_TODO ??//w  w  w .  j ava2 s.com
    startDateField = CommonFieldHandler.createDateField("", useSecondResolution);
    endDateField = CommonFieldHandler.createDateField("?", useSecondResolution);

    final CheckBox allDayField = CommonFieldHandler.createCheckBox("");
    allDayField.addValueChangeListener(new Property.ValueChangeListener() {

        private static final long serialVersionUID = -7104996493482558021L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            Object value = event.getProperty().getValue();
            if (value instanceof Boolean && Boolean.TRUE.equals(value)) {
                setFormDateResolution(Resolution.DAY);

            } else {
                setFormDateResolution(Resolution.MINUTE);
            }
        }

    });

    captionField = CommonFieldHandler.createTextField("");
    //final TextField whereField = CommonFieldHandler.createTextField("");
    final TextArea descriptionField = CommonFieldHandler.createTextArea("??");
    descriptionField.setRows(3);
    //
    final ComboBox styleNameField = createStyleNameComboBox();

    formLayout.addComponent(startDateField);
    formLayout.addComponent(endDateField);
    formLayout.addComponent(allDayField);
    formLayout.addComponent(captionField);

    formLayout.addComponent(descriptionField);
    formLayout.addComponent(styleNameField);

    scheduleEventFieldGroup.bind(startDateField, "start");
    scheduleEventFieldGroup.bind(endDateField, "end");
    scheduleEventFieldGroup.bind(captionField, "caption");
    scheduleEventFieldGroup.bind(descriptionField, "description");

    scheduleEventFieldGroup.bind(styleNameField, "styleName");
    scheduleEventFieldGroup.bind(allDayField, "allDay");
}

From source file:com.mechanicshop.components.TableLayout.java

public void createCustomMessage() {
    final TextArea textArea = new TextArea();
    textArea.setImmediate(true);//from  w w w .ja  v  a2 s.c o m
    textArea.setColumns(30);
    textArea.setRows(10);
    textArea.addStyleName(ValoTheme.TEXTAREA_SMALL);
    textArea.setRequired(true);
    final Window subWindow = new Window();
    subWindow.setModal(true);
    subWindow.setHeight("350px");
    subWindow.setWidth("500px");
    subWindow.setCaption("Insert Message");
    subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR);
    subWindow.setClosable(false);
    subWindow.setResizable(false);

    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    Button sendBtn = new Button("Send");
    sendBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                textArea.validate();
                String message = textArea.getValue();
                smsSenderService.sendMessageMassive(message);
                subWindow.close();
                Notification.show("Message Sent");
            } catch (Exception e) {

            }
        }
    });
    sendBtn.setImmediate(true);
    sendBtn.setStyleName(ValoTheme.BUTTON_TINY);
    sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button cancelBtn = new Button("Cancel");
    cancelBtn.setStyleName(ValoTheme.BUTTON_TINY);
    cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    cancelBtn.setImmediate(true);
    cancelBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            subWindow.close();

        }
    });

    layoutButtons.setSizeUndefined();
    layoutButtons.setSpacing(true);
    layoutButtons.addComponents(cancelBtn, sendBtn);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(textArea);
    layout.addComponent(layoutButtons);
    layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT);
    layout.setExpandRatio(textArea, 3);

    layout.setSizeFull();

    subWindow.setContent(layout);
    subWindow.center();

    getUI().addWindow(subWindow);
}

From source file:com.openhris.employee.EmployeePersonalInformation.java

private Window updatePersonalInformationConfirmation(final PersonalInformation pi) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);// w  w w  . j  a v  a  2s.  c om
    vlayout.setMargin(true);

    final Window window = new Window("UPDATE WINDOW", vlayout);
    window.setWidth("350px");

    final TextArea remarks = new TextArea("Remarks");
    remarks.setWidth("100%");
    remarks.setRows(3);
    window.addComponent(remarks);

    Button removeBtn = new Button("UPDATE EMPLOYEE?");
    removeBtn.setWidth("100%");
    removeBtn.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (remarks.getValue() == null || remarks.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Add remarks!", Window.Notification.TYPE_ERROR_MESSAGE);
                return;
            }

            boolean result = piService.updatePersonalInformation(pi, remarks.getValue().toString().trim());
            if (result) {
                getWindow().showNotification("Information Updated", Window.Notification.TYPE_TRAY_NOTIFICATION);
                (window.getParent()).removeWindow(window);
            } else {
                getWindow().showNotification("SQL Error", Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }

    });
    window.addComponent(removeBtn);

    return window;
}

From source file:com.save.client.RemoveAccountWindow.java

VerticalLayout getVLayout() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);//  w  w w.ja  v a  2s  .c o m
    vlayout.setMargin(true);
    vlayout.setSizeFull();

    final TextArea remarks = new TextArea("Remarks: ");
    remarks.setRows(2);
    remarks.setWidth("100%");
    vlayout.addComponent(remarks);

    Button removeBtn = new Button("REMOVE ACCOUNT?");
    removeBtn.setWidth("100%");
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add Remarks!", Notification.Type.ERROR_MESSAGE);
            return;
        }

        boolean result = clientService.removeAccount(getClientId(), remarks.getValue().trim().toLowerCase());
        if (result) {
            close();
        }
    });
    vlayout.addComponent(removeBtn);

    return vlayout;
}

From source file:com.save.employee.RemoveAccountWindow.java

VerticalLayout getVLayout() {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setSpacing(true);/*  w  w  w . ja  v a  2s . co m*/
    vlayout.setMargin(true);
    vlayout.setSizeFull();

    final TextArea remarks = new TextArea("Remarks: ");
    remarks.setRows(2);
    remarks.setWidth("100%");
    vlayout.addComponent(remarks);

    Button removeBtn = new Button("REMOVE ACCOUNT?");
    removeBtn.setWidth("100%");
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) {
            Notification.show("Add Remarks!", Notification.Type.ERROR_MESSAGE);
            return;
        }

        boolean result = employeeService.removeAccount(getEmployeeId(),
                remarks.getValue().trim().toLowerCase());
        if (result) {
            close();
        }
    });
    vlayout.addComponent(removeBtn);

    return vlayout;
}

From source file:com.trivago.mail.pigeon.web.components.templates.ModalAddTemplate.java

License:Apache License

public ModalAddTemplate(final TemplateList tl, final Long templateId) {
    setResizable(true);/*from  w  ww .ja v a2  s  .c  o  m*/
    setWidth("972px");
    setHeight("700px");
    Panel rootPanel = new Panel("Add new Template");
    TabSheet tSheet = new TabSheet();
    HorizontalLayout hLayout = new HorizontalLayout();

    final TextField title = new TextField("Template description");
    final TextField subject = new TextField("Newsletter Subject");

    final TextArea textContent = new TextArea("Text Version");
    textContent.setRows(40);
    textContent.setColumns(100);

    final CKEditorTextField htmlContent = new CKEditorTextField();
    htmlContent.setWidth("100%");
    htmlContent.setHeight("650px");

    // Load the content, if we receive a template id
    if (templateId != null) {
        MailTemplate mt = new MailTemplate(templateId);
        title.setValue(mt.getTitle());
        subject.setValue(mt.getSubject());
        textContent.setValue(mt.getText());
        htmlContent.setValue(mt.getHtml());
    }

    Button saveButton = new Button("Save");
    Button cancel = new Button("Cancel");

    saveButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            boolean hasError = false;
            if (title.getValue().equals("")) {
                title.setComponentError(new UserError("Name must not be empty"));
                hasError = true;
            } else {
                title.setComponentError(null);
            }

            if (subject.getValue().equals("")) {
                subject.setComponentError(new UserError("Subject must not be empty"));
                hasError = true;
            } else {
                subject.setComponentError(null);
            }

            if (htmlContent.getValue().equals("")) {
                htmlContent.setComponentError(new UserError("Please provide some HTML content"));
                hasError = true;
            } else {
                htmlContent.setComponentError(null);
            }

            if (textContent.getValue().equals("")) {
                textContent.setComponentError(new UserError("Please provide some text content"));
                hasError = true;
            } else {
                textContent.setComponentError(null);
            }

            if (!hasError) {
                if (templateId == null) {
                    long templateId = Util.generateId();
                    try {
                        MailTemplate mt = new MailTemplate(templateId, title.getValue().toString(),
                                textContent.getValue().toString(), htmlContent.getValue().toString(),
                                subject.getValue().toString());
                        event.getButton().getWindow().setVisible(false);
                        event.getButton().getWindow().getParent()
                                .removeComponent(event.getButton().getWindow());
                        event.getButton().getWindow().getParent().showNotification("Saved successfully",
                                Notification.TYPE_HUMANIZED_MESSAGE);
                        tl.getBeanContainer().addItem(mt.getId(), mt);
                    } catch (RuntimeException e) {
                        // Should never happen ... hopefully :D
                    }
                } else {
                    MailTemplate mt = new MailTemplate(templateId);

                    mt.setHtml(htmlContent.getValue().toString());
                    mt.setSubject(subject.getValue().toString());
                    mt.setText(textContent.getValue().toString());
                    mt.setTitle(title.getValue().toString());

                    event.getButton().getWindow().setVisible(false);
                    event.getButton().getWindow().getParent().removeComponent(event.getButton().getWindow());
                    event.getButton().getWindow().getParent().showNotification("Saved successfully",
                            Notification.TYPE_HUMANIZED_MESSAGE);

                    final int beanIndex = tl.getBeanContainer().indexOfId(mt.getId());
                    tl.getBeanContainer().removeItem(mt.getId());
                    tl.getBeanContainer().addItemAt(beanIndex, mt.getId(), mt);
                }
                TemplateSelectBox.reloadSelect();
            }
        }
    });

    hLayout.addComponent(saveButton);
    hLayout.addComponent(cancel);
    hLayout.setSpacing(true);

    VerticalLayout metaDataLayout = new VerticalLayout();

    Panel textFieldPanel = new Panel("Meta Data");
    VerticalLayout metaLayout = new VerticalLayout();
    metaLayout.addComponent(title);
    metaLayout.addComponent(subject);
    textFieldPanel.addComponent(metaLayout);

    Panel helpPanel = new Panel("Template Documentation");
    assembleHelpComponents(helpPanel);

    metaDataLayout.addComponent(textFieldPanel);
    metaDataLayout.addComponent(helpPanel);

    tSheet.addTab(metaDataLayout).setCaption("Meta Data");

    VerticalLayout textLayout = new VerticalLayout();
    textLayout.addComponent(textContent);
    tSheet.addTab(textLayout).setCaption("Text Content");

    VerticalLayout htmlLayout = new VerticalLayout();
    htmlLayout.addComponent(htmlContent);
    tSheet.addTab(htmlLayout).setCaption("HTML Content");

    rootPanel.addComponent(tSheet);
    rootPanel.addComponent(hLayout);
    addComponent(rootPanel);
}

From source file:de.fzi.fhemapi.view.vaadin.ui.HWindow.java

License:Apache License

private void openConfig() {
    VerticalLayout layout = new VerticalLayout();

    final TextArea area = new TextArea(null, server.getConfigManager().getConfigFile());
    //      area.setHeight("100%");
    area.setRows(100);
    area.setWidth("100%");

    layout.addComponent(area);/* w  ww.  ja  v  a2 s .  c o  m*/

    Button saveButton = new Button("Speichern");
    saveButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            server.setFHEMCfg(((String) area.getValue()));
            getWindow().showNotification(server.rereadConfiguration().toString(),
                    Notification.TYPE_TRAY_NOTIFICATION);
            server.getConfigManager().update();
        }
    });
    layout.addComponent(saveButton);
    layout.setComponentAlignment(saveButton, Alignment.TOP_CENTER);
    mainSplitPanel.setSecondComponent(layout);
}

From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java

License:Apache License

protected TextArea createTextArea(final String caption, final int tabIndex, final int rows) {
    TextArea result = new TextArea(presenter.translate(caption));

    result.setTabIndex(tabIndex);//from w w  w .  ja  v a2 s. c o  m
    result.setWidth(100f, PERCENTAGE);
    result.setRows(rows);
    result.setWordwrap(true);
    result.setNullRepresentation("");

    return result;
}

From source file:de.mendelson.comm.as2.webclient2.TransactionDetailsDialog.java

private TextArea createLogTab() {
    DateFormat format = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    TextArea textArea = new TextArea();
    textArea.setRows(7);
    textArea.setSizeFull();//from www.  j  av  a 2s  . c  o m
    List<LogEntry> entries = this.logAccess.getLog(this.messageId);
    StringBuilder log = new StringBuilder();
    for (LogEntry entry : entries) {
        log.append("[").append(format.format(entry.getMillis())).append("] ");
        log.append(entry.getMessage());
        log.append("\n");
    }
    textArea.setValue(log.toString());
    textArea.setReadOnly(true);
    return (textArea);
}

From source file:de.unioninvestment.eai.portal.portlet.crud.datatypes.AbstractDataType.java

License:Apache License

@Override
public Field<?> createField(Class<?> type, Object propertyId, boolean multiline, String inputPrompt,
        Format format) {/*w  w w. j  a v a2  s  . c  om*/

    AbstractTextField textField;
    if (multiline) {
        TextArea textArea = new TextArea();
        textArea.setRows(1);
        textField = textArea;
    } else {
        textField = new TextField();
    }
    textField.setConverter(createFormatter(type, format));
    textField.setReadOnly(isReadonly());
    textField.setNullRepresentation("");
    textField.setNullSettingAllowed(true);
    if (inputPrompt != null) {
        textField.setInputPrompt(inputPrompt);
    }
    return textField;
}