You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smoothe19 <sa...@justassociates.com> on 2015/11/18 17:43:50 UTC

Adding line breaks in MessageDialog

How can I add line breaks in the message content of a message dialog?

I have tried
String message = "Text here:<br/> More text " ;
  Dialog.setEscapeModelStrings(false);
  Dialog.setModelObject(message);

failed to work

HTML:
<div wicket:id="dialog"></div>

java:
private void createDialog(){
        Dialog = new MessageDialog("dialog", "Information", "Text Here <br/>
Text",
          DialogButtons.YES_NO, DialogIcon.WARN) {
          

         public void onClose(AjaxRequestTarget target, DialogButton button)
{
           
             
          }
       };

       add(Dialog);
    }

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Adding-line-breaks-in-MessageDialog-tp4672659.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Adding line breaks in MessageDialog

Posted by Sebastien <se...@gmail.com>.
Hi,

You have to override #newLabel like this:

            @Override
            protected Component newLabel(String id, IModel<String> model)
            {
                return super.newLabel(id,
model).setEscapeModelStrings(false);
            }

Hope this helps,
Sebastien.


On Wed, Nov 18, 2015 at 5:43 PM, smoothe19 <sa...@justassociates.com>
wrote:

> How can I add line breaks in the message content of a message dialog?
>
> I have tried
> String message = "Text here:<br/> More text " ;
>   Dialog.setEscapeModelStrings(false);
>   Dialog.setModelObject(message);
>
> failed to work
>
> HTML:
> <div wicket:id="dialog"></div>
>
> java:
> private void createDialog(){
>         Dialog = new MessageDialog("dialog", "Information", "Text Here
> <br/>
> Text",
>           DialogButtons.YES_NO, DialogIcon.WARN) {
>
>
>          public void onClose(AjaxRequestTarget target, DialogButton button)
> {
>
>
>           }
>        };
>
>        add(Dialog);
>     }
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Adding-line-breaks-in-MessageDialog-tp4672659.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>