How to iterate over an bxml form to get all the TextInputs added to it?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to iterate over an bxml form to get all the TextInputs added to it?

Santosh
Hi,
In my application I created one Border component in bxml file and then added TablePane to it. And then added multiple rows to that TablePane. And in each Row i have added several textinput components.

Now i want to iterate through the Border component to get all the TextInputs. Is there any way of doing this?

--
Thanks & Regards
B.S.V.S.Pavan Raju.
Skype: skype_pavan1
Hyderabad.
santosh pavan raju
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to iterate over an bxml form to get all the TextInputs added to it?

Roger and Beth Whitcomb
Hi,
    All the components can be iterated through using the "Sequence<Component>" interface, something like this:

private void iterateTextInputs(Container container) {
    for (Component comp : container) {
        if (comp instanceof Container) {
            iterateTextInputs((Container)comp);
        } else if (comp instanceof TextInput) {
            TextInput textInput = (TextInput)comp;
            // Do whatever you need to do
        }
    }
}

Then you would call this method with your Border component:
    @BXML Border borderComponent;
    iterateTextInputs(borderComponent);

HTH,
~Roger

On 6/11/14 12:11 AM, V SANTOSH PAVAN RAJU Bs wrote:
Hi,
In my application I created one Border component in bxml file and then added TablePane to it. And then added multiple rows to that TablePane. And in each Row i have added several textinput components.

Now i want to iterate through the Border component to get all the TextInputs. Is there any way of doing this?

--
Thanks & Regards
B.S.V.S.Pavan Raju.
Skype: skype_pavan1
Hyderabad.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to iterate over an bxml form to get all the TextInputs added to it?

Santosh
Thank you Roger, its working.
santosh pavan raju
Loading...