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 org.itsnat.comp.ui.ItsNatButtonToggleUI;
17: import javax.swing.JToggleButton.ToggleButtonModel;
18:
19: /**
20: * Is the base interface of toggle button components. Toggle buttons can be selected.
21: *
22: * <p>By default this component type uses a <code>javax.swing.JToggleButton.ToggleButtonModel</code>
23: * button model.</p>
24: *
25: * @author Jose Maria Arranz Santamaria
26: */
27: public interface ItsNatButtonToggle extends ItsNatButton {
28: /**
29: * Returns the current data model of this component.
30: *
31: * @return the current data model
32: * @see #setToggleButtonModel(javax.swing.JToggleButton.ToggleButtonModel)
33: */
34: public ToggleButtonModel getToggleButtonModel();
35:
36: /**
37: * Changes the data model of this component.
38: *
39: * <p>Current data model is disconnected from this component, and the new
40: * data model is bound to this component, every change is tracked and
41: * updates the user interfaces accordingly.</p>
42: *
43: * <p>If the specified data model is the same instance as the current data model,
44: * then is reset, component listener is removed and added again. Use this technique if
45: * you want to add a data model listener to be executed <i>before</i> the default component listener.
46: *
47: * @param dataModel the new data model.
48: * @see #getToggleButtonModel()
49: */
50: public void setToggleButtonModel(ToggleButtonModel dataModel);
51:
52: /**
53: * Returns the user interface manager of this component.
54: *
55: * @return the user interface manager.
56: */
57: public ItsNatButtonToggleUI getItsNatButtonToggleUI();
58:
59: /**
60: * Informs whether the button is selected.
61: *
62: * <p>This method calls <code>ButtonModel.isSelected()</code>.</p>
63: *
64: * @return true if this button is selected.
65: */
66: public boolean isSelected();
67:
68: /**
69: * Sets the selection button state.
70: *
71: * <p>This method calls <code>ButtonModel.setSelected(boolean)</code>.</p>
72: *
73: * @param b true if this button is going to be selected.
74: */
75: public void setSelected(boolean b);
76: }
|