You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wo...@dachser.com on 2009/05/12 13:00:53 UTC

wicket.markup.html.basic.MultiLineLabel with Links, different word color inside?

Hi,

I have a request to put a link into a MultiLineLabel, or to set
some Words within the MultiLineLabel with a different color.

Is this possible in general?

thx
- jk



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket.markup.html.basic.MultiLineLabel with Links, different word color inside?

Posted by Jeremy Thomerson <je...@wickettraining.com>.
I've done similar things by creating a model that wraps another model.
 The outer model modifies the content of the inner model's string by
adding markup, converting links, etc...  This is really very effective
because you can actually separate the logic into multiple models if
you would like to...  And you could create your own MultiLineLabel
that automatically adds these models.

Tutorial on nested models:
http://www.jeremythomerson.com/blog/2008/11/06/wicket-the-power-of-nested-models/

For instance, you could nest multiple implementations like this:

public class OurCustomMultiLineLabel extends MultiLineLabel {

  public OurCustomMultiLineLabel(String id, IModel<String> model) {
    super(id);
    IModel<String> ourModel = new ConvertLinksModel(model);
    ourModel = new AddColorsModel(ourModel);
    setModel(ourModel);
    setEscapeModelStrings(false);
  }
}

--
Jeremy Thomerson
http://www.wickettraining.com




On Tue, May 12, 2009 at 6:00 AM,  <Wo...@dachser.com> wrote:
>
> Hi,
>
> I have a request to put a link into a MultiLineLabel, or to set
> some Words within the MultiLineLabel with a different color.
>
> Is this possible in general?
>
> thx
> - jk
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket.markup.html.basic.MultiLineLabel with Links, different word color inside?

Posted by Igor Vaynberg <ig...@gmail.com>.
add whatever markup you want to the label's model and call
setescapemodelstrings(false)

-igor

On Tue, May 12, 2009 at 4:00 AM,  <Wo...@dachser.com> wrote:
>
> Hi,
>
> I have a request to put a link into a MultiLineLabel, or to set
> some Words within the MultiLineLabel with a different color.
>
> Is this possible in general?
>
> thx
> - jk
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket.markup.html.basic.MultiLineLabel with Links, different word color inside?

Posted by Martin Grigorov <mc...@e-card.bg>.
Looking at the package name I think you are using Wicket 1.2.
Consider upgrade to 1.3.6 or even 1.4-rc4.

About the question: yes, it is possible. Wrap the words with <span
style="color: #xxxxxx">word</span> and call
multiLineLabel.setEscapeModelStrings(false)


El mar, 12-05-2009 a las 13:00 +0200, Wolfgang.Schele@dachser.com
escribió:
> Hi,
> 
> I have a request to put a link into a MultiLineLabel, or to set
> some Words within the MultiLineLabel with a different color.
> 
> Is this possible in general?
> 
> thx
> - jk
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org