Seems to me you could implement an MapArea component pretty easily.  Have it take a listener and all that ... just like an DirectLink.
 
Basically, you can get the right IEngineService from the IEngine.
 
You can get a Gesture from the service.
 
The Gesture will provide you with the URL.
 
----- Original Message -----
Sent: Thursday, December 05, 2002 1:27 PM
Subject: [Tapestry-developer] DirectLink

Hello,

 

I�ve a page which contains an image map and each area has associated an action, in fact a direct action.

 

The  implementation is:

 

HTML

<span jwcid="hiddenZone">

<a jwcid="link">link</a>

</span>

<img jwcid="bottomImage" src="/images/bottom.jpeg" border=0 usemap="#buttons" width="426" height="258"/>

 

<map name="buttons">

  <area shape="rect" coords="324,124,371,204" href="calculator?service=direct&context=Home/link&sp=Sclear" alt="Clear"/>

  <area shape="rect" coords="262,124,308,203" href="calculator?service=direct&context=Home/link&sp=Splus" alt="Plus"/>

  <area shape="rect" coords="325,79,370,112" href="calculator?service=direct&context=Home/link&sp=Snegate" alt="Negate"/>

  <area shape="rect" coords="324,33,368,67" href="calculator?service=direct&context=Home/link&sp=Sdivide" alt="Divide"/>

  <area shape="rect" coords="262,77,308,112" href="calculator?service=direct&context=Home/link&sp=Sminus" alt="Subtract"/>

  <area shape="rect" coords="261,34,308,66" href="calculator?service=direct&context=Home/link&sp=Stimes" alt="Times"/>

  <area shape="rect" coords="192,171,250,204" href="calculator?service=direct&context=Home/link&sp=Sequals" alt="Equals"/>

  <area shape="rect" coords="132,170,179,205" href="calculator?service=direct&context=Home/link&sp=Spoint" alt="Point"/>

</map>

 

Page

    <component id="hiddenZone" type="Conditional"/>

    <component id="link" type="DirectLink">

        <binding name="listener" expression='listeners.processButton'/>

    </component>

    <component id="bottomImage" type="Image">

        <binding name="image" expression='assets.bottomImage'/>

    </component>

    <context-asset name="bottomImage" path="/images/bottom.jpeg"/>

 

I had to  declare a DirectLink even though it�s invisible and I encoded the URL for each area by hand. From my point of view this is ugly and depends on Tapestry internals.

We�ve a menu implemented with javascript and used the same technique to solve this.

My concern is why the DirectLink is just for html links? � Yes, I know this is a silly question; I guess these cases probably are exceptions for many applications, however I�m wondering if there is a general method to deal with direct actions?

 

Is there a better way to encode the href elements?

 

 

Regards

 

David

Reply via email to