You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Moritz Gmelin <mo...@gmx.de> on 2009/06/03 20:49:13 UTC
overriding dateeditor
Hi,
I am still trying to find the proper way to override the default date
editor component.
I have tried to do the following in my AppModule class
public static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
{
configuration.add(new BeanBlockContribution("date",
"AppPropertyEditBlocks", "dateEdit", true));
configuration.add(new BeanBlockContribution("date",
"AppPropertyEditBlocks", "dateDisplay", false));
}
But since the TapestryModule.class is contributing its own
beanblocksources for those types
public static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
{
addEditBlock(configuration, "text");
addEditBlock(configuration, "number");
addEditBlock(configuration, "enum");
addEditBlock(configuration, "boolean");
addEditBlock(configuration, "date");
.
.
}
my contributions get overridden by Tapestys' default.
I tried adding an @order("after:*Tapestry*") annotation to my method
but had no success.
What can I do else but changing the original Tapestry source code to
achieve this?
Thanks
Moritz
Re: overriding dateeditor
Posted by DH <ni...@gmail.com>.
BeanBlockSourceImpl call BeanBlockOverrideSource first to find the display/edit block, so contribute to BeanBlockOverrideSource give you the chance to overwrite the default.
DH
----- Original Message -----
From: "Moritz Gmelin"
Sent: Thursday, June 04, 2009 4:01 AM
Subject: Re: overriding dateeditor
> Wow, found a strange solution:
>
> calling the method
>
> contributeBeanBlockOverrideSource
>
> instead of
>
> contributeBeanBlockSource
>
> fixes it. My method is called after tapestrys'.
> I got this from tapx-datefield where the method has this name.
>
> Can anyone explain this?
>
> M.
>
> Am 03.06.2009 um 21:36 schrieb Moritz Gmelin:
>
>> Well yes, I'm using 5.1.0.5 too.
>> Your example is working for the DataTypeAnalyzer whicht takes an
>> ordered List.
>> BeanBlockContribution unfortunately only takes an unorderedList.
>>
>> M.
>>
>> Am 03.06.2009 um 21:29 schrieb Thiago H. de Paula Figueiredo:
>>
>>> Em Wed, 03 Jun 2009 16:16:19 -0300, Moritz Gmelin <moritz.gmelin@gmx.de
>>> > escreveu:
>>>
>>>> Sorry, does not work.
>>>>
>>>> org.apache.tapestry5.ioc.internal.OperationException
>>>> Service 'BeanBlockSource' is configured using
>>>> org.apache.tapestry5.ioc.Configuration, not
>>>> org.apache.tapestry5.ioc.OrderedConfiguration.
>>>
>>> What Tapestry version are you using? The example I gave you is for
>>> Tapestry 5.1.0.5.
>>>
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Independent Java consultant, developer, and instructor
>>> http://www.arsmachina.com.br/thiago
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: overriding dateeditor
Posted by Moritz Gmelin <mo...@gmx.de>.
Wow, found a strange solution:
calling the method
contributeBeanBlockOverrideSource
instead of
contributeBeanBlockSource
fixes it. My method is called after tapestrys'.
I got this from tapx-datefield where the method has this name.
Can anyone explain this?
M.
Am 03.06.2009 um 21:36 schrieb Moritz Gmelin:
> Well yes, I'm using 5.1.0.5 too.
> Your example is working for the DataTypeAnalyzer whicht takes an
> ordered List.
> BeanBlockContribution unfortunately only takes an unorderedList.
>
> M.
>
> Am 03.06.2009 um 21:29 schrieb Thiago H. de Paula Figueiredo:
>
>> Em Wed, 03 Jun 2009 16:16:19 -0300, Moritz Gmelin <moritz.gmelin@gmx.de
>> > escreveu:
>>
>>> Sorry, does not work.
>>>
>>> org.apache.tapestry5.ioc.internal.OperationException
>>> Service 'BeanBlockSource' is configured using
>>> org.apache.tapestry5.ioc.Configuration, not
>>> org.apache.tapestry5.ioc.OrderedConfiguration.
>>
>> What Tapestry version are you using? The example I gave you is for
>> Tapestry 5.1.0.5.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java consultant, developer, and instructor
>> http://www.arsmachina.com.br/thiago
>>
>> ---------------------------------------------------------------------
>> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: overriding dateeditor
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 03 Jun 2009 16:36:22 -0300, Moritz Gmelin <mo...@gmx.de>
escreveu:
> Well yes, I'm using 5.1.0.5 too.
> Your example is working for the DataTypeAnalyzer whicht takes an ordered
> List.
> BeanBlockContribution unfortunately only takes an unorderedList.
You're right, but I am too. :) As far as I know, you can have only one
bean editor block for each type, so you need to provide a data type
analyzer that says that dates have type "mydate", for example, and then
provide a bean editor block for it. ;)
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: overriding dateeditor
Posted by Moritz Gmelin <mo...@gmx.de>.
Well yes, I'm using 5.1.0.5 too.
Your example is working for the DataTypeAnalyzer whicht takes an
ordered List.
BeanBlockContribution unfortunately only takes an unorderedList.
M.
Am 03.06.2009 um 21:29 schrieb Thiago H. de Paula Figueiredo:
> Em Wed, 03 Jun 2009 16:16:19 -0300, Moritz Gmelin <moritz.gmelin@gmx.de
> > escreveu:
>
>> Sorry, does not work.
>>
>> org.apache.tapestry5.ioc.internal.OperationException
>> Service 'BeanBlockSource' is configured using
>> org.apache.tapestry5.ioc.Configuration, not
>> org.apache.tapestry5.ioc.OrderedConfiguration.
>
> What Tapestry version are you using? The example I gave you is for
> Tapestry 5.1.0.5.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> 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
Re: overriding dateeditor
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 03 Jun 2009 16:16:19 -0300, Moritz Gmelin <mo...@gmx.de>
escreveu:
> Sorry, does not work.
>
> org.apache.tapestry5.ioc.internal.OperationException
> Service 'BeanBlockSource' is configured using
> org.apache.tapestry5.ioc.Configuration, not
> org.apache.tapestry5.ioc.OrderedConfiguration.
What Tapestry version are you using? The example I gave you is for
Tapestry 5.1.0.5.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: overriding dateeditor
Posted by Moritz Gmelin <mo...@gmx.de>.
Sorry, does not work.
org.apache.tapestry5.ioc.internal.OperationException
Service 'BeanBlockSource' is configured using
org.apache.tapestry5.ioc.Configuration, not
org.apache.tapestry5.ioc.OrderedConfiguration.
What is funny is that the order of execution of those
contributeBeanBlockSource methods is not predictable. Most often times
the method from my appModule class is called first but sometimes the
method from tapestryModule is called first.
M.
Am 03.06.2009 um 21:02 schrieb Thiago H. de Paula Figueiredo:
> Em Wed, 03 Jun 2009 15:49:13 -0300, Moritz Gmelin <moritz.gmelin@gmx.de
> > escreveu:
>
>> Hi,
>
> HI!
>
>> public static void
>> contributeBeanBlockSource(Configuration<BeanBlockContribution>
>> configuration)
>
> You should use an OrderedConfiguration as a parameter, not a
> Configuration.
>
> Example: Tapestry CRUD provides an editing block for entity classes
> and its configured like this:
>
> public static void contributeDataTypeAnalyzer(
> OrderedConfiguration<DataTypeAnalyzer> configuration,
> EntityDataTypeAnalyzer entityDataTypeAnalyzer) {
>
> configuration.add(Constants.ENTITY_DATA_TYPE,
> entityDataTypeAnalyzer, "before:Annotation");
>
> }
>
> The "before:Annotation" guarantees that my analyzer is called before
> the Tapestry built-in ones.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> 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
Re: overriding dateeditor
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Wed, 03 Jun 2009 15:49:13 -0300, Moritz Gmelin <mo...@gmx.de>
escreveu:
> Hi,
HI!
> public static void
> contributeBeanBlockSource(Configuration<BeanBlockContribution>
> configuration)
You should use an OrderedConfiguration as a parameter, not a Configuration.
Example: Tapestry CRUD provides an editing block for entity classes and
its configured like this:
public static void contributeDataTypeAnalyzer(
OrderedConfiguration<DataTypeAnalyzer> configuration,
EntityDataTypeAnalyzer entityDataTypeAnalyzer) {
configuration.add(Constants.ENTITY_DATA_TYPE, entityDataTypeAnalyzer,
"before:Annotation");
}
The "before:Annotation" guarantees that my analyzer is called before the
Tapestry built-in ones.
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org