https://issues.apache.org/jira/browse/PIVOT-677
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java
http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/buttons/radio_button_group_example.bxml

I've just committed a new class for PIVOT-677, and have a some related
questions.

1) The new RadioButtonGroup class has the following 4 public methods to
navigate around the buttons in the group.
- selectFirstButton()
- selectLastButton()
- selectNextButton(Button)
- selectPreviousButton(Button)

Are those names OK?   ListView & TreeView both have selectAll() methods, so
there is kind of a precedent and I couldn't think of non-contrived setXXX
style names unless...

... would it be preferable to have a single method with an associated enum
such as
setSelection(SelectionRequest request, Button context)?
(The 'context' parameter would not be required for FIRST & LAST)

// Not sure about this name...
private enum SelectionRequest {
FIRST, LAST, NEXT, PREVIOUS
}

That could be expanded into a pair of methods to avoid having to pass a null
for FIRST & LAST
setSelection(SelectionRequest request)
setSelection(SelectionRequest request, Button context)


2) ButtonGroup doesn't support clearing the selection.  It just throws an
IllegalArgumentException with no message.
Does this seem right, or should clearing selection be allowed
for ButtonGroup and RadioButtonGroup?


3) I added in some extra keyboard handling so that by default TAB and
SHIFT+TAB transfer focus out of the group.  This seemed much more natural
for the common use case where all of the buttons in the group are in the
same Container.

However, it is just a keyboard listener and therefore won't have any effect
on org.apache.pivot.wtk.Component#transferFocus(FocusTraversalDirection).
I considered adding a new FocusTraversalPolicy to the parents of the
buttons, which would conditionally apply the new 'soft policy' controlled by
the keypress listener, but that seemed overkill.


4) Should any of the tutorials or demos be updated to use RadioButtonGroup
now?
http://pivot.apache.org/tutorials/radio-buttons.html
http://pivot.apache.org/demos/kitchen-sink.html
http://pivot.apache.org/demos/component-explorer.html

Chris

Reply via email to