if (clients.contains(name))
return;
// HorizontalPanel customerRow = new HorizontalPanel();
Label nameLabel = new Label(name);
final FlowPanel cupArray = new FlowPanel();
nameLabel.setWidth("100px");
// create a listener for removing coffee icon to the column
ClickHandler removeButtonListener = new ClickHandler() {
public void onClick(ClickEvent event) {
int lastCupID = cupArray.getWidgetCount() - 1;
if (lastCupID > -1)
cupArray.clear();
}
};
PushButton removeButton = new PushButton(coffeeImages.removeIcon()
.createImage(), removeButtonListener);
// Define the oracle that finds drink suggestions
final MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
oracle.add("Latte");
oracle.add("Moccachino");
oracle.add("Black Coffee + Sugar 026");
oracle.add("Black Coffee - Sugar");
final SuggestBox box = new SuggestBox(oracle);
// create a listener for adding coffee icon to the column
SelectionHandler<Suggestion> addListener = new SelectionHandler<Suggestion>() {
public void onSelection(SelectionEvent<Suggestion> event) {
if (cupArray.getWidgetCount() == 4) {
Window.alert("Easy Tiger!");
box.setText("");
return;
}
cupArray.add(coffeeImages.cupIcon().createImage());
cupArray.getElement().setTitle(box.getText());
box.setText("");
}
};
box.addSelectionHandler(addListener);