本文整理汇总了Java中org.pentaho.reporting.libraries.resourceloader.ResourceManager.createDirectly方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceManager.createDirectly方法的具体用法?Java ResourceManager.createDirectly怎么用?Java ResourceManager.createDirectly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.reporting.libraries.resourceloader.ResourceManager
的用法示例。
在下文中一共展示了ResourceManager.createDirectly方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doPost
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
try {
// Getting the report.
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
Resource res = manager.createDirectly(
new URL("file:resources/interactive_report_2.prpt"),
MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
// Mandatory parameter.
report.getParameterValues().put("LINE", request.getParameter("line"));
// Conversion to HTML and rendering.
response.setContentType("text/html");
HtmlReportUtil.createStreamHTML(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例2: testPrptSetMasterReport
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
@Test
public void testPrptSetMasterReport() throws Exception{
if(ClassicEngineBoot.getInstance().isBootDone() == false){
ClassicEngineBoot engineBoot = ClassicEngineBoot.getInstance();
engineBoot.start();
}
SwtXulLoader loader = new SwtXulLoader();
loader.register("PRPT", PrptViewerTag.class.getCanonicalName());
XulDomContainer container = loader.loadXul("org/pentaho/agilebi/test/res/prpt.xul");
PrptViewerTag prpt = (PrptViewerTag) container.getDocumentRoot().getElementById("prptViewer");
ResourceManager theResourceManager = new ResourceManager();
theResourceManager.registerDefaults();
File theReportFile = new File("test-res/test.prpt");
Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
MasterReport masterReport = (MasterReport) theResource.getResource();
prpt.setMasterReport(masterReport);
}
示例3: doPost
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
try {
// Getting the report.
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
Resource res = manager.createDirectly(
new URL("file:resources/interactive_report_1.prpt"),
MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
// Conversion to HTML and rendering.
response.setContentType("text/html");
HtmlReportUtil.createStreamHTML(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例4: doPost
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
// Prpt file.
String reportPath = "file:" + this.getServletContext().getRealPath("WEB-INF/classes/reports/my_first_report.prpt");
try
{
// Resource manager.
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
// Get report.
Resource res = manager.createDirectly(new URL(reportPath), MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
// Generate report in PDF into the response.
response.setContentType("application/pdf");
PdfReportUtil.createPDF(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例5: loadMasterReport
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
public static MasterReport loadMasterReport(String sourceFilename) throws Exception {
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
FileObject fileObject = KettleVFS.getFileObject(sourceFilename);
URL url = new URL(fileObject.getName().getURI());
Resource resource = manager.createDirectly(url, MasterReport.class);
MasterReport report = (MasterReport) resource.getResource();
return report;
}
示例6: loadMasterReport
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
public static MasterReport loadMasterReport( String sourceFilename ) throws Exception {
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
FileObject fileObject = KettleVFS.getFileObject( sourceFilename );
URL url = new URL( fileObject.getName().getURI() );
Resource resource = manager.createDirectly( url, MasterReport.class );
MasterReport report = (MasterReport) resource.getResource();
return report;
}
示例7: open
import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入方法依赖的package包/类
public boolean open(Node transNode, String fname, boolean importfile) {
try {
if(ClassicEngineBoot.getInstance().isBootDone() == false){
ObjectUtilities.setClassLoader(getClass().getClassLoader());
ObjectUtilities.setClassLoaderSource(ObjectUtilities.CLASS_CONTEXT);
LibLoaderBoot.getInstance().start();
LibFontBoot.getInstance().start();
ClassicEngineBoot.getInstance().start();
}
ResourceManager theResourceManager = new ResourceManager();
theResourceManager.registerDefaults();
File theReportFile = new File(fname);
Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
MasterReport masterReport = (MasterReport) theResource.getResource();
XulTabAndPanel tabAndPanel = AgileBiVisualizationPerspective.getInstance().createTab();
AgileBiVisualizationPerspective.getInstance().setNameForTab(tabAndPanel.tab, getPathAndFilename(fname)[1].replace(".prpt", "")); //$NON-NLS-1$ //$NON-NLS-2$
SpoonPerspectiveManager.getInstance().activatePerspective(AgileBiVisualizationPerspective.class);
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag"); //$NON-NLS-1$ //$NON-NLS-2$
XulDomContainer theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/visualizations/prpt/prptVisualization.xul", new PDIMessages(IVisualization.class)); //$NON-NLS-1$
PRPTMeta meta = new PRPTMeta();
meta.setTab(tabAndPanel.tab);
AgileBiVisualizationPerspective.getInstance().setMetaForTab(tabAndPanel.tab, meta);
PRPTVisualizationController controller = new PRPTVisualizationController(meta, masterReport);
controller.setFileName(fname);
controller.setDirty(false);
PmdDataFactory theDataFactory = (PmdDataFactory) masterReport.getDataFactory();
String theXmiFile = theDataFactory.getXmiFile();
ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
XmiParser parser = new XmiParser();
FileInputStream inputStream = new FileInputStream(new File(theXmiFile));
Domain domain = parser.parseXmi(inputStream);
inputStream.close();
LogicalModel logical = domain.getLogicalModels().get(0);
Object property = logical.getProperty("source_type"); //$NON-NLS-1$
if( property != null ) {
IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
theSource.initialize(domain);
model.setModelSource(theSource);
}
model.setDomain(domain);
model.setModelName(domain.getId());
model.setFileName(theXmiFile);
model.setTemporary(false);
controller.setModel(model);
theXulContainer.addEventHandler(controller);
Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainContainer").getManagedObject(); //$NON-NLS-1$
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
theMainBox.setParent((Composite) tabAndPanel.panel.getManagedObject());
((Composite) tabAndPanel.panel.getManagedObject()).layout(true);
AgileBiVisualizationPerspective.getInstance().setSelectedMeta(meta);
return true;
} catch(Exception e){
e.printStackTrace();
}
return false;
}