| 3872 |
chandransh |
1 |
package in.shop2020.catalog.dashboard.client;
|
|
|
2 |
|
|
|
3 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
4 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
5 |
import com.google.gwt.user.client.ui.Button;
|
|
|
6 |
import com.google.gwt.user.client.ui.DialogBox;
|
|
|
7 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
|
8 |
import com.google.gwt.user.client.ui.Label;
|
|
|
9 |
import com.google.gwt.user.client.ui.TextBox;
|
|
|
10 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
11 |
|
|
|
12 |
public class SearchItemBox extends DialogBox {
|
|
|
13 |
|
|
|
14 |
private Label searchLabel = new Label("Brand");
|
|
|
15 |
private TextBox searchBox = new TextBox();
|
|
|
16 |
|
|
|
17 |
private Button submitButton = new Button("Search");
|
|
|
18 |
|
|
|
19 |
private HorizontalPanel hpanel;
|
|
|
20 |
|
|
|
21 |
private VerticalPanel vpanel = new VerticalPanel();
|
|
|
22 |
|
|
|
23 |
public SearchItemBox(final ItemList itemList){
|
|
|
24 |
hpanel = new HorizontalPanel();
|
|
|
25 |
hpanel.setSpacing(5);
|
|
|
26 |
hpanel.add(searchLabel);
|
|
|
27 |
hpanel.add(searchBox);
|
|
|
28 |
hpanel.setCellWidth(searchLabel, "50px");
|
|
|
29 |
vpanel.add(hpanel);
|
|
|
30 |
|
|
|
31 |
vpanel.add(submitButton);
|
|
|
32 |
|
|
|
33 |
setWidget(vpanel);
|
|
|
34 |
setAutoHideEnabled(true);
|
|
|
35 |
setGlassEnabled(true);
|
|
|
36 |
setText("Search for items:");
|
|
|
37 |
setModal(true);
|
|
|
38 |
|
|
|
39 |
submitButton.addClickHandler(new ClickHandler() {
|
|
|
40 |
|
|
|
41 |
@Override
|
|
|
42 |
public void onClick(ClickEvent event) {
|
|
|
43 |
itemList.searchForItems(searchBox.getText());
|
|
|
44 |
hide();
|
|
|
45 |
}
|
|
|
46 |
});
|
|
|
47 |
}
|
|
|
48 |
}
|