Yes a world map will be tricky but this is still a cool solution :-) sean
On 8/18/05, Sunil Tiwari <[EMAIL PROTECTED]> wrote: > Hi Sean, > > Thanx for this useful information. > I searched a lot yesterday on this topic and I got the same information that > you have provided. > We can use image in the commandButton and can get the pixel coordinates when > clicked anywhere on the image. > And then this coordinate can be used to divide the image into various > regions. > > The problem will be mapping if the image is complex like a world map and you > want to click on any country. > > I am also looking into html IMG tag and usemap. > I can call a javascript on the <Area> tag and pass on a parameter and this > parameter can furthur be passed on to the managed bean. > I will try implementing this way and tell the result later on. > > Thanx again for following it up! > > Regards, > Sunil > > ----- Original Message ----- > From: "Sean Schofield" <[EMAIL PROTECTED]> > To: "MyFaces Discussion" <[email protected]> > Sent: Friday, August 19, 2005 3:54 AM > Subject: Re: How to find out the co-ordinates when I click on a world > map(Image)? > > > >I am in the process of re-reading the excellent Core JSF book by Geary > > and Horstmann. (I had initially only skimmed it having already read 3 > > other JSF books.) There are some interesting nuggets in there > > including the following: > > > > According to them, you can do this with <h:commandButton> and a > > combination of action and actionListener. > > > > <h:commandButton image="foo.jpg" actionListener="#{backer.listen}" > > action="#{backer.act}"/> > > > > I was suprised that you can apparently get the mouse click coordinates > > from the listener ... you can then set a variable in the backer so > > that your action method can use it in navigation (if that's what you > > need.) > > > > public void listen(ActionEvent e) > > { > > ... > > > > Map requestParams = > > context.getExternalContext().getRequestParameterMap(); > > int x = new Integer((String)requestParams.get(clientId + > > ".x")).intValue(); > > > > ... > > } > > > > There is more great stuff like this in Core JSF so check it out! > > > > sean > > > > > > On 8/18/05, Sunil Tiwari <[EMAIL PROTECTED]> wrote: > >> Hi, > >> > >> Cld you give me this component so that I can try implementing the same on > >> websphere? > >> > >> Thanx > >> Sunil > >> > >> ----- Original Message ----- > >> From: "Mario Ivankovits" <[EMAIL PROTECTED]> > >> To: "MyFaces Discussion" <[email protected]> > >> Sent: Wednesday, August 17, 2005 7:24 PM > >> Subject: Re: How to find out the co-ordinates when I click on a world > >> map(Image)? > >> > >> > >> > Martin Marinschek wrote: > >> >>Ideally, > >> >> > >> >>you would build an image map JSF component. > >> >> > >> > I already created such a component,, but maybe its too limited to get > >> > added to myfaces. > >> > Its sort of "my first component" and maybe too restricted to my > >> > application. > >> > I used it in conjunction with jfreechart to be able to click into the > >> > graph. > >> > > >> > It works like this: > >> > > >> > <h:inputHidden id="annotateEvent" > >> > value="#{AnnotationForm.eventNumber}"/> > >> > <h:graphicImage > >> > binding="#{EventDataProvider.image}" > >> > url="#{EventDataProvider.url}" > >> > alt="WateringData" > >> > width="900" > >> > height="600" > >> > usemap="#CHART_TOOLTIP" > >> > /> > >> > <s:area > >> > mapName = "CHART_TOOLTIP" > >> > action = "annotateSpot" > >> > areas="#{EventDataProvider.areas}" > >> > destField="annotateEvent" > >> > /> > >> > > >> > The hidden field is required for the s:area component (see destField=). > >> > With my knowledge today I could get rid of this hidden field. > >> > The areas are passed in through an ArrayList of ImageMapArea.java > >> > instances which is a simple bean with "shape, coords, title and data". > >> > data is the value you might find in "destField" then. > >> > > >> > Sayed all that: If one find it useable that way I can contribute it. > >> > > >> > > >> > --- > >> > Mario > >> > >> > >

