Custom XHTML tag
I am using Wicket 1.4.18. I need to add custom tool tips to many fields in my application. The spec requires a help image with the tool tip (like the question mark JIRA uses) at the end of my field label that displays the tool tip on mouseover. The tool tip messages must be localized. The goal is to make this as simple as possible for programmers to add. To make it simple, I want to avoid adding code to both the Java and the markup on each page. I can use my base page to contribute jQuery (see Step 7 in https://cwiki.apache.org/WICKET/how-to-add-tooltips.html) and I would only like to touch the html file on the extending pages. Is there a way I can make a custom xhtml tag to allow me to replace the tag with markup? I am thinking of something like AutoLabelResolver and . Here is an example of the markup (just assume I am already contributing the JavaScript I need): [First Name]<*/wicket:tooltip/* key="firstNameTip"> Properties file: firstName=First Name firstNameTip=This is the first name Rendered it would look something like this: First Namesrc="blah" id="img323" title="This is the first name" /> Thanks for taking the time to read this! Jered Myers
Re: Custom XHTML tag
Hi First, is it a good question. My solution use jqwicket tooltip and I touch both java and html files but it's ok for me. >>> InlineHelp.java public class InlineHelp extends Panel { private static final long serialVersionUID = 1L; public InlineHelp(String id, IModel messageModel) { super(id, messageModel); } public InlineHelp(String id, String message) { super(id, Model.of(message)); } @Override protected void onInitialize() { super.onInitialize(); setRenderBodyOnly(true); WebComponent image = new ContextImage("image", "/images/help.png") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { tag.put("title", (String) InlineHelp.this.getDefaultModelObject()); } }; image.add(new TipTipBehavior(new TipTipOptions().maxWidth("auto"))); add(image); } } >>> InlineHelp.html http://wicket.apache.org/";> >>> How to use > java form.add(new InlineHelp("emailHelp", "If you want some notifications")); > html Email notifications Best regards, Decebal -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Custom-XHTML-tag-tp4650489p4650506.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
Re: Custom XHTML tag
This seems to be getting me where I want to go with the xhtml tag: http://sanityresort.blogspot.com/2011/08/creating-custom-wicket-tag-resolver.html On 07/13/2012 01:40 AM, Decebal Suiu wrote: Hi First, is it a good question. My solution use jqwicket tooltip and I touch both java and html files but it's ok for me. InlineHelp.java public class InlineHelp extends Panel { private static final long serialVersionUID = 1L; public InlineHelp(String id, IModel messageModel) { super(id, messageModel); } public InlineHelp(String id, String message) { super(id, Model.of(message)); } @Override protected void onInitialize() { super.onInitialize(); setRenderBodyOnly(true); WebComponent image = new ContextImage("image", "/images/help.png") { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag) { tag.put("title", (String) InlineHelp.this.getDefaultModelObject()); } }; image.add(new TipTipBehavior(new TipTipOptions().maxWidth("auto"))); add(image); } } InlineHelp.html http://wicket.apache.org/";> How to use java form.add(new InlineHelp("emailHelp", "If you want some notifications")); html Email notifications Best regards, Decebal -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Custom-XHTML-tag-tp4650489p4650506.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