You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jabbar <aj...@gmail.com> on 2005/11/14 14:21:20 UTC

How to create a url to call a listener in a page class

Hello all,
I have created a custom component using the @Any tag

<span jwcid="@Foreach" source="ognl:getMapAreas(profileRow.startDate,
profileRow.endDate, 150,100)" value="ognl:mapArea">
		<area jwcid="@Any" shape="rect" coords="ognl:getCoords(mapArea)"
href="ognl:getURL(mapArea.startDate, mapArea.endDate, 800,700)"/>
	</span>

I want the href attribute to contain the url to call

public void doDailyTotalProfile(Date startDate, Date endDate, int
width, int height)

in my page class.

Does anybody have any pointers to how I can do this?

--
Thanks

Jabbar Azam

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


Re: How to create a url to call a listener in a page class

Posted by Jabbar <aj...@gmail.com>.
I love tapestry and OGNL :))))

On 15/11/05, Oleg Batrashev <og...@gmail.com> wrote:
> You could refer to the component directly from html, no need for getURL() method
>
> Like this
> <area jwcid="chart@Any" shape="rect"
> coords="ognl:getCoords(mapArea)"
> href="ognl:components.directlink.getLink(requestCycle).getURL()"/>
>
> But I think its kind of hack - create component only for getting some
> value from it, although I did it myself.
>
> Oleg
>
> On 11/15/05, Jabbar <aj...@gmail.com> wrote:
> > You're right Leonardo!
> >
> > I've solved the problem anyway :p
> >
> > On my html page I've added a directlink component whose behaviour I
> > wanted imitate.
> >
> >         <span jwcid="@Foreach" source="ognl:getMapAreas(profileRow.startDate,
> > profileRow.endDate, 150,100)" value="ognl:mapArea">
> >                 <span jwcid="directlink@DirectLink" disabled="true"
> > listener="listener:doShowDailyTotal"
> > parameters="ognl:{mapArea.startDate, mapArea.endDate}"/>
> >                 <area jwcid="chart@Any" shape="rect"
> > coords="ognl:getCoords(mapArea)" href="ognl:getURL()"/>
> >         </span>
> >
> > In the @Any component I have an href which calls a method in my page class.
> >
> > The definition of the method in the page class is
> >
> >     public String getURL() {
> >
> >         return ((DirectLink)getComponent("directlink")).getLink(getRequestCycle()).getURL();
> >
> >     }
> >
> > Now I have the URL I need to do exactly want I want. I can't believe
> > this actually worked :)
> >
> > I've seen an example of what Geoff talked about, but I couldn't work
> > out how to imitiate the directlink behaviour I wanted.
> >
> >
> >
> > On 14/11/05, Leonardo Quijano Vincenzi <le...@dtqsoftware.com> wrote:
> > > Heheh I don't want to be rude or something, but you did ask for a
> > > 'pointer' and that's what Geoff gave you. But it's not that hard, trust me.
> > >
> > > You should checkout how to inject services in the Tapestry's Manual. I
> > > think that can help you out.
> > >
> > > --
> > > Ing. Leonardo Quijano Vincenzi
> > > Director Técnico
> > > DTQ Software
> > >
> > >
> > > Jabbar wrote:
> > > > Thanks for you answer Geoff, but I need an example. I've been using
> > > > tapestry for a while but don't consider myself as a expert, like
> > > > yourself :)
> > > >
> > > > On 14/11/05, Geoff Longman <gl...@gmail.com> wrote:
> > > >
> > > >> get a reference to the Direct service and call the getLink() method.
> > > >> then call getUr() on the ILink that's returned (Tapestry 3 but T4
> > > >> should have similar sematic).
> > > >>
> > > >> Geoff
> > > >>
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > --
> > Thanks
> >
> > Jabbar Azam
> >
> > ---------------------------------------------------------------------
> > 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
>
>


--
Thanks

Jabbar Azam

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


Re: How to create a url to call a listener in a page class

Posted by Oleg Batrashev <og...@gmail.com>.
You could refer to the component directly from html, no need for getURL() method

Like this
<area jwcid="chart@Any" shape="rect"
coords="ognl:getCoords(mapArea)"
href="ognl:components.directlink.getLink(requestCycle).getURL()"/>

But I think its kind of hack - create component only for getting some
value from it, although I did it myself.

Oleg

On 11/15/05, Jabbar <aj...@gmail.com> wrote:
> You're right Leonardo!
>
> I've solved the problem anyway :p
>
> On my html page I've added a directlink component whose behaviour I
> wanted imitate.
>
>         <span jwcid="@Foreach" source="ognl:getMapAreas(profileRow.startDate,
> profileRow.endDate, 150,100)" value="ognl:mapArea">
>                 <span jwcid="directlink@DirectLink" disabled="true"
> listener="listener:doShowDailyTotal"
> parameters="ognl:{mapArea.startDate, mapArea.endDate}"/>
>                 <area jwcid="chart@Any" shape="rect"
> coords="ognl:getCoords(mapArea)" href="ognl:getURL()"/>
>         </span>
>
> In the @Any component I have an href which calls a method in my page class.
>
> The definition of the method in the page class is
>
>     public String getURL() {
>
>         return ((DirectLink)getComponent("directlink")).getLink(getRequestCycle()).getURL();
>
>     }
>
> Now I have the URL I need to do exactly want I want. I can't believe
> this actually worked :)
>
> I've seen an example of what Geoff talked about, but I couldn't work
> out how to imitiate the directlink behaviour I wanted.
>
>
>
> On 14/11/05, Leonardo Quijano Vincenzi <le...@dtqsoftware.com> wrote:
> > Heheh I don't want to be rude or something, but you did ask for a
> > 'pointer' and that's what Geoff gave you. But it's not that hard, trust me.
> >
> > You should checkout how to inject services in the Tapestry's Manual. I
> > think that can help you out.
> >
> > --
> > Ing. Leonardo Quijano Vincenzi
> > Director Técnico
> > DTQ Software
> >
> >
> > Jabbar wrote:
> > > Thanks for you answer Geoff, but I need an example. I've been using
> > > tapestry for a while but don't consider myself as a expert, like
> > > yourself :)
> > >
> > > On 14/11/05, Geoff Longman <gl...@gmail.com> wrote:
> > >
> > >> get a reference to the Direct service and call the getLink() method.
> > >> then call getUr() on the ILink that's returned (Tapestry 3 but T4
> > >> should have similar sematic).
> > >>
> > >> Geoff
> > >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
> Thanks
>
> Jabbar Azam
>
> ---------------------------------------------------------------------
> 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: How to create a url to call a listener in a page class

Posted by Jabbar <aj...@gmail.com>.
You're right Leonardo!

I've solved the problem anyway :p

On my html page I've added a directlink component whose behaviour I
wanted imitate.

	<span jwcid="@Foreach" source="ognl:getMapAreas(profileRow.startDate,
profileRow.endDate, 150,100)" value="ognl:mapArea">
		<span jwcid="directlink@DirectLink" disabled="true"
listener="listener:doShowDailyTotal"
parameters="ognl:{mapArea.startDate, mapArea.endDate}"/>
		<area jwcid="chart@Any" shape="rect"
coords="ognl:getCoords(mapArea)" href="ognl:getURL()"/>
	</span>

In the @Any component I have an href which calls a method in my page class.

The definition of the method in the page class is

    public String getURL() {

        return ((DirectLink)getComponent("directlink")).getLink(getRequestCycle()).getURL();

    }

Now I have the URL I need to do exactly want I want. I can't believe
this actually worked :)

I've seen an example of what Geoff talked about, but I couldn't work
out how to imitiate the directlink behaviour I wanted.



On 14/11/05, Leonardo Quijano Vincenzi <le...@dtqsoftware.com> wrote:
> Heheh I don't want to be rude or something, but you did ask for a
> 'pointer' and that's what Geoff gave you. But it's not that hard, trust me.
>
> You should checkout how to inject services in the Tapestry's Manual. I
> think that can help you out.
>
> --
> Ing. Leonardo Quijano Vincenzi
> Director Técnico
> DTQ Software
>
>
> Jabbar wrote:
> > Thanks for you answer Geoff, but I need an example. I've been using
> > tapestry for a while but don't consider myself as a expert, like
> > yourself :)
> >
> > On 14/11/05, Geoff Longman <gl...@gmail.com> wrote:
> >
> >> get a reference to the Direct service and call the getLink() method.
> >> then call getUr() on the ILink that's returned (Tapestry 3 but T4
> >> should have similar sematic).
> >>
> >> Geoff
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Thanks

Jabbar Azam

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


Re: How to create a url to call a listener in a page class

Posted by Leonardo Quijano Vincenzi <le...@dtqsoftware.com>.
Heheh I don't want to be rude or something, but you did ask for a 
'pointer' and that's what Geoff gave you. But it's not that hard, trust me.

You should checkout how to inject services in the Tapestry's Manual. I 
think that can help you out.

-- 
Ing. Leonardo Quijano Vincenzi
Director Técnico
DTQ Software


Jabbar wrote:
> Thanks for you answer Geoff, but I need an example. I've been using
> tapestry for a while but don't consider myself as a expert, like
> yourself :)
>
> On 14/11/05, Geoff Longman <gl...@gmail.com> wrote:
>   
>> get a reference to the Direct service and call the getLink() method.
>> then call getUr() on the ILink that's returned (Tapestry 3 but T4
>> should have similar sematic).
>>
>> Geoff
>>     



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


Re: How to create a url to call a listener in a page class

Posted by Jabbar <aj...@gmail.com>.
Thanks for you answer Geoff, but I need an example. I've been using
tapestry for a while but don't consider myself as a expert, like
yourself :)

On 14/11/05, Geoff Longman <gl...@gmail.com> wrote:
> get a reference to the Direct service and call the getLink() method.
> then call getUr() on the ILink that's returned (Tapestry 3 but T4
> should have similar sematic).
>
> Geoff
>
> On 11/14/05, Jabbar <aj...@gmail.com> wrote:
> > Hello all,
> > I have created a custom component using the @Any tag
> >
> > <span jwcid="@Foreach" source="ognl:getMapAreas(profileRow.startDate,
> > profileRow.endDate, 150,100)" value="ognl:mapArea">
> >                 <area jwcid="@Any" shape="rect" coords="ognl:getCoords(mapArea)"
> > href="ognl:getURL(mapArea.startDate, mapArea.endDate, 800,700)"/>
> >         </span>
> >
> > I want the href attribute to contain the url to call
> >
> > public void doDailyTotalProfile(Date startDate, Date endDate, int
> > width, int height)
> >
> > in my page class.
> >
> > Does anybody have any pointers to how I can do this?
> >
> > --
> > Thanks
> >
> > Jabbar Azam
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> --
> The Spindle guy.           http://spindle.sf.net
> Get help with Spindle:
> http://lists.sourceforge.net/mailman/listinfo/spindle-user
> Announcement Feed:
> http://www.jroller.com/rss/glongman?catname=/Announcements
> Feature Updates:            http://spindle.sf.net/updates
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Thanks

Jabbar Azam

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


Re: How to create a url to call a listener in a page class

Posted by Geoff Longman <gl...@gmail.com>.
get a reference to the Direct service and call the getLink() method.
then call getUr() on the ILink that's returned (Tapestry 3 but T4
should have similar sematic).

Geoff

On 11/14/05, Jabbar <aj...@gmail.com> wrote:
> Hello all,
> I have created a custom component using the @Any tag
>
> <span jwcid="@Foreach" source="ognl:getMapAreas(profileRow.startDate,
> profileRow.endDate, 150,100)" value="ognl:mapArea">
>                 <area jwcid="@Any" shape="rect" coords="ognl:getCoords(mapArea)"
> href="ognl:getURL(mapArea.startDate, mapArea.endDate, 800,700)"/>
>         </span>
>
> I want the href attribute to contain the url to call
>
> public void doDailyTotalProfile(Date startDate, Date endDate, int
> width, int height)
>
> in my page class.
>
> Does anybody have any pointers to how I can do this?
>
> --
> Thanks
>
> Jabbar Azam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

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