You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by PDiefent <pd...@csc.com> on 2014/02/27 11:15:24 UTC

StringResourceModel

Hi,
I just ran into a problem generating a confirmation for a delete request.
I'm using an AjaxCallListener to build the confirmation message:

public class AjaxConfimListener extends AjaxCallListener {
	private static final long serialVersionUID = 1L;
	private final LinkIcon icon; 

	public AjaxConfimListener(final LinkIcon linkIcon) {
		super();
		this.icon = linkIcon;
	}
	
	@Override
	public CharSequence getPrecondition(
			Component component) {
		return "if (confirm (\"" 
			+ new
StringResourceModel("confirm"+icon.name()+"."+component.getPage().getClass().getSimpleName(),
					component.getPage(),
					component.getParent().getDefaultModel()).getString()
			+ "\")) { return true;} else { return false;}";
	}


The problem rises with the StringResourceModel. The message is composed with
information of the item to delete:

confirmDELETE.Detail='${name}' wirklich löschen?
  
The getter getName() of the component returns a string like "Buster "The
But" Baggin" with double quotes inside. I suppose that while rendering the
String I will need something like "Buster &quot;The But&quot; Baggin" as a
result.

Is there any help inside Wicket to render the string like this?

Thanks a lot, Peter

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/StringResourceModel-tp4664706.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: StringResourceModel

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Strings#escapeMarkup?


On Thu, Feb 27, 2014 at 11:15 AM, PDiefent <pd...@csc.com> wrote:

> Hi,
> I just ran into a problem generating a confirmation for a delete request.
> I'm using an AjaxCallListener to build the confirmation message:
>
> public class AjaxConfimListener extends AjaxCallListener {
>         private static final long serialVersionUID = 1L;
>         private final LinkIcon icon;
>
>         public AjaxConfimListener(final LinkIcon linkIcon) {
>                 super();
>                 this.icon = linkIcon;
>         }
>
>         @Override
>         public CharSequence getPrecondition(
>                         Component component) {
>                 return "if (confirm (\""
>                         + new
> StringResourceModel("confirm"+icon.name
> ()+"."+component.getPage().getClass().getSimpleName(),
>                                         component.getPage(),
>
> component.getParent().getDefaultModel()).getString()
>                         + "\")) { return true;} else { return false;}";
>         }
>
>
> The problem rises with the StringResourceModel. The message is composed
> with
> information of the item to delete:
>
> confirmDELETE.Detail='${name}' wirklich löschen?
>
> The getter getName() of the component returns a string like "Buster "The
> But" Baggin" with double quotes inside. I suppose that while rendering the
> String I will need something like "Buster &quot;The But&quot; Baggin" as a
> result.
>
> Is there any help inside Wicket to render the string like this?
>
> Thanks a lot, Peter
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/StringResourceModel-tp4664706.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro