You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Michael Allman (JIRA)" <ji...@apache.org> on 2010/07/27 01:23:16 UTC

[jira] Created: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Add a Lifecycle callback interface so that components know when they've been initialized
----------------------------------------------------------------------------------------

                 Key: PIVOT-580
                 URL: https://issues.apache.org/jira/browse/PIVOT-580
             Project: Pivot
          Issue Type: New Feature
          Components: wtk
            Reporter: Michael Allman


I just created

public interface Lifecycle {
    public void initialized();
}

because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".

The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Michael Allman <ms...@allman.ms>.
Greg,

I will switch to Pivot 2 dev in a few weeks after the initial release is 
out the door.

Cheers,

Michael

On Mon, 26 Jul 2010, Greg Brown wrote:

> Just to be clear - I'm not suggesting that what you are asking for is 
> unreasonable. It has just been solved in a slightly different way than 
> what you are describing. I think it will meet your needs, if you can 
> consider moving to 2.0 at this point. I understand that it is still 
> fairly far from release, but many of the major changes are already in 
> place. You may find that, in the long run, using the features provided 
> by Pivot 2.0 is a better alternative than implementing a custom version 
> of WTKXSerializer.
>
> G
>
> On Jul 26, 2010, at 9:59 PM, Greg Brown wrote:
>
>> There is. Use Pivot 2.0 and <bxml:include> the component you want to initialize.
>>
>> On Jul 26, 2010, at 8:41 PM, Michael Allman wrote:
>>
>>> I don't know what @PostConstruct is.  Does it do what I want?  I just want to know when the serializer has finished building my component.  Jeeesh. You think there'd be a way...
>>>
>>> Michael
>>>
>>>
>>>
>>> On Mon, 26 Jul 2010, aappddeevv wrote:
>>>
>>>> I think this is the @PostConstruct concept again. However, in a parent-child
>>>> tree you may have to bound the initialization process like in WPF
>>>> (BeginInit, EndInit) because a parent component is not really initialized
>>>> until its children are. You have to pick your semantics to figure out what's
>>>> right for you.
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Greg Brown (JIRA) [mailto:jira@apache.org]
>>>> Sent: Monday, July 26, 2010 8:13 PM
>>>> To: dev@pivot.apache.org
>>>> Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so
>>>> that components know when they've been initialized
>>>>
>>>>
>>>>  [
>>>> https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
>>>> in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
>>>> 2892553 ]
>>>>
>>>> Greg Brown commented on PIVOT-580:
>>>> ----------------------------------
>>>>
>>>> I understand. But keep in mind that BXML is just a shortcut to instantiating
>>>> and setting properties on Java objects "by hand". You wouldn't get any such
>>>> notifications in Java, so we don't provide them in BXML either. Your classes
>>>> should be able to function the same whether they are created by
>>>> BXMLSerializer or some other means (i.e. programmatically).
>>>>
>>>>
>>>>
>>>>> Add a Lifecycle callback interface so that components know when they've
>>>> been initialized
>>>>>
>>>> ----------------------------------------------------------------------------
>>>> ------------
>>>>>
>>>>>               Key: PIVOT-580
>>>>>               URL: https://issues.apache.org/jira/browse/PIVOT-580
>>>>>           Project: Pivot
>>>>>        Issue Type: New Feature
>>>>>        Components: wtk
>>>>>          Reporter: Michael Allman
>>>>>
>>>>> I just created
>>>>> public interface Lifecycle {
>>>>>   public void initialized();
>>>>> }
>>>>> because I want one of my custom components to know when it's been
>>>> initialized.  The component takes a specific action after being initialized.
>>>> By "initialized", I mean "having all properties set".
>>>>> The serializer calls this method after it has finished initializing the
>>>> component, basically at the end of the processEndElement method.
>>>>
>>>> --
>>>> This message is automatically generated by JIRA.
>>>> -
>>>> You can reply to this email to add a comment to the issue online.
>>>>
>>
>

Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Greg Brown <gk...@mac.com>.
Just to be clear - I'm not suggesting that what you are asking for is unreasonable. It has just been solved in a slightly different way than what you are describing. I think it will meet your needs, if you can consider moving to 2.0 at this point. I understand that it is still fairly far from release, but many of the major changes are already in place. You may find that, in the long run, using the features provided by Pivot 2.0 is a better alternative than implementing a custom version of WTKXSerializer.

G

On Jul 26, 2010, at 9:59 PM, Greg Brown wrote:

> There is. Use Pivot 2.0 and <bxml:include> the component you want to initialize.
> 
> On Jul 26, 2010, at 8:41 PM, Michael Allman wrote:
> 
>> I don't know what @PostConstruct is.  Does it do what I want?  I just want to know when the serializer has finished building my component.  Jeeesh. You think there'd be a way...
>> 
>> Michael
>> 
>> 
>> 
>> On Mon, 26 Jul 2010, aappddeevv wrote:
>> 
>>> I think this is the @PostConstruct concept again. However, in a parent-child
>>> tree you may have to bound the initialization process like in WPF
>>> (BeginInit, EndInit) because a parent component is not really initialized
>>> until its children are. You have to pick your semantics to figure out what's
>>> right for you.
>>> 
>>> 
>>> -----Original Message-----
>>> From: Greg Brown (JIRA) [mailto:jira@apache.org]
>>> Sent: Monday, July 26, 2010 8:13 PM
>>> To: dev@pivot.apache.org
>>> Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so
>>> that components know when they've been initialized
>>> 
>>> 
>>>  [
>>> https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
>>> in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
>>> 2892553 ]
>>> 
>>> Greg Brown commented on PIVOT-580:
>>> ----------------------------------
>>> 
>>> I understand. But keep in mind that BXML is just a shortcut to instantiating
>>> and setting properties on Java objects "by hand". You wouldn't get any such
>>> notifications in Java, so we don't provide them in BXML either. Your classes
>>> should be able to function the same whether they are created by
>>> BXMLSerializer or some other means (i.e. programmatically).
>>> 
>>> 
>>> 
>>>> Add a Lifecycle callback interface so that components know when they've
>>> been initialized
>>>> 
>>> ----------------------------------------------------------------------------
>>> ------------
>>>> 
>>>>               Key: PIVOT-580
>>>>               URL: https://issues.apache.org/jira/browse/PIVOT-580
>>>>           Project: Pivot
>>>>        Issue Type: New Feature
>>>>        Components: wtk
>>>>          Reporter: Michael Allman
>>>> 
>>>> I just created
>>>> public interface Lifecycle {
>>>>   public void initialized();
>>>> }
>>>> because I want one of my custom components to know when it's been
>>> initialized.  The component takes a specific action after being initialized.
>>> By "initialized", I mean "having all properties set".
>>>> The serializer calls this method after it has finished initializing the
>>> component, basically at the end of the processEndElement method.
>>> 
>>> -- 
>>> This message is automatically generated by JIRA.
>>> -
>>> You can reply to this email to add a comment to the issue online.
>>> 
> 


Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Greg Brown <gk...@mac.com>.
> I just read this message and I knew I was going to get it.  ;)

No worries. As I mentioned earlier, your input is valued and the discussions you have driven have helped to improve the platform. That's what open source is all about.  :-)


Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Michael Allman <ms...@allman.ms>.
On Tue, 27 Jul 2010, Greg Brown wrote:

>> You want me to create a one line file and include it because Pivot 
>> doesn't support lifecycle notification?  That's absurd.  A one line 
>> bxml file. Is there any conceivable use for a one line bxml file aside 
>> from working around this problem?  And I'm supposed to create these 
>> files every time I want a notification?
>
> The point is that BXML (intentionally) doesn't define any kind of 
> "lifecycle notification". It is a shortcut for creating Java class 
> instances. Java's support for "lifecycle notifications" includes the 
> constructor, methods, and the finalizer. You have access to the same 
> facilities in BXML.
>
> The Bindable#initialize() method only exists because, without it, a root 
> element would have no way of knowing that all of the page variables had 
> been fully processed. In essence, initialize() is a "constructor" for 
> functional modules defined in BXML. Just like you partition 
> functionality into classes in Java, you can partition it into separate 
> includes in BXML.
>
>> Here's the thing.  I have a component.  It has a button for adding 
>> children, but it has to know what wtkx file to include and it has to 
>> know the value of one other property.  I want it to create one child 
>> (like pressing the 'add child' button) after its properties have been 
>> set (so it knows how to do it) by the serializer so that one child item 
>> appears in the UI when the user sees it.  From there they can click the 
>> 'add child' button to their heart's content.
>
> This makes an even stronger case for separating your BXML file into 
> includes. In the BXML that declares your button, you can include the 
> BXML that defines the child component. Then, the button press listener 
> can use BXMLSerializer to load new instances of the child component 
> every time it is pressed.
>
> Now, with that said, I would like to provide some hopefully constructive 
> feedback. While I sincerely appreciate your interest in the platform and 
> suggestions for how to improve it, your approach to communication on the 
> mailing lists often borders on antagonistic and arrogant when those 
> suggestions are rejected. This makes me (and possibly others) reluctant 
> to want to help you.
>
> I recommend that you try asking questions about how your design issues 
> might be solved within the existing framework before suggesting changes 
> to it. Note that I'm not attempting to discourage you or anyone else 
> from challenging elements of Pivot's design - that's how the platform 
> evolves. However, a lot of thought has gone into the existing design, 
> and I think it's pretty good. The constant onslaught is getting a bit 
> frustrating.

I just read this message and I knew I was going to get it.  ;)

I'm sorry.  I let my frustration get the better of me and I came out 
swinging.  For that, I apologize.  I really appreciate the dialog and 
interaction I have with you and other Pivot developers and users on this 
mailing list, and I don't intend to abuse that privilege.

As regards this particular issue, I'm still using a serialization callback 
to accomplish some things--including a new use case---but I'm going to 
give it a rest for now.  I'm not ready to discuss my new use case.  It may 
be solved by pivot 2, which I haven't migrated to yet.

Cheers,

Michael

Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Greg Brown <gk...@mac.com>.
> You want me to create a one line file and include it because Pivot doesn't support lifecycle notification?  That's absurd.  A one line bxml file. Is there any conceivable use for a one line bxml file aside from working around this problem?  And I'm supposed to create these files every time I want a notification?

The point is that BXML (intentionally) doesn't define any kind of "lifecycle notification". It is a shortcut for creating Java class instances. Java's support for "lifecycle notifications" includes the constructor, methods, and the finalizer. You have access to the same facilities in BXML.

The Bindable#initialize() method only exists because, without it, a root element would have no way of knowing that all of the page variables had been fully processed. In essence, initialize() is a "constructor" for functional modules defined in BXML. Just like you partition functionality into classes in Java, you can partition it into separate includes in BXML.

> Here's the thing.  I have a component.  It has a button for adding children, but it has to know what wtkx file to include and it has to know the value of one other property.  I want it to create one child (like pressing the 'add child' button) after its properties have been set (so it knows how to do it) by the serializer so that one child item appears in the UI when the user sees it.  From there they can click the 'add child' button to their heart's content.

This makes an even stronger case for separating your BXML file into includes. In the BXML that declares your button, you can include the BXML that defines the child component. Then, the button press listener can use BXMLSerializer to load new instances of the child component every time it is pressed.

Now, with that said, I would like to provide some hopefully constructive feedback. While I sincerely appreciate your interest in the platform and suggestions for how to improve it, your approach to communication on the mailing lists often borders on antagonistic and arrogant when those suggestions are rejected. This makes me (and possibly others) reluctant to want to help you. 

I recommend that you try asking questions about how your design issues might be solved within the existing framework before suggesting changes to it. Note that I'm not attempting to discourage you or anyone else from challenging elements of Pivot's design - that's how the platform evolves. However, a lot of thought has gone into the existing design, and I think it's pretty good. The constant onslaught is getting a bit frustrating.

Greg


Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Michael Allman <ms...@allman.ms>.
You want me to create a one line file and include it because Pivot doesn't 
support lifecycle notification?  That's absurd.  A one line bxml file. 
Is there any conceivable use for a one line bxml file aside from working 
around this problem?  And I'm supposed to create these files every time I 
want a notification?

I'm trying to think of another reason I would want to or need to litter my 
source tree with one line files like

<NotifiedComponent label="Duh"/>

And the conclusion I'm drawing is that if the framework requires you to 
create one line bxml files to implement certain functionality, the 
framework is making your life harder than it needs to be.

Here's the thing.  I have a component.  It has a button for adding 
children, but it has to know what wtkx file to include and it has to know 
the value of one other property.  I want it to create one child (like 
pressing the 'add child' button) after its properties have been set (so it 
knows how to do it) by the serializer so that one child item appears in 
the UI when the user sees it.  From there they can click the 'add child' 
button to their heart's content.

Michael


On Mon, 26 Jul 2010, Greg Brown wrote:

> There is. Use Pivot 2.0 and <bxml:include> the component you want to initialize.
>
> On Jul 26, 2010, at 8:41 PM, Michael Allman wrote:
>
>> I don't know what @PostConstruct is.  Does it do what I want?  I just want to know when the serializer has finished building my component.  Jeeesh. You think there'd be a way...
>>
>> Michael
>>
>>
>>
>> On Mon, 26 Jul 2010, aappddeevv wrote:
>>
>>> I think this is the @PostConstruct concept again. However, in a parent-child
>>> tree you may have to bound the initialization process like in WPF
>>> (BeginInit, EndInit) because a parent component is not really initialized
>>> until its children are. You have to pick your semantics to figure out what's
>>> right for you.
>>>
>>>
>>> -----Original Message-----
>>> From: Greg Brown (JIRA) [mailto:jira@apache.org]
>>> Sent: Monday, July 26, 2010 8:13 PM
>>> To: dev@pivot.apache.org
>>> Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so
>>> that components know when they've been initialized
>>>
>>>
>>>   [
>>> https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
>>> in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
>>> 2892553 ]
>>>
>>> Greg Brown commented on PIVOT-580:
>>> ----------------------------------
>>>
>>> I understand. But keep in mind that BXML is just a shortcut to instantiating
>>> and setting properties on Java objects "by hand". You wouldn't get any such
>>> notifications in Java, so we don't provide them in BXML either. Your classes
>>> should be able to function the same whether they are created by
>>> BXMLSerializer or some other means (i.e. programmatically).
>>>
>>>
>>>
>>>> Add a Lifecycle callback interface so that components know when they've
>>> been initialized
>>>>
>>> ----------------------------------------------------------------------------
>>> ------------
>>>>
>>>>                Key: PIVOT-580
>>>>                URL: https://issues.apache.org/jira/browse/PIVOT-580
>>>>            Project: Pivot
>>>>         Issue Type: New Feature
>>>>         Components: wtk
>>>>           Reporter: Michael Allman
>>>>
>>>> I just created
>>>> public interface Lifecycle {
>>>>    public void initialized();
>>>> }
>>>> because I want one of my custom components to know when it's been
>>> initialized.  The component takes a specific action after being initialized.
>>> By "initialized", I mean "having all properties set".
>>>> The serializer calls this method after it has finished initializing the
>>> component, basically at the end of the processEndElement method.
>>>
>>> --
>>> This message is automatically generated by JIRA.
>>> -
>>> You can reply to this email to add a comment to the issue online.
>>>
>

Re: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Greg Brown <gk...@mac.com>.
There is. Use Pivot 2.0 and <bxml:include> the component you want to initialize.

On Jul 26, 2010, at 8:41 PM, Michael Allman wrote:

> I don't know what @PostConstruct is.  Does it do what I want?  I just want to know when the serializer has finished building my component.  Jeeesh. You think there'd be a way...
> 
> Michael
> 
> 
> 
> On Mon, 26 Jul 2010, aappddeevv wrote:
> 
>> I think this is the @PostConstruct concept again. However, in a parent-child
>> tree you may have to bound the initialization process like in WPF
>> (BeginInit, EndInit) because a parent component is not really initialized
>> until its children are. You have to pick your semantics to figure out what's
>> right for you.
>> 
>> 
>> -----Original Message-----
>> From: Greg Brown (JIRA) [mailto:jira@apache.org]
>> Sent: Monday, July 26, 2010 8:13 PM
>> To: dev@pivot.apache.org
>> Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so
>> that components know when they've been initialized
>> 
>> 
>>   [
>> https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
>> in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
>> 2892553 ]
>> 
>> Greg Brown commented on PIVOT-580:
>> ----------------------------------
>> 
>> I understand. But keep in mind that BXML is just a shortcut to instantiating
>> and setting properties on Java objects "by hand". You wouldn't get any such
>> notifications in Java, so we don't provide them in BXML either. Your classes
>> should be able to function the same whether they are created by
>> BXMLSerializer or some other means (i.e. programmatically).
>> 
>> 
>> 
>>> Add a Lifecycle callback interface so that components know when they've
>> been initialized
>>> 
>> ----------------------------------------------------------------------------
>> ------------
>>> 
>>>                Key: PIVOT-580
>>>                URL: https://issues.apache.org/jira/browse/PIVOT-580
>>>            Project: Pivot
>>>         Issue Type: New Feature
>>>         Components: wtk
>>>           Reporter: Michael Allman
>>> 
>>> I just created
>>> public interface Lifecycle {
>>>    public void initialized();
>>> }
>>> because I want one of my custom components to know when it's been
>> initialized.  The component takes a specific action after being initialized.
>> By "initialized", I mean "having all properties set".
>>> The serializer calls this method after it has finished initializing the
>> component, basically at the end of the processEndElement method.
>> 
>> -- 
>> This message is automatically generated by JIRA.
>> -
>> You can reply to this email to add a comment to the issue online.
>> 


RE: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by aappddeevv <aa...@verizon.net>.
@PostConstruct is a DependencyInjection oriented approach to attributing a
method to call after all variables have been injected and the object can
initialize knowing everything has been set. BXML does not support that, but
that's the analogy. You can actually call a depth-first traversal on your
root object and perform initialization after you call readObject() and
obtain the root object on the serializer. All of this is external to the
serializer and requires one extra method call to kick-start it.

myRoot = serializer.getRoot();
MyStaticClassUtils.initializeTree(myRoot);


But otherwise you change the serializer or use AOP. If you have written tree
events as you describe in another email, you can propagate a tunneling event
through the tree that calls initialize or checks for @PostConstruct.



-----Original Message-----
From: Michael Allman [mailto:msa@allman.ms] 
Sent: Monday, July 26, 2010 8:41 PM
To: dev@pivot.apache.org
Subject: RE: [jira] Commented: (PIVOT-580) Add a Lifecycle callback
interface so that components know when they've been initialized

I don't know what @PostConstruct is.  Does it do what I want?  I just want 
to know when the serializer has finished building my component.  Jeeesh. 
You think there'd be a way...

Michael



On Mon, 26 Jul 2010, aappddeevv wrote:

> I think this is the @PostConstruct concept again. However, in a
parent-child
> tree you may have to bound the initialization process like in WPF
> (BeginInit, EndInit) because a parent component is not really initialized
> until its children are. You have to pick your semantics to figure out
what's
> right for you.
>
>
> -----Original Message-----
> From: Greg Brown (JIRA) [mailto:jira@apache.org]
> Sent: Monday, July 26, 2010 8:13 PM
> To: dev@pivot.apache.org
> Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface
so
> that components know when they've been initialized
>
>
>    [
>
https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
>
in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
> 2892553 ]
>
> Greg Brown commented on PIVOT-580:
> ----------------------------------
>
> I understand. But keep in mind that BXML is just a shortcut to
instantiating
> and setting properties on Java objects "by hand". You wouldn't get any
such
> notifications in Java, so we don't provide them in BXML either. Your
classes
> should be able to function the same whether they are created by
> BXMLSerializer or some other means (i.e. programmatically).
>
>
>
>> Add a Lifecycle callback interface so that components know when they've
> been initialized
>>
>
----------------------------------------------------------------------------
> ------------
>>
>>                 Key: PIVOT-580
>>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>>             Project: Pivot
>>          Issue Type: New Feature
>>          Components: wtk
>>            Reporter: Michael Allman
>>
>> I just created
>> public interface Lifecycle {
>>     public void initialized();
>> }
>> because I want one of my custom components to know when it's been
> initialized.  The component takes a specific action after being
initialized.
> By "initialized", I mean "having all properties set".
>> The serializer calls this method after it has finished initializing the
> component, basically at the end of the processEndElement method.
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>


RE: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by Michael Allman <ms...@allman.ms>.
I don't know what @PostConstruct is.  Does it do what I want?  I just want 
to know when the serializer has finished building my component.  Jeeesh. 
You think there'd be a way...

Michael



On Mon, 26 Jul 2010, aappddeevv wrote:

> I think this is the @PostConstruct concept again. However, in a parent-child
> tree you may have to bound the initialization process like in WPF
> (BeginInit, EndInit) because a parent component is not really initialized
> until its children are. You have to pick your semantics to figure out what's
> right for you.
>
>
> -----Original Message-----
> From: Greg Brown (JIRA) [mailto:jira@apache.org]
> Sent: Monday, July 26, 2010 8:13 PM
> To: dev@pivot.apache.org
> Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so
> that components know when they've been initialized
>
>
>    [
> https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
> in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
> 2892553 ]
>
> Greg Brown commented on PIVOT-580:
> ----------------------------------
>
> I understand. But keep in mind that BXML is just a shortcut to instantiating
> and setting properties on Java objects "by hand". You wouldn't get any such
> notifications in Java, so we don't provide them in BXML either. Your classes
> should be able to function the same whether they are created by
> BXMLSerializer or some other means (i.e. programmatically).
>
>
>
>> Add a Lifecycle callback interface so that components know when they've
> been initialized
>>
> ----------------------------------------------------------------------------
> ------------
>>
>>                 Key: PIVOT-580
>>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>>             Project: Pivot
>>          Issue Type: New Feature
>>          Components: wtk
>>            Reporter: Michael Allman
>>
>> I just created
>> public interface Lifecycle {
>>     public void initialized();
>> }
>> because I want one of my custom components to know when it's been
> initialized.  The component takes a specific action after being initialized.
> By "initialized", I mean "having all properties set".
>> The serializer calls this method after it has finished initializing the
> component, basically at the end of the processEndElement method.
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>

RE: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by aappddeevv <aa...@verizon.net>.
I think this is the @PostConstruct concept again. However, in a parent-child
tree you may have to bound the initialization process like in WPF
(BeginInit, EndInit) because a parent component is not really initialized
until its children are. You have to pick your semantics to figure out what's
right for you.


-----Original Message-----
From: Greg Brown (JIRA) [mailto:jira@apache.org] 
Sent: Monday, July 26, 2010 8:13 PM
To: dev@pivot.apache.org
Subject: [jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so
that components know when they've been initialized


    [
https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plug
in.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_1
2892553 ] 

Greg Brown commented on PIVOT-580:
----------------------------------

I understand. But keep in mind that BXML is just a shortcut to instantiating
and setting properties on Java objects "by hand". You wouldn't get any such
notifications in Java, so we don't provide them in BXML either. Your classes
should be able to function the same whether they are created by
BXMLSerializer or some other means (i.e. programmatically).



> Add a Lifecycle callback interface so that components know when they've
been initialized
>
----------------------------------------------------------------------------
------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been
initialized.  The component takes a specific action after being initialized.
By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the
component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892553#action_12892553 ] 

Greg Brown commented on PIVOT-580:
----------------------------------

I understand. But keep in mind that BXML is just a shortcut to instantiating and setting properties on Java objects "by hand". You wouldn't get any such notifications in Java, so we don't provide them in BXML either. Your classes should be able to function the same whether they are created by BXMLSerializer or some other means (i.e. programmatically).



> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Brown resolved PIVOT-580.
------------------------------

    Resolution: Won't Fix

The Bindable interface serves this purpose. Initialization of other elements can take place in your class constructor.




> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892563#action_12892563 ] 

Greg Brown commented on PIVOT-580:
----------------------------------

It may help to note that Bindable is primarily about namespace variables, not instantiation. The initialize() method is called when BXMLSerializer#bind() has been called on the root object, to notify the object that all page-level variables have been fully initialized and are available for event registration, etc.

If you need nested initialization notification, you can split your BXML file up into includes with their own bindable root elements - that way, the root of every include will also be notified when its initialize() method is called.


> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Michael Allman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892561#action_12892561 ] 

Michael Allman commented on PIVOT-580:
--------------------------------------

BXML calls the initialize method on the Bindable interface.  Isn't that a notification?  It doesn't look like setting a property to me...

> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Michael Allman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892566#action_12892566 ] 

Michael Allman commented on PIVOT-580:
--------------------------------------

Oh, yeah, and while I think it's best to avoid having interdependencies among properties, where it's unavoidable or quite inconvenient otherwise an "initialized" callback tells the object that it can manage dependencies at that point.

> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Michael Allman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892547#action_12892547 ] 

Michael Allman commented on PIVOT-580:
--------------------------------------

Tried Bindable.  Doesn't work.  Bindable is only called on root objects, not subobjects.  I want to know when *any* object that implements the Lifecycle interface is initialized.

Cheers.

> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-580) Add a Lifecycle callback interface so that components know when they've been initialized

Posted by "Michael Allman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893174#action_12893174 ] 

Michael Allman commented on PIVOT-580:
--------------------------------------

I just wanted to add that I'm passing the serializer as part of the "initialized" method.  I think that makes it a little more obvious what the method is there for.

> Add a Lifecycle callback interface so that components know when they've been initialized
> ----------------------------------------------------------------------------------------
>
>                 Key: PIVOT-580
>                 URL: https://issues.apache.org/jira/browse/PIVOT-580
>             Project: Pivot
>          Issue Type: New Feature
>          Components: wtk
>            Reporter: Michael Allman
>
> I just created
> public interface Lifecycle {
>     public void initialized();
> }
> because I want one of my custom components to know when it's been initialized.  The component takes a specific action after being initialized.  By "initialized", I mean "having all properties set".
> The serializer calls this method after it has finished initializing the component, basically at the end of the processEndElement method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.