本文整理汇总了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;
}
示例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();
}
示例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;
}