tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thiago H. de Paula Figueiredo" <thiag...@gmail.com>
Subject Re: Grid component customization
Date Tue, 06 Feb 2018 11:51:42 GMT
Another possibility for doing that is to use Tapestry DOM rewriting. You'd
create a mixin, apply it to your grids, and the mixin would have an
afterRender(MarkupWriter writer) method. writer.getDocument() gives you the
Tapestry DOM element tree. From it, you can find the grids, its tags and
change them to your pleasure. tapestry-xpath allows you to find DOM
elements using XPath and may help you in this task.

Have you tried what I suggested (component overriding?)?

On Mon, Feb 5, 2018 at 4:39 PM, Erich Gormann <e.gormann@gormann.de> wrote:

> Hi Thiago,
>
> Our HTML designer wants to create a fully responsive  website based on
> Tapestry 5.3.8.
> So she asked me, if it would be possible, to render some data attributes
> inside the td tags of the grid.
>
> Regards, Erich
>
>
>
> Am 05.02.2018 18:49, schrieb Thiago H. de Paula Figueiredo:
>
>> Hello!
>>
>> Well, you can override a component, you can decorate or advise the
>> ComponentClassResolver service. Specifically, when
>> the resolveComponentTypeToClassName(String componentType) method is
>> called,
>> if componentType.equalsIgnoreCase("GridColumns"), then return the fully
>> qualified class name of your GridColumns replacement component. Otherwise,
>> let it return normally. That's basically how ComponentSubstitutor is
>> implemented inside Tapestry itself.
>>
>> Just curious: what customizations do you want to do?
>>
>> On Sat, Feb 3, 2018 at 9:01 AM, Erich Gormann<e.gormann@gormann.de>
>> wrote:
>>
>> Dear Thiago,
>>>
>>> first thanks for this solution, but can you please propose a solution
>>> which works under Tapestry 5.3.8? This would be great.
>>>
>>> Anyway, I tried to migrate our applications to 5.4.3 yesterday and nearly
>>> succeeded, but only nearly, due to problems with the removed javassist
>>> lib.
>>> ut this would be another topic in this support list.
>>>
>>> Thanks and Best Regards
>>> Erich
>>>
>>>
>>> Am 28.11.2017 16:32, schrieb Thiago H. de Paula Figueiredo:
>>>
>>> On Tue, Nov 28, 2017 at 6:33 AM, Erich Gormann<e.gormann@gormann.de>
>>>> wrote:
>>>>
>>>> Dear all,
>>>>
>>>>> Hi!
>>>>>
>>>>
>>>> I wanted to customize the GridColumns component, which is embedded
>>>> inside
>>>>
>>>>> the Grid component, by trying different approaches.
>>>>>
>>>>> Finally I failed, because it was neither possible by a request filter
>>>>> replacing the GridColumns component at runtime with my customized one,
>>>>>
>>>>> This wasn't expected to work, but I'm curious in how you tried to do
>>>> it.
>>>> :)
>>>>
>>>>
>>>> nor did it work to use an own template for the Grid component pointing
>>>> to
>>>>
>>>>> my customized version of GridColumns.
>>>>>
>>>>> What is the best way to do this? The GridColumns component is a private
>>>>> component inside the Grid and I wonder how to replace it.
>>>>>
>>>>> Contribute to the ComponentOverride distributed configuration, which
>>>>> is a
>>>>>
>>>> Map<Class, Class>, the key being the component or page or mixin class
to
>>>> be
>>>> replaced, the value being the replacement.
>>>>
>>>> Here's an example from Tapestry's test suite:
>>>>
>>>> @Contribute(ComponentReplacer.class)
>>>> public static void
>>>> overridePageAndComponentAndMixin(MappedConfiguration<Class, Class>
>>>> configuration) {
>>>>       configuration.add(OverridenPage.class, OverridePage.class);
>>>>       configuration.add(OverridenComponent.class,
>>>> OverrideComponent.class);
>>>>       configuration.add(OverridenMixin.class, OverrideMixin.class);
>>>> }
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Thiago

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message