ICEfaces
  1. ICEfaces
  2. ICE-4142

Styles are not applied to ice:radio

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8RC1
    • Fix Version/s: 1.8RC2, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      icefaces rev18425

      Description

      Following scenario :

      <ice:selectOneRadio id="woi13" layout="spread" partialSubmit="false"
      value="#{...}" disabled="#{...}" disabledClass="rbHideText" enabledClass="rbHideText">
         <f:selectItems value="#{list.value}" />
      </ice:selectOneRadio>

      <ice:dataTable value="#{lista.value}" ...
         <ice:column>
             <ice:radio for="woi13" index="#{element.value}" />
        </ice:column>
      <ice:dataTable>

      Classes styleClass, disabledClass, enabledClass are not added to output.

      BTW
      If style patch is imposiible then new feature will be usable.
      Spread radio's are generated with label's. In table those labels are not necessary because users got columns.
      Ice:radio with new attribute for disabling labels can help users.

        Activity

        Hide
        Krashan Brahmanjara added a comment -

        Another bug of ice:radio.

        In above sequence of ice:selectOneRadio / f:selectItems / ice:radio spread radios are generated correctly only for regular list of values stared with 0 like 0,1,2,3....

        Other sequances are rendered incorrectly, like 1,2,3,4 - some labels and values are multiplicated.

        Show
        Krashan Brahmanjara added a comment - Another bug of ice:radio. In above sequence of ice:selectOneRadio / f:selectItems / ice:radio spread radios are generated correctly only for regular list of values stared with 0 like 0,1,2,3.... Other sequances are rendered incorrectly, like 1,2,3,4 - some labels and values are multiplicated.
        Hide
        Krashan Brahmanjara added a comment -

        One more bug for this example.

        Readonly attribute are not apllied to rendered radios.

        Workaround patch for RadioRendered.java rev.18438

        protected void renderOption{
        (...)
        row 195

        Element input = domContext.createElement(HTML.INPUT_ELEM);
        input.setAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_RADIO);
        input.setAttribute(HTML.ID_ATTR, radioClientId);
        input.setAttribute(HTML.NAME_ATTR, selectOneClientId);
        input.setAttribute(HTML.VALUE_ATTR, selectItemValue);

        < if (selectItem.isDisabled()) {
        > Boolean readonly = (Boolean) selectOne.getAttributes().get(HTML.READONLY_ATTR);
        > if (readonly != null && readonly.booleanValue())

        { > input.setAttribute(HTML.READONLY_ATTR, HTML.READONLY_ATTR); > }

        > Boolean disabled = (Boolean) selectOne.getAttributes().get(HTML.DISABLED_ATTR);
        > if (selectItem.isDisabled() || (disabled != null && disabled.booleanValue()))

        { input.setAttribute(HTML.DISABLED_ATTR, HTML.DISABLED_ATTR); }

        if (isValueSelected(facesContext, selectItem, selectOne,
        submittedValue, componentValue))

        { input.setAttribute(HTML.CHECKED_ATTR, HTML.CHECKED_ATTR); }

        }

        Show
        Krashan Brahmanjara added a comment - One more bug for this example. Readonly attribute are not apllied to rendered radios. Workaround patch for RadioRendered.java rev.18438 protected void renderOption{ (...) row 195 Element input = domContext.createElement(HTML.INPUT_ELEM); input.setAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_RADIO); input.setAttribute(HTML.ID_ATTR, radioClientId); input.setAttribute(HTML.NAME_ATTR, selectOneClientId); input.setAttribute(HTML.VALUE_ATTR, selectItemValue); < if (selectItem.isDisabled()) { > Boolean readonly = (Boolean) selectOne.getAttributes().get(HTML.READONLY_ATTR); > if (readonly != null && readonly.booleanValue()) { > input.setAttribute(HTML.READONLY_ATTR, HTML.READONLY_ATTR); > } > Boolean disabled = (Boolean) selectOne.getAttributes().get(HTML.DISABLED_ATTR); > if (selectItem.isDisabled() || (disabled != null && disabled.booleanValue())) { input.setAttribute(HTML.DISABLED_ATTR, HTML.DISABLED_ATTR); } if (isValueSelected(facesContext, selectItem, selectOne, submittedValue, componentValue)) { input.setAttribute(HTML.CHECKED_ATTR, HTML.CHECKED_ATTR); } }
        Hide
        yip.ng added a comment -

        We don't use the "enabledClass" and "disabledClass". We use "styleClass" and "disabled". But even then there were some bugs. These have now been fixed. The markup would look like this:

        <ice:selectOneRadio ... layout="spread" styleClass="rbStyle" disabled="true" ...>

        The output would look like this:

        <input type="radio" ... disabled="disabled"/>
        <label for="..." class="iceSelOneRb-dis rbStyle-dis">...</label>

        Show
        yip.ng added a comment - We don't use the "enabledClass" and "disabledClass". We use "styleClass" and "disabled". But even then there were some bugs. These have now been fixed. The markup would look like this: <ice:selectOneRadio ... layout="spread" styleClass="rbStyle" disabled="true" ...> The output would look like this: <input type="radio" ... disabled="disabled"/> <label for="..." class="iceSelOneRb-dis rbStyle-dis">...</label>
        Hide
        yip.ng added a comment -

        Labels can be disabled by setting the select item's label to null or empty string, e.g.:

        SelectItem item = new SelectItem("sprite", "");

        See attached screenshot.

        Show
        yip.ng added a comment - Labels can be disabled by setting the select item's label to null or empty string, e.g.: SelectItem item = new SelectItem("sprite", ""); See attached screenshot.
        Hide
        yip.ng added a comment -

        The list of selectItems is zero-based, and there is range checking to prevent out-of-bounds errors. Out-of-range indexes are reset to the first or last index:

        if (radioIndex < 0) radioIndex = 0;
        if (radioIndex >= selectItemList.size()) radioIndex = selectItemList.size() - 1;

        So, as can be seen from the attached screenshot, index 4 is reset to index 3, resulting in the last 2 items looking duplicated.

        It is the user's responsibility to make sure that the select item indexes are not out of range.

        Show
        yip.ng added a comment - The list of selectItems is zero-based, and there is range checking to prevent out-of-bounds errors. Out-of-range indexes are reset to the first or last index: if (radioIndex < 0) radioIndex = 0; if (radioIndex >= selectItemList.size()) radioIndex = selectItemList.size() - 1; So, as can be seen from the attached screenshot, index 4 is reset to index 3, resulting in the last 2 items looking duplicated. It is the user's responsibility to make sure that the select item indexes are not out of range.
        Hide
        yip.ng added a comment -

        Readonly attribute is working now. See attached screenshot. Fixed by changing the call to the PassThruAttributeRenderer. No need for the patch.

        Show
        yip.ng added a comment - Readonly attribute is working now. See attached screenshot. Fixed by changing the call to the PassThruAttributeRenderer. No need for the patch.
        Hide
        Krashan Brahmanjara added a comment -

        "We don't use the "enabledClass" and "disabledClass"."

        Current revision 18478. In tld users still see "enabledClass" and "disabledClass".

        Show
        Krashan Brahmanjara added a comment - "We don't use the "enabledClass" and "disabledClass"." Current revision 18478. In tld users still see "enabledClass" and "disabledClass".
        Hide
        yip.ng added a comment -

        New JIRA created: ICE-4187.

        Show
        yip.ng added a comment - New JIRA created: ICE-4187 .
        Hide
        Krashan Brahmanjara added a comment -

        I see a label generation bug after last changes .

        The same scenario described at beggining. Now radio's are generated with correct value and incorrect labels.
        Example for one item (value=32 but label is from third item)

        <input id="UE:icePnlTbSet:0:woi13:_4" type="radio" value="32" onkeypress="Ice.util.radioCheckboxEnter(form,this,event);" onfocus="setFocus(this.id);" onblur="setFocus('');" name="UE:icePnlTbSet:0:woi13" disabled="disabled"/>
        <label class="iceSelOneRb-dis" for="UE:icePnlTbSet:0:woi13:_4">DEM</label>

        BTW
        Styles are now applied but only to label element, not to input.

        Show
        Krashan Brahmanjara added a comment - I see a label generation bug after last changes . The same scenario described at beggining. Now radio's are generated with correct value and incorrect labels. Example for one item (value=32 but label is from third item) <input id="UE:icePnlTbSet:0:woi13:_4" type="radio" value="32" onkeypress="Ice.util.radioCheckboxEnter(form,this,event);" onfocus="setFocus(this.id);" onblur="setFocus('');" name="UE:icePnlTbSet:0:woi13" disabled="disabled"/> <label class="iceSelOneRb-dis" for="UE:icePnlTbSet:0:woi13:_4">DEM</label> BTW Styles are now applied but only to label element, not to input.
        Hide
        yip.ng added a comment -

        Value is a key, not an index. It could be a string, not a number. It is matched to the select item with the same value, not the same index. The index is used solely for layout purposes.

        For applying the style to input, see ICE-4187.

        Show
        yip.ng added a comment - Value is a key, not an index. It could be a string, not a number. It is matched to the select item with the same value, not the same index. The index is used solely for layout purposes. For applying the style to input, see ICE-4187 .

          People

          • Assignee:
            Unassigned
            Reporter:
            Krashan Brahmanjara
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: