Getting the folder's current view

Started by Joel01, January 27, 2020, 15:50:46 PM

Previous topic - Next topic

Joel01

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

Phil Beauvoir

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.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Joel01

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?


Phil Beauvoir

eContainer() in this context returns type com.archimatetool.model.IFolder.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Joel01

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