The Artima Developer Community
Sponsored Link

Java Answers Forum
Family Tree web app problem with image map using Tapestry 4.

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Alex Tian

Posts: 3
Nickname: alextian
Registered: Jul, 2006

Family Tree web app problem with image map using Tapestry 4. Posted: Jul 6, 2006 2:37 AM
Reply to this message Reply
Advertisement
hi, everyone, I know it's gonna be a lenthy statement below, but I desperately need help...

my task actually is to build a "family tree" web application, for simplicity, e.g. User enters his/her name and his relatives'names (e.g. his parents' names and children's names ) and sumbit the form (triggers a listener in that page's .java file). What I do is generate a tree-like image to show the relations among them (use only rectangles with lines to connect them, on each rectangle write proper family member's name which the user entered) and display it on the page and use image map to make those rectangles on the image clickable (e.g. user can link to a person's detail page), because the I don't know what relations will be among those family members and how many names the user will enter, so I cannot pre-define the coords attribute and the number of <area> tags for "image map".

As I said in the first post, I managed to generate the buffered image and display it on the page, I used 2 classes and 1 interface exactly as Chart example in Workbench example (IChartProvider.java, ChartService.java, ChartAsset.java). and I used DirectArea custom component in Virtual Library example implemented image map on this newly created image, the DirectArea custom component in Virtual Library example to implement the image map so that when user clicks a region of the image, it is just a link to another page.

The problem now is I don't know how many <area jwcid="@DirectArea" .../> tags will be in .html for image map and I have to specify the "coords" attribute in each <area> tag myself. Because in my web app, I don't know how many family memebers'names the user will provide( the number of <area> tag is unknown) and what relations will be among them ( the rectangle's coordinates on the image will be different everytime, so the "coords" value in each <area> is unknown), say this time there should be 1 <area> tag(1 clickable area on that image) and the coords value is "10,10 10,10", but next time user wants 2 <area> tags(2 clickable area on that image) and the coords value are "20,20 20,20 ", "30,30 30,30" that's what DirectArea.java does not do, because the coords attribute's value is already specified in .html and the number of <area> tag doesn't change. I know there is a way to specify coords value in DirectArea.java in the method below:

protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
if (cycle.isRewinding())
return;

Object[] parameters = DirectLink.constructServiceParameters(getParameters

());

IEngineService service = cycle.getEngine().getService

(Tapestry.DIRECT_SERVICE);
ILink link = service.getLink(cycle, this, parameters);

writer.beginEmpty("area");
writer.attribute("href", link.getURL());

renderInformalParameters(writer, cycle);
}

I can write "writer.attribute("coords", "10, 10 10,10");" after "writer.attribute("href", link.getURL());"
but since DirectArea is a component, everytime I use DirectArea component, the coords value would be same, that even makes it worse than specifying the coords's value in .html, because for each <area jwcid="@DirectArea" ... /> one can specify the coords'value differently.

Do I have to create a new custome component of my own, if so, can I extend the DirectArea component's feature, modify the DirectArea.java and How ?

thanks very much...

Topic: help please, problem with image map using Tapestry 4 !!! Previous Topic   Next Topic Topic: Null Value for JFormattedTextField

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use