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


Java Report.setName方法代码示例

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


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

示例1: 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.getCurrentQueryAbsolutePath())) {
              Globals.setCurrentQueryAbsolutePath(newFile.getAbsolutePath());
          }
          // change name in xml
          Report report = loadReport(newFile.getAbsolutePath());
          report.setName(newName + REPORT_EXTENSION_SEPARATOR + REPORT_EXTENSION);
          saveReport(report,newFile.getAbsolutePath());
      }
      return result;
  }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:18,代码来源:FileReportPersistence.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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 ReportBandElement(defaultReport);
      grid.putClientProperty("layoutBeforeInsert", ObjectCloner.silenceDeepCopy(LayoutHelper.getReportLayout()));
      BandUtil.insertElement(element, row, column);

      grid.editCellAt(row, column, event);

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

示例6: createReport

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
    public Report createReport(String name) {
        Report report = new Report();
        report.setName(name);
        report.setVersion(ReleaseInfoAdapter.getVersionNumber());
        if (queryWasModified(true)) {
            report.setSql(getUserSql());
        } else {
            report.setQuery(getSelectQuery());
            report.setTables(getTables());
            report.setRows(getRows());
        }
        LinkedList<QueryParameter> parameters = (LinkedList) ParameterManager.getInstance().getParameters();
        // Saved the parameters in the order inside sql!
//		LinkedList<QueryParameter> parameters = new LinkedList();
//		ParameterManager manager = ParameterManager.getInstance();
//		String[] paramNames = (new Query(getUserSql())).getParameterNames();
//		for (String pname : paramNames) {
//			QueryParameter qp = manager.getParameter(pname);
//			if (!parameters.contains(qp)) {
//				parameters.add(qp);
//			}
//		}

        report.setParameters(parameters);                
        return report;
    }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:28,代码来源:QueryBuilderPanel.java

示例7: 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.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。