You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Alex Tian <al...@hotmail.com> on 2006/07/06 11:32:20 UTC

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

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...

-- 
View this message in context: http://www.nabble.com/Family-Tree-web-app-problem-with-image-map-using-Tapestry-4..-tf1899555.html#a5196478
Sent from the Tapestry - Dev forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org