Re: Setting text content of component

2008-03-27 Thread Gerolf Seitz
you can also roll your own TextLink very easily:

class textlink extends link {
  public textlink(id, model) {
super(id, model);
  }

  protected void onComponentTagBody(...) {
replaceComponentTagBody(..., getModelObjectAsString());
  }
}

this way you don't need a label inside the link.

  Gerolf



On Wed, Mar 26, 2008 at 4:01 PM, Jörn Zaefferer 
[EMAIL PROTECTED] wrote:

 I keep stumbling about components where I'm (afaik) forced to add
 child components just to set their text content. Common examples are
 ListView items and Links. I'd like to set the text content of a li
 or a element without adding another child component (to give it a
 wicket:id and add a Label).

 Any solution to that?

 Jörn

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Setting text content of component

2008-03-27 Thread Timo Rantalaiho
On Wed, 26 Mar 2008, Maurice Marrink wrote:
 In wicket you have to assign a Label to an Item or a Link. The
 corresponding markup would then be something like:
 li wicket:id=itemspan wicket:id=label/span/li
 However it is possible to remove the span for the label from the final
 markup send to the browser by using label.setRenderBodyOnly(true);

Another functionally equivalent alternative is

  li wicket:id=item
wicket:container wicket:id=label/wicket:container
  /li

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Setting text content of component

2008-03-26 Thread Jörn Zaefferer
I keep stumbling about components where I'm (afaik) forced to add
child components just to set their text content. Common examples are
ListView items and Links. I'd like to set the text content of a li
or a element without adding another child component (to give it a
wicket:id and add a Label).

Any solution to that?

Jörn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Setting text content of component

2008-03-26 Thread Maurice Marrink
In wicket you have to assign a Label to an Item or a Link. The
corresponding markup would then be something like:
li wicket:id=itemspan wicket:id=label/span/li
However it is possible to remove the span for the label from the final
markup send to the browser by using label.setRenderBodyOnly(true);
So where you markupfile would look like the above the user would see
lisome text/li

Maurice

On Wed, Mar 26, 2008 at 4:01 PM, Jörn Zaefferer
[EMAIL PROTECTED] wrote:
 I keep stumbling about components where I'm (afaik) forced to add
  child components just to set their text content. Common examples are
  ListView items and Links. I'd like to set the text content of a li
  or a element without adding another child component (to give it a
  wicket:id and add a Label).

  Any solution to that?

  Jörn

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Setting text content of component

2008-03-26 Thread Jörn Zaefferer
Thanks Maurice, that was exactly what I was looking for!

Jörn

On Wed, Mar 26, 2008 at 4:30 PM, Maurice Marrink [EMAIL PROTECTED] wrote:
 In wicket you have to assign a Label to an Item or a Link. The
  corresponding markup would then be something like:
  li wicket:id=itemspan wicket:id=label/span/li
  However it is possible to remove the span for the label from the final
  markup send to the browser by using label.setRenderBodyOnly(true);
  So where you markupfile would look like the above the user would see
  lisome text/li

  Maurice



  On Wed, Mar 26, 2008 at 4:01 PM, Jörn Zaefferer
  [EMAIL PROTECTED] wrote:
   I keep stumbling about components where I'm (afaik) forced to add
child components just to set their text content. Common examples are
ListView items and Links. I'd like to set the text content of a li
or a element without adding another child component (to give it a
wicket:id and add a Label).
  
Any solution to that?
  
Jörn
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  

  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]