Re: help please, problem with image map using Tapestry 4 !!!

2006-07-08 Thread Peter Svensson

Hmm. I did something similar recently, but chickened out on all the
complicated stuff, you might say.

I made a map service which reads and parses (Thanks to geotools!) map
shapefiles and then build images of the maps, and returns the coords for the
current map, so that I get a nice click-through effect.

I only use a regular hml image map, but with an @Any tag, and get the
current coords and the target url from the current map object. Hope that
helps,

Cheers,
PS

On 7/6/06, Alex Tian <[EMAIL PROTECTED]> wrote:



Jessek, I don't quite understand what you said. did you mean I should
modify
DirectArea.java?

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  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 
tags will be in .html for image map and I have to specify the "coords"
attribute in each  tag myself. Because in my web app, I don't know
how
many family memebers'names the user will provide( the number of  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  is unknown), say this time there should be 1  tag(1
clickable area on that image) and the coords value is "10,10 10,10", but
next time user wants 2  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  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 
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/help-please%2C-problem-with-image-map-using-Tapestry-4-%21%21%21-tf1897938.html#a5196425
Sent from the Tapestry - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: help please, problem with image map using Tapestry 4 !!!

2006-07-06 Thread Alex Tian

Jessek, I don't quite understand what you said. did you mean I should modify
DirectArea.java?

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  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 
tags will be in .html for image map and I have to specify the "coords"
attribute in each  tag myself. Because in my web app, I don't know how
many family memebers'names the user will provide( the number of  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  is unknown), say this time there should be 1  tag(1
clickable area on that image) and the coords value is "10,10 10,10", but
next time user wants 2  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  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 
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/help-please%2C-problem-with-image-map-using-Tapestry-4-%21%21%21-tf1897938.html#a5196425
Sent from the Tapestry - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: help please, problem with image map using Tapestry 4 !!!

2006-07-05 Thread Jesse Kuhnert

The easiest option (imho) would be to use the java 2d api (should be
perfectly safe in server mode) to find the image size on the server and use
those values to write to your DirectArea.

On 7/5/06, Alex Tian <[EMAIL PROTECTED]> wrote:



Hi, everyone, I'm a beginner with tapestry 4 and got stuck with a problem
for
3 weeks already...

my task is:
1. create a dynamic image based on some data provided from user's input
2. create a buffered image and display that image on the page
3. use image map to make some regions of that image clickable

now I've done the first 2 steps and part of the 3rd step. In step 3, I
used
@DirectArea custom component(explained in Tapestry in Action as well as
used
in the Pet Shop example) to create the image map, but I cannot dynamically
specify the "coords" attribute in  tag which is inside  tag.

@DirectArea component statically pre-defines the "coords" attribute in
.html
file(e.g.  ), because as for Pet Shop example the image
already
exists whereas in my case that buffered image will be created dynamically
and sends to OutputStream to display it. What I want is to take the
"coords"
attribute's value from user input at the same time in step 1 and specify
the
"coords" attribute(for example: pass "50, 50 50,50" as a string)  for
image
map after creating the buffered image.

should I modify the DirectArea.java?

does anyone have any idea how to make it...?

many thanks in advance.

--
View this message in context:
http://www.nabble.com/help-please%2C-problem-with-image-map-using-Tapestry-4-%21%21%21-tf1897938.html#a5192038
Sent from the Tapestry - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.


help please, problem with image map using Tapestry 4 !!!

2006-07-05 Thread Alex Tian

Hi, everyone, I'm a beginner with tapestry 4 and got stuck with a problem for
3 weeks already...

my task is:
1. create a dynamic image based on some data provided from user's input
2. create a buffered image and display that image on the page
3. use image map to make some regions of that image clickable

now I've done the first 2 steps and part of the 3rd step. In step 3, I used
@DirectArea custom component(explained in Tapestry in Action as well as used
in the Pet Shop example) to create the image map, but I cannot dynamically
specify the "coords" attribute in  tag which is inside  tag.

@DirectArea component statically pre-defines the "coords" attribute in .html
file(e.g.  ), because as for Pet Shop example the image already
exists whereas in my case that buffered image will be created dynamically
and sends to OutputStream to display it. What I want is to take the "coords"
attribute's value from user input at the same time in step 1 and specify the
"coords" attribute(for example: pass "50, 50 50,50" as a string)  for image
map after creating the buffered image.

should I modify the DirectArea.java?

does anyone have any idea how to make it...? 

many thanks in advance.

-- 
View this message in context: 
http://www.nabble.com/help-please%2C-problem-with-image-map-using-Tapestry-4-%21%21%21-tf1897938.html#a5192038
Sent from the Tapestry - User forum at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]