You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Juan E. Maya" <ma...@gmail.com> on 2009/09/25 18:14:56 UTC

Re: T5:how to do initialization work when custom component was called?

Hi cleverpig,

You can use @SetupRender or onActivation methods to setup ur page.
There was a long discussion in the mail list about when to use what.

Using the @setuprender on ur page would be as simple as:


	@SetupRender
	private void loadData() {
           this.data=serv.list();
	}

2009/9/25 cleverpig <gr...@gmail.com>:
> hi,friends!
>
> i got a trouble thing:how to do initialization work when custom
> component was called?
> i mean when i made a custom component which need some parameters,and
> these parameters will be inject in the page that the custom component
> hold on.
>
> such as:
> the custom component class:
> public class DictionarySelect  extends AbstractField
> {
> ...
>        @Parameter(required=true)
>        private List data;
> ...
> }
> the page class:
> public class MyPage{
>        @InjectService
>        private DictionaryService serv;
>        private List data;
>        void onPageLoaded(){
>            data=serv.list();
>        }
> ...
> }
> the tml code:
> <html t:type="layout"
>        xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>        <t:DictionarySelect  t:data="dataFromServ"/>
> </html>
>
> notes:
> the injected serv will load the data variable of DictionarySelect Component.
> When this page is first instantiated,i would call serv's list method
> to assign a list to data variable.
> but i got null exception...
>
> what's the way to prepare data for component which get data from
> page's parameter that depend on inject service?
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liudan@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>
> ---------------------------------------------------------------------
> 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: T5:how to do initialization work when custom component was called?

Posted by cleverpig <gr...@gmail.com>.
thanks all of friends! I got!

On Sat, Sep 26, 2009 at 4:29 AM, Julian Wood <wo...@brightsquid.com> wrote:
> I also find this JumpStart page invaluable:
> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/whatiscalledandwhen
>
> J
>
> On Fri, Sep 25, 2009 at 10:58 AM, Andreas Andreou <an...@di.uoa.gr> wrote:
>
>> There's a nice diagram at
>> http://tapestry.apache.org/tapestry5/guide/rendering.html
>>
>> And there's another great diagram (but this time for the whole
>> request) at the nightly docs:
>> http://tapestry.formos.com/nightly/tapestry5/guide/request.html
>



-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

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


Re: T5:how to do initialization work when custom component was called?

Posted by Julian Wood <wo...@brightsquid.com>.
I also find this JumpStart page invaluable:
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/navigation/whatiscalledandwhen

J

On Fri, Sep 25, 2009 at 10:58 AM, Andreas Andreou <an...@di.uoa.gr> wrote:

> There's a nice diagram at
> http://tapestry.apache.org/tapestry5/guide/rendering.html
>
> And there's another great diagram (but this time for the whole
> request) at the nightly docs:
> http://tapestry.formos.com/nightly/tapestry5/guide/request.html

Re: T5:how to do initialization work when custom component was called?

Posted by Andreas Andreou <an...@di.uoa.gr>.
There's a nice diagram at
http://tapestry.apache.org/tapestry5/guide/rendering.html

And there's another great diagram (but this time for the whole
request) at the nightly docs:
http://tapestry.formos.com/nightly/tapestry5/guide/request.html

On Fri, Sep 25, 2009 at 7:39 PM, cleverpig <gr...@gmail.com> wrote:
> ok! thanks! it's working!
> by the way:what's the page or component's render order?
> @SetupRender/beginRender/endRender/@BeforeRenderTemplate/@AfterRenderTemplate
> what's the order?
>
> 2009/9/26 Juan E. Maya <ma...@gmail.com>:
>> Hi cleverpig,
>>
>> You can use @SetupRender or onActivation methods to setup ur page.
>> There was a long discussion in the mail list about when to use what.
>>
>> Using the @setuprender on ur page would be as simple as:
>>
>>
>>        @SetupRender
>>        private void loadData() {
>>           this.data=serv.list();
>>        }
>>
>> 2009/9/25 cleverpig <gr...@gmail.com>:
>>> hi,friends!
>>>
>>> i got a trouble thing:how to do initialization work when custom
>>> component was called?
>>> i mean when i made a custom component which need some parameters,and
>>> these parameters will be inject in the page that the custom component
>>> hold on.
>>>
>>> such as:
>>> the custom component class:
>>> public class DictionarySelect  extends AbstractField
>>> {
>>> ...
>>>        @Parameter(required=true)
>>>        private List data;
>>> ...
>>> }
>>> the page class:
>>> public class MyPage{
>>>        @InjectService
>>>        private DictionaryService serv;
>>>        private List data;
>>>        void onPageLoaded(){
>>>            data=serv.list();
>>>        }
>>> ...
>>> }
>>> the tml code:
>>> <html t:type="layout"
>>>        xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>>        <t:DictionarySelect  t:data="dataFromServ"/>
>>> </html>
>>>
>>> notes:
>>> the injected serv will load the data variable of DictionarySelect Component.
>>> When this page is first instantiated,i would call serv's list method
>>> to assign a list to data variable.
>>> but i got null exception...
>>>
>>> what's the way to prepare data for component which get data from
>>> page's parameter that depend on inject service?
>>> --
>>> cleverpig(Dan)
>>> Location: Beijing
>>> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
>>> Zipcode: 100031
>>> MSN: great_liudan@hotmail.com
>>> QQ: 149291732
>>> Skype: cleverpigatmatrix
>>> Facebook ID:cleverpig
>>> Blog: www.cleverpig.name
>>> Tags: del.icio.us/cleverpig
>>> Twitter: twitter.com/cleverpig
>>> 新浪微博: t.sina.com.cn/cleverpig
>>> Organization: www.beijing-open-party.org
>>> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
>
> --
> cleverpig(Dan)
> Location: Beijing
> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
> Zipcode: 100031
> MSN: great_liudan@hotmail.com
> QQ: 149291732
> Skype: cleverpigatmatrix
> Facebook ID:cleverpig
> Blog: www.cleverpig.name
> Tags: del.icio.us/cleverpig
> Twitter: twitter.com/cleverpig
> 新浪微博: t.sina.com.cn/cleverpig
> Organization: www.beijing-open-party.org
> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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


Re: T5:how to do initialization work when custom component was called?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Fri, 25 Sep 2009 13:39:42 -0300, cleverpig <gr...@gmail.com>  
escreveu:

> ok! thanks! it's working!
> by the way:what's the page or component's render order?
> @SetupRender/beginRender/endRender/@BeforeRenderTemplate/@AfterRenderTemplate
> what's the order?

Please read the documentation:  
http://tapestry.apache.org/tapestry5.1/guide/event.html.

-- 
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: T5:how to do initialization work when custom component was called?

Posted by cleverpig <gr...@gmail.com>.
ok! thanks! it's working!
by the way:what's the page or component's render order?
@SetupRender/beginRender/endRender/@BeforeRenderTemplate/@AfterRenderTemplate
what's the order?

2009/9/26 Juan E. Maya <ma...@gmail.com>:
> Hi cleverpig,
>
> You can use @SetupRender or onActivation methods to setup ur page.
> There was a long discussion in the mail list about when to use what.
>
> Using the @setuprender on ur page would be as simple as:
>
>
>        @SetupRender
>        private void loadData() {
>           this.data=serv.list();
>        }
>
> 2009/9/25 cleverpig <gr...@gmail.com>:
>> hi,friends!
>>
>> i got a trouble thing:how to do initialization work when custom
>> component was called?
>> i mean when i made a custom component which need some parameters,and
>> these parameters will be inject in the page that the custom component
>> hold on.
>>
>> such as:
>> the custom component class:
>> public class DictionarySelect  extends AbstractField
>> {
>> ...
>>        @Parameter(required=true)
>>        private List data;
>> ...
>> }
>> the page class:
>> public class MyPage{
>>        @InjectService
>>        private DictionaryService serv;
>>        private List data;
>>        void onPageLoaded(){
>>            data=serv.list();
>>        }
>> ...
>> }
>> the tml code:
>> <html t:type="layout"
>>        xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>        <t:DictionarySelect  t:data="dataFromServ"/>
>> </html>
>>
>> notes:
>> the injected serv will load the data variable of DictionarySelect Component.
>> When this page is first instantiated,i would call serv's list method
>> to assign a list to data variable.
>> but i got null exception...
>>
>> what's the way to prepare data for component which get data from
>> page's parameter that depend on inject service?
>> --
>> cleverpig(Dan)
>> Location: Beijing
>> Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
>> Zipcode: 100031
>> MSN: great_liudan@hotmail.com
>> QQ: 149291732
>> Skype: cleverpigatmatrix
>> Facebook ID:cleverpig
>> Blog: www.cleverpig.name
>> Tags: del.icio.us/cleverpig
>> Twitter: twitter.com/cleverpig
>> 新浪微博: t.sina.com.cn/cleverpig
>> Organization: www.beijing-open-party.org
>> Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294
>>
>> ---------------------------------------------------------------------
>> 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
>
>



-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liudan@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: www.cleverpig.name
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
Organ@Facebook: http://www.facebook.com/group.php?gid=8159558294

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