You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Charles Moulliard <cm...@gmail.com> on 2011/08/15 12:28:00 UTC

onClick on Image

Hi,

I would like to change the Locale setting when we click on a Image (flag
corresponding to the Locale - France, UK, ...).

So in my HTML page, I have defined the following HTML 

#   

and in the corresponding Wicket Class, the following code :

        Link link = new Link("goFrench") {
			@Override
			public void onClick() {
				getSession().setLocale(Locale.FRANCE);
			}
		};


        add(link).add(new Image("frenchFlag", new
ResourceReference(BasePage.class, "images/karaf-logo.png")));

But when I open the page in my browser, I get this error :

WicketMessage: Unable to find component with id 'frenchFlag' in
[MarkupContainer [Component id = goFrench]]. This means that you declared
wicket:id=frenchFlag in your markup, but that you either did not add the
component to your page at all, or that the hierarchy does not match.

Any help is welcome.

Regards,

Charles M. - Apache Committer

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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: onClick on Image

Posted by Charles Moulliard <cm...@gmail.com>.
Here is the code which was missing from my topic post -->

" #   "

Regards,

Charles
   


Иванов Дмитрий wrote:
> 
> And what is your markup?
> 
> 15 Август 2011 г. 16:28:00, Charles Moulliard писал:
>>
>> Hi,
>>
>> I would like to change the Locale setting when we click on a Image (flag
>> corresponding to the Locale - France, UK, ...).
>>
>> So in my HTML page, I have defined the following HTML
>>
>> #
>>
>> and in the corresponding Wicket Class, the following code :
>>
>> Link link = new Link("goFrench") {
>> @Override
>> public void onClick() {
>> getSession().setLocale(Locale.FRANCE);
>> }
>> };
>>
>>
>> add(link).add(new Image("frenchFlag", new
>> ResourceReference(BasePage.class, "images/karaf-logo.png")));
>>
>> But when I open the page in my browser, I get this error :
>>
>> WicketMessage: Unable to find component with id 'frenchFlag' in
>> [MarkupContainer [Component id = goFrench]]. This means that you declared
>> wicket:id=frenchFlag in your markup, but that you either did not add the
>> component to your page at all, or that the hierarchy does not match.
>>
>> Any help is welcome.
>>
>> Regards,
>>
>> Charles M. - Apache Committer
>>
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Иванов Дмитрий wrote:
> 
> And what is your markup?
> 
> 15 Август 2011 г. 16:28:00, Charles Moulliard писал:
>>
>> Hi,
>>
>> I would like to change the Locale setting when we click on a Image (flag
>> corresponding to the Locale - France, UK, ...).
>>
>> So in my HTML page, I have defined the following HTML
>>
>> #
>>
>> and in the corresponding Wicket Class, the following code :
>>
>> Link link = new Link("goFrench") {
>> @Override
>> public void onClick() {
>> getSession().setLocale(Locale.FRANCE);
>> }
>> };
>>
>>
>> add(link).add(new Image("frenchFlag", new
>> ResourceReference(BasePage.class, "images/karaf-logo.png")));
>>
>> But when I open the page in my browser, I get this error :
>>
>> WicketMessage: Unable to find component with id 'frenchFlag' in
>> [MarkupContainer [Component id = goFrench]]. This means that you declared
>> wicket:id=frenchFlag in your markup, but that you either did not add the
>> component to your page at all, or that the hierarchy does not match.
>>
>> Any help is welcome.
>>
>> Regards,
>>
>> Charles M. - Apache Committer
>>
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Иванов Дмитрий wrote:
> 
> And what is your markup?
> 
> 15 Август 2011 г. 16:28:00, Charles Moulliard писал:
>>
>> Hi,
>>
>> I would like to change the Locale setting when we click on a Image (flag
>> corresponding to the Locale - France, UK, ...).
>>
>> So in my HTML page, I have defined the following HTML
>>
>> #
>>
>> and in the corresponding Wicket Class, the following code :
>>
>> Link link = new Link("goFrench") {
>> @Override
>> public void onClick() {
>> getSession().setLocale(Locale.FRANCE);
>> }
>> };
>>
>>
>> add(link).add(new Image("frenchFlag", new
>> ResourceReference(BasePage.class, "images/karaf-logo.png")));
>>
>> But when I open the page in my browser, I get this error :
>>
>> WicketMessage: Unable to find component with id 'frenchFlag' in
>> [MarkupContainer [Component id = goFrench]]. This means that you declared
>> wicket:id=frenchFlag in your markup, but that you either did not add the
>> component to your page at all, or that the hierarchy does not match.
>>
>> Any help is welcome.
>>
>> Regards,
>>
>> Charles M. - Apache Committer
>>
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744330.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: onClick on Image

Posted by "Dmitriy V. Ivanov" <iv...@prognoz.ru>.
And what is your markup?

15 Август 2011 г. 16:28:00, Charles Moulliard писал:
>
> Hi,
>
> I would like to change the Locale setting when we click on a Image (flag
> corresponding to the Locale - France, UK, ...).
>
> So in my HTML page, I have defined the following HTML
>
> #
>
> and in the corresponding Wicket Class, the following code :
>
> Link link = new Link("goFrench") {
> @Override
> public void onClick() {
> getSession().setLocale(Locale.FRANCE);
> }
> };
>
>
> add(link).add(new Image("frenchFlag", new
> ResourceReference(BasePage.class, "images/karaf-logo.png")));
>
> But when I open the page in my browser, I get this error :
>
> WicketMessage: Unable to find component with id 'frenchFlag' in
> [MarkupContainer [Component id = goFrench]]. This means that you declared
> wicket:id=frenchFlag in your markup, but that you either did not add the
> component to your page at all, or that the hierarchy does not match.
>
> Any help is welcome.
>
> Regards,
>
> Charles M. - Apache Committer
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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
>

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


Re: onClick on Image

Posted by Charles Moulliard <cm...@gmail.com>.
Thx for the remark. That works now.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744332.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: onClick on Image

Posted by Bas Gooren <ba...@iswd.nl>.
If the image is inside the link, your code should read:

add(link);
link.add(new Image(...));

Bas

Op 15-8-2011 12:28, schreef Charles Moulliard:
> Hi,
>
> I would like to change the Locale setting when we click on a Image (flag
> corresponding to the Locale - France, UK, ...).
>
> So in my HTML page, I have defined the following HTML
>
> #
>
> and in the corresponding Wicket Class, the following code :
>
>          Link link = new Link("goFrench") {
> 			@Override
> 			public void onClick() {
> 				getSession().setLocale(Locale.FRANCE);
> 			}
> 		};
>
>
>          add(link).add(new Image("frenchFlag", new
> ResourceReference(BasePage.class, "images/karaf-logo.png")));
>
> But when I open the page in my browser, I get this error :
>
> WicketMessage: Unable to find component with id 'frenchFlag' in
> [MarkupContainer [Component id = goFrench]]. This means that you declared
> wicket:id=frenchFlag in your markup, but that you either did not add the
> component to your page at all, or that the hierarchy does not match.
>
> Any help is welcome.
>
> Regards,
>
> Charles M. - Apache Committer
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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: onClick on Image

Posted by vineet semwal <vi...@gmail.com>.
add(link).add(new Image("frenchFlag", new
ResourceReference(BasePage.class, "images/karaf-logo.png")));

^^ is the problem
add(link)  actually returns the container to which you are adding
component so you are actually not adding image to link

and i think in your html you have specified image to be child of link
is what error saying..

On Mon, Aug 15, 2011 at 3:58 PM, Charles Moulliard <cm...@gmail.com> wrote:
> Hi,
>
> I would like to change the Locale setting when we click on a Image (flag
> corresponding to the Locale - France, UK, ...).
>
> So in my HTML page, I have defined the following HTML
>
> #
>
> and in the corresponding Wicket Class, the following code :
>
>        Link link = new Link("goFrench") {
>                        @Override
>                        public void onClick() {
>                                getSession().setLocale(Locale.FRANCE);
>                        }
>                };
>
>
>        add(link).add(new Image("frenchFlag", new
> ResourceReference(BasePage.class, "images/karaf-logo.png")));
>
> But when I open the page in my browser, I get this error :
>
> WicketMessage: Unable to find component with id 'frenchFlag' in
> [MarkupContainer [Component id = goFrench]]. This means that you declared
> wicket:id=frenchFlag in your markup, but that you either did not add the
> component to your page at all, or that the hierarchy does not match.
>
> Any help is welcome.
>
> Regards,
>
> Charles M. - Apache Committer
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/onClick-on-Image-tp3744299p3744299.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
>
>



-- 
thank you,

regards,
Vineet Semwal

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