Page 1 of 1

Function IndexOf returning -1 from existing StiPanel

Posted: Fri Jul 17, 2015 4:59 pm
by rafaelwithoeft
Hello, I need to get the StiPanel component index but function is returning -1

Code: Select all

StiPanel bandaPainelOriginal = (StiPanel) relatorioOriginal.getComponents().get("XYZ");
int indiceComponenteOriginal = bandaPainelOriginal.getPage().getComponents().indexOf(bandaPainelOriginal); // Return -1

//another way
System.out.println(relatorioOriginal.getPages().get(0).getComponents().indexOf(bandaPainelOriginal)); // Return -1

System.out.println(relatorioOriginal.getComponents().get("XYZ") + " Class: " + relatorioOriginal.getComponents().get("XYZ").getClass()); 
// Return XYZ Class: class com.stimulsoft.report.components.complexcomponents.StiPanel 
What is wrong? Thank you


------------------EDIT------------------

The interaction of the "foreach" doesn't give me the correct components connected to the panel.

Code: Select all

for (StiComponent componente : bandaPainelOriginal.getComponents()) { 
//return only "XYZ" - XYZ is the panel...
}
Thank you

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Tue Jul 21, 2015 8:30 am
by HighAley
Hello.

Sorry for the delay with answer.
We need some additional time to prepare an answer.

Thank you.

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Wed Jul 22, 2015 1:19 pm
by HighAley
Hello.

We have found the issue. We need some time to fix the issue.
To be sure that it is solved we need to see your report template.

Thank you.

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Wed Jul 22, 2015 7:44 pm
by rafaelwithoeft
OK, I will attach the report in this response.

Thank you

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Thu Jul 23, 2015 7:08 am
by HighAley
Hello.

Sorry, but we couldn't find Panels mentioned in your previous messages.

Also we should notice that you should make some changes in the report template to avoid some difficulties in future. You should remove Rectangles from the report and change size of text components to the size of the rectangles. The border property of the text components will help you to draw necessary lines.

Thank you.

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Thu Jul 23, 2015 5:52 pm
by rafaelwithoeft
Panels is inside of the "DataBand1".
The panel as named "configuravel-boleto-carta".

Over this panel, in future, will contain several other components, like text, images..

I liked your idea to use text to make the necessaries lines, thank you.

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Fri Jul 24, 2015 11:57 am
by Vladimir
Hello,

Thank you for sample report, we will fix the error and let you know.
We need some time.

Thank you.

Re: Function IndexOf returning -1 from existing StiPanel

Posted: Tue Aug 04, 2015 12:46 pm
by Vadim
Hello.
bandaPainelOriginal.getPage().getComponents().indexOf(bandaPainelOriginal); // Return -1
System.out.println(relatorioOriginal.getPages().get(0).getComponents().indexOf(bandaPainelOriginal)); // Return -1
Return -1 because this component located on other component DataBand1, you can use next code to get component index:

Code: Select all

bandaPainelOriginal.getParent().getComponents().indexOf(bandaPainelOriginal)