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
            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.

Reply via email to