danger.ui
Class RadioGroup

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.Container
              extended by danger.ui.Control
                  extended by danger.ui.CheckBoxGroup
                      extended by danger.ui.RadioGroup
All Implemented Interfaces:
ToolTipOwner


public class RadioGroup
extends CheckBoxGroup

A RadioGroup is a group of radio buttons, which lets the user choose one of a mutually exclusive set of choices.


Field Summary
 
Fields inherited from class danger.ui.CheckBoxGroup
DEFAULT_SPACING
 
Fields inherited from class danger.ui.View
DEFAULT_SCROLL_FOCUS_MARGIN, FOCUS_DEFAULT, FOCUS_DOWNWARD, FOCUS_FROM_NOWHERE, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, HEIGHT_AUTO, HEIGHT_FILL_TO_BOTTOM, HEIGHT_FILL_TO_TOP, HEIGHT_MATCH_CONTROL, HEIGHT_PERCENTAGE, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_PARENT_TOP, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_BELOW_GROUP_BOX_HEADING, POSITION_CENTER_HORIZONTALLY, POSITION_CENTER_VERTICALLY, POSITION_TO_LEFT, POSITION_TO_RIGHT, PREFER_DIRECTION_NONE, PREFER_HORIZONTAL_DIRECTION, PREFER_VERTICAL_DIRECTION, STATE_AT_AND_SPACE_PAGE, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_MAKE_DING, STATE_PARTIAL_FOCUS_OK, STATE_TRANSPARENT, STATE_VISIBLE, WIDTH_AUTO, WIDTH_FILL_TO_LEFT, WIDTH_FILL_TO_RIGHT, WIDTH_MATCH_CONTROL, WIDTH_PERCENTAGE
 
Constructor Summary
RadioGroup()
          Create a radio group with no buttons.
RadioGroup(CharSequence inGroupLabel, CharSequence[] inLabels, int inDefault)
          Create a radio group with a title and buttons.
RadioGroup(CharSequence inGroupLabel, CharSequence[] inLabels, int inDefault, int inSpacing)
          Create a radio group with a title and buttons.
RadioGroup(String inGroupLabel, String[] inLabels, int inDefault)
          Create a radio group with a title and buttons.
RadioGroup(String inGroupLabel, String[] inLabels, int inDefault, int inSpacing)
          Create a radio group with a title and buttons.
 
Method Summary
 boolean eventKeyUp(char inChar, Event event)
          Processes key releases directed at this container.
 boolean eventWidgetUp(int inWhichWidget, Event event)
          Handle the release of a device widget
 int getIDOfSelectedItem()
          Determine the id of the currently selected radio button.
 void selectButton(RadioButton button)
          Select the specified radio button.
protected  void selectFocusedButton()
          Select the currently focused radio button.
 void selectItemWithID(int inItemID)
          Select the radio button with the specified id.
 void setLabels(CharSequence inGroupLabel, CharSequence[] inLabels, int[] ids, int inDefault, int inSpacing, boolean multiLine)
          Set the labels in the radio group.
 void setLabels(String inGroupLabel, String[] inLabels, int[] ids, int inDefault, int inSpacing, boolean multiLine)
          Set the labels in the radio group.
 void setValue(int inValue)
          Select one of the radio buttons in the group.
 
Methods inherited from class danger.ui.CheckBoxGroup
getItemValue, getValueOfItemWithID, loseFocus, onSetHasBorder, paint, reflowChildren, setCheckBoxLabels, setCheckBoxLabels, setItemEvent, setItemValue, setLabelFont, setSize, setTransparent, setValueOfItemWithID, takeFocus
 
Methods inherited from class danger.ui.Control
drawFocusBox, drawIdleBox, drawIdleBox, getBaseline, getEvent, getEventListener, getEventType, getHasBorder, getMaxToolTipLines, getTitle, getTitleSequence, getToolTip, getValue, hasToolTip, notifyWhenBaselineChanges, onBaselineChanged, onControlBaselineChanged, onSetTitle, sendEvent, setEvent, setEvent, setEvent, setEvent, setEvent, setEventArg, setEventListener, setEventMethod, setHasBorder, setMaxToolTipLines, setTitle, setTitle, setToolTip, showToolTip
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, addChildAt, addFromContainerResource, addFromContainerResource, addFromContainerResource, addFromDialogResource, addFromDialogResource, advanceFocus, advanceFocusInWindow, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventShortcut, eventWidgetDown, eventWidgetHeld, focusedDescendantIsValid, getBottomChild, getBottomChild, getChildAt, getChildIndex, getChildWithID, getControlWithID, getDescendantWithID, getFirstChild, getFirstFocusableChild, getFocusableChildInWindow, getFocusedChild, getFocusedLeaf, getInterestingRect, getLastChild, getLastFocusableChild, getLeftMostChild, getNextFocusableChild, getNextFocusableChild, getPageHeight, getPrevFocusableChild, getPrevFocusableChild, getRightMostChild, getRightMostChild, handleButtonShortcut, hideAllChildren, isDescendant, keepRectInView, moveChildToIndex, onChildPositionChanged, onChildSizeChanged, onChildVisibilityChanged, pageToEnd, pageToHome, paintChildren, receiveEvent, removeAllChildren, removeChild, reverseFocus, setFocusedChild, setFocusedChild, setFocusedChild, setFocusedDescendant, setFocusedDescendant, setFocusedDescendant, setFocusToFirstDescendant, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setReflowAdjustHeight, setWindow, showAllChildren, snapHeightToChildren, snapHeightToChildren, snapToChildren, snapWidthToChildren, snapWidthToChildren, willFocusWithin, willFocusWithin
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getData, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, hide, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isObscured, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenFocusChanges, notifyWhenObscurityChanges, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, notifyWhenVisibilityChanges, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onEnabledStateChanged, onHide, onPeriodicPulse, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onShow, onSizeChanged, onStyleChanged, onSystemFontChanged, onViewFocusChanged, onViewObscurityChanged, onViewPositionChanged, onViewSizeChanged, onViewVisibilityChanged, onWindowPaint, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setData, setDebugBounds, setDynamicHeight, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPosition, setPreferredDirection, setRight, setScrollFocusMargin, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setVisible, setWidth, shouldDropEvent, show, showContextMenu, styleIsDefault, swapStyleColors, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioGroup

public RadioGroup()
Create a radio group with no buttons.


RadioGroup

public RadioGroup(String inGroupLabel,
                  String[] inLabels,
                  int inDefault)
Create a radio group with a title and buttons.

Parameters:
inGroupLabel - the label to appear at the top of the group
inLabels - labels for the radio buttons in the group
inDefault - index of the initially selected radio button, starting with 0

RadioGroup

public RadioGroup(CharSequence inGroupLabel,
                  CharSequence[] inLabels,
                  int inDefault)
Create a radio group with a title and buttons.

Parameters:
inGroupLabel - the label to appear at the top of the group
inLabels - labels for the radio buttons in the group
inDefault - index of the initially selected radio button, starting with 0
Since:
3.0

RadioGroup

public RadioGroup(String inGroupLabel,
                  String[] inLabels,
                  int inDefault,
                  int inSpacing)
Create a radio group with a title and buttons.

Parameters:
inGroupLabel - the label to appear at the top of the group
inLabels - labels for the radio buttons in the group
inDefault - index of the initially selected radio button, starting with 0
inSpacing - amount of vertical spacing between radio buttons

RadioGroup

public RadioGroup(CharSequence inGroupLabel,
                  CharSequence[] inLabels,
                  int inDefault,
                  int inSpacing)
Create a radio group with a title and buttons.

Parameters:
inGroupLabel - the label to appear at the top of the group
inLabels - labels for the radio buttons in the group
inDefault - index of the initially selected radio button, starting with 0
inSpacing - amount of vertical spacing between radio buttons
Since:
3.0
Method Detail

setLabels

public void setLabels(String inGroupLabel,
                      String[] inLabels,
                      int[] ids,
                      int inDefault,
                      int inSpacing,
                      boolean multiLine)
Set the labels in the radio group. If ids is non-null, then this group must already have been added to a container (via a call to Container.addChild(danger.ui.View) before this call.

Parameters:
inGroupLabel - the label to appear at the top of the group.
inLabels - an array of labels. Each label is used as the title of a radio button.
ids - an array of ids, corresponding to the labels array.
inDefault - index of the initially selected radio button
inSpacing - amount of vertical spacing between radio buttons
multiLine - whether the radio buttons should be multi-line

setLabels

public void setLabels(CharSequence inGroupLabel,
                      CharSequence[] inLabels,
                      int[] ids,
                      int inDefault,
                      int inSpacing,
                      boolean multiLine)
Set the labels in the radio group. If ids is non-null, then this group must already have been added to a container (via a call to Container.addChild(danger.ui.View) before this call.

Parameters:
inGroupLabel - the label to appear at the top of the group.
inLabels - an array of labels. Each label is used as the title of a radio button.
ids - an array of ids, corresponding to the labels array.
inDefault - index of the initially selected radio button
inSpacing - amount of vertical spacing between radio buttons
multiLine - whether the radio buttons should be multi-line

eventKeyUp

public boolean eventKeyUp(char inChar,
                          Event event)
Description copied from class: Container
Processes key releases directed at this container.

Overrides:
eventKeyUp in class CheckBoxGroup
Parameters:
inChar - the character being released.

eventWidgetUp

public boolean eventWidgetUp(int inWhichWidget,
                             Event event)
Description copied from class: Container
Handle the release of a device widget

Overrides:
eventWidgetUp in class CheckBoxGroup
Parameters:
inWhichWidget - the widget that went down
Returns:
whether or not the event was consumed

selectFocusedButton

protected void selectFocusedButton()
Select the currently focused radio button. This method is called when the user presses the return key or presses the trackball. You generally do not need to call this method, but may override it.


setValue

public void setValue(int inValue)
Select one of the radio buttons in the group. All other buttons are unselected. A value of 0 refers to the first radio button; 1 corresponds to the next one, etc.

Overrides:
setValue in class Control
Parameters:
inValue - 0-based index of the radio button to select.

selectItemWithID

public void selectItemWithID(int inItemID)
Select the radio button with the specified id. All other buttons are unselected.

Parameters:
inItemID - id of the radio button to select.

getIDOfSelectedItem

public int getIDOfSelectedItem()
Determine the id of the currently selected radio button. Returns 0 if the selected radio button does not have an id.


selectButton

public void selectButton(RadioButton button)
Select the specified radio button. All other buttons are unselected.

Parameters:
button - the radio button to select.