01: package simpleorm.simplewebapp.core;
02:
03: import simpleorm.simplewebapp.core.WButton;
04:
05: import java.util.LinkedHashMap;
06: import java.util.Collection;
07:
08: /**
09: * Created by IntelliJ IDEA.
10: * User: aberglas
11: * Date: Aug 18, 2006
12: * Time: 11:38:41 AM
13: * To change this template use File | Settings | File Templates.
14: */
15: public class WButtonBar {
16: LinkedHashMap<String, WButton> buttons = new LinkedHashMap(10);
17:
18: public WButton putButton(WButton item) {
19: return buttons.put(item.nameValue, item);
20: }
21:
22: public Collection<WButton> getButtonCollection() {
23: return buttons.values();
24: }
25:
26: /** Finds button in bar, exception if non null and not found. */
27: WButton findButton(String nameValue) {
28: if (nameValue != null) {
29: WButton button = buttons.get(nameValue);
30: if (button == null)
31: throw new WException("No Button named " + nameValue);
32: return button;
33: }
34: return null;
35: }
36:
37: }
|