You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Roger L. Whitcomb" <Ro...@actian.com> on 2012/10/23 19:52:18 UTC

RE: Form.getSection returns null for nested components

In looking into this change (for Pivot-834(, there are some subtle
implications to changing the existing method:
1) TerraFormSkin uses Form.getSection() in conjunction with
section.indexOf() in the "labelChanged" method. This probably would
break badly with the proposed change, and the follow-on changes to
"getIndex" and etc. would quickly get to be very confusing.
2) As Chris noted this is easy enough to implement in an application by
following the parent chain.

So, I would propose adding another method:
"Form.getEnclosingSection(Component)" that would do what is requested
for when it is needed, but leave the existing method alone.

 

~Roger Whitcomb

 

From: Chris Bartlett [mailto:cbartlett.x@gmail.com] 
Sent: Monday, January 09, 2012 11:55 AM
To: user@pivot.apache.org
Subject: Re: Form.getSection returns null for nested components

 

David,

I would need to take a look through the source to see where this method
(and similar ones in other containers) is used to try to determine the
original intent.  I don't have time right now, but will try to get to it
soon.

It certainly doesn't sound unreasonable for 'nested' components to be
found, but it could be argued that it may not really belong within the
library itself.  It would be just as easy for application code to
perform the check and then repeat with the result of
component.getParent() as many times as was required.

Anyone else have any thoughts?

Chris

On Jan 9, 2012 4:40 AM, "David Keen" <DK...@sigtec.com> wrote:

Hi,

 

If I call Form.getSection(component) where, for example, component is a
TextInput inside a BoxPane in a Form Section, then I get null.  However
if the TextInput is not inside the BoxPane then it will return the
section just fine.

 

I'm just wondering whether this is intended behaviour or not - it seems
like it would be more useful if this worked for all components within a
form section, regardless of whether they are nested or not.

 

Regards,

David.