Jump to content
Changes to the Jaspersoft community edition download ×

"OpenFile" Method of MainFrame returns null


Recommended Posts

By: C-Box - c-box

"OpenFile" Method of MainFrame returns null

2004-12-02 07:24

Hi Giulio,

 

I'm still developing my database-plugin for iReport... I use the method "openFile" of mainframe to load my reports from database into iReport.

But now I need the JReportFrame that actually should get returned by that method. But when I looked at the source I encountered that it returns NULL when I open the report for the first time:

 

could you please change that method to the following:

 

public JReportFrame openFile(File file){

 

JReportFrame reportFrame;

reportFrame = findReportFrameByFile(file);

 

 

if( reportFrame == null ){

try {

Report report = new Report(file.getPath());

report.setUsingMultiLineExpressions( false ); //this.isUsingMultiLineExpressions());

openNewReportWindow( report );

reportFrame = findReportFrameByFile(file); // that's the new line... so the returnvalue isn't null at the first call for the report -> it's just the simplest thing I found within one minute ... perhaps you have another idea that is much better.

} catch (Exception e ) {

logOnConsole( e.getMessage() + "n" );

}

 

} else {

setActiveReportForm(reportFrame);

}

 

return reportFrame;

}

 

 

Does it influence any other methods you're using?

 

tia + greetings from quite cold Germany

C-Box

 

 

 

By: C-Box - c-box

RE: "OpenFile" Method of MainFrame returns nu

2004-12-02 07:57

... just a question yet,

 

i temporarily solved the problem above with calling the "OpenFile" method twice.... so I get the JReportFrame.... but now I stored the JReportFrame-Object within my "DBPluginReport-Object" (has some additional information from database) and want to activate it in iReport (from a JTree within my plugin-form).... therefor I tried the methods

 

_iReportMainFrame.setFileListActivatedFrame(rep.getIReportFrame());

 

and/or

 

_iReportMainFrame.setActiveReportForm(rep.getIReportFrame());

 

both methods don't bring the needed Report to the front, just move it in the FileTree to the active one... but how can I set the JReportFrame ACTIVE that I can see the report-layout directly.... (bringToFront also doesn't work).... ??? (I load a kind of set of reports (like your Project that's not yet implemented) and I see the last report that was loaded from database in iReport.)

 

thx in advance again

C-Box

 

PS: I'm using 0.4.0

 

 

By: Giulio Toffoli - gt78

RE: "OpenFile" Method of MainFrame returns null

2004-12-02 10:01

 

Hi C-Box

 

1. call OpenFile twice is bad but safe. Anyway now should works (I fixed and versioned, now OpenFile return the JReportFrame correctly).

 

2. To activate a report simply:

 

JReportFrame youReportFrame;

youReportFrame..setSelected(true);

 

 

Ciao!

 

Giulio

 

P.S. 0.4.1 in CVS use JR 0.6.3

 

 

 

 

 

By: C-Box - c-box

RE: "OpenFile" Method of MainFrame returns nu

2004-12-03 05:07

Hi Giulio,

 

thx for your reply. It works fine now. (I still call the method twice yet - because I wait till 0.4.1 is ready).

The "setSelected(true)"works also fine.

 

What I would like to introduce in your PluginArchitecture is just an additional boolean attribute in the Plugin.xml that is called for instance. "AutoStartPlugin" and when you load the plugins at the LAST action after iReports start-routine you can call the plugin class it that attribute is set to true.

 

What do you think about it?

 

thx + have a nice weekend

C-Box

 

 

By: C-Box - c-box

RE: "OpenFile" Method of MainFrame returns nu

2004-12-13 03:47

Hi Giulio,

 

I'm still building my DataBasePlugin for IReport.... and I now tried to add a Button into your panelToolbar .. but I found out, that it's not as easy as I thought this morning.... :-( You built a vector with all that elements within... so that vector is private.... so I can't add a new Button by myself... so perhaps you could make that vector public or even better... build a simple addMethod to extend the Toolbar... or even yet better allow a plugin to add a own toolbar (that is placed after your formatToolbar)....

 

what do you think... is that manageable?

 

greetings

C-Box

 

 

 

By: Giulio Toffoli - gt78

RE: "OpenFile" Method of MainFrame returns null

2004-12-13 15:34

 

It's possible. The best is put a button on the main toolbar with a function like: addToolbarComponent(JComponent component)

 

 

About plugin: no problem for the autostart.

I'll add it.

 

Giulio

 

 

By: C-Box - c-box

RE: "OpenFile" Method of MainFrame returns nu

2005-02-01 08:01

Hi Giulio (once more :-))

 

thx for the "loadOnStartup" feature and the repaired "openFile" method. Works great since 0.4.1.

 

But I guess you didn't find time to implement the "addToolbarComponent" method we discussed above, to add a Button into the mainToolbar, isn't it?!?

Will you "waste" another 10 min. on thinking about that public method? I'd love it!

 

tia + greetings again from quite uncomfortable Germany

 

C-Box

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...