当前位置: 首页>>代码示例>>Java>>正文


Java Report类代码示例

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


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

示例1: copyTemplate

import ro.nextreports.engine.Report; //导入依赖的package包/类
public static void copyTemplate(Report report, File directory) throws IOException {
      ReportLayout layout = LayoutHelper.getReportLayout();
      if (report != null) {
          // run report from tree (without open)
          layout = report.getLayout();
      }
      String templateName = layout.getTemplateName();
if ((templateName != null) && !"".equals(templateName.trim())) {
	String fromPath = Globals.getCurrentReportAbsolutePath();
	if (fromPath == null) {
		fromPath = Globals.getTreeReportAbsolutePath();
	}						
	FileUtil.copyToDir(new File(new File(fromPath).getParentFile().getAbsolutePath() + File.separator + templateName),
				directory, true);			
}       
  }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:17,代码来源:FileUtil.java

示例2: saveXStream

import ro.nextreports.engine.Report; //导入依赖的package包/类
private static void saveXStream(File file, Chart chart) throws Exception {
	XStream xstream = XStreamFactory.createXStream();
	FileOutputStream fos = new FileOutputStream(file);
	if (chart == null) {
		chart = Globals.getChartDesignerPanel().getChart();
		chart.setVersion(ReleaseInfoAdapter.getVersionNumber());
		chart.setName(getChartFileName(file));
		Report query = ro.nextreports.designer.Globals.getMainFrame().getQueryBuilderPanel()
				.createReport(file.getName());
		chart.setReport(query);
	}
	System.out.println("----- set Keys = " + I18nManager.getInstance().getKeys());
	System.out.println("----- set Languages = " + I18nManager.getInstance().getLanguages());
	chart.setI18nkeys(I18nManager.getInstance().getKeys());
	chart.setLanguages(I18nManager.getInstance().getLanguages());
	xstream.toXML(chart, fos);
	fos.close();
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:19,代码来源:ChartUtil.java

示例3: getStaticImages

import ro.nextreports.engine.Report; //导入依赖的package包/类
/**
 * Get static images used by report
 * 
 * @param report
 *            report
 * @return a list of static images used by report
 */
public static List<String> getStaticImages(Report report) {
	List<String> images = new ArrayList<String>();
	ReportLayout layout = report.getLayout();
	List<Band> bands = layout.getBands();
	for (Band band : bands) {
		for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
			List<BandElement> list = band.getRow(i);
			for (BandElement be : list) {
				if ((be instanceof ImageBandElement) && !(be instanceof ChartBandElement)
						&& !(be instanceof BarcodeBandElement)) {
					images.add(((ImageBandElement) be).getImage());
				}
			}
		}
	}
	if (layout.getBackgroundImage() != null) {
		images.add(layout.getBackgroundImage());
	}
	return images;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:28,代码来源:ReportUtil.java

示例4: getSql

import ro.nextreports.engine.Report; //导入依赖的package包/类
protected String getSql(Report report) {
    String sql;
    if (report == null) {
        sql = queryArea.getText();
    } else {
        if (report.getSql() != null) {
            sql = report.getSql();
        } else {
        	try {
        		for (Column col : report.getQuery().getColumns()) {            		
		col.getTable().setDialect(DialectUtil.getDialect(Globals.getConnection()));					
        		}
        	} catch (Exception e) {					
	e.printStackTrace();
	LOG.error(e.getMessage(), e);
}
            sql = report.getQuery().toString();
        }
    }
    if (sql.equals("") || sql.equals(DEFAULT_QUERY)) {
        return null;
    }
    return sql;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:25,代码来源:SQLViewPanel.java

示例5: getDetailSubreports

import ro.nextreports.engine.Report; //导入依赖的package包/类
/**
 * Get detail band subreports for a report layout
 * @param reportLayout current report layout
 * @return list of subreports from detail band
 */
public static List<Report> getDetailSubreports(ReportLayout reportLayout) {
	List<Report> subreports = new ArrayList<Report>();

	Band band = reportLayout.getDetailBand();
	for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
		List<BandElement> list = band.getRow(i);
		for (int j = 0, size = list.size(); j < size; j++) {
			BandElement be = list.get(j);
			if (be instanceof ReportBandElement) {
				subreports.add(((ReportBandElement) be).getReport());
			}
		}
	}
	return subreports;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:21,代码来源:ReportUtil.java

示例6: getAllColumnsForReport

import ro.nextreports.engine.Report; //导入依赖的package包/类
public static List<NameType> getAllColumnsForReport(Report report, DataSource ds) throws Exception {

        String sql;
        if (report == null) {
            QueryBuilderPanel builderPanel = Globals.getMainFrame().getQueryBuilderPanel();
            builderPanel.refreshSql();
            sql = builderPanel.getUserSql();
        } else {
            if (report.getSql() != null) {
                sql = report.getSql();
            } else {
                sql = report.getQuery().toString();
            }
        }
        return getAllColumnsForSql(report, sql, ds);
    }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:17,代码来源:ReportLayoutUtil.java

示例7: getAllColumnNamesForReport

import ro.nextreports.engine.Report; //导入依赖的package包/类
public static List<String> getAllColumnNamesForReport(Report report, DataSource ds) throws Exception {

        String sql;
        if (report == null) {
            QueryBuilderPanel builderPanel = Globals.getMainFrame().getQueryBuilderPanel();            
            builderPanel.refreshSql();
            sql = builderPanel.getUserSql();            
        } else {
            if (report.getSql() != null) {
                sql = report.getSql();
            } else {
                sql = report.getQuery().toString();
            }
        }
        return getAllColumnNamesForSql(report, sql, ds);
    }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:17,代码来源:ReportLayoutUtil.java

示例8: renameReport

import ro.nextreports.engine.Report; //导入依赖的package包/类
public boolean renameReport(String oldName, String newName, String parentPath) {
	DataSourceManager manager = DefaultDataSourceManager.getInstance();
	DataSource ds = manager.getConnectedDataSource();
	File file = new File(parentPath + File.separator + oldName + REPORT_EXTENSION_SEPARATOR + REPORT_EXTENSION);
	File newFile = new File(parentPath + File.separator + newName + REPORT_EXTENSION_SEPARATOR + REPORT_EXTENSION);
	boolean result = file.renameTo(newFile);
	if (result) {
		if (file.getAbsolutePath().equals(Globals.getCurrentReportAbsolutePath())) {
			Globals.setCurrentReportAbsolutePath(newFile.getAbsolutePath());
		}
		// change name in xml
		Report report = FormLoader.getInstance().load(newFile.getAbsolutePath());
		report.setName(newName + REPORT_EXTENSION_SEPARATOR + REPORT_EXTENSION);
		try {
			saveXStream(newFile, report);
		} catch (Exception e) {
			e.printStackTrace();
			LOG.error(e.getMessage(), e);
		}
	}
	return result;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:23,代码来源:FormSaver.java

示例9: export

import ro.nextreports.engine.Report; //导入依赖的package包/类
public void export() throws ReportEngineException, InterruptedException {
	Report report = NextUtil.getNextReport(storageService.getSettings(), (NextContent) exportContext.getReportContent());
	LOG.info("Export report '" + report.getName() + "' format="+ReportConstants.ETL_FORMAT +
      		 " queryTimeout="+storageService.getSettings().getQueryTimeout());
	FluentReportRunner runner = FluentReportRunner.report(report);
	NextRunnerFactory.addRunner(exportContext.getKey(), runner);
	Connection conn = createConnection();
	runner = runner.connectTo(conn).
       		withQueryTimeout(storageService.getSettings().getQueryTimeout()).
               withParameterValues(new HashMap<String, Object>(exportContext.getReportParameterValues()));

       try {
		String tableName = getEtlTableName(exportContext.getCreator(), exportContext.getServerReportName());
       	createEtl(runner.executeQuery(), tableName);
       } catch (ReportRunnerException ex) {
       	throw new ReportEngineException(ex.getMessage(), ex);
       } finally {
           NextRunnerFactory.removeRunner(exportContext.getKey());
           ConnectionUtil.closeConnection(conn);
       }

}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:23,代码来源:ETLExporter.java

示例10: getItemMap

import ro.nextreports.engine.Report; //导入依赖的package包/类
public static Map<String, List<CheckListItem>> getItemMap(Report report) throws Exception {
    Map<String, List<CheckListItem>> itemMap = new HashMap<String, List<CheckListItem>>();
    if (report.getTables() == null) {
        return itemMap;
    }
    for (TablePersistentObject tpo : report.getTables()) {
        Table table = tpo.getTable();
        try {
            table.setDialect(DialectUtil.getDialect(Globals.getConnection()));
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            LOG.error(e.getMessage(), e);
        }
        String key = table.getAlias();
        if(key == null) {
            key =table.getName();
        }
        itemMap.put(key, TableUtil.loadTable(table));
    }
    return itemMap;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:22,代码来源:TableUtil.java

示例11: createQueryRuntime

import ro.nextreports.engine.Report; //导入依赖的package包/类
public static QueryRuntime createQueryRuntime(StorageService storageService, ro.nextreports.server.domain.Report report) {
    QueryRuntime queryRuntime = new QueryRuntime();
    Connection connection = null;
    try {
        connection = ConnectionUtil.createConnection(storageService, report.getDataSource());
        Map<String, Object> map = new HashMap<String, Object>();
        ParameterUtil.initNotHiddenDefaultParameterValues(connection, NextUtil.getNextReport(storageService.getSettings(), report), map);
        queryRuntime.setParametersValues(map);
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        e.printStackTrace();
    } finally {
    	ConnectionUtil.closeConnection(connection);
    }
    return queryRuntime;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:17,代码来源:NextUtil.java

示例12: incompatibleParametersType

import ro.nextreports.engine.Report; //导入依赖的package包/类
/**
 * Test (by name) if sub-report parameters types are incompatible with
 * report parameter types (where we want the sub-report to be inserted)
 * 
 * @return list of incompatible parameters
 */
public static List<String> incompatibleParametersType(Report report) {
	ParameterManager paramManager = ParameterManager.getInstance();
	List<QueryParameter> reportParams = paramManager.getParameters();
	List<QueryParameter> chartParams = report.getParameters();
	List<String> result = new ArrayList<String>();
	for (QueryParameter cqp : chartParams) {
		for (QueryParameter rqp : reportParams) {
			if (rqp.getName().equals(cqp.getName())) {
				if (!rqp.getValueClassName().equals(cqp.getValueClassName())) {
					result.add(rqp.getName());
				} else if (!rqp.getSelection().equals(cqp.getSelection())) {
					result.add(rqp.getName());
				}
			}
		}
	}
	return result;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:25,代码来源:NextReportsUtil.java

示例13: deleteImages

import ro.nextreports.engine.Report; //导入依赖的package包/类
public static void deleteImages(Report report) {
    ReportLayout layout = LayoutHelper.getReportLayout();
    if (report != null) {
        // run report from tree (without open)
        layout = report.getLayout();
    }
    List<Band> bands = layout.getBands();
    for (Band band : bands) {
        for (int i=0, rows = band.getRowCount(); i<rows; i++) {
            List<BandElement> list = band.getRow(i);
            for (BandElement be : list) {
                if (be instanceof ImageBandElement) {
                    String image = ((ImageBandElement)be).getImage();
                    deleteImage(image);
                }
            }
        }
    }
    if (layout.getBackgroundImage() != null) {
    	deleteImage(layout.getBackgroundImage());
    }
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:23,代码来源:FileUtil.java

示例14: getReportUserParameters

import ro.nextreports.engine.Report; //导入依赖的package包/类
public Map<String, Serializable> getReportUserParameters(ro.nextreports.server.domain.Report report,
                                                         List<ExternalParameter> externalParameters) throws Exception {

    Map<String, Serializable> params = new LinkedHashMap<String, Serializable>(
            ParameterUtil.getUsedParametersMap(NextUtil.getNextReport(storageService.getSettings(), report)));
    // overwite with external parameters
    for (ExternalParameter ep : externalParameters) {
        for (String name : params.keySet()) {
            if (name.equals(ep.getName())) {
                params.put(name, getParameter(ep));
                break;
            }
        }
    }

    return params;
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:18,代码来源:NextEngine.java

示例15: actionPerformed

import ro.nextreports.engine.Report; //导入依赖的package包/类
public void actionPerformed(ActionEvent event) {
  	    	
  	// report was not saved and we do not know where to insert the subreport
  	if (Globals.getCurrentReportAbsolutePath() == null) {
  		if (!NextReportsUtil.saveReportForInserting(I18NSupport.getString("existing.report.report.save"))) {
  			return;
  		}
  	}
  	
  	ReportGrid grid = Globals.getReportGrid();
SelectionModel selectionModel = grid.getSelectionModel();

int row = selectionModel.getSelectedCell().getRow();
      int column = selectionModel.getSelectedCell().getColumn();

      Report defaultReport = new Report();
      defaultReport.setName(DEFAULT_TEXT);
      BandElement element = new ForReportBandElement(defaultReport);
      grid.putClientProperty("layoutBeforeInsert", ObjectCloner.silenceDeepCopy(LayoutHelper.getReportLayout()));
      BandUtil.insertElement(element, row, column);

      grid.editCellAt(row, column, event);

  }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:25,代码来源:InsertForReportAction.java


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