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:fi.semantum.strategia.widget.Meter.java

License:Open Source License

public static void editMeter(final Main main, final Base base, final Meter meter) {

    Database database = main.getDatabase();

    final VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//from   ww  w .  j a  v  a  2s  . c o  m
    content.setHeightUndefined();
    content.setSpacing(true);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);
    hl.setMargin(false);

    final TextField tf = new TextField();
    tf.setCaption("Lyhytnimi");
    tf.setValue(meter.getId(database));
    tf.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf.setWidth("100%");

    hl.addComponent(tf);
    hl.setComponentAlignment(tf, Alignment.TOP_CENTER);
    hl.setExpandRatio(tf, 1.0f);

    final TextField tf1 = new TextField();
    tf1.setCaption("Teksti");
    tf1.setValue(meter.getText(database));
    tf1.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf1.setWidth("100%");

    hl.addComponent(tf1);
    hl.setComponentAlignment(tf1, Alignment.TOP_CENTER);
    hl.setExpandRatio(tf1, 2.0f);

    content.addComponent(hl);
    content.setComponentAlignment(hl, Alignment.TOP_CENTER);
    content.setExpandRatio(hl, 0.0f);

    final TextField tf2 = new TextField();
    tf2.setCaption("Voimassaolo");
    tf2.setValue(Utils.getValidity(database, meter));
    tf2.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf2.setWidth("100%");

    content.addComponent(tf2);
    content.setComponentAlignment(tf2, Alignment.TOP_CENTER);
    content.setExpandRatio(tf2, 0.0f);

    final TextArea ta = new TextArea();
    ta.setCaption("Mritys");
    ta.setValue(meter.getText(database));
    ta.addStyleName(ValoTheme.TEXTAREA_TINY);
    ta.setHeight("100%");
    ta.setWidth("100%");

    content.addComponent(ta);
    content.setComponentAlignment(ta, Alignment.TOP_CENTER);
    content.setExpandRatio(ta, 1.0f);

    final TrafficValuation valuation = meter.trafficValuation;
    final Runnable onOK = valuation != null ? valuation.getEditor(content, main, meter) : null;

    Indicator indicator = meter.getPossibleIndicator(database);
    if (indicator != null) {
        final Label ta2 = Indicator.makeHistory(database, indicator, main.getUIState().forecastMeters);
        content.addComponent(ta2);
        content.setComponentAlignment(ta2, Alignment.MIDDLE_CENTER);
        content.setExpandRatio(ta2, 1.0f);
    }

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(false);

    Button ok = new Button("Tallenna", new Button.ClickListener() {

        private static final long serialVersionUID = 1992235622970234624L;

        public void buttonClick(ClickEvent event) {
            if (onOK != null)
                onOK.run();
            meter.modifyId(main, tf.getValue());
            meter.modifyText(main, tf1.getValue());
            Utils.modifyValidity(main, meter, tf2.getValue());
            meter.modifyDescription(main, ta.getValue());
            Updates.update(main, true);
            manageMeters(main, main.getUIState().currentItem);
        }

    });
    buttons.addComponent(ok);

    Button close = new Button("Sulje");
    buttons.addComponent(close);

    final Window dialog = Dialogs.makeDialog(main, "500px", "800px", "Mrit mittaria", null, content,
            buttons);
    close.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8065367213523520602L;

        public void buttonClick(ClickEvent event) {
            main.removeWindow(dialog);
            manageMeters(main, main.getUIState().currentItem);
        }

    });

}

From source file:fr.amapj.view.views.advanced.devtools.PopupDecodeZipField.java

License:Open Source License

private void addFieldAffichage() {
    setStepTitle("Rsultat");

    String str = tf.getValue();//from w  w  w.  ja  v  a 2  s .  c  o m
    str = GzipUtils.uncompress(str);

    TextArea textArea = new TextArea();
    textArea.setHeight(8, Unit.CM);
    textArea.setValue(str);
    textArea.setWidth("90%");
    form.addComponent(textArea);

}

From source file:gov.va.ds4p.ds4pmobileportal.ui.AuditLogs.java

License:Open Source License

private Popover getPopoverTextArea(String val, String title) {
    Popover popover = new Popover();
    popover.setModal(true);/*from  ww w.j a  v  a 2 s  . c  o m*/
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("100%");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();
    popLayout.setMargin(true);

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    TextArea textArea = new TextArea();
    textArea.setWidth("100%");
    textArea.setHeight("700px");
    textArea.setValue(val);
    textArea.setReadOnly(true);
    layout2.addComponent(textArea);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow());
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java

License:Open Source License

private Popover getPopoverTextArea(String val, String title) {
    Popover popover = new Popover();
    popover.setModal(true);//  w  ww .ja va  2s.  c  o  m
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("100%");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();
    popLayout.setMargin(true);

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    TextArea textArea = new TextArea();
    textArea.setWidth("100%");
    textArea.setHeight("700px");
    textArea.setValue(val);
    textArea.setReadOnly(true);
    layout2.addComponent(textArea);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new ClickListener() {

        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow());
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}

From source file:gov.va.ehtac.appsonfhir.ui.HCSLogs.java

private Popover getPopoverTextArea(String val, String title) {
    popover = new Popover();
    popover.setModal(true);//from   w ww. j  a va  2s . c  o  m
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("550px");

    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    TextArea textArea = new TextArea();
    textArea.setWidth("100%");
    textArea.setHeight("490px");
    textArea.setValue(val);
    //        textArea.setReadOnly(true);
    //        textArea.setStyleName(Runo.LABEL_SMALL);
    layout2.addComponent(textArea);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent event) {
            popover.removeFromParent();
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}

From source file:info.magnolia.jcrtools.JcrToolsViewResultImpl.java

License:Open Source License

@Override
protected void build() {

    super.build();

    result = new TextArea();
    result.setRows(20);/*from  w w w .jav a2s.c  o m*/
    result.setSizeFull();

    resultSection.addComponent(result);

    content.addSection(inputSection);
    content.addSection(resultSection);

}

From source file:info.magnolia.ui.form.field.factory.TextFieldFactory.java

License:Open Source License

@Override
protected Field<String> createFieldComponent() {
    // Create a TextArea if the rows > 1
    if (definition.getRows() > 1) {
        TextArea textArea = new TextArea();
        textArea.setRows(definition.getRows());
        field = textArea;//w w  w  . j  a va2 s  .c  o  m
    } else {
        field = new TextField();
    }
    field.setNullRepresentation("");
    field.setNullSettingAllowed(true);
    if (definition.getMaxLength() != -1) {
        field.setMaxLength(definition.getMaxLength());
        MaxLengthIndicator.extend(field);
    }
    return field;
}

From source file:me.uni.emuseo.view.exhibits.form.DescriptionFieldBuilder.java

License:Open Source License

@Override
public Field<?> build(String propertyId) {
    if (propertyId.equals(fieldName)) {
        return new TextArea();
    }/*from  w w w  . j av a 2  s .c om*/
    return null;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Layout getTextFieldPreviews() {
    Layout grid = getPreviewLayout("Text fields");

    TextField tf = new TextField();
    tf.setValue("Text field");
    grid.addComponent(tf);/*from  ww w .jav a 2 s  .  c  om*/

    tf = new TextField();
    tf.setValue("Small field");
    tf.setStyleName("small");
    grid.addComponent(tf);

    tf = new TextField();
    tf.setValue("Big field");
    tf.setStyleName("big");
    tf.setComponentError(new UserError("Test error"));
    grid.addComponent(tf);

    tf = new TextField();
    tf.setInputPrompt("Search field");
    tf.setStyleName("search");
    grid.addComponent(tf);

    tf = new TextField();
    tf.setInputPrompt("Small search");
    tf.setStyleName("search small");
    grid.addComponent(tf);

    tf = new TextField();
    tf.setInputPrompt("Big search");
    tf.setStyleName("search big");
    grid.addComponent(tf);

    tf = new TextField("Error");
    tf.setComponentError(new UserError("Test error"));
    grid.addComponent(tf);

    tf = new TextField();
    tf.setInputPrompt("Error");
    tf.setComponentError(new UserError("Test error"));
    grid.addComponent(tf);

    tf = new TextField();
    tf.setInputPrompt("Small error");
    tf.setStyleName("small");
    tf.setComponentError(new UserError("Test error"));
    grid.addComponent(tf);

    TextArea ta = new TextArea();
    ta.setInputPrompt("Multiline");
    ta.setRows(4);
    grid.addComponent(ta);

    ta = new TextArea();
    ta.setInputPrompt("Small multiline");
    ta.setStyleName("small");
    ta.setRows(4);
    grid.addComponent(ta);

    ta = new TextArea();
    ta.setInputPrompt("Big multiline");
    ta.setStyleName("big");
    ta.setRows(4);
    grid.addComponent(ta);

    return grid;
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.about.AboutProvider.java

License:Apache License

@Override
public Component getContent() {
    VerticalLayout vl = new VerticalLayout();
    vl.addComponent(new Image("", LOGO));
    TextField version = new TextField(TRANSLATOR.translate("general.version"));
    version.setValue(((ValidationManagerUI) UI.getCurrent()).getVersion());
    version.setReadOnly(true);//from ww  w.java 2 s.  com
    vl.addComponent(version);
    TextField build = new TextField(TRANSLATOR.translate("general.build"));
    build.setValue(((ValidationManagerUI) UI.getCurrent()).getBuild());
    build.setReadOnly(true);
    vl.addComponent(build);
    TextArea desc = new TextArea();
    desc.setValue("Validation Manager is a tool to handle all the "
            + "cumbersome paperwork of regulated environment validations. "
            + "Including Validation Plans, protocols, "
            + "executions and exceptions. Keeping everything in one " + "place and best of all paperless. ");
    desc.setReadOnly(true);
    desc.setWidth(100, Unit.PERCENTAGE);
    Link link = new Link("Get more information here",
            new ExternalResource("https://github.com/javydreamercsw/validation-manager"));
    vl.addComponent(desc);
    vl.addComponent(link);
    vl.setId(getComponentCaption());
    return vl;
}