Search in sources :

Example 41 with TextBox

use of com.google.gwt.user.client.ui.TextBox 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

TextBox (com.google.gwt.user.client.ui.TextBox)41 Label (com.google.gwt.user.client.ui.Label)13 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)13 Test (org.junit.Test)10 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 CheckBox (com.google.gwt.user.client.ui.CheckBox)5 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)4 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)4 Grid (com.google.gwt.user.client.ui.Grid)4 PasswordTextBox (com.google.gwt.user.client.ui.PasswordTextBox)3 HashMap (java.util.HashMap)3 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)2 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)2 JSONString (com.google.gwt.json.client.JSONString)2 Button (com.google.gwt.user.client.ui.Button)2 FlexTable (com.google.gwt.user.client.ui.FlexTable)2 HTML (com.google.gwt.user.client.ui.HTML)2 ListBox (com.google.gwt.user.client.ui.ListBox)2