當前位置: 首頁>>代碼示例>>Java>>正文


Java Report.setLayout方法代碼示例

本文整理匯總了Java中ro.nextreports.engine.Report.setLayout方法的典型用法代碼示例。如果您正苦於以下問題:Java Report.setLayout方法的具體用法?Java Report.setLayout怎麽用?Java Report.setLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ro.nextreports.engine.Report的用法示例。


在下文中一共展示了Report.setLayout方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: reportModification

import ro.nextreports.engine.Report; //導入方法依賴的package包/類
private static boolean reportModification() {
    String loadedFilePath = Globals.getCurrentReportAbsolutePath();
    QueryBuilderPanel builderPanel = Globals.getMainFrame().getQueryBuilderPanel();
    if (loadedFilePath != null) {            
        Report reportLoaded = FormLoader.getInstance().load(loadedFilePath);
        if (reportLoaded == null) {
            return true;
        }
        reportLoaded.setName(FormSaver.getInstance().getReportFileName(reportLoaded.getName()));
        Report reportToSave = builderPanel.createReport(Globals.getCurrentReportName());
        reportToSave.setLayout(LayoutHelper.getReportLayout());
        if ((reportLoaded != null) && reportLoaded.equals(reportToSave)) {
            return false;
        } 
    }
    return true;
}
 
開發者ID:nextreports,項目名稱:nextreports-designer,代碼行數:18,代碼來源:NextReportsUtil.java

示例2: saveXStream

import ro.nextreports.engine.Report; //導入方法依賴的package包/類
private void saveXStream(File file, Report report) throws Exception {
	XStream xstream = XStreamFactory.createXStream();
	FileOutputStream fos = new FileOutputStream(file);
	if (report == null) {
		report = ro.nextreports.designer.Globals.getMainFrame().getQueryBuilderPanel().createReport(file.getName());
		report.setLayout(LayoutHelper.getReportLayout());
	}
	xstream.toXML(report, fos);
	fos.close();
}
 
開發者ID:nextreports,項目名稱:nextreports-designer,代碼行數:11,代碼來源:FormSaver.java

示例3: getForReportLayout

import ro.nextreports.engine.Report; //導入方法依賴的package包/類
/**
 * If a report layout contains a ForReportBandElement we must replace this
 * element with more ReportBandElements This means inserting n-1 new
 * columns, where n is the number of values return by sql inside
 * ForReportBandElement
 * 
 * A ForReportBandElement is interpreted only at first appearance Column
 * name from sql inside ForReportBandElement must be the same with a
 * parameter name from subreport. Every value from sql will be considered
 * the value for that parameter from subreport.
 * 
 * @param con
 *            connection
 * @param layout
 *            report layout
 * @param pBean
 *            parameters bean
 * @return a new report layout with ReportBandElement elements instead a
 *         ForReportBandElement
 * @throws Exception
 *             if query fails
 */
private static ReportLayout getForReportLayout(Connection con, ReportLayout layout, ParametersBean pBean) throws Exception {
	ReportLayout convertedLayout = ObjectCloner.silenceDeepCopy(layout);

	List<Band> bands = convertedLayout.getDocumentBands();
	for (Band band : bands) {
		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 ForReportBandElement) {
					String sql = ((ForReportBandElement) be).getSql();
					Report report = ((ForReportBandElement) be).getReport();
					if ((sql == null) || sql.isEmpty()) {
						return convertedLayout;
					} else {
						QueryUtil qu = new QueryUtil(con, DialectUtil.getDialect(con));
						// column name is the same with parameter name
						String columnName = qu.getColumnNames(sql, pBean.getParams()).get(0);
						List<IdName> values = qu.getValues(sql, pBean.getParams(), pBean.getParamValues());
						int pos = j;
						for (int k = 0; k < values.size(); k++) {
							IdName in = values.get(k);
							if (k > 0) {
								band.insertColumn(pos);
							}
							Report newReport = ObjectCloner.silenceDeepCopy(report);								
							ReportLayout subReportLayout = ReportUtil.getReportLayoutForHeaderFunctions(newReport.getLayout());
							newReport.setLayout(subReportLayout);
							newReport.setName(report.getBaseName() + "_" + (k + 1) + ".report");
							newReport.getGeneratedParamValues().put(columnName, in.getId());
							band.setElementAt(new ReportBandElement(newReport), i, pos);
							pos++;
						}
						List<Integer> oldColumnsWidth = layout.getColumnsWidth();
						List<Integer> newColumnWidth = new ArrayList<Integer>();
						for (int m = 0; m < j; m++) {
							newColumnWidth.add(oldColumnsWidth.get(m));
						}
						for (int m = 0; m < values.size(); m++) {
							newColumnWidth.add(oldColumnsWidth.get(j));
						}
						for (int m = j + 1; m < size; m++) {
							newColumnWidth.add(oldColumnsWidth.get(m));
						}
						convertedLayout.setColumnsWidth(newColumnWidth);
						// we look just for first appearance
						return convertedLayout;
					}
				}
			}
		}
	}
	return convertedLayout;

}
 
開發者ID:nextreports,項目名稱:nextreports-engine,代碼行數:78,代碼來源:ReportUtil.java


注:本文中的ro.nextreports.engine.Report.setLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。