|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wings.SButtonGroup
public class SButtonGroup
Used to create a multiple-exclusion scope for a set of buttons.
Creating a set of buttons with the same ButtonGroup object means that turning "on" one of those buttons turns off all other buttons in the group.A SButtonGroup can be used with any set of objects that inherit from
SAbstractButton, because they support the selected state.
Initially, all buttons in the group are unselected. Once any button is selected, one button is always selected in the group. There is no way to turn a button programmatically to "off", in order to clear the button group.
Details:The implementation of the button group is a
bit tricky for the HTML generation. In HTML, groups of components are
usually formed by giving them all the same name. The problem is, that
any SComponent, especially the SAbstractButton, have globally
unique names. So this implementation gives all buttons in the
group the name of this SButtonGroup, and sets their value to
their actual name. So a bit of dispatching is already done here.
ButtonGroup,
Serialized Form| Field Summary | |
|---|---|
protected ArrayList |
buttons
|
protected ArrayList |
delayedEvents
all delayed events are stored here. |
protected EventListenerList |
listenerList
|
static String |
SELECTION_CHANGED
|
| Constructor Summary | |
|---|---|
SButtonGroup()
|
|
| Method Summary | |
|---|---|
void |
add(SAbstractButton button)
adds a button to the group. |
void |
addActionListener(ActionListener listener)
Adds an action listener to this group of buttons. |
protected void |
fireActionEvent(ActionEvent e)
Fire an ActionEvent at each registered listener. |
protected void |
fireActionPerformed(String command)
Fire an ActionEvent at each registered listener. |
void |
fireDelayedFinalEvents()
fire remaining delayed events. |
void |
fireDelayedIntermediateEvents()
fire delayed events which describes a "in progress" state change, like TreeWillExpand, or ListSelectionEvent with getIsAdjusting() true, ... |
ActionListener[] |
getActionListeners()
Returns an array of all the ActionListeners added
to this group of buttons with addActionListener(). |
String |
getComponentId()
Return a jvm wide unique id. |
boolean |
getDelayEvents()
|
Enumeration |
getElements()
Gets all the buttons the group consists of. |
String |
getLowLevelEventId()
Gets the id of the component. |
SAbstractButton |
getSelection()
Gets the button of the group that is selected. |
boolean |
isSelected(SAbstractButton button)
Returns the state of the button. |
Iterator |
iterator()
|
void |
remove(SAbstractButton button)
removes a button from the group. |
void |
removeActionListener(ActionListener listener)
Removes the supplied Listener from the listener list |
void |
removeAll()
removes all buttons from the group. |
void |
setDelayEvents(boolean b)
if this is set to true, events are not fired immediately. |
void |
setSelected(SAbstractButton b,
boolean selected)
Sets a button in the selected state. |
protected void |
setSelection(SAbstractButton button)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SELECTION_CHANGED
protected final ArrayList buttons
protected final EventListenerList listenerList
protected final ArrayList delayedEvents
| Constructor Detail |
|---|
public SButtonGroup()
| Method Detail |
|---|
public final String getComponentId()
protected void setSelection(SAbstractButton button)
public void add(SAbstractButton button)
button - the button that is to be addedpublic void remove(SAbstractButton button)
button - the button that is to be removedpublic void removeAll()
public final SAbstractButton getSelection()
setSelection(SAbstractButton)
public void setSelected(SAbstractButton b,
boolean selected)
b - the button.selected - true if this button is to be selected, otherwise false.public boolean isSelected(SAbstractButton button)
button - the button.
public Iterator iterator()
public Enumeration getElements()
public String getLowLevelEventId()
public void addActionListener(ActionListener listener)
listener - public void removeActionListener(ActionListener listener)
public ActionListener[] getActionListeners()
ActionListeners added
to this group of buttons with addActionListener().
ActionListeners added or an empty
array if no listeners have been addedprotected void fireActionPerformed(String command)
protected void fireActionEvent(ActionEvent e)
public void setDelayEvents(boolean b)
SDelayedEventModel
setDelayEvents in interface SDelayedEventModelpublic boolean getDelayEvents()
getDelayEvents in interface SDelayedEventModelpublic void fireDelayedIntermediateEvents()
SDelayedEventModel
fireDelayedIntermediateEvents in interface SDelayedEventModelpublic void fireDelayedFinalEvents()
SDelayedEventModel
fireDelayedFinalEvents in interface SDelayedEventModel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||