Directory

← Back

SearchField

A field designed to process and return stylized search results

Author

Rating

Popularity

<100

When ComboBox isn't doing it for you, the SearchField allows you to eagerly process search keywords, and return a result in the way that suits your application best.

Requires SuperImmediateTextField and PopupButton.

Sample code

public class SearchfieldApplication extends Application {

    // An example implementation on ResultDisplayer
    public class ResultDisplayerExample implements ResultDisplayer {

        public Layout processSearch(final List<String> keywords) {
            final Layout cssLayout = new CssLayout();

            for (final String keyword : keywords) {
                cssLayout.addComponent(new Label(keyword));
            }

            return cssLayout;
        }
    }

    @Override
    public void init() {
        setTheme("searchfield");

        final Layout cssLayout = new CssLayout();
        final Panel panel = new Panel("SearchField example");
        panel.setContent(cssLayout);
        panel.setSizeFull();

        final Window mainWindow = new Window("Searchfield Application");
        mainWindow.setContent(panel);
        setMainWindow(mainWindow);

        mainWindow.addComponent(new Label(
                "This application's ResultDisplayer will create a "
                        + "Layout with Labels for each keyword."));

        // Create a new SearchField, with ResultDisplayerExample to handle the
        // processing and rendering
        mainWindow.addComponent(new SearchField(new ResultDisplayerExample()));
    }
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

  • ResultDisplayer takes a SearchEvent instead of a List.
  • Returning a null Layout from the ResultDisplayer will cause the popup not to be shown (regarded as "no hits found")
Released
2011-06-23
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.2+
Vaadin 6.3+ in 2.0.1
Browser
Internet Explorer
Internet Explorer
Internet Explorer
Firefox
Opera
Safari
Google Chrome

SearchField - Vaadin Add-on Directory

A field designed to process and return stylized search results SearchField - Vaadin Add-on Directory
When ComboBox isn't doing it for you, the SearchField allows you to eagerly process search keywords, and return a result in the way that suits your application best. Requires SuperImmediateTextField and PopupButton.
SuperImmediateTextField
PopupButton
Live Demo
Forum Thread
Video Demo

SearchField version 1.0.0
null

SearchField version 1.1.0
null

SearchField version 2.0.0
Supports IE, Added PopupButton as a dependency, requires Vaadin 6.3.0 or greater

SearchField version 2.0.1
Requirement updated to PopupButton 1.0.0

SearchField version 2.1.0
Added "setPopupVisible()" method

SearchField version 2.2.0
- ResultDisplayer takes a SearchEvent instead of a List. - Returning a null Layout from the ResultDisplayer will cause the popup not to be shown (regarded as "no hits found")

Online