Author Topic: Getting the folder's current view  (Read 606 times)

Joel01

  • Member
  • **
  • Posts: 10
Getting the folder's current view
« 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

Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1639
  • Code Punk
    • Archi
Re: Getting the folder's current view
« Reply #1 on: January 27, 2020, 16:00:42 PM »
In code you do this to get the parent folder:

Code: [Select]
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! https://www.archimatetool.com/donate

Joel01

  • Member
  • **
  • Posts: 10
Re: Getting the folder's current view
« Reply #2 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?


Phil Beauvoir

  • Administrator
  • Hero Member
  • *****
  • Posts: 1639
  • Code Punk
    • Archi
Re: Getting the folder's current view
« Reply #3 on: January 27, 2020, 16:32:23 PM »
eContainer() in this context returns type com.archimatetool.model.IFolder.
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Joel01

  • Member
  • **
  • Posts: 10
Re: Getting the folder's current view
« Reply #4 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