5353public  class  VRadioButtonGroup  extends  FocusableFlowPanelComposite 
5454        implements  Field , ClickHandler , HasEnabled  {
5555
56+     /** Default classname for this widget. */ 
5657    public  static  final  String  CLASSNAME  = "v-select-optiongroup" ;
58+     /** Default classname for all radio buttons within this widget. */ 
5759    public  static  final  String  CLASSNAME_OPTION  = "v-select-option" ;
60+     /** Default classname for the selected radio button within this widget. */ 
5861    public  static  final  String  CLASSNAME_OPTION_SELECTED  = "v-select-option-selected" ;
5962
6063    private  final  Map <RadioButton , JsonObject > optionsToItems ;
@@ -72,6 +75,9 @@ public class VRadioButtonGroup extends FocusableFlowPanelComposite
7275    private  final  String  groupId ;
7376    private  List <Consumer <JsonObject >> selectionChangeListeners ;
7477
78+     /** 
79+      * Constructs a widget for the RadioButtonGroup component. 
80+      */ 
7581    public  VRadioButtonGroup () {
7682        groupId  = DOM .createUniqueId ();
7783        getWidget ().setStyleName (CLASSNAME );
@@ -80,8 +86,11 @@ public VRadioButtonGroup() {
8086        selectionChangeListeners  = new  ArrayList <>();
8187    }
8288
83-     /* 
84-      * Build all the options 
89+     /** 
90+      * Build all the options. 
91+      * 
92+      * @param items 
93+      *            the list of options 
8594     */ 
8695    public  void  buildOptions (List <JsonObject > items ) {
8796        Roles .getRadiogroupRole ().set (getElement ());
@@ -194,16 +203,26 @@ public void onClick(ClickEvent event) {
194203        }
195204    }
196205
206+     /** 
207+      * Sets the tabulator index for the container element that holds the radio 
208+      * buttons. It represents the entire radio button group within the browser's 
209+      * focus cycle. 
210+      * 
211+      * @param tabIndex 
212+      *            tabulator index for the radio button group 
213+      */ 
197214    public  void  setTabIndex (int  tabIndex ) {
198215        for  (Widget  anOptionsContainer  : getWidget ()) {
199216            FocusWidget  widget  = (FocusWidget ) anOptionsContainer ;
200217            widget .setTabIndex (tabIndex );
201218        }
202219    }
203220
221+     /** 
222+      * Sets radio buttons enabled according to this widget's enabled and 
223+      * read-only status, as well as each option's own enabled status. 
224+      */ 
204225    protected  void  updateEnabledState () {
205-         // sets options enabled according to the widget's enabled, 
206-         // readonly and each options own enabled 
207226        for  (Map .Entry <RadioButton , JsonObject > entry  : optionsToItems 
208227                .entrySet ()) {
209228            RadioButton  radioButton  = entry .getKey ();
@@ -214,10 +233,28 @@ protected void updateEnabledState() {
214233        }
215234    }
216235
236+     /** 
237+      * Returns whether HTML is allowed in the item captions. 
238+      * 
239+      * @return {@code true} if the captions are used as HTML, {@code false} if 
240+      *         used as plain text 
241+      */ 
217242    public  boolean  isHtmlContentAllowed () {
218243        return  htmlContentAllowed ;
219244    }
220245
246+     /** 
247+      * Sets whether HTML is allowed in the item captions. If set to 
248+      * {@code true}, the captions are displayed as HTML and the developer is 
249+      * responsible for ensuring no harmful HTML is used. If set to 
250+      * {@code false}, the content is displayed as plain text. 
251+      * <p> 
252+      * This value is delegated from the RadioButtonGroupState. 
253+      * 
254+      * @param htmlContentAllowed 
255+      *            {@code true} if the captions are used as HTML, {@code false} 
256+      *            if used as plain text 
257+      */ 
221258    public  void  setHtmlContentAllowed (boolean  htmlContentAllowed ) {
222259        this .htmlContentAllowed  = htmlContentAllowed ;
223260    }
@@ -227,10 +264,22 @@ public boolean isEnabled() {
227264        return  enabled ;
228265    }
229266
267+     /** 
268+      * Returns whether this radio button group is read-only or not. 
269+      * 
270+      * @return {@code true} if this widget is read-only, {@code false} otherwise 
271+      */ 
230272    public  boolean  isReadonly () {
231273        return  readonly ;
232274    }
233275
276+     /** 
277+      * Sets the read-only status of this radio button group. 
278+      * 
279+      * @param readonly 
280+      *            {@code true} if this widget should be read-only, {@code false} 
281+      *            otherwise 
282+      */ 
234283    public  void  setReadonly (boolean  readonly ) {
235284        if  (this .readonly  != readonly ) {
236285            this .readonly  = readonly ;
@@ -246,13 +295,27 @@ public void setEnabled(boolean enabled) {
246295        }
247296    }
248297
298+     /** 
299+      * Adds the given selection change handler to this widget. 
300+      * 
301+      * @param selectionChanged 
302+      *            the handler that should be triggered when selection changes 
303+      * @return the registration object for removing the given handler when no 
304+      *         longer needed 
305+      */ 
249306    public  Registration  addSelectionChangeHandler (
250307            Consumer <JsonObject > selectionChanged ) {
251308        selectionChangeListeners .add (selectionChanged );
252309        return  (Registration ) () -> selectionChangeListeners 
253310                .remove (selectionChanged );
254311    }
255312
313+     /** 
314+      * Removes previous selection and adds new selection. 
315+      * 
316+      * @param selectedItemKey 
317+      *            the key of the selected radio button 
318+      */ 
256319    public  void  selectItemKey (String  selectedItemKey ) {
257320        // At most one item could be selected so reset all radio buttons 
258321        // before applying current selection 
0 commit comments