01: /*
02: * de.jwic.controls.TabStripControl
03: * $Id: ActionBarControl.java,v 1.3 2006/09/26 14:26:55 lordsam Exp $
04: */
05: package de.jwic.controls;
06:
07: import java.util.ArrayList;
08: import java.util.List;
09:
10: import de.jwic.base.Control;
11: import de.jwic.base.ControlContainer;
12: import de.jwic.base.IControlContainer;
13: import de.jwic.base.JWicException;
14:
15: /**
16: * An ActionBarControl can contain Controls like ButtonControls and ListBoxControls.
17: *
18: * TODO Add the ability to specify an index of the controls or to arrange them.
19: *
20: * @author Adi Nitzu
21: */
22: public class ActionBarControl extends ControlContainer {
23:
24: private static final long serialVersionUID = 1L;
25:
26: private List elements = new ArrayList();
27:
28: /**
29: * @param container
30: */
31: public ActionBarControl(IControlContainer container) {
32: super (container);
33: }
34:
35: /**
36: * @param container
37: * @param name
38: */
39: public ActionBarControl(IControlContainer container, String name) {
40: super (container, name);
41: }
42:
43: /* (non-Javadoc)
44: * @see de.jwic.base.ControlContainer#registerControl(de.jwic.base.Control, java.lang.String)
45: */
46: public void registerControl(Control control, String name)
47: throws JWicException {
48: super .registerControl(control, name);
49: elements.add(control);
50: if (control instanceof ButtonControl) {
51: control.setTemplateName(control.getTemplateName()
52: + "_Action");
53: }
54: }
55:
56: /* (non-Javadoc)
57: * @see de.jwic.base.ControlContainer#unregisterControl(de.jwic.base.Control)
58: */
59: public void unregisterControl(Control control) {
60: super .unregisterControl(control);
61: elements.remove(control);
62: }
63:
64: /**
65: * Get the controls in the right order as they were inserted
66: */
67: public List getElements() {
68: return elements;
69: }
70:
71: }
|