Re: Custom XHTML tag

2012-07-13 Thread Decebal Suiu
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, IModelString messageModel) {
  super(id, messageModel);
   }

   public InlineHelp(String id, String message) {
 super(id, Model.Stringof(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
?xml version=1.0 encoding=utf-8?
html xmlns:wicket=http://wicket.apache.org/;
wicket:panel
 
/wicket:panel
/html

 How to use
 java
form.add(new InlineHelp(emailHelp, If you want some notifications));
 html

Email notifications
input type=checkbox wicket:id=emailNotification/


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

2012-07-13 Thread Jered Myers

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, IModelString messageModel) {
   super(id, messageModel);
}

public InlineHelp(String id, String message) {
  super(id, Model.Stringof(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

?xml version=1.0 encoding=utf-8?
html xmlns:wicket=http://wicket.apache.org/;
wicket:panel
  
/wicket:panel

/html


How to use

java

form.add(new InlineHelp(emailHelp, If you want some notifications));

html

Email notifications
input type=checkbox wicket:id=emailNotification/


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






Custom XHTML tag

2012-07-12 Thread Jered Myers

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 
wicket:message.


Here is an example of the markup (just assume I am already contributing 
the JavaScript I need):
label wicket:for=firstNamewicket:label[First 
Name]/wicket:label/label*/wicket:tooltip/* key=firstNameTip

input type=text wicket:id=firstName

Properties file:
firstName=First Name
firstNameTip=This is the first name

Rendered it would look something like this:
label for=firstName221 class=requiredFirst Name/labelimg 
src=blah id=img323 title=This is the first name /

input type=text name=balh:firstName id=firstName221

Thanks for taking the time to read this!

Jered Myers