Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.catalog.dashboard.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class SearchItemBox extends DialogBox {

    private Label searchLabel = new Label("Brand");
    private TextBox searchBox = new TextBox();
    
    private Button submitButton = new Button("Search");
    
    private HorizontalPanel hpanel;
    
    private VerticalPanel vpanel = new VerticalPanel();
    
    public SearchItemBox(final ItemList itemList){
        hpanel = new HorizontalPanel();
        hpanel.setSpacing(5);
        hpanel.add(searchLabel);
        hpanel.add(searchBox);
        hpanel.setCellWidth(searchLabel, "50px");
        vpanel.add(hpanel);
        
        vpanel.add(submitButton);
            
        setWidget(vpanel);
        setAutoHideEnabled(true);
        setGlassEnabled(true);
        setText("Search for items:");
        setModal(true);
        
        submitButton.addClickHandler(new ClickHandler() {
            
            @Override
            public void onClick(ClickEvent event) {
                itemList.searchForItems(searchBox.getText());
                hide();
            }
        });
    }
}