Package org.zkoss.stateless.sul

## Interface IRadiogroup<I extends IAnyGroup>

- All Superinterfaces:
    `IAnyGroup<IRadiogroup<I>>`, `IChildable<IRadiogroup<I>,​I>`, `IComponent<IRadiogroup<I>>`, `IDisable<IRadiogroup<I>>`, `IHtmlBasedComponent<IRadiogroup<I>>`, `IXulElement<IRadiogroup<I>>`

      public interface IRadiogroup<I extends IAnyGroup>
      extends IXulElement<IRadiogroup<I>>, IChildable<IRadiogroup<I>,​I>, IAnyGroup<IRadiogroup<I>>, IDisable<IRadiogroup<I>>

  Immutable `Radiogroup` component

  A radio group.

  Note: To support the versatile layout, a radio group accepts any kind of children, including `IRadio`. On the other hand, the parent of a radio, if any, must be a radio group.

  ## Example

       @RichletMapping("/example")
       public IComponent example() {
           return IWindow.ofTitle("Radiobox & Radio Demo").withWidth("400px")
               .withBorder("normal").withChildren(
                   IVlayout.of(IRadiogroup.of(
                       IRadio.of("Apple"),
                       IRadio.of("Orange"),
                       IRadio.of("Banana")
                   ).withAction(this::doRadioCheck),
                   ILabel.of(" You have selected :"),
                   ILabel.ofId("fruit").withStyle("color:red")
               )
           );
       }
       @Action(type = Events.ON_CHECK)
       public void doRadioCheck(UiAgent uiAgent, @ActionVariable(targetId = ActionTarget.SELF,
           field = "selectedItem.label") String label) {
               uiAgent.smartUpdate(Locator.ofId("fruit"), new ILabel.Updater().value(label));
       }

  Note: To support the versatile layout, a radio group accepts any kind of children ,including Radio. On the other hand, the parent of a radio, if any, must be a radio group.

  #### Radiogroup as an Ancestor of Radio

  Groups radio components into the same radiogroup if they share the same ancestor, not just direct parent. It allows a more sophisticated layout. For example,

       @RichletMapping("/example/ancestor")
       public IComponent ancestorExample() {
           return IRadiogroup.of(
               IVlayout.of(
                   IHlayout.of(
                       IRadio.of("radio 1"),
                       IRadio.of("radio 2"),
                       IRadio.of("radio 3")
                   ), IHlayout.of(
                       IRadio.of("radio 4"),
                       IRadio.of("radio 5"),
                       IRadio.of("radio 6")
                   )
               )
           );
       }

  #### A Row of a Grid as a Radio Group

  Sometimes it is not possible to make the radiogroup component as an ancestor of all radio components. For example, each row of a grid might be an independent group. To solve this, you have to assign the radiogroup component to the radio component explicitly by the use of `IRadio.withRadiogroup(String)`.

       @RichletMapping("/example/grid")
       public IComponent gridExample() {
           return IDiv.of(
               IRadiogroup.ofId("popular"),
               IRadiogroup.ofId("fun"),
               IGrid.of(
                   IRow.of(
                       ILabel.of("Most popular"),
                       IRadio.of("Java").withRadiogroup("popular"),
                       IRadio.of("Groovy").withRadiogroup("popular"),
                       IRadio.of("C#").withRadiogroup("popular"),
                       ITextbox.DEFAULT
                   ),
                   IRow.of(
                       ILabel.of("Most fun"),
                       IRadio.of("Open Source").withRadiogroup("fun"),
                       IRadio.of("Social Networking").withRadiogroup("fun"),
                       IRadio.of("Searching").withRadiogroup("fun"),
                       ITextbox.DEFAULT
                   )
               )
           );
       }

  Author:
    katherine
  See Also:
    `Radiogroup`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `IRadiogroup.Builder<I extends IAnyGroup>` | Builds instances of type `IRadiogroup`.
    `static class` | `IRadiogroup.Orient` | Specifies the orient of `IRadiogroup` component
    `static class` | `IRadiogroup.Updater` | Builds an updater of type `IRadiogroup` for `UiAgent.smartUpdate(Locator, SmartUpdater)`.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static IRadiogroup<IAnyGroup>` | `DEFAULT` | Constant for default attributes of this immutable component.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `default java.lang.String` | `getName()` | Returns the name of this group of radio buttons.
    `default java.lang.String` | `getOrient()` | Returns the orient.
    `default java.lang.String` | `getWidgetClass()` | Returns the client widget class.
    `static <I extends IAnyGroup> IRadiogroup<I>` | `of​(I... children)` | Returns the instance with the given any group children.
    `static <I extends IAnyGroup> IRadiogroup<I>` | `of​(java.lang.Iterable<? extends I> children)` | Returns the instance with the given any group children.
    `static <I extends IAnyGroup> IRadiogroup<I>` | `ofId​(java.lang.String id)` | Returns the instance with the given id.
    `IRadiogroup` | `withName​(java.lang.String name)` | Returns a copy of `this` immutable component with the specified `name`.
    `IRadiogroup<I>` | `withOrient​(java.lang.String orient)` | Returns a copy of `this` immutable component with the specified `orient`.
    `default IRadiogroup<I>` | `withOrient​(IRadiogroup.Orient orient)` | Returns a copy of `this` immutable component with the specified `orient`.

    - ### Methods inherited from interface org.zkoss.stateless.sul.IChildable

      `getChildren, withChildren, withChildren`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IComponent

      `getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IDisable

      `isDisabled, withDisabled`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent

      `getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex`

    - ### Methods inherited from interface org.zkoss.stateless.sul.IXulElement

      `getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip`

- - ### Field Detail

    - #### DEFAULT

          static final IRadiogroup<IAnyGroup> DEFAULT

      Constant for default attributes of this immutable component.

  - ### Method Detail

    - #### getWidgetClass

          default java.lang.String getWidgetClass()

      Returns the client widget class.

      Default: `"zul.wgt.Radiogroup"`

      Specified by:
        `getWidgetClass` in interface `IComponent<I extends IAnyGroup>`

    - #### getOrient

          default java.lang.String getOrient()

      Returns the orient.

      Default: `"horizontal"`.

    - #### withOrient

          IRadiogroup<I> withOrient​(java.lang.String orient)

      Returns a copy of `this` immutable component with the specified `orient`.

      Sets the orient of component

      Parameters:
        `orient` - Either `"horizontal"` or `"vertical"`

        Default: `"horizontal"`.

      Returns:
        A modified copy of the `this` object

    - #### withOrient

          default IRadiogroup<I> withOrient​(IRadiogroup.Orient orient)

      Returns a copy of `this` immutable component with the specified `orient`.

      Sets the orient of component

      Parameters:
        `orient` - The `orient`

        Default: `"horizontal"`.

      Returns:
        A modified copy of the `this` object

    - #### getName

          default java.lang.String getName()

      Returns the name of this group of radio buttons. All child radio buttons shared the same name (`ICheckboxBase.getName()`).

      Default: automatically generated a unique name

      Don't use this method if your application is purely based on ZK's event-driven model.

    - #### withName

          IRadiogroup withName​(java.lang.String name)

      Returns a copy of `this` immutable component with the specified `name`.

      Sets the name of this group of radio buttons. All child radio buttons shared the same name (`ICheckboxBase.getName()`).

      Don't use this method if your application is purely based on ZK's event-driven model.

      Parameters:
        `name` - The unique name to identify this component

        Default: no null.

      Returns:
        A modified copy of the `this` object

    - #### of

          static <I extends IAnyGroup> IRadiogroup<I> of​(java.lang.Iterable<? extends I> children)

      Returns the instance with the given any group children.
      Parameters:
        `children` - The children belong to any group
      See Also:
        `IAnyGroup`

    - #### of

          static <I extends IAnyGroup> IRadiogroup<I> of​(I... children)

      Returns the instance with the given any group children.
      Parameters:
        `children` - The children belong to any group
      See Also:
        `IAnyGroup`

    - #### ofId

          static <I extends IAnyGroup> IRadiogroup<I> ofId​(java.lang.String id)

      Returns the instance with the given id.
      Parameters:
        `id` - The id to identify this component