Function IndexOf returning -1 from existing StiPanel

Stimulsoft Reports.JAVA discussion
Post Reply
User avatar
rafaelwithoeft
Posts: 70
Joined: Thu Mar 05, 2015 8:26 pm

Function IndexOf returning -1 from existing StiPanel

Post 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
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Function IndexOf returning -1 from existing StiPanel

Post by HighAley »

Hello.

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

Thank you.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Function IndexOf returning -1 from existing StiPanel

Post 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.
User avatar
rafaelwithoeft
Posts: 70
Joined: Thu Mar 05, 2015 8:26 pm

Re: Function IndexOf returning -1 from existing StiPanel

Post by rafaelwithoeft »

OK, I will attach the report in this response.

Thank you
Attachments
boleto-branco.mrt
(98.14 KiB) Downloaded 358 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Function IndexOf returning -1 from existing StiPanel

Post 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.
User avatar
rafaelwithoeft
Posts: 70
Joined: Thu Mar 05, 2015 8:26 pm

Re: Function IndexOf returning -1 from existing StiPanel

Post 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.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Function IndexOf returning -1 from existing StiPanel

Post by Vladimir »

Hello,

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

Thank you.
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: Function IndexOf returning -1 from existing StiPanel

Post 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)
Post Reply