You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Robert Piotrowski <rp...@azonic.net> on 2010/03/05 21:03:24 UTC

events and wtkx:id's

I've got an accordion with 2 custom panes objects:

<Window title="SOLR VUE" maximized="true" xmlns:wtkx="
http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"
wtkx:id="window_top">
    <content>
        <Accordion wtkx:id="accordion_entities" styles="{padding:5}"
height="200">
            <userData url_solr_base="http://usildlapisea02/solr/dev"/>
            <panels>
            <wtkx:include src="file:c:\rpiotrowski\solr\pane_person.xml"
Accordion.label="Person"/>
            <wtkx:include src="file:c:\rpiotrowski\solr\pane_company.xml"
Accordion.label="Company"/>


Each Panel's wtkx file has as a Form.Section with a submit button the same
wtkx:id of "submit_button".

When I press on the submit button for one form, the handler fires for both
forms automatically.  Is this because both buttons have the same wtkx:id ?

If so, then how do I generically add a handler to all forms without creating
this kind of behavior?



Thanks
Bob

Re: events and wtkx:id's

Posted by Robert Piotrowski <rp...@azonic.net>.
i was using multple wtkx file without an ID on the include element.  When I 
tried adding an ID attribute in the include element, I was getting an error 
(forgot what it was)

But each panel had a unique ID (person_panel, company_panel, etc.) inside 
their own wtxk file.



Bob


----- Original Message ----- 
From: "Greg Brown" <gk...@mac.com>
To: <us...@pivot.apache.org>
Sent: Friday, March 05, 2010 5:49 PM
Subject: Re: events and wtkx:id's


>I just had a thought. Do you use multiple <wtkx:include> elements in your 
>WTKX that contains the accordion? For example, do you have an include for 
>each panel? If so, do those includes define their own IDs? Finally, do you 
>assign IDs to the includes themselves? e.g.
>
> <wtkx:include wtkx:id="foo" src="foo.wtkx"/>
>
> Defining an ID for an include creates a separate namespace for that 
> include. Currently, if you don't define an ID for an include, it inherits 
> the namespace of the parent WTKX. This could create naming collisions and 
> may be the cause of some of your confusion. It also isn't very intuitive.
>
> It might be more appropriate to define an "inline" attribute for the 
> <wtkx:include> element. If true, the include would inherit the parent's 
> namespace; otherwise, it would define its own. Does this make sense?
>
>
> On Mar 5, 2010, at 5:09 PM, Greg Brown wrote:
>
>>> Duplicate Id's are pretty helpful though.  Are you supposed to be able 
>>> to add multiple instances of a wtkx file?
>>
>> Sorry, I should have been more clear. Duplicate IDs aren't really 
>> supported in a single WTKX file. However, you can duplicate them across 
>> WTKX files, or within multiple instances of the same WTKX file. 
>> Basically, the WTKX file defines a scope within which the IDs should be 
>> unique.
>>
>> It is analogous to defining multiple member variables with the same name 
>> in a Java class. That's not allowed, but you can still have multiple 
>> instances of that class, each of which has its own set of member 
>> variables.
>>
>>> If I wanted to add multple accordion panels that share a generic 
>>> interface, what would be the best way to do that?
>>
>>
>> For each panel, I'd create a custom class that implements that interface. 
>> Then I would create a separate WTKX file for each panel, using your 
>> custom classes as the root element of your WTKX files. Then 
>> <wtkx:include> the files into the Accordion.
>>
>> G
>>
>>
>
> 


Re: events and wtkx:id's

Posted by Greg Brown <gk...@mac.com>.
OK, that explains it. I just checked in support for the "inline" attribute. If you are building Pivot from source, you can start to use it in your code. Otherwise, it will be included in Pivot 1.4.1 when it is released.


On Mar 5, 2010, at 7:39 PM, Robert Piotrowski wrote:

> I was using multiple wtkx files without an ID on the include elements.  When I tried adding an ID attribute in the include elements, I was getting an error (forgot what it was)
> 
> But each panel had a unique ID(person_panel,company_panel, etc.) inside their own wtxk file.
> 
> An "inline" attribute would make sense.
> 
> 
> 
> Bob
> 
> 
> 
> ----- Original Message ----- From: "Greg Brown" <gk...@mac.com>
> To: <us...@pivot.apache.org>
> Sent: Friday, March 05, 2010 5:49 PM
> Subject: Re: events and wtkx:id's
> 
> 
>> I just had a thought. Do you use multiple <wtkx:include> elements in your WTKX that contains the accordion? For example, do you have an include for each panel? If so, do those includes define their own IDs? Finally, do you assign IDs to the includes themselves? e.g.
>> 
>> <wtkx:include wtkx:id="foo" src="foo.wtkx"/>
>> 
>> Defining an ID for an include creates a separate namespace for that include. Currently, if you don't define an ID for an include, it inherits the namespace of the parent WTKX. This could create naming collisions and may be the cause of some of your confusion. It also isn't very intuitive.
>> 
>> It might be more appropriate to define an "inline" attribute for the <wtkx:include> element. If true, the include would inherit the parent's namespace; otherwise, it would define its own. Does this make sense?
>> 
>> 
>> On Mar 5, 2010, at 5:09 PM, Greg Brown wrote:
>> 
>>>> Duplicate Id's are pretty helpful though.  Are you supposed to be able to add multiple instances of a wtkx file?
>>> 
>>> Sorry, I should have been more clear. Duplicate IDs aren't really supported in a single WTKX file. However, you can duplicate them across WTKX files, or within multiple instances of the same WTKX file. Basically, the WTKX file defines a scope within which the IDs should be unique.
>>> 
>>> It is analogous to defining multiple member variables with the same name in a Java class. That's not allowed, but you can still have multiple instances of that class, each of which has its own set of member variables.
>>> 
>>>> If I wanted to add multple accordion panels that share a generic interface, what would be the best way to do that?
>>> 
>>> 
>>> For each panel, I'd create a custom class that implements that interface. Then I would create a separate WTKX file for each panel, using your custom classes as the root element of your WTKX files. Then <wtkx:include> the files into the Accordion.
>>> 
>>> G
>>> 
>>> 
>> 
> 


Re: events and wtkx:id's

Posted by Robert Piotrowski <rp...@azonic.net>.
I was using multiple wtkx files without an ID on the include elements.  When 
I tried adding an ID attribute in the include elements, I was getting an 
error (forgot what it was)

But each panel had a unique ID(person_panel,company_panel, etc.) inside 
their own wtxk file.

An "inline" attribute would make sense.



Bob



----- Original Message ----- 
From: "Greg Brown" <gk...@mac.com>
To: <us...@pivot.apache.org>
Sent: Friday, March 05, 2010 5:49 PM
Subject: Re: events and wtkx:id's


>I just had a thought. Do you use multiple <wtkx:include> elements in your 
>WTKX that contains the accordion? For example, do you have an include for 
>each panel? If so, do those includes define their own IDs? Finally, do you 
>assign IDs to the includes themselves? e.g.
>
> <wtkx:include wtkx:id="foo" src="foo.wtkx"/>
>
> Defining an ID for an include creates a separate namespace for that 
> include. Currently, if you don't define an ID for an include, it inherits 
> the namespace of the parent WTKX. This could create naming collisions and 
> may be the cause of some of your confusion. It also isn't very intuitive.
>
> It might be more appropriate to define an "inline" attribute for the 
> <wtkx:include> element. If true, the include would inherit the parent's 
> namespace; otherwise, it would define its own. Does this make sense?
>
>
> On Mar 5, 2010, at 5:09 PM, Greg Brown wrote:
>
>>> Duplicate Id's are pretty helpful though.  Are you supposed to be able 
>>> to add multiple instances of a wtkx file?
>>
>> Sorry, I should have been more clear. Duplicate IDs aren't really 
>> supported in a single WTKX file. However, you can duplicate them across 
>> WTKX files, or within multiple instances of the same WTKX file. 
>> Basically, the WTKX file defines a scope within which the IDs should be 
>> unique.
>>
>> It is analogous to defining multiple member variables with the same name 
>> in a Java class. That's not allowed, but you can still have multiple 
>> instances of that class, each of which has its own set of member 
>> variables.
>>
>>> If I wanted to add multple accordion panels that share a generic 
>>> interface, what would be the best way to do that?
>>
>>
>> For each panel, I'd create a custom class that implements that interface. 
>> Then I would create a separate WTKX file for each panel, using your 
>> custom classes as the root element of your WTKX files. Then 
>> <wtkx:include> the files into the Accordion.
>>
>> G
>>
>>
>
> 


Re: events and wtkx:id's

Posted by Greg Brown <gk...@mac.com>.
I just had a thought. Do you use multiple <wtkx:include> elements in your WTKX that contains the accordion? For example, do you have an include for each panel? If so, do those includes define their own IDs? Finally, do you assign IDs to the includes themselves? e.g.

<wtkx:include wtkx:id="foo" src="foo.wtkx"/>

Defining an ID for an include creates a separate namespace for that include. Currently, if you don't define an ID for an include, it inherits the namespace of the parent WTKX. This could create naming collisions and may be the cause of some of your confusion. It also isn't very intuitive. 

It might be more appropriate to define an "inline" attribute for the <wtkx:include> element. If true, the include would inherit the parent's namespace; otherwise, it would define its own. Does this make sense?


On Mar 5, 2010, at 5:09 PM, Greg Brown wrote:

>> Duplicate Id's are pretty helpful though.  Are you supposed to be able to add multiple instances of a wtkx file?
> 
> Sorry, I should have been more clear. Duplicate IDs aren't really supported in a single WTKX file. However, you can duplicate them across WTKX files, or within multiple instances of the same WTKX file. Basically, the WTKX file defines a scope within which the IDs should be unique. 
> 
> It is analogous to defining multiple member variables with the same name in a Java class. That's not allowed, but you can still have multiple instances of that class, each of which has its own set of member variables.
> 
>> If I wanted to add multple accordion panels that share a generic interface, what would be the best way to do that?
> 
> 
> For each panel, I'd create a custom class that implements that interface. Then I would create a separate WTKX file for each panel, using your custom classes as the root element of your WTKX files. Then <wtkx:include> the files into the Accordion.
> 
> G
> 
> 


Re: events and wtkx:id's

Posted by Greg Brown <gk...@mac.com>.
> Duplicate Id's are pretty helpful though.  Are you supposed to be able to add multiple instances of a wtkx file?

Sorry, I should have been more clear. Duplicate IDs aren't really supported in a single WTKX file. However, you can duplicate them across WTKX files, or within multiple instances of the same WTKX file. Basically, the WTKX file defines a scope within which the IDs should be unique. 

It is analogous to defining multiple member variables with the same name in a Java class. That's not allowed, but you can still have multiple instances of that class, each of which has its own set of member variables.

> If I wanted to add multple accordion panels that share a generic interface, what would be the best way to do that?


For each panel, I'd create a custom class that implements that interface. Then I would create a separate WTKX file for each panel, using your custom classes as the root element of your WTKX files. Then <wtkx:include> the files into the Accordion.

G



Re: events and wtkx:id's

Posted by Robert Piotrowski <rp...@azonic.net>.
Duplicate Id's are pretty helpful though.  Are you supposed to be able to
add multiple instances of a wtkx file?

If I wanted to add multple accordion panels that share a generic interface,
what would be the best way to do that?


Thanks,

Bob


On Fri, Mar 5, 2010 at 2:56 PM, Greg Brown <gk...@mac.com> wrote:

> It should have produced an NPE if the value wasn't actually bound. However,
> it sounds like it may have bound to the first button with the ID (the one
> that wasn't misspelled), so the member variable wouldn't have been null.
>
> One thing to note is that duplicate IDs in WTKX aren't really supported -
> if that doesn't currently throw an exception, it probably should.
>
>
> On Mar 5, 2010, at 3:45 PM, Robert Piotrowski wrote:
>
> Between my panels, the Form.Section wtkx:id was the same, but the
> submit_button id was misspelled on the second wtkx:id.  So the buttonhandler
> registered correctly on only one button.  For some reason, the correct
> submit button handler was processing both forms.  I'm surpised that binding
> a button handler to a @WTKX bound button that really doesnt exist didnt
> cause a NPE.
>
>
>
> Bob
>
>
> On Fri, Mar 5, 2010 at 2:32 PM, Robert Piotrowski <rp...@azonic.net>wrote:
>
>> never mind.  another bonehead move on my part.
>>
>>
>>
>>
>> On Fri, Mar 5, 2010 at 2:03 PM, Robert Piotrowski <rpiotrowski@azonic.net
>> > wrote:
>>
>>> I've got an accordion with 2 custom panes objects:
>>>
>>> <Window title="SOLR VUE" maximized="true" xmlns:wtkx="
>>> http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"
>>> wtkx:id="window_top">
>>>     <content>
>>>         <Accordion wtkx:id="accordion_entities" styles="{padding:5}"
>>> height="200">
>>>             <userData url_solr_base="http://usildlapisea02/solr/dev"/>
>>>             <panels>
>>>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_person.xml"
>>> Accordion.label="Person"/>
>>>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_company.xml"
>>> Accordion.label="Company"/>
>>>
>>>
>>> Each Panel's wtkx file has as a Form.Section with a submit button the
>>> same wtkx:id of "submit_button".
>>>
>>> When I press on the submit button for one form, the handler fires for
>>> both forms automatically.  Is this because both buttons have the same
>>> wtkx:id ?
>>>
>>> If so, then how do I generically add a handler to all forms without
>>> creating this kind of behavior?
>>>
>>>
>>>
>>> Thanks
>>> Bob
>>>
>>
>>
>
>

Re: events and wtkx:id's

Posted by Greg Brown <gk...@mac.com>.
It should have produced an NPE if the value wasn't actually bound. However, it sounds like it may have bound to the first button with the ID (the one that wasn't misspelled), so the member variable wouldn't have been null. 

One thing to note is that duplicate IDs in WTKX aren't really supported - if that doesn't currently throw an exception, it probably should.


On Mar 5, 2010, at 3:45 PM, Robert Piotrowski wrote:

> Between my panels, the Form.Section wtkx:id was the same, but the submit_button id was misspelled on the second wtkx:id.  So the buttonhandler registered correctly on only one button.  For some reason, the correct submit button handler was processing both forms.  I'm surpised that binding a button handler to a @WTKX bound button that really doesnt exist didnt cause a NPE.
> 
> 
> 
> Bob
> 
> 
> On Fri, Mar 5, 2010 at 2:32 PM, Robert Piotrowski <rp...@azonic.net> wrote:
> never mind.  another bonehead move on my part. 
> 
> 
> 
> 
> On Fri, Mar 5, 2010 at 2:03 PM, Robert Piotrowski <rp...@azonic.net> wrote:
> I've got an accordion with 2 custom panes objects:
> 
> <Window title="SOLR VUE" maximized="true" xmlns:wtkx="http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk" wtkx:id="window_top">
>     <content>
>         <Accordion wtkx:id="accordion_entities" styles="{padding:5}" height="200">
>             <userData url_solr_base="http://usildlapisea02/solr/dev"/>
>             <panels>
>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_person.xml" Accordion.label="Person"/>
>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_company.xml" Accordion.label="Company"/>
> 
> 
> Each Panel's wtkx file has as a Form.Section with a submit button the same wtkx:id of "submit_button".
> 
> When I press on the submit button for one form, the handler fires for both forms automatically.  Is this because both buttons have the same wtkx:id ?
> 
> If so, then how do I generically add a handler to all forms without creating this kind of behavior?
> 
> 
> 
> Thanks
> Bob
> 
> 


Re: events and wtkx:id's

Posted by Robert Piotrowski <rp...@azonic.net>.
Between my panels, the Form.Section wtkx:id was the same, but the
submit_button id was misspelled on the second wtkx:id.  So the buttonhandler
registered correctly on only one button.  For some reason, the correct
submit button handler was processing both forms.  I'm surpised that binding
a button handler to a @WTKX bound button that really doesnt exist didnt
cause a NPE.



Bob


On Fri, Mar 5, 2010 at 2:32 PM, Robert Piotrowski <rp...@azonic.net>wrote:

> never mind.  another bonehead move on my part.
>
>
>
>
> On Fri, Mar 5, 2010 at 2:03 PM, Robert Piotrowski <rp...@azonic.net>wrote:
>
>> I've got an accordion with 2 custom panes objects:
>>
>> <Window title="SOLR VUE" maximized="true" xmlns:wtkx="
>> http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"
>> wtkx:id="window_top">
>>     <content>
>>         <Accordion wtkx:id="accordion_entities" styles="{padding:5}"
>> height="200">
>>             <userData url_solr_base="http://usildlapisea02/solr/dev"/>
>>             <panels>
>>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_person.xml"
>> Accordion.label="Person"/>
>>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_company.xml"
>> Accordion.label="Company"/>
>>
>>
>> Each Panel's wtkx file has as a Form.Section with a submit button the same
>> wtkx:id of "submit_button".
>>
>> When I press on the submit button for one form, the handler fires for both
>> forms automatically.  Is this because both buttons have the same wtkx:id ?
>>
>> If so, then how do I generically add a handler to all forms without
>> creating this kind of behavior?
>>
>>
>>
>> Thanks
>> Bob
>>
>
>

Re: events and wtkx:id's

Posted by Robert Piotrowski <rp...@azonic.net>.
never mind.  another bonehead move on my part.




On Fri, Mar 5, 2010 at 2:03 PM, Robert Piotrowski <rp...@azonic.net>wrote:

> I've got an accordion with 2 custom panes objects:
>
> <Window title="SOLR VUE" maximized="true" xmlns:wtkx="
> http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"
> wtkx:id="window_top">
>     <content>
>         <Accordion wtkx:id="accordion_entities" styles="{padding:5}"
> height="200">
>             <userData url_solr_base="http://usildlapisea02/solr/dev"/>
>             <panels>
>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_person.xml"
> Accordion.label="Person"/>
>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_company.xml"
> Accordion.label="Company"/>
>
>
> Each Panel's wtkx file has as a Form.Section with a submit button the same
> wtkx:id of "submit_button".
>
> When I press on the submit button for one form, the handler fires for both
> forms automatically.  Is this because both buttons have the same wtkx:id ?
>
> If so, then how do I generically add a handler to all forms without
> creating this kind of behavior?
>
>
>
> Thanks
> Bob
>

Re: events and wtkx:id's

Posted by Robert Piotrowski <rp...@azonic.net>.
More info:   I name a TextInput on each pane/form.section so that there was
a wtkx:id collision, but the eventhandlers for those acted normally.


Bob

On Fri, Mar 5, 2010 at 2:03 PM, Robert Piotrowski <rp...@azonic.net>wrote:

> I've got an accordion with 2 custom panes objects:
>
> <Window title="SOLR VUE" maximized="true" xmlns:wtkx="
> http://pivot.apache.org/wtkx" xmlns="org.apache.pivot.wtk"
> wtkx:id="window_top">
>     <content>
>         <Accordion wtkx:id="accordion_entities" styles="{padding:5}"
> height="200">
>             <userData url_solr_base="http://usildlapisea02/solr/dev"/>
>             <panels>
>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_person.xml"
> Accordion.label="Person"/>
>             <wtkx:include src="file:c:\rpiotrowski\solr\pane_company.xml"
> Accordion.label="Company"/>
>
>
> Each Panel's wtkx file has as a Form.Section with a submit button the same
> wtkx:id of "submit_button".
>
> When I press on the submit button for one form, the handler fires for both
> forms automatically.  Is this because both buttons have the same wtkx:id ?
>
> If so, then how do I generically add a handler to all forms without
> creating this kind of behavior?
>
>
>
> Thanks
> Bob
>