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:uk.q3c.krail.core.sysadmin.I18NView.java

License:Apache License

/**
 * {@inheritDoc}/*w w w . j  a v  a 2 s . com*/
 */
@Override
protected void doBuild() {
    super.doBuild();
    instructions1 = new Label();
    instructions2 = new Label();
    localeList = new TextArea();
    exportButton = new Button();
    exportButton.addClickListener(event -> export());
    exportStatus = new Label();
    VerticalLayout layout1 = new VerticalLayout(exportButton, exportStatus);

    setTopLeft(new VerticalLayout(instructions1, instructions2, localeList));
    setMiddleLeft(layout1);
    localeChanged(null);
}

From source file:uk.q3c.krail.core.sysadmin.SitemapReportView.java

License:Apache License

@Override
protected void doBuild(ViewChangeBusMessage busMessage) {
    super.doBuild(busMessage);
    reportArea = new TextArea();
    //        reportArea.setEnabled(false);
    reportArea.setSizeFull();//from  w  w w . j  a v  a  2s .c o  m
    reportArea.setValue(masterSitemap.getReport());
    setCentreCell(reportArea);
    setColumnWidths(1f, 4f, 1f);
    setRowHeights(1f, 10f, 1f);

}

From source file:uk.q3c.krail.core.view.DefaultErrorView.java

License:Apache License

@Override
public void doBuild(ViewChangeBusMessage busMessage) {
    textArea = new TextArea();
    textArea.setSizeFull();/*from   w  ww  .ja va 2 s .com*/
    textArea.setReadOnly(false);
    textArea.setWordwrap(false);
    if (error != null) {
        String s = StackTraceUtil.getStackTrace(error);
        //add a couple of blank lines at the bootom to ensure visibility of the last line
        textArea.setValue(s + "\n\n");
    } else {
        textArea.setValue("Error view has been called but no error has been set.  This should not happen");
        textArea.setReadOnly(true);
    }
    setRootComponent(textArea);
}

From source file:uk.q3c.krail.testapp.view.PayrollView.java

License:Apache License

@Override
protected void doBuild() {
    super.doBuild();
    adminButton = new Button();
    adminButton.addClickListener(click -> setSystemLevel());
    setTopLeft(adminButton);/*from   www  .  j av  a 2s.  c  om*/

    setValue1Button = new Button("Set user value 433");
    setValue1Button.addClickListener(click -> setUserValue(433));
    setTopCentre(setValue1Button);

    setValue2Button = new Button("Set user value 22");
    setValue2Button.addClickListener(click -> setUserValue(22));
    setTopRight(setValue2Button);

    refreshButton = new Button("refresh");
    refreshButton.addClickListener(click -> updateText());
    setBottomRight(refreshButton);

    clearCacheButton = new Button("clear cache");
    clearCacheButton.addClickListener(click -> optionCache.clear());
    setBottomCentre(clearCacheButton);

    textArea = new TextArea();
    textArea.setSizeFull();
    setMiddleCentre(textArea);

    clearOptionDatabaseButton = new Button("clear database");
    clearOptionDatabaseButton.addClickListener(click -> optionDao.clear());
    setMiddleRight(clearOptionDatabaseButton);
}

From source file:v7cr.ReviewTab.java

License:Open Source License

private void reload() {
    final V7CR v7 = V7CR.getInstance();
    r = new Review(v7.load("reviews", reviewId));
    Project p = new Project(v7.load("projects", r.getProjectName()));
    SVNLogEntry svn = r.getSVNLogEntry();
    String url;//from w  w w.j a  v  a 2s . c o m
    if (svn != null) {
        url = r.getProjectName() + "-" + svn.getRevision();
        setCaption(url);
    } else {
        url = reviewId.toString();
        setCaption(StringUtils.abbreviate(r.getTitle(), 20));
    }
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();

    vl.addComponent(getBasicInfo(v7, r, p, url));
    Panel s = getSVNPanel(v7, r.getSchemaDefinition(), svn, p);
    if (s != null)
        vl.addComponent(s);

    final BSONBackedObject[] notes = r.getObjectFieldAsArray("notes");
    if (notes != null) {
        for (BSONBackedObject note : notes) {
            vl.addComponent(getNotesPanel(note));
        }
    }

    final BSONBackedObject[] votes = r.getObjectFieldAsArray("v");
    if (votes != null) {
        for (BSONBackedObject vote : votes) {
            vl.addComponent(new CommentPanel(vote));
        }

    }

    {
        HorizontalLayout commentGrid = new HorizontalLayout();

        newComment = new TextArea();
        newComment.setColumns(50);
        newComment.setRows(10);
        commentGrid.addComponent(newComment);
        voteOptions = new OptionGroup();
        voteOptions.addItem("+");
        voteOptions.addItem("0");
        voteOptions.addItem("-");
        voteOptions.setValue("0");
        commentGrid.addComponent(voteOptions);

        vl.addComponent(commentGrid);
        fileArea = new VerticalLayout();
        vl.addComponent(fileArea);
        MultiFileUpload uploader = new MultiFileUpload() {

            @Override
            protected void handleFile(File file, String fileName, String mimeType, long length) {
                try {
                    BSONBackedObject gf = v7.storeFile(file, fileName, mimeType);
                    TemporaryFile tf = new TemporaryFile(v7, gf);
                    fileArea.addComponent(tf);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        };

        vl.addComponent(uploader);

        Button submitButton = new Button(v7.getMessage("button.submit"));
        submitButton.addListener(this);
        vl.addComponent(submitButton);
    }

    setCompositionRoot(vl);

    Component parent = getParent();
    if (parent instanceof TabSheet) {
        TabSheet t = (TabSheet) parent;
        Iterator<Component> i = t.getComponentIterator();
        while (i.hasNext()) {
            Component c = i.next();
            if (c instanceof ReviewList && r.getProjectName().equals(c.getCaption())) {
                ((ReviewList) c).reload();
                break;
            }
        }
    }
}

From source file:vaadinTicket.TableBugApplication.java

License:Apache License

@Override
public void init() {
    setMainWindow(main);//from w w w  . ja  v  a 2  s  . c om
    Table table = new Table();
    table.addContainerProperty("prop1", String.class, "default");
    table.addContainerProperty("prop2", String.class, "default2");
    TextArea textArea = new TextArea();
    textArea.setDescription("Description");
    textArea.setRows(10);
    textArea.setColumns(10);
    VerticalLayout layout = new VerticalLayout();
    SuggestionBox suggestionBox = new SuggestionBox();

    suggestionBox.setHeight("200px");
    layout.addComponent(suggestionBox);
    layout.addComponent(textArea);

    main.setContent(layout);

    suggestionBox.setDescription("suggestion box!!!");
    textArea.setDescription("text area!!!!");

    //        for(int i=0; i<1000; ++i){
    //            table.removeAllItems();
    //            for(int j=0; j<2000; ++j){
    //                table.addItem();
    //            }
    //        }

}

From source file:views.MetadataUploadView.java

License:Open Source License

private void showStatus() {
    boolean ready = true;
    for (Object colName : getActiveTable().getContainerPropertyIds()) {
        String selected = getSelectedProperty(colName);
        ready &= selected != null && !selected.isEmpty();
    }//from   ww w .j  a  v  a  2 s  .c o  m
    if (ready) {
        fillCollisionsList();
        if (collisions.size() > 0) {
            Window subWindow = new Window(" Collisions found!");
            subWindow.setWidth("400px");

            VerticalLayout layout = new VerticalLayout();
            layout.setSpacing(true);
            layout.setMargin(true);
            Label preInfo = new Label("The following entries exist and would need to be overwritten:");
            layout.addComponent(preInfo);
            TextArea tf = new TextArea();
            tf.setWidth("350px");
            tf.setValue(StringUtils.join(collisions, ""));
            tf.setStyleName(Styles.areaTheme);
            layout.addComponent(tf);
            String overwriteInfo = "In order to keep your data safe, you are not allowed to overwrite existing information by default. "
                    + "You can either remove the columns in question (choose 'ignore column') or contact QBiC.";
            if (overWriteAllowed)
                overwriteInfo = "You can either remove the columns in question (choose 'ignore column') "
                        + "before sending it to the Database or overwrite the metadata.";
            Label info = new Label(overwriteInfo);
            Button ok = new Button("Got it!");
            ok.addClickListener(new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    subWindow.close();
                }
            });
            layout.addComponent(info);
            layout.addComponent(ok);

            subWindow.setContent(layout);
            // Center it in the browser window
            subWindow.center();
            subWindow.setModal(true);
            subWindow.setIcon(FontAwesome.BOLT);
            subWindow.setResizable(false);
            ProjectwizardUI ui = (ProjectwizardUI) UI.getCurrent();
            ui.addWindow(subWindow);
        } else {
            Styles.notification("No collisions found!",
                    "You can update the metadata in our database without overwriting something. To do so press 'Send to Database'",
                    NotificationType.DEFAULT);
        }
        send.setEnabled(collisions.isEmpty() || overWriteAllowed);
    } else
        send.setEnabled(false);
}

From source file:zm.hashcode.mshengu.app.util.validation.OnSubmitValidationHelper.java

public void doValidation() {
    TextField textField = new TextField();
    TextArea textArea = new TextArea();
    DateField dateField = new DateField();
    ComboBox comboBox = new ComboBox();
    for (Field o : fields) {

        String currentMessage = "";
        try {/*w  w w  .  j  a v a2 s . c o m*/
            if (o instanceof TextField) {
                textField = (TextField) o;
                textField.validate();
            } else if (o instanceof TextArea) {
                textArea = (TextArea) o;
                textArea.validate();
            } else if (o instanceof DateField) {
                dateField = (DateField) o;
                dateField.validate();
            } else if (o instanceof ComboBox) {
                comboBox = (ComboBox) o;
                comboBox.validate();
            }

        } catch (Validator.InvalidValueException x) { //works with vaadin required
            currentMessage = x.getMessage();
            if (o instanceof TextField) {
                textField.setStyleName("invalid");
            } else if (o instanceof TextArea) {
                textArea.setStyleName("invalid");
            } else if (o instanceof DateField) {
                dateField.setStyleName("invalid");
            } else if (o instanceof ComboBox) {
                comboBox.setStyleName("invalid");
            }

        } finally {
            if (o instanceof TextField) {
                textField.addFocusListener(
                        new LabelErrorMessageManipulator(textField, errorLabel, currentMessage)); //custom focus handler for displaying error message on a labe when you focus on an errored Textfield                       
            } else if (o instanceof TextArea) {
                textArea.addFocusListener(
                        new LabelErrorMessageManipulator(textArea, errorLabel, currentMessage)); //custom focus handler for displaying error message on a labe when you focus on an errored Textfield
            } else if (o instanceof DateField) {
                dateField.addFocusListener(
                        new LabelErrorMessageManipulator(dateField, errorLabel, currentMessage)); //custom focus handler for displaying error message on a labe when you focus on an errored Textfield                
            } else if (o instanceof ComboBox) {
                comboBox.addFocusListener(
                        new LabelErrorMessageManipulator(comboBox, errorLabel, currentMessage)); //custom focus handler for displaying error message on a labe when you focus on an errored Textfield
            }
        }

        if (o instanceof TextField) {
            textField.addBlurListener(new LabelErrorMessageManipulator(textField, errorLabel, currentMessage)); //custom blur handler for displaying error message on a labe when you blur on an errored Textfield                       
        } else if (o instanceof TextArea) {
            textArea.addBlurListener(new LabelErrorMessageManipulator(textArea, errorLabel, currentMessage)); //custom blur handler for displaying error message on a labe when you blur on an errored Textfield
        } else if (o instanceof DateField) {
            dateField.addBlurListener(new LabelErrorMessageManipulator(dateField, errorLabel, currentMessage)); //custom blur handler for displaying error message on a labe when you blur on an errored Textfield
        } else if (o instanceof ComboBox) {
            comboBox.addBlurListener(new LabelErrorMessageManipulator(comboBox, errorLabel, currentMessage)); //custom blur handler for displaying error message on a labe when you blur on an errored Textfield
        }
    }

}

From source file:zm.hashcode.mshengu.client.web.content.fieldservices.quoterequest.views.PopupQuotationDetails.java

public PopupQuotationDetails(QuoteRequestsTab tab, MshenguMain main, String requestId) {
    this.requestId = requestId;
    this.main = main;
    this.tab = tab;
    root = new VerticalLayout();

    root.setSizeUndefined();// w  w  w  .j  a  va2  s  . co  m
    root.setSpacing(true);
    root.setMargin(true);

    total = new TextField();
    total.setReadOnly(false);
    total.setWidth("300px");
    total.setNullRepresentation("");
    total.setImmediate(true);
    total.setStyleName("blackcolor");
    total.focus();

    commentTextArea = new TextArea();
    commentTextArea.setReadOnly(false);
    commentTextArea.setWidth("300px");
    commentTextArea.setNullRepresentation("");
    commentTextArea.setImmediate(true);
    commentTextArea.setStyleName("blackcolor");

    followUpButton = new Button("Continue");
    followUpButton.setStyleName(Reindeer.BUTTON_DEFAULT);
    followUpButton.setData(this.requestId);
    followUpButton.addClickListener((Button.ClickListener) this);

    root.addComponent(new Label("Please enter the Quotation's Total Price:"));
    root.addComponent(total);
    root.addComponent(new Label("<br/>", ContentMode.HTML));
    root.addComponent(new Label("Comments"));
    root.addComponent(commentTextArea);
    root.addComponent(new Label("<br/>", ContentMode.HTML));
    root.addComponent(followUpButton);
    root.addComponent(new Label("<br/>", ContentMode.HTML));
    root.addComponent(new Label("Total including VAT."));

}