Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
adding birt engine to java application
asilo1
I manage integrate birt with Jide/Jformdesigner application. Now i need to figure out how i am gonna start the engine and stop it. i was thinking of deploying in jboss and accessing the birt report but i am not sure if that would work at all. What would be best way to run birtreport engine and print the graphs to jpanel.
public class HtmlReport extends JPanel
{
JEditorPane myEditorPane = new JEditorPane() ;
IReportRunnable design = null;
HtmlReport()
{
initComponents();
}
/**
* Initialize the components.
*/
protected void initComponents() {
setLayout(new FormLayout("fill:p:grow", "fill:p:grow"));
setBackground(new Color(216, 228, 248));
startPlatform();
runReport();
stopPlatform();
}
public void runReport()
{
try {
CellConstraints cc = new CellConstraints();
setBorder(Borders.DLU4_BORDER);
// Open the report design
design = engine.openReportDesign("C:/Documents and Settings/AsilO1/workspace2/Tracs8.0/ReportAlarmSummary.rptdesign");
// Create task to run and render the report,
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
HTMLRenderOption options = new HTMLRenderOption();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
options.setOutputStream(bos);
options.setSupportedImageFormats( "PNG;GIF;JPG;BMP;SWF");
options.setOutputFormat("html");
options.setEmbeddable(true);
options.setImageDirectory("output/image");
options.setEnableInlineStyle(true);
task.setRenderOption(options);
task.setParameterValue("reportRunId", reportRunId);
task.run();
task.close();
myEditorPane.setContentType("text/html");
myEditorPane.setText(bos.toString());
// myEditorPane.setBackground(new Color(216, 228, 248));
myEditorPane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(myEditorPane);
add(myEditorPane, cc.xy(1, 1));
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void startPlatform() {
try {
config = new EngineConfig();
config.setBIRTHome("C:\\birt-runtime-2_6_2\\ReportEngine");
<<<<< I wont able to access this when my application gets packaged>>>>>>>>>
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
} catch (Exception e) {
e.printStackTrace();
}
}
public void stopPlatform() {
engine.destroy();
Platform.shutdown();
}}
Find more posts tagged with
Comments
There are no comments yet