JavaFX: Embedding encoded image in .FXML file - image

I would like to embed an encoded image into an FXML (i need this in that I'm coding a converter between svg and fxml).
I tried with this:
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="153.0" layoutY="94.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYEAYAAACw5+G7AAAABmJLR0T///////8JWPfcAAAA CXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAYAAAAGAB4TKWmAAAI1UlEQVRYw61YS4gc VRf+7r1Vt+pWdfdMd0/P9PTMOCGJBpNI4gPiRrPQnSKIigQEN4LgQoTgwpU7QYOggop7UVA3 ESMEDKiJmIlEhUwS85pM5tGP6Wemn/V2cVJ2xxjCr//d3K66davOd873nXNus+jGwH8cjuM4 jgN0Op1OpwOEYRiGIcAY54wBQgihaUAqlUwmkwDnnEcRwBhjmvbvv8v+VwCO43muC1y6dOHC 0hJQKhWL5TIghKYJARQK09PpNDA1lc9nMoBlWVYyCdRqtdrmJrC+vr5eqQAAYwAwOzs3VygA 09NTU1NTBIhW/k8AoigMgwBYWbl2rVgEfvnl998XF4F6vVq9dg2YmUkmGQNyOSn7fYBzxlx3 uF8IIYQANE3XlaI7ySRQrfq+YQBra9Vqrwdks7nczAzw6KOPPPLww0AymUwmEncGdFsAnud5 vg9cvbq8fPUq0GiUSpUK0GqVSouLgBC9XqkEWBbn3S6g62HougDnUaTrIx9gjHE+vA4C8r3r apquA5ubvp9IAL0eY9kskMnMzc3PA/feu3v3nj0UmXz+9gD+Yl8URVEQEHejCKhUyuVKBbBt KcMQaDY3N5eWgPHxKNrYIGo4Du2UEghDQCkgioRgDBg1enTE9w2DZtsG+n2g23Wc1VVASt9P JoFOp93u9YBqVdMaDWBiIpNJp2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MDIN6r/l5YM+ehx568MEhgDuNf32ov3jx0qWrV4FisVQa bSFmZ6em0mlgbq5QKBTI84kEUC4Xi6USsLFRrzebQ63Nzs7MFApAPj85mc1SZb7T2eI/Afj7 iHf7vu8HAdDtUr/vODeaLY1zzgHTVMo0qXeiyFCd+K9/q/wJwRXXOxs1rPEAAAAASUVORK5C YII= " preserveRatio="false" smooth="false" />
</image>
</ImageView>
</children>
</AnchorPane>
As you can see I used the standard way I would do with HTML or CSS, passing a data url with the Base64 encoding of the image.
In this case it does not return any error, but the image is not displayed (passing a url to the same image as a file works, but this is not what I want).
Can somebody help me?
Thank you very much!

I was able to do this but not in FXML
String rocketImgStr = "iVBORw0KGgoAAAANSUhEUgAAADIAAAAdCAYAAADoxT9SAAAACXBIWXMAAAsYAAALGAGJqbUQAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/P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TCjJc1ocJIkFYKXZRlFUcY8jwIdLfVTqRQdnZ38at269CddXW+nYTOw60rdEF9eJUk/9NfWojU0MHPBAmbX1VE1fTo+nw+Xy1WQn+M4E4CNgnAch2w2Szwep6enh48++shsb2/f393d/RfgT3l358rd2efBlpegzgaOAgeAFrf7pF5Zua+6qmpmKBQqr6io0MvKyhS/34/H40FRFGzbLtxPTp06Zff39yd7e3ujvb29B2Ox2F7gQ2BfPjldORflKrh5Fdz0GGiVQDy/yf4M/AieMUdclKnAVee4KMVAUT6DOvlD+QwwCAzkXZQk/2M7r6+lQIUONVOhugZqZkPoenBfD1SOm+B1YA109H/JvtYYp3EmiCYQm0F8COIzELlxTmMCxGEQr4JohKzvK+Q0TvB+AxAphppiKC+CYm2kqCSb934H4PjAiOf7lfF+/zMAVaPsnAfVjSoAAAAASUVORK5CYII=";
BASE64Decoder base64Decoder = new BASE64Decoder();
ByteArrayInputStream rocketInputStream = new ByteArrayInputStream(base64Decoder.decodeBuffer(rocketImgStr));
Image rocketImg = new Image(rocketInputStream);
Hope that helps.

If you look at the String for the url attribute of the Image in the question, you can see that it has spaces in it, so it is not well-formed.
However, in another provided answer, there is an Image URL string encoding that has no spaces in it and is well formed.
If the corrupted Image URL string from the question is replaced with the correctly encoded value, then the image will be displayed (otherwise the image display will silently fail).
This is quite an old question (ten years), so it is possible that originally this feature was not supported and the image URL decoding support was added to JavaFX in a relatively recent release. For instance, support for data URL encoding of CSS stylesheets was only added in the JavaFX 17 release. And earlier Image javadoc than JavaFX 17 does not mention the feature.
From the Image javadoc:
The RFC 2397 "data" scheme for URLs is supported in addition to the
protocol handlers that are registered for the application. If a URL
uses the "data" scheme, the data must be base64-encoded and the MIME
type must either be empty or a subtype of the image type.
Example App
ImageScene.fxml
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="153.0" layoutY="94.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAdCAYAAADoxT9SAAAACXBIWXMAAAsYAAALGAGJqbUQAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQi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Q2BfPjldORflKrh5Fdz0GGiVQDy/yf4M/AieMUdclKnAVee4KMVAUT6DOvlD+QwwCAzkXZQk/2M7r6+lQIUONVOhugZqZkPoenBfD1SOm+B1YA109H/JvtYYp3EmiCYQm0F8COIzELlxTmMCxGEQr4JohKzvK+Q0TvB+AxAphppiKC+CYm2kqCSb934H4PjAiOf7lfF+/zMAVaPsnAfVjSoAAAAASUVORK5CYII=" preserveRatio="false" smooth="false" />
</image>
</ImageView>
</children>
</AnchorPane>
ImageDataApp.java
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class ImageDataApp extends Application {
#Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader(
ImageDataApp.class.getResource(
"ImageScene.fxml"
)
);
stage.setScene(
new Scene(
loader.load()
)
);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Side note for IntelliJ users
My IDE (Idea 2022.1.2), in the editor, highlights the URL image string in red and indicates that it is a malformed file path, but that is misleading and a shortcoming of the IDE. The IDE does not understand the correctly encoded image data URLs in FXML. The program will execute fine despite the IDE highlighting error.

Related

How can I open an App using it own background service

I'm creating Xamarin.Forms App and it has a service that runs in the background monitoring if any messages arrive. If a message arrives, the service should open the App.
I tried to open the App using Intent (Dependency Service) and I also tried using Xamarin.Essentials. Neither way worked.
My last attempt was with Xamarin.Essentials and gave the following error:
[Error][1]
[1]: https://i.stack.imgur.com/5jPGf.png
This is my code using Intent (Dependency Service):
//Intent (Dependency Service)
string teste = "com.saferit.saferproject";
openAppManager = DependencyService.Get<IAppHandler>();
openAppManager.Initialize(teste);
openAppManager.LaunchApp();
[enter image description here][2]
[2]: https://i.stack.imgur.com/lLx3g.png
This is my native code for Android
public void LaunchApp()
{
Intent intent = new Intent();
intent.SetClassName(Package, "activity");
intent.AddFlags(ActivityFlags.NewTask);
Xamarin.Forms.Forms.Context.StartActivity(intent);
}
[Complete Native Code][3]
[3]: https://i.stack.imgur.com/G4zOV.png
This is my AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.saferit.saferproject" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="29" />
<!--<application android:label="SaferProject.Android"></application>-->
<application android:label="com.saferit.saferproject" android:icon="#drawable/logo">
<activity android:icon="#drawable/logo" android:label="com.saferit.saferproject" android:name="com.saferit.saferproject">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.saferit.saferproject" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
This is my attempt using Xamarin.Essential:
//Xamarin.Essentials
var appname = "com.saferit.saferproject://";
var supportsUri = await Launcher.CanOpenAsync(appname);
if (supportsUri)
await Launcher.OpenAsync(appname);
Looking for here at stackoverflow I found this question:
Open Notification list page when user clicks on navigation
I tried to implement it on my App but I also couldn't get it to work.
In all three cases the errors are very similar.
I think the problem is in the configuration of the URI of my App.
Can someone help me?

Xamarin.Forms.Xaml.XamlParseException exception in Xamarineforms

I am new to Xamarine.
I had created new blank Xamarine project in Visual studio 2019.
I am using this link to create demo native views in Xamarine forms : https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/native-views/xaml
MainPage.Xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS"
xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
xmlns:androidLocal="clr-namespace:App1.Android;assembly=App1.Android;targetPlatform=Android"
mc:Ignorable="d"
x:Class="App1.MainPage">
<StackLayout>
<!-- Place new controls here -->
<ios:UILabel Text="Hello World" TextColor="{x:Static ios:UIColor.Red}" View.HorizontalOptions="Start" />
<androidWidget:TextView Text="Hello World" x:Arguments="{x:Static androidLocal:MainActivity.Instance}" />
</StackLayout>
</ContentPage>
I had added skip Xamlcomplitation in MainPage.xaml.cs file.
[XamlCompilation(XamlCompilationOptions.Skip)]
Added in MainActivity.cs in App1.Android file.
internal static MainActivity Instance { get; private set; } // define Instance
Bit it shows error for
( 8976): Assembly Ref addref System.Xml[0xd1e768c0] -> System[0xe4b32b00]: 5
**Xamarin.Forms.Xaml.XamlParseException:** 'Position 15:52. Type MainActivity not found in xmlns clr-namespace:App1.Android;assembly=App1.Android;targetPlatform=Android'
[XamlCompilation(XamlCompilationOptions.Skip)]
Is something that you add to the Xaml backend code. Adding it to something else like in your case is likely to cause problems.

Load page event in Flex?

I'm currently working on this website (http://www.jowannes.com/thomasschoof/flash/LauraBarsby.html) and I created a little gallery. When you press the image it becomes the background of the website. Now this has some problems if the background is white and you look at the other pages again, you can't read the text any more.
I would like it to be when you go back to another page, the background changes to it's original one. So basically I'm looking for the page (component?) load event or something alike, but I can't seem to find it.
CreationCompleted doesn't work for this, because when you navigate to it the second time it's already created, this the background doesn't change.
I'm setting the background like this:
Main page:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:component="component.*">
<fx:Script>
<![CDATA[
public function changeBackground(bitmapFillObj:BitmapFill):void
{
backgroundContainer.backgroundFill = bitmapFillObj;
}
]]>
</fx:Script>
<fx:Declarations>
<s:BitmapFill id="_bg1" source="#Embed('assets/bg1.jpg')"/>
<s:BitmapFill id="_bg2" source="#Embed('assets/bg2.jpg')"/>
</fx:Declarations>
<s:BorderContainer id="backgroundContainer" width="100%" height="100%" backgroundImage="#Embed('assets/bg1.jpg')" borderAlpha="0">
<component:home/>
</s:BorderContainer>
</s:WindowedApplication>
Component:
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<s:Button label="click to show bg 1" click="FlexGlobals.topLevelApplication.changeBackground(FlexGlobals.topLevelApplication._bg1)"/>
<s:Button label="click to show bg 2" click="FlexGlobals.topLevelApplication.changeBackground(FlexGlobals.topLevelApplication._bg2)"/>
I also have the problem that the images become stretched, because I can't set the fillmode NOR can I center them, any ideas for this?
I hope somebody can help me, Thanks
Thomas
I found the solution: In a viewstack you have a handler called change=, I just put my method in there and it worked.

How to access backstage checkbox value in an Office addin?

I have a boolean property Settings.Default.MarkAsRead in the Setting.settings file, which I can access in my Ribbon class. What I'd like to do is set the value of a check box in my backstage section depending on the value of this property. Also if the user modifies it, I'll need to save the new value.
Any way I can do this?
This is my (simplified) xml:
<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load"
xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<backstage>
<tab id="MyBackstageSection" label="MyBackstageSection"
columnWidthPercent="30" insertAfterMso="TabInfo" visible="true" >
<firstColumn>
<group id="grpOne" label="Configuration">
<bottomItems>
<checkBox id="markAsRead" label="Mark as read"
getPressed="markAsRead_GetPressed" />
<button id="save" label="Save Preferences" onAction="save_Click"/>
</bottomItems>
</group>
</firstColumn>
</tab>
</backstage>
</customUI>
I didn't find a way to access the xml elements from the Ribbon_Load method, so I've created a boolean property in the ribbon class that I update using the GetPressed and OnAction callbacks:
xml:
<checkBox id="markAsRead" label="Mark as read"
onAction="markAsRead_OnAction" getPressed="markAsRead_GetPressed"/>
c#:
private bool MarkAsRead { get; set; }
public bool markAsRead_GetPressed(Office.IRibbonControl control)
{
this.MarkAsRead = Settings.Default.MarkAsRead;
return this.MarkAsRead;
}
public void markAsRead_OnAction(Office.IRibbonControl control, bool isPressed)
{
this.MarkAsRead = isPressed;
}

Jasper Reports empty PDF report problem, using Spring ModelAndView

I am trying to generate PDF report with Jasper Reports using Spring. But report is always empty. I searched a lot and could not find problem. I tried to write byte[] pdfReport to OutputStream but result is same, report is always empty.
I have 2 parameters one o them is testName and one of them is chart. Both can not display at pdf report.
Thanks a lot for your help,
Here is the code that generates report.
//My class extends MultiActionController
DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue(String.format("%s, %s", "pie1", "pie1"),20);
dataset.setValue(String.format("%s, %s", "pie2", "pie2"),80);
JFreeChart chart = ChartFactory.createPieChart("testPie", dataset, true, true, false);
Map model = new HashMap();
model.put("chart", chart.createBufferedImage(200, 200));
model.put("testName", "test report");
model.put("format", "pdf");
AbstractJasperReportsView view = new JasperReportsMultiFormatView();
view.setUrl("/WEB-INF/classes/reports/"+"test1"+".jasper");
view.setApplicationContext(getApplicationContext());
view.setContentType("application/pdf");
Properties header = new Properties();
view.setHeaders(header);
ModelAndView mv = new ModelAndView(view, model);
JasperReport report = (JasperReport) JRLoader.loadObject(getServletContext().getResourceAsStream("/WEB-INF/classes/reports/"+"test1"+".jasper"));
JasperPrint prt = JasperFillManager.fillReport(report, model);
byte[] pdfReport = JasperExportManager.exportReportToPdf(prt);
return mv;
And here is jrxml file
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test1" language="groovy" pageWidth="700" pageHeight="842" columnWidth="660" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="2"/>
<parameter name="testName" class="java.lang.String"/>
<parameter name="chart" class="java.awt.Image" isForPrompting="false"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="48" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="14" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="229" splitType="Stretch">
<image>
<reportElement x="162" y="13" width="200" height="200"/>
<imageExpression class="java.awt.Image"><![CDATA[$P{chart}]]></imageExpression>
</image>
<textField>
<reportElement x="37" y="61" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{testName}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="112" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="76" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Why are you doing the following?
ModelAndView mv = new ModelAndView(view, model);
JasperReport report = (JasperReport) JRLoader.loadObject(getServletContext().getResourceAsStream("/WEB-INF/classes/reports/"+"test1"+".jasper"));
JasperPrint prt = JasperFillManager.fillReport(report, model);
byte[] pdfReport = JasperExportManager.exportReportToPdf(prt);
return mv;
Using JasperReportsMultiFormatView() already combines the filling and exporting of the report. No need for the following:
JasperReport report = (JasperReport) JRLoader.loadObject(getServletContext().getResourceAsStream("/WEB-INF/classes/reports/"+"test1"+".jasper"));
JasperPrint prt = JasperFillManager.fillReport(report, model);
byte[] pdfReport = JasperExportManager.exportReportToPdf(prt);
You must declare the JRXML file and report data key in a resource bundle.
I suggest you check this guide I wrote for Spring 3 MVC - Jasper Integration Tutorial:
http://krams915.blogspot.com/2010/12/spring-3-mvc-jasper-integration.html
Just modify the views to use the JasperReportsMultiFormatView() instead.
Check the Tutorials section for more. If I have time later, I'm gonna make a tutorial using JasperReportsMultiFormatView(). If not maybe tomorrow. Let me know if this helps you.
There is a property in jasper report called 'whenNoDataType'. Did you tried setting that to
whenNoDataType="AllSectionsNoDetail"
Also the report language is given as 'groovy'. Why?

Resources