Re: Dynamic Tag substitution
override oncomponenttag and call tag.setname() -igor On Thu, Feb 17, 2011 at 9:14 AM, Arjun Dhar wrote: > > One correction I'd make to my own code is instead of allowing to add a > Component; I'd enforce "WebComponent". That would make the case stronger for > using and enforcing HTML tags. > > ..the issue remains, hwow do I make the markup here dynamic to suit the > "WebComponent" being wrapped! :( > > - > Don't take life too seriously, your'e not getting out it alive anyway! > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Dynamic-Tag-substitution-tp3311189p3311199.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Dynamic Tag substitution
One correction I'd make to my own code is instead of allowing to add a Component; I'd enforce "WebComponent". That would make the case stronger for using and enforcing HTML tags. ..the issue remains, hwow do I make the markup here dynamic to suit the "WebComponent" being wrapped! :( - Don't take life too seriously, your'e not getting out it alive anyway! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dynamic-Tag-substitution-tp3311189p3311199.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Dynamic Tag substitution
Hi, Im creating a Decorator/Wrapper Panel that will show EDIT/DELETE options on the content if the user is authorized to do so. The markup simply put, is like this: DELETE EDIT <***TAG_TYPE***wicket:id='component' /> The issue is that the Wrapper by design can consume any Component and decorate it. However, the TAG type depends on the component inserted. I'd liek to control that programatically. Is there any way I can do that? ..the corresponding code is like : public abstract class EditableComponentWrapper extends Panel { private static final long serialVersionUID = 1191322949129480444L; private boolean allowDelete, allowEdit; public EditableComponentWrapper(String id) { super( id ); WebMarkupContainer container = new WebMarkupContainer("container"); add(container); container.add(addComponent("component")); } /** * Add custom Component to the container. Use the id passed to construct the component. * * @param componentId as String */ public abstract Component addComponent(String componentId); public void onInitialize() { super.onInitialize(); addOrReplace(new AjaxLink("delete") { @Override public void onClick(AjaxRequestTarget target) { onDelete(target); } } .setOutputMarkupId(true) .setEnabled(allowDelete) .setVisible(allowDelete)); addOrReplace(new AjaxLink("edit") { @Override public void onClick(AjaxRequestTarget target) { onEdit(target); } } .setOutputMarkupId(true) .setEnabled(allowEdit) .setVisible(allowEdit)); } ... ... - Don't take life too seriously, your'e not getting out it alive anyway! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dynamic-Tag-substitution-tp3311189p3311189.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org