Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject PJAGraphicsManager.prepareImage(), StyleReport and z/OS

Matthias Fraass

Location : Leipzig/Germany
Member since : Mar 19, 2004
Messages : 4
 Mar 19, 2004 at 11:06 AM
Hi,

I've got a wierd combination but have to make it run:
We're generating reports with the Inetsoft Stylereport [1] in PDF format.
The platform is z/OS (aka OS/290, MVS) in headless mode - Xvfb is not
possible (don't ask...) so we chose PJA Toolkit (2.5Beta).

Testing under Linux, we encountered the first problem when loading a
report template:

---->
Exception in thread "main" java.awt.AWTError: PJA can't manage this image (inets
oft.report.internal.MetaImage)
at com.eteks.awt.PJAGraphicsManager.checkImage(PJAGraphicsManager.java:857)
at com.eteks.java2d.PJAGraphicsManager2D.checkImage(PJAGraphicsManager2D.java
:136)
at com.eteks.awt.PJAToolkit.checkImage(PJAToolkit.java:627)
at java.awt.Component.checkImage(Component.java:2399)
at java.awt.ImageMediaEntry.getStatus(MediaTracker.java:873)
at java.awt.MediaTracker.statusAll(MediaTracker.java:435)
at java.awt.MediaTracker.waitForAll(MediaTracker.java:387)
at java.awt.MediaTracker.waitForAll(MediaTracker.java:357)
at inetsoft.report.Common.waitForImage(Unknown Source)
at inetsoft.report.painter.ImagePainter.setImage(Unknown Source)
at inetsoft.report.painter.ImagePainter.<init>(Unknown Source)
at inetsoft.report.internal.ImageElementDef.updateImage(Unknown Source)
at inetsoft.report.internal.ImageElementDef.setPath(Unknown Source)
at inetsoft.report.io.helper.element.ImageElementHelper.read(Unknown Source)
at inetsoft.report.io.helper.element.EditRegionElementHelper.read(Unknown Sou
rce)
at inetsoft.report.io.helper.element.SectionElementHelper.readSectionBand(Unk
nown Source)
at inetsoft.report.io.helper.element.SectionElementHelper.readSectionLens(Unk
nown Source)
at inetsoft.report.io.helper.element.SectionElementHelper.read(Unknown Source
)
at inetsoft.report.io.helper.ReportHelper.readGridColumn(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.readGridRow(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.readGrid(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.parseChildNodes(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.read(Unknown Source)
at inetsoft.report.io.TemplateParser.read(Unknown Source)
at inetsoft.report.io.Builder.read(Unknown Source)
at inetsoft.report.LibManager.loadMetaReports(Unknown Source)
at inetsoft.report.LibManager.loadLibrary(Unknown Source)
at inetsoft.report.LibManager.loadLibrary(Unknown Source)
at inetsoft.report.LibManager.initialize(Unknown Source)
at inetsoft.report.LibManager.getManager(Unknown Source)
at inetsoft.report.io.helper.element.TableElementHelper.getStyle(Unknown Sour
ce)
at inetsoft.report.io.helper.element.TableElementHelper.read(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.readElements(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.parseChildNodes(Unknown Source)
at inetsoft.report.io.helper.ReportHelper.read(Unknown Source)
at inetsoft.report.io.TemplateParser.read(Unknown Source)
at inetsoft.report.io.Builder.read(Unknown Source)
at de.alldata.druckmanagement.test.CompactTest.createReport(CompactTest.java:
66)
at de.alldata.druckmanagement.test.CompactTest.main(CompactTest.java:38)
<----

Puzzled by this I checked the sourcecode:

---->
/**
* Starts the loading of an image.
* @see com.eteks.awt.PJAToolkit#prepareImage
*/
public boolean prepareImage (Image image, int width, int height,
ImageObserver observer)
{
if (image instanceof PJAImage)
return ((PJAImage)image).prepare (observer);
else
throw new AWTError ("PJA can't manage this image (" + image.getClass ().getName () + ")");
}

/**
* Checks the status of an image laoding.
* @see com.eteks.awt.PJAToolkit#checkImage
*/
public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
if (image instanceof PJAImage)
return ((PJAImage)image).check (observer);
else
throw new AWTError ("PJA can't manage this image (" + image.getClass ().getName () + ")");
}
<----

Without decent knowledge of graphics programming at all I checked the
PJAImage.java and changed the source code to:

---->
/**
* Starts the loading of an image.
* @see com.eteks.awt.PJAToolkit#prepareImage
*/
public boolean prepareImage (Image image, int width, int height,
ImageObserver observer)
{
if (image instanceof PJAImage)
return ((PJAImage)image).prepare (observer);
else
{
// changed by Matthias Fraass/bbv AG
//throw new AWTError ("PJA can't manage this image (" + image.getClass ().getName () + ")");
int availableInfo = ImageObserver.WIDTH
| ImageObserver.HEIGHT
| ImageObserver.PROPERTIES
| ImageObserver.ALLBITS;
// v2.0 : Verify if observer is null
if (observer != null)
observer.imageUpdate (image, availableInfo, 0, 0, width, height);
return (availableInfo & ImageObserver.ALLBITS) != 0;
}
}

/**
* Checks the status of an image laoding.
* @see com.eteks.awt.PJAToolkit#checkImage
*/
public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
if (image instanceof PJAImage)
return ((PJAImage)image).check (observer);
else
{
// changed by Matthias Fraass/bbv AG
// throw new AWTError ("PJA can't manage this image (" + image.getClass ().getName () + ")");
int availableInfo = ImageObserver.WIDTH
| ImageObserver.HEIGHT
| ImageObserver.PROPERTIES
| ImageObserver.ALLBITS;
// v2.0 : Verify if observer is null
if (observer != null)
observer.imageUpdate (image, availableInfo, 0, 0, width, height);
return availableInfo;
}
}
<----

and voila! The PDFs are generated flawlessly under Linux! I was sooo proud ;)

So we went to the z/OS platform - but all the text in the generated PDFs
is placed at the upper left corner of the printable area of the document.
The test ist exactly the same.

Has anybody got a clue what the problem could be?

Regards,

Matthias

[1] http://www.inetsoft.com/inetsoft/products/srpro/prooverview.html

Matthias Fraass

Location : Leipzig/Germany
Member since : Mar 19, 2004
Messages : 4
 Mar 22, 2004 at 4:32 PM
Hmm. I think the problem has nothing to do with the rewritten methods or the report engine:
I executed the PJADemo and everything is fine.
I executed the ToolkitDemo with the follwing results:
- ArcDrawer and PolygonDrawer: fine
- ImageDrawer: the "XOR clipped text" is missing
- textDrawer: empty

which puzzles me...
I executed the tests with identical options on linux and they're fine.

Matthias

Matthias Fraass

Location : Leipzig/Germany
Member since : Mar 19, 2004
Messages : 4
 Mar 22, 2004 at 5:21 PM
I found the problem:
java2d.fonts.usePlatformFonts=true

Everything works fine now, including the report generator.

Matthias Fraaß

Manu

Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
 Mar 22, 2004 at 8:05 PM
I'm glad you found the solution :-)
Instead of modifying the com.eteks.awt.PJAGraphicsManager class, you could also override the prepareImage and checkImage methods in a subclass of PJAGraphicsManager2D :
-----
import java.awt.*;
import java.awt.image.*;
import com.eteks.awt.*;
import com.eteks.java2d.*;

public class OtherGraphicsManager extends PJAGraphicsManager2D
{
public boolean prepareImage (Image image, int width, int height, ImageObserver observer)
{
if (image instanceof PJAImage || image instanceof BufferedImage)
return super.prepareImage (image, width, height, observer);
else
{
int availableInfo = ImageObserver.WIDTH
| ImageObserver.HEIGHT
| ImageObserver.PROPERTIES
| ImageObserver.ALLBITS;
if (observer != null)
observer.imageUpdate (image, availableInfo, 0, 0, width, height);
return (availableInfo & ImageObserver.ALLBITS) != 0;
}
}

public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
if (image instanceof PJAImage || image instanceof BufferedImage)
return super. checkImage (image, width, height, observer);
else
{
int availableInfo = ImageObserver.WIDTH
| ImageObserver.HEIGHT
| ImageObserver.PROPERTIES
| ImageObserver.ALLBITS;
if (observer != null)
observer.imageUpdate (image, availableInfo, 0, 0, width, height);
return availableInfo;
}
}
}
-----
and then use this class as com.eteks.awt.graphicsmanager System property instead of com.eteks.java2d.PJAGraphicsManager2D default class :
-Dcom.eteks.awt.graphicsmanager=com.company.tools.OtherGraphicsManager
---
Manu (moderator/modérateur)

Matthias Fraass

Location : Leipzig/Germany
Member since : Mar 19, 2004
Messages : 4
 Mar 23, 2004 at 8:43 AM
Of course - I'll adopt that.

Matz


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation