Archi Forum

Archi => Archi Development => Topic started by: Joel01 on January 27, 2020, 15:50:46 PM

Title: Getting the folder's current view
Post by: Joel01 on January 27, 2020, 15:50:46 PM
Hi,
My question concerns the ability to include folder's view in the existing jasper report.
In the subreport view.jrxml, we have access to the current com.archimatetool.model.IDiagramModel. I wonder how is it possibme to get the folder containing this view in the atrchimate model.
Those folders represent titles in the global document generated by jasper report.

I've already include a table of content, as I've seen it in on another post.  And I would share this work with great pleasure if I manage to do this.
Thank's for any response
Title: Re: Getting the folder's current view
Post by: Phil Beauvoir on January 27, 2020, 16:00:42 PM
In code you do this to get the parent folder:

view.eContainer()

(view is a com.archimatetool.model.IDiagramModel)

So I think you can use this in the report on the view object.
Title: Re: Getting the folder's current view
Post by: Joel01 on January 27, 2020, 16:29:02 PM
Thanks for your response. But it seems I still have some problems. I get a net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source texte $V{FOLDER_VIEW}

And I declared this in my view.jrxml:
<variable name="FOLDER_VIEW" class="java.lang.String" calculation="System">
  <initialValueExpression><![CDATA[((com.archimatetool.model.IDiagramModel)$F{this}).eContainer()]]</initialValueExpression>
</variable>
Ad then printed it in a textField like this: <textFieldExpression><![CDATA[$V{FOLDER_VIEW}]]></textFieldExpression>
I also tried with casting into com.archimatetool.model.impl.ArchimateDiagramModel, but I had the same error.

I couldn't find this method eContainer() in Git source code. Where is it defined?
Any idea?

Title: Re: Getting the folder's current view
Post by: Phil Beauvoir on January 27, 2020, 16:32:23 PM
eContainer() in this context returns type com.archimatetool.model.IFolder.
Title: Re: Getting the folder's current view
Post by: Joel01 on January 27, 2020, 18:10:56 PM
Thanks a lot! It works. I have now some others issues, but I can investigate!
I'll share my work when it'll be finished.
Thanks again