Change unused class org.compiere.report.Barbecue to be useful in Jasper

Reports. Changes should be backwards compatible.

https://sourceforge.net/tracker/?func=detail&aid=2789362&group_id=176962&atid=879335
This commit is contained in:
usrdno 2009-05-09 10:02:20 +00:00
parent 46c49edca8
commit dd4906fafc
1 changed files with 14 additions and 42 deletions

View File

@ -1,46 +1,34 @@
package org.compiere.report;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRRenderable;
import net.sf.jasperreports.engine.util.JRImageLoader;
import net.sf.jasperreports.engine.JRAbstractSvgRenderer;
import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeImageHandler;
public abstract class Barbecue implements JRRenderable
public class Barbecue extends JRAbstractSvgRenderer
{
private static final long serialVersionUID = 5112469398754718739L;
private Barcode m_barcode = null;
public byte getType()
{
return TYPE_SVG;
}
public Dimension2D getDimension()
{
return m_barcode.getSize();
}
public Color getBackcolor()
{
return null;
}
public Barbecue (Barcode barcode)
{
m_barcode = barcode;
}
/**
* Convenience method for creating a barcode renderer with the option of
*
*
* @param barcode The barcode
* @param showDrawingText If the alphanumeric text should be visible below the barcode
*/
public Barbecue (Barcode barcode, boolean showDrawingText) {
m_barcode = barcode;
m_barcode.setDrawingText(showDrawingText);
}
public void render(Graphics2D grx, Rectangle2D rectangle)
{
try
@ -54,20 +42,4 @@ public abstract class Barbecue implements JRRenderable
}
public byte[] getImageData() throws JRException
{
try
{
BufferedImage bi = BarcodeImageHandler.getImage(m_barcode);
return JRImageLoader.loadImageDataFromAWTImage(bi);
}
catch (Exception e)
{
return null;
// TODO implement exception handling
}
}
}