onClick on Image

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

onClick on Image

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

french flag

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
Reply | Threaded
Open this post in threaded view
|

Re: onClick on Image

Sebastian
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: onClick on Image

Иванов Дмитрий
In reply to this post by Charles Moulliard
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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: onClick on Image

vineetsemwal
In reply to this post by Charles Moulliard
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
thank you,

regards,
Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: onClick on Image

Charles Moulliard
In reply to this post by Иванов Дмитрий
Here is the code which was missing from my topic post -->

"french flag"

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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Иванов Дмитрий 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Иванов Дмитрий 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: onClick on Image

Charles Moulliard
In reply to this post by Sebastian
Thx for the remark. That works now.