pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: getting object fron its container
Date Wed, 02 Feb 2011 13:06:38 GMT
 The Container#getNamedComponent(String) method is defined here

You can see that it only iterates over the direct child Components in the
Container and then checks for a matching name property.
It does *not* check to see if those Components are actually instances of
Container, and then recursively iterate over them.

It appears that none of the standard Pivot Containers override this method
at look into child Containers, so you would need to roll your own method if
you need to do that.

Bear in mind that theContainer#getNamedComponent(String) method attempts to
match against Component#getName().
BXMLSerializer sets the Component's name property to the same value as the
bxml:id as a convenience, but these are 2 separate values.

The Component's name can be set explicity in BXML as follows.
<PushButton bxml:id="Button1" name="Foo" buttonData="%Button1”/>
or in java (including at runtime) with

If you wanted to find this PushButton by name you would have to supply a
value of "Foo", and not "Button1"

It will often be more convenient to use the @BXML annotation to pick up
objects in your code.
The section titled 'The Bindable Interface' in the following tutorial
contains more info.


On 2 February 2011 17:43, Aanjaneya Shukla <aanjaneya@vmware.com> wrote:

> Hi,
> I am having some issues using ‘getNamedComponent’ method.
> BXML file:
> <PushButton bxml:id="Button1" buttonData="%Button1”/>
> Java file:
> PushButton Button1 = (PushButton)window.getNamedComponent("Button1");
> I want to get Button object but I have getting null value returned.

View raw message