Yeah, exceptions are expensive to create and throw and never should
really be caught as part of the normal flow code (*). The example was
really just an ineffective way of pointing out I know the
ComponentClassResolver exists and I know it holds map of page names to
page class names.

The thing is, it always assumes the input strings (page / component /
mixin names) to be valid but doesn't provide a way for me to check
them before hand. I was just wondering if there's some other service
or transform method I've overlooked.

> use this one, but changing "contains" by 
> startWith("full.name.of.package.pages.");

Nice, but I'm turning it in to a component for reuse. Besides, no
one's ever going to put a "pages" subpackage in their component
package! (Sorry, what's that you say about 637K and Bill Gates?)

Steve.

(*) speaking of which, has anyone ever created their own Integer
parser? Or do we all just catch the NumberFormatException?


On 11 May 2010 15:01, Nicolas Bouillon <nico...@bouil.org> wrote:
> Le 11/05/2010 18:48, Steve Eynon a écrit :
>>
>> Hello,
>>
>> Following a suggestion from a fellow T5 user (cheers Nicolas!) I've
>> changed my page name injecting strategy. I now have a
>> ComponentClassTransformWorker which adds a Mixin to every Page
>> component. This Page Mixin (in the afterRender() method) then injects
>> the page name as a comment in the Document model.
>>
>
> I'm glad that my suggestion works ;-)
>
> Btw, i responded by mistake directly to you instead of responding to the
> list.
> For the record, i was suggestesting to try to apply
> http://wiki.apache.org/tapestry/Tapestry5HowToVisualizeComponentHierarchy
> to pages instead of components.
>>
>> if (!transformation.getClassName().contains(".pages."))
>>        // not a page... goodbye!
>>        return;
>>
>
> I may use this one, but changing "contains" by
> startWith("full.name.of.package.pages.");
> But the tradeoff is that you will not transform pages outside the scope of
> your project (such as ExceptionReport)
>>
>> Any ideas?
>>
>> Cheers,
>>
>> Steve.
>>
>>
>>
>> On 7 May 2010 12:00, Steve Eynon<steve.ey...@googlemail.com>  wrote:
>>
>>>
>>> Thanks for the help and a quick response! The following gives me what
>>> I need inside a MarkupRendererFilter:
>>>
>>> @Inject
>>> private Request request;
>>>
>>> @Inject
>>> private ComponentEventLinkEncoder linkEncoder;
>>>
>>> @Inject
>>> private ComponentClassResolver classResolver;
>>>
>>> String logicalPageName =
>>> linkEncoder.decodePageRenderRequest(request).getLogicalPageName();
>>> String actualPageName =
>>> classResolver.canonicalizePageName(logicalPageName);
>>>
>>> Cheers,
>>>
>>> Steve.
>>> --
>>> Steve Eynon
>>> mobie: (+592) 678 4236
>>>
>>>
>>>
>>> On 7 May 2010 10:25, Thiago H. de Paula Figueiredo<thiag...@gmail.com>
>>>  wrote:
>>>
>>>>
>>>> On Fri, 07 May 2010 11:05:56 -0300, Dmitry Gusev<dmitry.gu...@gmail.com>
>>>> wrote:
>>>>
>>>>
>>>>>
>>>>> public void
>>>>> contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
>>>>> configuration,
>>>>>                                         final MetaDataLocator
>>>>> metaDataLocator,
>>>>>                                         final ComponentEventLinkEncoder
>>>>> linkEncoder,
>>>>>                                         final RequestGlobals globals)
>>>>>    {
>>>>>        configuration.add(NO_MARKUP_SYMBOL,
>>>>>            new MarkupRendererFilter()
>>>>>            {
>>>>>               �...@override
>>>>>                public void renderMarkup(MarkupWriter writer,
>>>>> MarkupRenderer
>>>>> renderer) {
>>>>>                    PageRenderRequestParameters parameters =
>>>>> linkEncoder.decodePageRenderRequest(globals.getRequest());
>>>>>
>>>>
>>>> Instead of injecting RequestGlobals, you can inject Request directly.
>>>>
>>>>
>>>>>
>>>>> Not sure if this available in T5.1, but you can try this. I believe
>>>>> "parameters.getLogicalPageName()" is what you need.
>>>>>
>>>>
>>>> It is.
>>>>
>>>> --
>>>> Thiago H. de Paula Figueiredo
>>>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>>>> and
>>>> instructor
>>>> Owner, Ars Machina Tecnologia da Informação Ltda.
>>>> http://www.arsmachina.com.br
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to