Search in sources :

Example 1 with QueryChecker

use of org.activityinfo.shared.command.handler.search.QueryChecker in project activityinfo by bedatadriven.

the class SearchResultsPage method createSearchBox.

private void createSearchBox() {
    textboxSearch = new TextBox();
    textboxSearch.setSize("2em", "2em");
    textboxSearch.setStylePrimaryName("searchBox");
    textboxSearch.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                QueryChecker checker = new QueryChecker();
                if (checker.checkQuery(textboxSearch.getText())) {
                    eventBus.fireEvent(new SearchEvent(textboxSearch.getText()));
                } else {
                    showError(checker.getFails());
                }
            }
        }
    });
    BorderLayoutData bld = new BorderLayoutData(LayoutRegion.NORTH);
    bld.setSize(40);
    bld.setMargins(new Margins(16));
    add(textboxSearch, bld);
}
Also used : KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) Margins(com.extjs.gxt.ui.client.util.Margins) TextBox(com.google.gwt.user.client.ui.TextBox) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler) QueryChecker(org.activityinfo.shared.command.handler.search.QueryChecker)

Aggregations

Margins (com.extjs.gxt.ui.client.util.Margins)1 BorderLayoutData (com.extjs.gxt.ui.client.widget.layout.BorderLayoutData)1 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)1 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)1 TextBox (com.google.gwt.user.client.ui.TextBox)1 QueryChecker (org.activityinfo.shared.command.handler.search.QueryChecker)1