Example usage for com.vaadin.ui TextArea TextArea

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

Introduction

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

Prototype

public TextArea() 

Source Link

Document

Constructs an empty TextArea.

Usage

From source file:org.vaadin.tori.view.thread.ReportComponent.java

License:Apache License

private static TextArea createReasonTextArea() {
    final TextArea area = new TextArea();
    area.setWidth("100%");
    area.setRows(4);/* w ww.j  av a 2  s  .c om*/
    return area;
}

From source file:pl.edu.agh.samm.testapp.SAMMTestApplication.java

License:Apache License

private TextArea createGenerationLogTextArea() {
    TextArea log = new TextArea();
    log.setWidth("100%");
    log.setHeight("100%");
    return log;//from w w w  . ja  v  a 2 s  .  c o  m
}

From source file:probe.com.view.core.TextFieldFilter.java

/**
 *
 * @param controller// w ww. j  av  a 2 s  .  c  o  m
 * @param filterId
 * @param filterTitle
 */
public TextFieldFilter(SearchingFiltersControl_t controller, int filterId, String filterTitle) {
    this.control = controller;
    this.filterId = filterId;
    this.setSpacing(true);

    okBtn = new Button("ok");
    okBtn.setStyleName(Reindeer.BUTTON_SMALL);
    textField = new TextArea();
    textField.setStyleName(Reindeer.TEXTFIELD_SMALL);
    textField.setHeight("60px");
    textField.setWidth("200px");
    textField.setInputPrompt("Please use one key-word per line");
    Label captionLabel = new Label(filterTitle);
    captionLabel.setWidth("70px");
    captionLabel.setStyleName("custLabel");
    if (filterTitle != null) {
        textField.setDescription(filterTitle);
    }
    this.addComponent(captionLabel);
    this.addComponent(textField);
    this.addComponent(okBtn);

    filterConfirmLabel = new FilterConfirmLabel();
    this.addComponent(filterConfirmLabel);

    filterBtn = new ClosableFilterLabel(filterTitle, "", filterId, true);
    filterBtn.getCloseBtn().addClickListener(TextFieldFilter.this);
    okBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            control.removeFilter(filterBtn.getCaption());
            filterConfirmLabel.setVisible(false);
            if (textField.getValue() != null && !textField.getValue().trim().equalsIgnoreCase("")) {
                filterBtn.setValue(textField.getValue().trim().toUpperCase());
                control.addFilter(filterBtn);
                filterConfirmLabel.setVisible(true);

            }
        }
    });
    textField.addFocusListener(TextFieldFilter.this);
    this.setEnabled(true);
    this.focus();

}

From source file:pt.ist.bennu.vaadin.errorHandling.ReporterErrorWindow.java

License:Open Source License

@Override
protected void setErrorContext(final Throwable systemError) {
    this.systemError = systemError;
    removeAllComponents();//from   www . j  a v a2 s .  c  o m
    setCaption(VaadinResources.getString(ERROR_WINDOW_TITLE));
    setModal(true);
    center();
    setBorder(Window.BORDER_NONE);
    setClosable(false);
    setCloseShortcut(KeyCode.ESCAPE);
    setResizable(false);
    setWidth(350, Sizeable.UNITS_PIXELS);
    ((MarginHandler) getContent()).setMargin(new MarginInfo(true));
    ((SpacingHandler) getContent()).setSpacing(true);
    addComponent(new Label(VaadinResources.getString(ERROR_WINDOW_ANNOUNCEMENT_LABEL)));

    // email = new
    // TextField(VaadinResources.getString(ERROR_WINDOW_EMAIL_LABEL));
    // addComponent(email);

    comment = new TextArea();
    addComponent(comment);
    comment.setInputPrompt(VaadinResources.getString(ERROR_WINDOW_COMMENT_LABEL));
    comment.setSizeFull();
    comment.setRows(6);

    HorizontalLayout response = new HorizontalLayout();
    addComponent(response);
    response.setSpacing(true);

    Button report = new Button(VaadinResources.getString(COMMONS_ACTION_SUBMIT), new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow()
                    .showNotification(VaadinResources.getString(ERROR_WINDOW_THANKING_LABEL));
            sendEmail();
            ReporterErrorWindow.this.close();
        }
    });
    response.addComponent(report);
    report.setClickShortcut(KeyCode.ENTER);

    Button ignore = new Button(VaadinResources.getString(COMMONS_ACTION_CANCEL), new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            ReporterErrorWindow.this.close();
        }
    });
    response.addComponent(ignore);
    // email.setValue(getFromAddress(UserView.getCurrentUser()));
}

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

License:Mozilla Public License

@Override
public Field createField(String taskId, String fieldId, String name, byte[] value, PropertyNode node,
        boolean archive) {
    TMP.remove();//from ww  w.j  a  va 2 s  . co m
    Field result;
    String stringValue = "";
    try {
        if (value != null) {
            stringValue = new String(value, "UTF-8");
        }
    } catch (UnsupportedEncodingException e) {
        Logger.getAnonymousLogger().info("can't decode model!");
    }
    if (!node.isFieldWritable() || archive) {
        result = new ReadOnly(stringValue);
    } else {
        TextArea json = new TextArea();
        //      json.setColumns(10);
        json.setSizeFull();
        json.setRows(50);
        json.setImmediate(true);
        String defaultValue = StringUtils.trimToEmpty(stringValue);
        FieldHelper.setTextBufferSink(taskId, fieldId, json, true, defaultValue);
        result = json;
    }
    FieldHelper.setCommonFieldProperty(result, node.isFieldWritable() && !archive, name,
            node.isFieldRequired());
    return result;
}

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 w  ww.  j  av  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.activiti.ReadOnly.java

License:Mozilla Public License

public ReadOnly(String labelValue, String value, boolean valid) {
    this.valid = valid;
    if (value == null || value.length() < 4000) {
        setSizeFull();/*ww w  .j a v a 2s  .  c o m*/
        Label label = new Label(labelValue);
        label.setSizeFull();
        label.setStyleName("left");
        HorizontalLayout layout = new HorizontalLayout(); //   GridLayout
        layout.setSizeFull();
        layout.addComponent(label);
        layout.setExpandRatio(label, 1f);
        setCompositionRoot(layout);
    } else {
        setSizeFull();
        TextArea area = new TextArea();
        area.setValue(value);
        area.setReadOnly(true);
        area.setSizeFull();
        area.setRows(25);
        setCompositionRoot(area);
    }
    if (valid) {
        setValue(value);
    }
}

From source file:ru.codeinside.gses.webui.form.JsonForm.java

License:Mozilla Public License

@Override
public Field getField(Object propertyId) {
    if (valueId.equals(propertyId)) {
        TextArea field = new TextArea();
        field.setNullRepresentation("");
        field.setValue(formField.getValue());
        return field;
    }/* w w  w .  ja  va  2 s  .c  o  m*/
    if (API.JSON_FORM.equals(propertyId)) {
        ReadOnly field = new ReadOnly(templateRef);
        field.setCaption("");
        return field;
    }
    return null;
}

From source file:ru.codeinside.gses.webui.MemoryUsage.java

License:Mozilla Public License

public MemoryUsage(TabSheet tabs) {
    this.tabs = tabs;
    sizeErr = new TextArea();
    sizeErr.setStyleName("debug-panel");
    sizeErr.setSizeFull();//from  ww w .j av a 2  s  .c o  m
    sizeErr.setReadOnly(true);
    setCompositionRoot(sizeErr);
    setSizeFull();

    Flash.router().addListener(SizeEvent.class, this, "onSizeEvent");
    tabs.addTab(this, "?").setDescription("? ?");
}

From source file:ru.codeinside.gses.webui.supervisor.SupervisorWorkplace.java

License:Mozilla Public License

private void buildListPanel() {
    controlledTasksTable.setHeight("255px");
    controlledTasksTable.setWidth("100%");
    controlledTasksTable.setImmediate(true);
    controlledTasksTable.setSelectable(true);
    controlledTasksTable.setSortDisabled(true);
    controlledTasksTable.addContainerProperty("id", Component.class, null);
    controlledTasksTable.addContainerProperty("dateCreated", String.class, null);
    controlledTasksTable.addContainerProperty("task", String.class, null);
    controlledTasksTable.addContainerProperty("procedure", String.class, null);
    controlledTasksTable.addContainerProperty("declarant", String.class, null);
    controlledTasksTable.addContainerProperty("version", String.class, null);
    controlledTasksTable.addContainerProperty("status", String.class, null);
    controlledTasksTable.addContainerProperty("employee", String.class, null);
    controlledTasksTable.addContainerProperty("priority", String.class, null);
    controlledTasksTable.addContainerProperty("bidDays", String.class, null);
    controlledTasksTable.addContainerProperty("taskDays", String.class, null);
    controlledTasksTable.setVisibleColumns(new Object[] { "id", "dateCreated", "task", "procedure", "declarant",
            "version", "status", "employee", "bidDays", "taskDays" });
    controlledTasksTable.setColumnHeaders(new String[] { "?", "  ?",
            "", "", "?", "??", "?",
            "?", "..", ".?." });
    controlledTasksTable.setColumnExpandRatio("id", 0.05f);
    controlledTasksTable.setColumnExpandRatio("dateCreated", 0.15f);
    controlledTasksTable.setColumnExpandRatio("task", 0.2f);
    controlledTasksTable.setColumnExpandRatio("procedure", 0.25f);
    controlledTasksTable.setColumnExpandRatio("declarant", 0.1f);
    controlledTasksTable.setColumnExpandRatio("version", 0.05f);
    controlledTasksTable.setColumnExpandRatio("status", 0.1f);
    controlledTasksTable.setColumnExpandRatio("employee", 0.1f);
    controlledTasksTable.setCellStyleGenerator(new TaskStylist(controlledTasksTable));
    listPanel.addComponent(controlledTasksTable);
    final Button assignButton = new Button("? ??");
    controlledTasksTable.addListener(new Property.ValueChangeListener() {
        @Override/*from   w w w .j av a  2s  .  c om*/
        public void valueChange(Property.ValueChangeEvent event) {
            Table table = (Table) event.getProperty();
            Item item = table.getItem(table.getValue());

            if (item != null && item.getItemProperty("id") != null) {
                final String taskId = item.getItemProperty("taskId").getValue().toString();
                final Component procedureHistoryPanel = new ProcedureHistoryPanel(taskId);
                procedureHistoryPanel.addListener(new Listener() {
                    @Override
                    public void componentEvent(Event event) {
                        HistoricTaskInstance historicTaskInstance = ((ProcedureHistoryPanel.HistoryStepClickedEvent) event)
                                .getHistoricTaskInstance();
                        Date endDateTime = historicTaskInstance.getEndTime();
                        if (endDateTime == null) {
                            taskIdToAssign = findTaskByHistoricInstance(historicTaskInstance);
                            if (taskIdToAssign == null) {
                                alreadyGone();
                                return;
                            }
                            assignButton.setVisible(true);
                        } else {
                            assignButton.setVisible(false);
                        }
                    }
                });
                ((VerticalLayout) item1).removeAllComponents();
                Task task = Flash.flash().getProcessEngine().getTaskService().createTaskQuery().taskId(taskId)
                        .singleResult();
                Bid bid = Flash.flash().getAdminService().getBidByTask(taskId);
                String executionId = task.getExecutionId();
                final ProcessDefinition def = ActivitiBean.get()
                        .getProcessDefinition(task.getProcessDefinitionId(), Flash.login());
                final ShowDiagramComponentParameterObject param = new ShowDiagramComponentParameterObject();
                param.changer = bidChanger;
                param.processDefinitionId = def.getId();
                param.executionId = executionId;
                param.height = "300px";
                param.width = null;
                param.windowHeader = bid == null ? ""
                        : bid.getProcedure().getName() + " v. " + bid.getVersion();
                Button showDiagram = new Button("");
                showDiagram.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        Execution execution = Flash.flash().getProcessEngine().getRuntimeService()
                                .createExecutionQuery().executionId(param.executionId).singleResult();
                        if (execution == null) {
                            alreadyGone();
                            return;
                        }
                        ShowDiagramComponent showDiagramComponent = new ShowDiagramComponent(param);
                        VerticalLayout layout = new VerticalLayout();
                        Button back = new Button("?");
                        back.addListener(new Button.ClickListener() {
                            private static final long serialVersionUID = 4154712522487297925L;

                            @Override
                            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                                bidChanger.back();
                            }
                        });
                        layout.addComponent(back);
                        layout.setSpacing(true);
                        layout.addComponent(showDiagramComponent);
                        bidChanger.set(layout, "showDiagram");
                        bidChanger.change(layout);
                    }
                });

                Button deleteBidButton = new Button(" ?");
                deleteBidButton.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        final Window mainWindow = getWindow();
                        final Window rejectWindow = new Window();
                        rejectWindow.setWidth("38%");
                        rejectWindow.center();
                        rejectWindow.setCaption("!");
                        final VerticalLayout verticalLayout = new VerticalLayout();
                        verticalLayout.setSpacing(true);
                        verticalLayout.setMargin(true);
                        final Label messageLabel = new Label(
                                "  ? ?");
                        messageLabel.setStyleName("h2");
                        final TextArea textArea = new TextArea();
                        textArea.setSizeFull();
                        HorizontalLayout buttons = new HorizontalLayout();
                        buttons.setSpacing(true);
                        buttons.setSizeFull();
                        final Button ok = new Button("Ok");
                        Button cancel = new Button("Cancel");

                        buttons.addComponent(ok);
                        buttons.addComponent(cancel);
                        buttons.setExpandRatio(ok, 0.99f);
                        verticalLayout.addComponent(messageLabel);
                        verticalLayout.addComponent(textArea);
                        verticalLayout.addComponent(buttons);
                        verticalLayout.setExpandRatio(textArea, 0.99f);
                        rejectWindow.setContent(verticalLayout);
                        mainWindow.addWindow(rejectWindow);

                        Button.ClickListener ok1 = new Button.ClickListener() {
                            @Override
                            public void buttonClick(Button.ClickEvent event) {
                                ok.setEnabled(false);
                                verticalLayout.removeComponent(messageLabel);
                                verticalLayout.removeComponent(textArea);
                                final byte[] block;
                                final String textAreaValue = (String) textArea.getValue();
                                if (textAreaValue != null) {
                                    block = textAreaValue.getBytes();
                                } else {
                                    block = null;
                                }
                                Label reason = new Label(textAreaValue);
                                reason.setCaption(" :");
                                verticalLayout.addComponent(reason, 0);
                                event.getButton().removeListener(this);

                                SignApplet signApplet = new SignApplet(new SignAppletListener() {

                                    @Override
                                    public void onLoading(SignApplet signApplet) {

                                    }

                                    @Override
                                    public void onNoJcp(SignApplet signApplet) {
                                        verticalLayout.removeComponent(signApplet);
                                        ReadOnly field = new ReadOnly(
                                                "   ?? ?? ?  JCP",
                                                false);
                                        verticalLayout.addComponent(field);

                                    }

                                    @Override
                                    public void onCert(SignApplet signApplet, X509Certificate certificate) {
                                        boolean ok = false;
                                        String errorClause = null;
                                        try {
                                            boolean link = AdminServiceProvider
                                                    .getBoolProperty(CertificateVerifier.LINK_CERTIFICATE);
                                            if (link) {
                                                byte[] x509 = AdminServiceProvider.get()
                                                        .withEmployee(Flash.login(), new CertificateReader());
                                                ok = Arrays.equals(x509, certificate.getEncoded());
                                            } else {
                                                ok = true;
                                            }
                                            CertificateVerifyClientProvider.getInstance()
                                                    .verifyCertificate(certificate);
                                        } catch (CertificateEncodingException e) {
                                        } catch (CertificateInvalid err) {
                                            errorClause = err.getMessage();
                                            ok = false;
                                        }
                                        if (ok) {
                                            signApplet.block(1, 1);
                                        } else {
                                            NameParts subject = X509.getSubjectParts(certificate);
                                            String fieldValue = (errorClause == null)
                                                    ? " " + subject.getShortName()
                                                            + " "
                                                    : errorClause;
                                            ReadOnly field = new ReadOnly(fieldValue, false);
                                            verticalLayout.addComponent(field, 0);
                                        }
                                    }

                                    @Override
                                    public void onBlockAck(SignApplet signApplet, int i) {
                                        logger().fine("AckBlock:" + i);
                                        signApplet.chunk(1, 1, block);
                                    }

                                    @Override
                                    public void onChunkAck(SignApplet signApplet, int i) {
                                        logger().fine("AckChunk:" + i);
                                    }

                                    @Override
                                    public void onSign(SignApplet signApplet, byte[] sign) {
                                        final int i = signApplet.getBlockAck();
                                        logger().fine("done block:" + i);
                                        if (i < 1) {
                                            signApplet.block(i + 1, 1);
                                        } else {
                                            verticalLayout.removeComponent(signApplet);
                                            NameParts subjectParts = X509
                                                    .getSubjectParts(signApplet.getCertificate());
                                            Label field2 = new Label(subjectParts.getShortName());
                                            field2.setCaption("? ?:");
                                            verticalLayout.addComponent(field2, 0);
                                            ok.setEnabled(true);
                                        }
                                    }

                                    private Logger logger() {
                                        return Logger.getLogger(getClass().getName());
                                    }
                                });
                                byte[] x509 = AdminServiceProvider.get().withEmployee(Flash.login(),
                                        new CertificateReader());
                                if (x509 != null) {
                                    signApplet.setSignMode(x509);
                                } else {
                                    signApplet.setUnboundSignMode();
                                }
                                verticalLayout.addComponent(signApplet, 0);

                                ok.addListener(new Button.ClickListener() {
                                    @Override
                                    public void buttonClick(Button.ClickEvent event) {
                                        Task result = Flash.flash().getProcessEngine().getTaskService()
                                                .createTaskQuery().taskId(taskId).singleResult();
                                        if (result == null) {
                                            alreadyGone();
                                            return;
                                        }
                                        ActivitiBean.get().deleteProcessInstance(taskId, textAreaValue);
                                        AdminServiceProvider.get().createLog(Flash.getActor(), "activiti.task",
                                                taskId, "remove", " ?", true);
                                        fireTaskChangedEvent(taskId, SupervisorWorkplace.this);
                                        infoChanger.change(infoComponent);
                                        controlledTasksTable.setValue(null);
                                        controlledTasksTable.refresh();
                                        mainWindow.removeWindow(rejectWindow);
                                    }
                                });
                            }
                        };
                        ok.addListener(ok1);

                        cancel.addListener(new Button.ClickListener() {
                            @Override
                            public void buttonClick(Button.ClickEvent event) {

                                controlledTasksTable.refresh();
                                mainWindow.removeWindow(rejectWindow);
                            }
                        });
                    }
                });

                HorizontalLayout hl = new HorizontalLayout();
                hl.setSizeFull();
                hl.setSpacing(true);
                hl.addComponent(showDiagram);
                hl.addComponent(deleteBidButton);
                hl.setExpandRatio(showDiagram, 0.99f);
                hl.setExpandRatio(deleteBidButton, 0.01f);

                ((VerticalLayout) item1).addComponent(hl);
                ((VerticalLayout) item1).addComponent(procedureHistoryPanel);
                assignButton.setVisible(false);
                assignButton.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        ((Layout) item3).removeAllComponents();
                        if (taskIdToAssign != null) {
                            ((Layout) item3).addComponent(createAssignerToTaskComponent(taskIdToAssign,
                                    (ProcedureHistoryPanel) procedureHistoryPanel, controlledTasksTable));
                            bidChanger.change(item3);
                        } else {
                            alreadyGone();
                        }
                    }
                });
                ((VerticalLayout) item1).addComponent(assignButton);
                infoChanger.change(bidComponent);
                bidChanger.change(item1);
            } else {
                ((VerticalLayout) item1).removeAllComponents();
            }
        }
    });
}