[ https://issues.apache.org/jira/browse/WICKET-2776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844939#action_12844939 ]
Juergen Donnerstag commented on WICKET-2776: -------------------------------------------- applied to 1.4 I think in 1.5 the code should be reword to use a Compoent rather than hand-made markup > Enhancing RadioChoice input items with individual title and css class > attributes > -------------------------------------------------------------------------------- > > Key: WICKET-2776 > URL: https://issues.apache.org/jira/browse/WICKET-2776 > Project: Wicket > Issue Type: Improvement > Components: wicket > Affects Versions: 1.4.7 > Reporter: Szádeczky-Kardoss Szabolcs > Assignee: Juergen Donnerstag > Priority: Minor > Fix For: 1.4.8, 1.5-M1 > > Original Estimate: 1h > Remaining Estimate: 1h > > Wicket is a great framework based on an excellent idea. It is a joy to work > with. There are several existing components and most of them are very usable > and customizable as much as possible, however there are still a few places > for improvement. One of those is > org.apache.wicket.markup.html.form.RadioChoice, where it is currently not > possible to set HTML title and class attributes for the individual input > tags. This would be a great feature for some client-side javascript > frameworks, and in my case the JQuery star-rating plugin is even hard to use > without these. For this purpose I have created my own private alternative for > this component, but it would be good to have it included in wicket, so that > others can benefit too. > See below the changes I have performed to enable this feature! Please note > that all changes are made so that current behavior is not changed only new > optional behavior is added. > Changes in method onComponentTagBody(...) > ... > // Add radio tag > String title = getTitle(index, choice); > String cssClass = getCssClass(index, choice); > buffer.append("<input > name=\"").append(getInputName()).append("\" type=\"radio\""); > if (title != null) > buffer.append(" title=\"").append(title).append("\""); > if (cssClass != null) > buffer.append(" class=\"").append(cssClass).append("\""); > buffer.append((isSelected(choice, index, selected) ? " > checked=\"checked\"" : "")); > buffer.append((enabled ? "" : " disabled=\"disabled\"")); > buffer.append(" value=\"").append(id).append("\" > id=\"").append(idAttr) > .append("\""); > ... > Added two new methods: > /** > * Returns the title attribute to be output for the input tag with the > given index and choice > * value. By default this returns null, and so the title attribute won't > be set, but this can be > * overridden. > * > * @param index > * @param choice > * @return title attribute to be used for the given input tag > */ > protected String getTitle(int index, T choice) { > return null; > } > /** > * Returns the CSS class attribute to be output for the input tag with > the given index and > * choice value. By default this returns null, and so the class attribute > won't be set, but this > * can be overridden. > * > * @param index > * @param choice > * @return CSS class attribute to be used for the given input tag > */ > protected String getCssClass(int index, T choice) { > return null; > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.