[
https://issues.apache.org/jira/browse/WICKET-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12851290#action_12851290
]
Martin Grigorov commented on WICKET-2809:
-----------------------------------------
David, you can use a behavior for that as well. It will be again a single call
;-)
Additionally in Wicket 1.5 if you have HTMLElement 'id' attribute and this
HTMLElement is a component (i.e. has wicket:id) then Wicket will automatically
use 'id' as markup id and will not override it with autogenerated one.
> Add convenience method to reuse a component's ID as markup ID
> -------------------------------------------------------------
>
> Key: WICKET-2809
> URL: https://issues.apache.org/jira/browse/WICKET-2809
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Environment: no restrictions.
> Reporter: David Chang
> Assignee: Igor Vaynberg
> Priority: Minor
>
> Currently, here is the follow pattern I follow to reuse a wicket component's
> ID as the element's markup ID.
> Label abc = new Label("efg", "xyz");
> abc.setOutputMarkupId(true).setMarkupId(abc.getId());
> It takes two lines to do this. A helper method as James Carmen suggested
> protected <T extends ComponentT setMarkupId(T
> component, String markupId)
> {
> component.setMarkupId(markupId);
> return component;
> }
> It does the trick, but it does not seem to the optimal solution. I hope to
> see a convience method on Component such as the following:
> Component setMarkupIdToWicketId()
> This method should does two things in one method call:
> setOutputMarkupId(true).setMarkupId(abc.getId());
> Thanks!
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.