define some class with a name like ClientContext or something like that. Let that class be the "home" of the client entities you want to manage (like your pizzas). This class is responsble of mantaining this "client entities" both by let you add/remove the entities and also let observers to subscribe to "entity changes". So when you add / remove entities you notify the observers. Then register a Entity change listener and when notified for an entity change, just update all the GUI components that need to be updated when you add/remove pizzas. Something like this:
public class ClientContext {
private List<Pizza> pizzas;
public void add(Pizza p) {
pizzas.add(p);
notifyAllListeners();
}
public void addPizzaListener(PizzaListener l){...}
public void notifyAllListeners(){for(PizzaListener l : listeners){l.notifyPizzasChange(); }}
}
..then on your GUI code...:
ClientContext.getInstance().addPizzaListener(new PizzaListener(){
public void notifyPizzasChange(){update the list box using ClientContext.getInstance().getPizzas()}
})
Hope this can clarify something... Happy new year to you too!
P/D: in these cases, I often find much more useful to have a Map<String, Pizza> for storing the pizzas by id. Also you can use a cheap map using Js Objects directly instead of java.util.Map implementations, like this:
http://code.google.com/p/yuigwt/source/browse/trunk/yuigwt/src/org/sgx/yuigwt/yui/util/LWMap.java