Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.hotspot.dashbaord.client.inbox;import in.shop2020.hotspot.dashbaord.client.event.AddWeightEvent;import in.shop2020.hotspot.dashbaord.client.event.RejectOrderEvent;import in.shop2020.hotspot.dashbaord.shared.actions.Order;import org.enunes.gwt.mvp.client.EventBus;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 AddWeightBox extends DialogBox {private Label weightLabel = new Label("Weight");private TextBox weightBox = new TextBox();private Button submitbutton = new Button("Submit");private HorizontalPanel hpanel;private VerticalPanel vpanel = new VerticalPanel();public AddWeightBox(final EventBus eventBus, final Order order){hpanel = new HorizontalPanel();hpanel.setSpacing(5);hpanel.add(weightLabel);hpanel.add(weightBox);hpanel.setCellWidth(weightLabel, "50px");vpanel.add(hpanel);vpanel.add(submitbutton);setWidget(vpanel);setAutoHideEnabled(true);setGlassEnabled(true);setText("Please enter weight");setModal(true);submitbutton.addClickHandler(new ClickHandler() {@Overridepublic void onClick(ClickEvent event) {hide();String weightStr = weightBox.getText();double weight = Double.parseDouble(weightStr);eventBus.fireEvent(new AddWeightEvent(order, weight));clear();}});}public void clear(){weightBox.setText("");}}