• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Resource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.reporting.libraries.resourceloader.Resource的典型用法代码示例。如果您正苦于以下问题:Java Resource类的具体用法?Java Resource怎么用?Java Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Resource类属于org.pentaho.reporting.libraries.resourceloader包,在下文中一共展示了Resource类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doPost

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:31,代码来源:PentahoServlet2.java


示例2: testPrptSetMasterReport

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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);
  
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:24,代码来源:TestPrptComponent.java


示例3: doPost

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:28,代码来源:PentahoServlet.java


示例4: doPost

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:32,代码来源:PentahoServlet2.java


示例5: loadMasterReport

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:PentahoReportingOutput.java


示例6: loadMasterReport

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:11,代码来源:PentahoReportingOutput.java


示例7: open

import org.pentaho.reporting.libraries.resourceloader.Resource; //导入依赖的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;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:76,代码来源:PRPTVisualization.java



注:本文中的org.pentaho.reporting.libraries.resourceloader.Resource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Debug类代码示例发布时间:2022-05-23
下一篇:
Java LongSerializer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap