0

How to add simple formatting to ListItem or Comboitem labels?

asked 2012-10-16 17:49:17 +0800

mercibe gravatar image mercibe
6

updated 2012-10-16 18:15:03 +0800

Hi,

I would like to put some part of Listitem label in italic <i>, bold <strong> or <sup> for instance

Example:

1s item
2d item
...

Listitem don't allow child elements. Is there a way / workaround to put some HTML code directly inside the Listitem label ? I know I could develop a custom solution with a text field and a Grid to simulate what I need, but I would like to know if I am missing something simplier. Is it possible to prevent HTML escaping when setting Listitem label for instance, just like setContent for Comboitem? Comboitem is not an alternative to me since I need checkboxes (checkmark="true")

Thank you very much in advance.

Benoit

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-10-16 19:52:40 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

i think a custom renderer does fit your need.

	@Override
	public void render(Listitem item, Object data) throws Exception {

	MyBean obj = (MyBean) data;

	Listcell lc;
   . . .

		lc = new Listcell();
		Html html = new Html("This is italic");
		html.setStyle("font-style:italic; font-size: 11px; padding-left: 5px;");
		Div div = new Div();
		div.setAlign("left");
		div.appendChild(html);
		div.setParent(lc);
		lc.setParent(item);

   	     item.setValue(data);

. . .

best
Stephan

link publish delete flag offensive edit

answered 2012-10-17 20:10:17 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

You can also refer this example here

link publish delete flag offensive edit

answered 2012-10-25 04:29:45 +0800

mercibe gravatar image mercibe
6

Thank you Stephan. It works like a charm.
Best regards,
Benoit

link publish delete flag offensive edit

answered 2012-10-25 08:26:46 +0800

RichardL gravatar image RichardL
768 4

Just a note that using native components instead of the Html component would be lighter weight.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-10-16 17:49:17 +0800

Seen: 108 times

Last updated: Oct 25 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More