I'm aware of the large gap between 3 and 5 and may require some redesign on
my part.  That is why I'm using native tapestry links.  In 5.0.15, the
ComponentResources class has the createActionLink deprecated in favor of
createEventLink.  There are only 2 difference between ActionLink and
EventLink according to the API, the way it is controlled and the way it is
triggered.  

I do want to use an EventLink in my situation, and do this through
ComponentResources.createEventLink().  The tutorials show you how to use the
ActionLink in a template, whereas in my case, the component is created via
Java code.  Perhaps I do not understand what the "context" argument in the
createEventLink() method is used for.  I believe that the first argument
would be the name of the method to invoke?  How do you identify the handler
of the event when creating the EventLink?  Tutorials show this binding done
through the @OnEvent annotation and specifying the event name via the
"component" attribute in the annotation or the "id" attribute of the
element.

How would I bind these properties using a pure Java implementation?  My
previous T3 components never had a template file, and rendered purly in
Java.

Thanks
- Marcel



Peter Stavrinides wrote:
> 
> Hi Marcel
> 
> Tapestry 5 is not like 3, most of the boilerplate code is gone, it appears
> to me that you are trying to do too much... have you gone through the
> tutorials yet? I think you will be pleasantly surprised how simple yet
> powerful T5 is. You also haven't quite grasped the difference between
> ActionLink and EventLink and PageLink (it sounds like you want an
> EventLink)
> 
> cheers
> Peter
> 
> Thanks!
> I seem to be able to render the anchor component based on the Link being
> created from the ComponentResources.createActionLink().  However, the
> action
> does not seem to be fired when I hook up the event using the @OnEvent
> annotation.  The anchor is rendered using the MarkupWriter.element()
> method
> using the Link object to define the href attribute.
> 
> Note, that the creating and rendering of the action anchor is done purely
> in
> Java...no template.
> 
> My anchor renders the following url:
> mypage.pagelayout/activate Activate 
> 
> There is a page called Home/MyPage and on this page is a component called
> PageLayout which is an extension of my Layout component.  In the
> PageLayout
> component, I have my "activate" event handler as follows:
> @OnEvent(component="activate")
> public Object activate() {
>   ...
> }
> 
> Any idea why the activate event is not being called and how I can hook the
> event to the action?
> 
> Thanks Once Again.
> Marcel
> 
> 
> Howard Lewis Ship wrote:
>> 
>>  ${createURL} click me 
>> 
>> You just have to provide getCreateURL() as a wrapper around
>> ComponentResources.createActionLink().
>> 
>> You don't instantiate a component, just @Inject the ComponentResources.
>> 
>> On Fri, Oct 31, 2008 at 5:24 PM, Marcel Sammut <[EMAIL PROTECTED]> wrote:
>>>
>>> Thanks for the quick response.  My delima is that I need to have a
>>> reference
>>> to the link in the .tml template.  I was hoping to just use a pure Java
>>> implementation to let the developer configure the menu via code.
>>> In order to do this, I believe I have to inject the ComponentResources
>>> object of my container when instantiating the AbstractLink component. 
>>> Any
>>> idea to do that?
>>>
>>> Thanks,
>>> Marcel
>>>
>>>
>>> Robert Zeigler wrote:
>>>>
>>>> Why not just use ComponentResources.createActionLink and
>>>> ComponentResources.createPageLink?
>>>>
>>>> .tml:
>>>>  $somelink Link Text
>>>> .java:
>>>>
>>>> @Inject
>>>> private ComponentResources resources;
>>>>
>>>> public String getSomeLink() {
>>>>    return
>>>> resources.createPageLink("mypage",true,contextValue1,contextValue2,...);
>>>> }
>>>>
>>>>
>>>> Robert
>>>>
>>>> On Oct 31, 2008, at 10/315:04 PM , Marcel Sammut wrote:
>>>>
>>>>>
>>>>> Greetings,
>>>>> I'm looking at porting my 3.0 tapestry web application to v5 and I'm
>>>>> trying
>>>>> to build a menu component which accepts a parameter of type
>>>>> ArrayList that
>>>>> contains a list of AbstractLink objects.  These items get rendered
>>>>> in a menu
>>>>> layout etc.  The page that this menu component exists on will
>>>>> create, at
>>>>> runtime, the set of desired menu item and pass them to the menu
>>>>> component.
>>>>>
>>>>> This sounds straight forward, however, I am unable to determin how to
>>>>> instantiate, for example, a new instance of a ActionLink.  In the
>>>>> previous
>>>>> version (3.0), I simply rendered the anchor myself and generated the
>>>>> URi in
>>>>> a custom implementation.  I was hoping that in T5, I would be able
>>>>> to use
>>>>> the internal Link components since they do pretty much what I was
>>>>> doing in
>>>>> 3.0.
>>>>>
>>>>> Is there a way, in code, to create a new ActionLink component and
>>>>> have it
>>>>> act as the model for another component to be rendered?
>>>>>
>>>>> Your thoughts are much appreciated.
>>>>> - Marcel
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/-T5--Creating-Links-At-Runtime-tp20274715p20274715.html
>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/-T5--Creating-Links-At-Runtime-tp20274715p20275943.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Howard M. Lewis Ship
>> 
>> Creator Apache Tapestry and Apache HiveMind
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/-T5--Creating-Links-At-Runtime-tp20274715p20286038.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-T5--Creating-Links-At-Runtime-tp20274715p20307367.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to