Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d
Class ButtonGroup

java.lang.Object
  extended by
org.eclipse.draw2d.ButtonGroup

public class ButtonGroup
extends java.lang.Object

A ButtonGroup holds a group of Clickable's models and provides unique selection in them. There is capability to add a default selection. Models who want to belong to the group should just add themselves to this group. By doing so they listen to this group for changes.

Setting of the default selection results in its being selected any time setSelected(ButtonModel, boolean) is called. If no default selection is set, the last entry selected is not allowed to deselect.


Constructor Summary
ButtonGroup ()
          Constructs a ButtonGroup with no default selection.
 
Method Summary
 void add ( ButtonModel model)
          Adds the passed ButtonModel to the ButtonGroup.
 void addPropertyChangeListener (java.beans.PropertyChangeListener listener)
          Adds the passed listener.
protected  void firePropertyChange (java.lang.Object oldValue, java.lang.Object newValue)
          Fires a PropertyChangeEvent to all PropertyChangeListeners added to this ButtonGroup.
  ButtonModel getDefault ()
          Returns the ButtonModel which is selected by default for this ButtonGroup.
 java.util.List getElements ()
          Returns a List which contains all of the ButtonModels added to this ButtonGroup.
  ButtonModel getSelected ()
          Returns the ButtonModel for the currently selected button.
 boolean isSelected ( ButtonModel model)
          Determines if the given ButtonModel is selected or not.
 void remove ( ButtonModel model)
          Removes the given ButtonModel from this ButtonGroup.
 void removePropertyChangeListener (java.beans.PropertyChangeListener listener)
          Removes the passed PropertyChangeListener from this ButtonGroup.
protected  void selectNewModel ( ButtonModel model)
          Sets the passed ButtonModel to be the currently selected ButtonModel of this ButtonGroup.
 void setDefault ( ButtonModel model)
          Sets the default selection of this ButtonGroup.
 void setSelected ( ButtonModel model)
          Sets the button with the given ButtonModel to be selected.
 void setSelected ( ButtonModel model, boolean value)
          Sets model to the passed state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonGroup

public ButtonGroup()
Constructs a ButtonGroup with no default selection.

Since:
2.0
Method Detail

add

public void add(
ButtonModel model)
Adds the passed ButtonModel to the ButtonGroup.

Parameters:
model - ButtonModel to be added to this group
Since:
2.0

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the passed listener. ButtonGroups use PropertyChangeListeners to react to selection changes in the ButtonGroup.

Parameters:
listener - Listener to be added to this group
Since:
2.0

firePropertyChange

protected void firePropertyChange(java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fires a PropertyChangeEvent to all PropertyChangeListeners added to this ButtonGroup.

Parameters:
oldValue - Old selection value
newValue - New selection value
Since:
2.0

getDefault

public 
ButtonModel getDefault()
Returns the ButtonModel which is selected by default for this ButtonGroup.

Returns:
The default ButtonModel
Since:
2.0

getElements

public java.util.List getElements()
Returns a List which contains all of the ButtonModels added to this ButtonGroup.

Returns:
The List of ButtonModels in this ButtonGroup
Since:
2.0

getSelected

public 
ButtonModel getSelected()
Returns the ButtonModel for the currently selected button.

Returns:
The ButtonModel for the currently selected button
Since:
2.0

isSelected

public boolean isSelected(
ButtonModel model)
Determines if the given ButtonModel is selected or not.

Parameters:
model - Model being tested for selected status
Returns:
Selection state of the given model
Since:
2.0

remove

public void remove(
ButtonModel model)
Removes the given ButtonModel from this ButtonGroup.

Parameters:
model - ButtonModel being removed
Since:
2.0

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the passed PropertyChangeListener from this ButtonGroup.

Parameters:
listener - PropertyChangeListener to be removed
Since:
2.0

selectNewModel

protected void selectNewModel(
ButtonModel model)
Sets the passed ButtonModel to be the currently selected ButtonModel of this ButtonGroup. Fires a property change.

Parameters:
model - ButtonModel to be selected
Since:
2.0

setDefault

public void setDefault(
ButtonModel model)
Sets the default selection of this ButtonGroup. Does nothing if it is not present in the group. Sets selection to the passed ButtonModel.

Parameters:
model - ButtonModel which is to be the default selection.
Since:
2.0

setSelected

public void setSelected(
ButtonModel model)
Sets the button with the given ButtonModel to be selected.

Parameters:
model - The ButtonModel to be selected
Since:
2.0

setSelected

public void setSelected(
ButtonModel model,
                        boolean value)
Sets model to the passed state.

If value is

  • true:
    • The passed ButtonModel will own selection.
  • false:
    • If the passed model owns selection, it will lose selection, and selection will be given to the default ButonModel. If no default ButtonModel was set, selection will remain as it was, as one ButtonModel must own selection at all times.
    • If the passed model does not own selection, then selection will remain as it was.

Parameters:
model - The model to be affected
value - The selected state
Since:
2.0

Eclipse Draw2d
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire