01: /*
02: ItsNat Java Web Application Framework
03: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
04: Author: Jose Maria Arranz Santamaria
05:
06: This program is free software: you can redistribute it and/or modify
07: it under the terms of the GNU Affero General Public License as published by
08: the Free Software Foundation, either version 3 of the License, or
09: (at your option) any later version. See the GNU Affero General Public
10: License for more details. See the copy of the GNU Affero General Public License
11: included in this program. If not, see <http://www.gnu.org/licenses/>.
12: */
13:
14: package org.itsnat.comp;
15:
16: import javax.swing.ButtonGroup;
17:
18: /**
19: * Represents a button group.
20: *
21: * <p>Button groups are currently used only by radio buttons ({@link ItsNatButtonRadio}).</p>
22: *
23: * <p>A button group has a name, this name is unique per document no other button group has this name.
24: * The same is applied for the <code>javax.swing.ButtonGroup</code> associated to this group.</p>
25: *
26: * <p><code>ButtonGroup</code> objects are used to provide some support to the Swing
27: * standard way to create groups (see <code>javax.swing.ButtonModel.setGroup(ButtonGroup)</code>),
28: * but some methods like <code>ButtonGroup.add(AbstractButton)</code> have no sense in ItsNat,
29: * use {@link #addButton(ItsNatComponent)} instead.
30: * </p>
31: *
32: * @author Jose Maria Arranz Santamaria
33: * @see ItsNatComponentManager#createItsNatButtonGroup()
34: */
35: public interface ItsNatButtonGroup {
36: /**
37: * Returns the name of this button group. This name is not shared (unique) per document.
38: *
39: * @return the button group name.
40: * @see ItsNatComponentManager#getItsNatButtonGroup(String)
41: */
42: public String getName();
43:
44: /**
45: * Returns the Swing <code>ButtonGroup</code> object of this button group. This object is not shared (unique) per document.
46: *
47: * @return the <code>ButtonGroup</code> object of this button group.
48: * @see ItsNatComponentManager#getItsNatButtonGroup(javax.swing.ButtonGroup)
49: */
50: public ButtonGroup getButtonGroup();
51:
52: /**
53: * Adds the specified button to this group.
54: *
55: * @param button the button to add.
56: * @see #removeButton(ItsNatComponent)
57: * @see ItsNatButtonRadio#setItsNatButtonGroup(ItsNatButtonGroup)
58: */
59: public void addButton(ItsNatComponent button);
60:
61: /**
62: * Removes the specified button from this group.
63: *
64: * @param button the button to remove.
65: * @see #addButton(ItsNatComponent)
66: */
67: public void removeButton(ItsNatComponent button);
68:
69: /**
70: * Returns the number of buttons of this group.
71: *
72: * @return the number of buttons.
73: */
74: public int getButtonCount();
75:
76: /**
77: * Returns the button at the specified position.
78: *
79: * @param index 0 based index of the button.
80: * @return the button at the specified position.
81: */
82: public ItsNatComponent getButton(int index);
83: }
|