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(String caption, ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextArea with the given caption and a value change listener.

Usage

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.ConfigComponent.java

License:Apache License

private Layout createThemeconfLayout() {
    Layout themeLayout = new FormLayout();
    themeSelect = new NativeSelect("theme", Arrays.asList("red", "white", "blackglass", "clean", "custom"));
    themeSelect.setImmediate(true);/* ww w  .  j av a  2s  .co m*/
    themeSelect.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            customHtmlArea.setEnabled(isCustomTheme());
            customThemeWidgetField.setEnabled(isCustomTheme());
        }
    });
    themeLayout.addComponent(themeSelect);
    customHtmlArea = new TextArea("custom HTML", CUSTOM_HTML_SAMPLE);
    customHtmlArea.setEnabled(false);
    customHtmlArea.setRows(15);
    customHtmlArea.setColumns(40);
    themeLayout.addComponent(customHtmlArea);
    customThemeWidgetField = new TextField("custom_theme_widget", CUSTOM_THEME_WIDGET);
    customThemeWidgetField.setEnabled(false);
    themeLayout.addComponent(customThemeWidgetField);
    return themeLayout;
}

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);//from ww  w .  ja v a  2  s. c o m
    area.setWidth("100%");

    layout.addComponent(area);

    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:dhbw.ka.mwi.businesshorizon2.ui.initialscreen.projectlist.ProjectListViewImpl.java

License:Open Source License

/**Methode zur Implementierung des Dialogfensters fr Projekt-nderungen.
 * /*w w w .  j  ava2 s  .  c  o m*/
 */
@Override
public void showEditProjectDialog(Project project) {
    editDialog = new Window("Projekt bearbeiten");
    editDialog.setModal(true);
    editDialog.setWidth(410, UNITS_PIXELS);
    editDialog.setResizable(false);
    editDialog.setDraggable(false);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);

    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(true);
    formLayout.setSpacing(true);

    //TextFeld fr Name dem Formular hinzufgen
    tfName = new TextField("Name ndern:", project.getName());
    tfName.setRequired(true);
    tfName.addValidator(new StringLengthValidator("Der Projektname muss zwischen 2 und 20 Zeichen lang sein.",
            2, 20, false));
    tfName.setRequiredError("Pflichtfeld");
    tfName.setSizeFull();
    formLayout.addComponent(tfName);

    //TextArea fr Beschreibung dem Formular hinzufgen
    taDescription = new TextArea("Beschreibung ndern:", project.getDescription());
    taDescription.setSizeFull();
    formLayout.addComponent(taDescription);

    //Formular dem Layout hinzufgen
    layout.addComponent(formLayout);

    //Speichern-Button erstllen und dem Layout hinzufgen
    //TODO: ist das korrekt? Gute Frage, I have no idea what u r doing
    dialogEditBtn = new Button("Speichern");
    layout.addComponent(dialogEditBtn);

    dialogEditBtn.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            if (tfName.isValid()) {
                boolean succed = presenter.editProject(projects.get(indexEditBtn), (String) tfName.getValue(),
                        (String) taDescription.getValue());
                if (succed) {
                    getWindow().removeWindow(editDialog);
                    logger.debug("Projekt-bearbeiten Dialog geschlossen");

                }

            } else {
                getWindow().showNotification("",
                        "Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
                        Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });

    //Layout dem Dialog-Fenster hinzufgen
    editDialog.addComponent(layout);

    //Dialog dem Hauptfenster hinzufgen
    getWindow().addWindow(editDialog);
    logger.debug("Bearbeiten-Dialog erzeugt");

}

From source file:eu.eco2clouds.portal.component.ExperimentDetails.java

License:Apache License

public APWindow(String ap) {

    super("Application Profile");
    TextArea ta = new TextArea("Application Profile", ap);
    ta.setHeight("600px");
    ta.setWidth("800px");
    //ta.setEnabled(false);
    this.setWidth("-1px");
    this.setHeight("-1px");
    this.center();

    this.setContent(ta);
}

From source file:eu.lod2.QueryingTab.java

License:Apache License

private void extractionQuery(ClickEvent event) {

    try {/*  w w w .java2  s .com*/
        RepositoryConnection con = state.getRdfStore().getConnection();

        if (querygraph.equals("")) {

            sparqlResult.removeAllComponents();
            getWindow().showNotification("No query issued.");

        } else {
            //Initialize the result page
            sparqlResult.removeAllComponents();

            String query = "select * from <" + querygraph + "> where {?s ?p ?o} LIMIT 100";
            TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, query);
            TupleQueryResult result = tupleQuery.evaluate();

            String statements = "";
            while (result.hasNext()) {
                BindingSet bindingSet = result.next();
                Value valueOfS = bindingSet.getValue("s");
                Value valueOfP = bindingSet.getValue("p");
                Value valueOfO = bindingSet.getValue("o");

                String objectType = "";
                String objectString = "";
                if (valueOfO instanceof LiteralImpl) {
                    objectType = "literal";
                    LiteralImpl literalO = (LiteralImpl) valueOfO;
                    objectString = "\"" + literalO.getLabel() + "\" ^^ <" + literalO.getDatatype() + ">";

                }
                ;
                if (valueOfO instanceof URIImpl) {
                    objectType = "resource";
                    objectString = "<" + valueOfO.stringValue() + ">";
                }
                ;

                String triple = "<" + valueOfS.stringValue() + ">  <" + valueOfP.stringValue() + "> "
                        + objectString;

                statements = statements + "\n" + triple;

                // do something interesting with the values here...
            }
            TextArea resultArea = new TextArea("", statements);
            resultArea.setDebugId(this.getClass().getSimpleName() + "_resultArea");
            resultArea.setReadOnly(true);
            resultArea.setColumns(0);
            resultArea.setRows(30);
            sparqlResult.addComponent(resultArea);
        }

    } catch (RepositoryException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedQueryException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (QueryEvaluationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:eu.lod2.SesameSPARQL.java

License:Apache License

private void extractionQuery(ClickEvent event) {

    try {/*w w w. ja v a  2  s .com*/
        RepositoryConnection con = state.getRdfStore().getConnection();

        String queryValue = (String) query.getValue();

        if (queryValue.equals("")) {

            sparqlResult.removeAllComponents();
            getWindow().showNotification("No query issued.");

        } else {
            //Initialize the result page
            sparqlResult.removeAllComponents();

            TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryValue);
            TupleQueryResult result = tupleQuery.evaluate();

            String statements = "";
            while (result.hasNext()) {
                BindingSet bindingSet = result.next();
                Value valueOfS = bindingSet.getValue("s");
                Value valueOfP = bindingSet.getValue("p");
                Value valueOfO = bindingSet.getValue("o");

                String objectType = "";
                String objectString = "";
                if (valueOfO instanceof LiteralImpl) {
                    objectType = "literal";
                    LiteralImpl literalO = (LiteralImpl) valueOfO;
                    objectString = "\"" + literalO.getLabel() + "\" ^^ <" + literalO.getDatatype() + ">";

                }
                ;
                if (valueOfO instanceof URIImpl) {
                    objectType = "resource";
                    objectString = "<" + valueOfO.stringValue() + ">";
                }
                ;

                String triple = "<" + valueOfS.stringValue() + ">  <" + valueOfP.stringValue() + "> "
                        + objectString;

                statements = statements + "\n" + triple;

                // do something interesting with the values here...
            }
            TextArea resultArea = new TextArea("", statements);
            resultArea.setDebugId(this.getClass().getSimpleName() + "_resultArea");
            resultArea.setReadOnly(true);
            resultArea.setColumns(0);
            resultArea.setRows(30);
            sparqlResult.addComponent(resultArea);
        }

    } catch (RepositoryException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedQueryException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (QueryEvaluationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:org.apache.ace.log.server.ui.LogViewerExtension.java

License:Apache License

/**
 * Creates a {@link TextArea} with a dump of the given event's properties.
 * /*from w w w.  j  ava2s.c o  m*/
 * @param event
 *            the event to create a textarea for, cannot be <code>null</code>.
 * @return a {@link TextArea} instance, never <code>null</code>.
 */
final TextArea getProperties(Event event) {
    Map<String, String> props = event.getProperties();

    TextArea area = new TextArea("", dumpProperties(props));
    area.setWidth(FILL_AREA);
    area.setRows(props.size());
    area.setWordwrap(false);
    area.setReadOnly(true);
    area.setImmediate(true);
    return area;
}

From source file:org.escidoc.browser.ui.view.WikiPageView.java

License:Open Source License

private void buildContentSection(final VerticalLayout vlContentPanel) {
    String content;/*from  w ww. j a v a  2  s  .  c  om*/
    // controller.getWikiPageContent();

    String[] arrayContent = controller.getWikiPageContent();
    String title = arrayContent[0];
    content = arrayContent[1];

    wikiContent = new Label(controller.parseCreole(content), Label.CONTENT_XHTML);
    controller.getWikiTitle(content);

    wikiContent.setWidth("100%");
    // wikiContent.setHeight("400px");
    wikiContent.addStyleName("wikiarticle");
    // Invisible resources
    txtWikiContent = new TextArea("Wiki Content", content);
    txtWikiContent.setWidth("100%");
    txtWikiContent.setHeight("400px");
    saveContent = new Button("Save");
    saveContent.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (txtWikiContent.getValue().toString() != "") {
                controller.getWikiTitle(txtWikiContent.getValue().toString());
                // Create content
                controller.createWikiContent(controller.getWikiTitle(txtWikiContent.getValue().toString()),
                        txtWikiContent.getValue().toString());
                // set Label Content
                wikiContent.setValue(controller.parseCreole(txtWikiContent.getValue().toString()));
                // Swap to Label
                vlContentPanel.replaceComponent(txtWikiContent, wikiContent);
                // Enable Edit Button
                lockPublicStatusbtn.setEnabled(true);
                saveContent.setVisible(false);
            }
        }
    });

    vlContentPanel.addComponent(wikiContent);
    vlContentPanel.addComponent(saveContent);
    saveContent.setVisible(false);

}