You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vince Marco <vm...@mac.com> on 2003/08/05 05:29:49 UTC
Anybody have an ismap example using a DirectLink?
I am converting a bunch of mapped images from Struts to Tapestry, and
time is of the essence (as if it ever isn't).
I would very much appreciate any examples anybody has in doing this.
Is there one in the examples that I missed?
Thanks,
Vince
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Vince Marco
Enterprise Frameworks, Inc.
vmarco@mac.com
Re: Anybody have an ismap example using a DirectLink?
Posted by Tore Halset <ha...@pvv.ntnu.no>.
On Mon, 4 Aug 2003, Vince Marco wrote:
> I am converting a bunch of mapped images from Struts to Tapestry, and
> time is of the essence (as if it ever isn't).
>
> I would very much appreciate any examples anybody has in doing this.
> Is there one in the examples that I missed?
Hello. I have a dynamic generated map that act as a serverside image map.
The user can click a feature to get more info about it.
<a jwcid="@ExternalLink" page="MapInfo" parameters=""
target="mapinfoframe"><img ismap="true" jwcid="@Image"
image="ognl:mapImageAsset"/></a>
* mapImageAsset is a dynamic image of a map using OpenMap.
* ismap="true" are not legal HTML, but tapestry would not take a single
"ismap".
* MapInfo implements IExternalPage and has some code in
activateExternalPage to extract the coordinates.
The generated html-code look like this:
<a href="/myapp/public?service=external/MapInfo&sp=S"
target="mapinfoframe"><img src="whatever" ismap="true"/></a>
The url when a user clicks the image:
/myapp/public?service=external/MapInfo&sp=S?124,284
The url contains two "?", but that is not a problem. It is easy to extract
the coordinates in IExternalPage's activateExternalPage.
Good luck!
- Tore.
RE: Anybody have an ismap example using a DirectLink?
Posted by David Solis <ds...@legosoft.com.mx>.
Here is another solution (used for implementing a photorealistic
calculator):
Put your map in the template, e.g.
<map name="buttons">
<area jwcid="clearDirect" shape="rect" coords="324,124,371,204"
alt="Clear"/>
<area jwcid="plusDirect" shape="rect" coords="262,124,308,203"
alt="Plus"/>
..........
..........
</map>
Now declare your "area" components in the page spec, i.e.:
<component id="clearDirect" type="DirectLink">
<binding name="renderer"
expression="@spoc.link.AreaLinkRenderer@SHARED_INSTANCE"/>
<binding name="stateful" expression="false"/>
<binding name="listener" expression='listeners.processButton'/>
<binding name="parameters"
expression="@spoc.pages.Calculator@CLEAR_BUTTON"/>
</component>
<component id="plusDirect" type="DirectLink">
<binding name="renderer"
expression="@spoc.link.AreaLinkRenderer@SHARED_INSTANCE"/>
<binding name="stateful" expression="false"/>
<binding name="listener" expression='listeners.processButton'/>
<binding name="parameters"
expression="@spoc.pages.Calculator@PLUS_BUTTON"/>
</component>
As you can see, the "area" components are DirectLinks with a custom
renderer: AreaLinkRenderer.
AreaLinkRenderer source is:
package spoc.link;
import org.apache.tapestry.link.DefaultLinkRenderer;
import org.apache.tapestry.link.ILinkRenderer;
public class AreaLinkRenderer extends DefaultLinkRenderer {
/**
* A singleton for the area link.
**/
public static final ILinkRenderer SHARED_INSTANCE = new
AreaLinkRenderer();
public String getElement()
{
return "area";
}
public boolean getHasBody()
{
return false;
}
}
You can use AreaLinkRenderer with any Link component.
Regards
David
> -----Original Message-----
> From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
> Sent: Tuesday, August 05, 2003 7:41 AM
> To: 'Tapestry users'
> Subject: RE: Anybody have an ismap example using a DirectLink?
>
> <?xml version="1.0"?>
> <!-- $Id: DirectArea.jwc,v 1.1 2003/07/12 04:16:44 hship Exp $ -->
> <!DOCTYPE component-specification PUBLIC
> "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
>
> <component-specification
> class="examples.DirectArea"
> allow-body="no" allow-informal-parameters="yes">
>
> <parameter name="listener" required="yes" direction="auto"
> type="org.apache.tapestry.IActionListener"/>
> <parameter name="parameters" type="java.lang.Object"
direction="in"/>
>
> </component-specification>
>
>
>
>
>
> package examples;
>
> import org.apache.tapestry.AbstractComponent;
> import org.apache.tapestry.IActionListener;
> import org.apache.tapestry.IDirect;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.Tapestry;
> import org.apache.tapestry.engine.IEngineService;
> import org.apache.tapestry.engine.ILink;
> import org.apache.tapestry.link.DirectLink;
>
> public abstract class DirectArea extends AbstractComponent implements
> IDirect
> {
> public abstract IActionListener getListener();
> public abstract Object getParameters();
>
> 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);
> }
>
> public void trigger(IRequestCycle cycle)
> {
> IActionListener listener = getListener();
>
> if (listener == null)
> throw Tapestry.createRequiredParameterException(this,
> "listener");
>
> listener.actionTriggered(this, cycle);
> }
>
> public boolean isStateful()
> {
> return false;
> }
>
> }
>
>
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
> > Sent: Tuesday, August 05, 2003 8:35 AM
> > To: 'Tapestry users'
> > Subject: RE: Anybody have an ismap example using a DirectLink?
> >
> >
> > Didn't mean to tease, ezmlm must be stripping out enclosures.
> >
> > --
> > Howard M. Lewis Ship
> > Creator, Tapestry: Java Web Components
> > http://jakarta.apache.org/tapestry
> >
> >
> >
> > > -----Original Message-----
> > > From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
> > > Sent: Tuesday, August 05, 2003 7:22 AM
> > > To: 'Tapestry users'
> > > Subject: RE: Anybody have an ismap example using a DirectLink?
> > >
> > >
> > > This is an example component from the book that does what you
> > > want. You don't use the DirectLink component, you re-use the
> > > direct service in a new component.
> > >
> > > --
> > > Howard M. Lewis Ship
> > > Creator, Tapestry: Java Web Components
> > > http://jakarta.apache.org/tapestry
> > >
> > >
> > >
> > > > -----Original
> > > Message-----
> > > > From: Vince Marco [mailto:vmarco@mac.com]
> > > > Sent: Monday, August 04, 2003 11:30 PM
> > > > To: tapestry-user@jakarta.apache.org
> > > > Subject: Anybody have an ismap example using a DirectLink?
> > > >
> > > >
> > > > I am converting a bunch of mapped images from Struts to
> > > Tapestry, and
> > > > time is of the essence (as if it ever isn't).
> > > >
> > > > I would very much appreciate any examples anybody has in
> > doing this.
> > > > Is there one in the examples that I missed?
> > > >
> > > > Thanks,
> > > >
> > > > Vince
> > > >
> > > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > > > Vince Marco
> > > > Enterprise Frameworks, Inc.
> > > > vmarco@mac.com
> > > >
> > >
> > >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
tapestry-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
RE: Anybody have an ismap example using a DirectLink?
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
<?xml version="1.0"?>
<!-- $Id: DirectArea.jwc,v 1.1 2003/07/12 04:16:44 hship Exp $ -->
<!DOCTYPE component-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<component-specification
class="examples.DirectArea"
allow-body="no" allow-informal-parameters="yes">
<parameter name="listener" required="yes" direction="auto"
type="org.apache.tapestry.IActionListener"/>
<parameter name="parameters" type="java.lang.Object" direction="in"/>
</component-specification>
package examples;
import org.apache.tapestry.AbstractComponent;
import org.apache.tapestry.IActionListener;
import org.apache.tapestry.IDirect;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.engine.IEngineService;
import org.apache.tapestry.engine.ILink;
import org.apache.tapestry.link.DirectLink;
public abstract class DirectArea extends AbstractComponent implements IDirect
{
public abstract IActionListener getListener();
public abstract Object getParameters();
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);
}
public void trigger(IRequestCycle cycle)
{
IActionListener listener = getListener();
if (listener == null)
throw Tapestry.createRequiredParameterException(this, "listener");
listener.actionTriggered(this, cycle);
}
public boolean isStateful()
{
return false;
}
}
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
> -----Original Message-----
> From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
> Sent: Tuesday, August 05, 2003 8:35 AM
> To: 'Tapestry users'
> Subject: RE: Anybody have an ismap example using a DirectLink?
>
>
> Didn't mean to tease, ezmlm must be stripping out enclosures.
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
> > Sent: Tuesday, August 05, 2003 7:22 AM
> > To: 'Tapestry users'
> > Subject: RE: Anybody have an ismap example using a DirectLink?
> >
> >
> > This is an example component from the book that does what you
> > want. You don't use the DirectLink component, you re-use the
> > direct service in a new component.
> >
> > --
> > Howard M. Lewis Ship
> > Creator, Tapestry: Java Web Components
> > http://jakarta.apache.org/tapestry
> >
> >
> >
> > > -----Original
> > Message-----
> > > From: Vince Marco [mailto:vmarco@mac.com]
> > > Sent: Monday, August 04, 2003 11:30 PM
> > > To: tapestry-user@jakarta.apache.org
> > > Subject: Anybody have an ismap example using a DirectLink?
> > >
> > >
> > > I am converting a bunch of mapped images from Struts to
> > Tapestry, and
> > > time is of the essence (as if it ever isn't).
> > >
> > > I would very much appreciate any examples anybody has in
> doing this.
> > > Is there one in the examples that I missed?
> > >
> > > Thanks,
> > >
> > > Vince
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > > Vince Marco
> > > Enterprise Frameworks, Inc.
> > > vmarco@mac.com
> > >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
RE: Anybody have an ismap example using a DirectLink?
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Didn't mean to tease, ezmlm must be stripping out enclosures.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
> -----Original Message-----
> From: Howard M. Lewis Ship [mailto:hlship@comcast.net]
> Sent: Tuesday, August 05, 2003 7:22 AM
> To: 'Tapestry users'
> Subject: RE: Anybody have an ismap example using a DirectLink?
>
>
> This is an example component from the book that does what you
> want. You don't use the DirectLink component, you re-use the
> direct service in a new component.
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original
> Message-----
> > From: Vince Marco [mailto:vmarco@mac.com]
> > Sent: Monday, August 04, 2003 11:30 PM
> > To: tapestry-user@jakarta.apache.org
> > Subject: Anybody have an ismap example using a DirectLink?
> >
> >
> > I am converting a bunch of mapped images from Struts to
> Tapestry, and
> > time is of the essence (as if it ever isn't).
> >
> > I would very much appreciate any examples anybody has in doing this.
> > Is there one in the examples that I missed?
> >
> > Thanks,
> >
> > Vince
> >
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> > Vince Marco
> > Enterprise Frameworks, Inc.
> > vmarco@mac.com
> >
>
>
RE: Anybody have an ismap example using a DirectLink?
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
This is an example component from the book that does what you want. You don't use the DirectLink
component, you re-use the direct service in a new component.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
> -----Original Message-----
> From: Vince Marco [mailto:vmarco@mac.com]
> Sent: Monday, August 04, 2003 11:30 PM
> To: tapestry-user@jakarta.apache.org
> Subject: Anybody have an ismap example using a DirectLink?
>
>
> I am converting a bunch of mapped images from Struts to Tapestry, and
> time is of the essence (as if it ever isn't).
>
> I would very much appreciate any examples anybody has in doing this.
> Is there one in the examples that I missed?
>
> Thanks,
>
> Vince
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Vince Marco
> Enterprise Frameworks, Inc.
> vmarco@mac.com
>