Java 类net.sf.jasperreports.engine.data.JRTableModelDataSource 实例源码

项目:bisis-v4    文件:User.java   
private JPanel getRevers(){
  try {
    Map<String, Object> params = new HashMap<String, Object>(3);
    params.put("korisnik", lending.getUser()); //$NON-NLS-1$
    params.put("korisnik-adresa", userData.getAddressRevers()); //$NON-NLS-1$
    params.put("broj-indeksa", userData.getIndexNoRevers());
    params.put("biblioteka", Cirkulacija.getApp().getEnvironment().getReversLibraryName()); //$NON-NLS-1$
    params.put("adresa", Cirkulacija.getApp().getEnvironment().getReversLibraryAddress()); //$NON-NLS-1$
    params.put("bibliotekar", Cirkulacija.getApp().getLibrarian().getIme()+" "+Cirkulacija.getApp().getLibrarian().getPrezime()); //$NON-NLS-1$ //$NON-NLS-2$
    // budzotina zbog subotice (ako je vrednostu u ReversHeight = 1 stampace se inverntarni broj u zaglavlju reversa
    params.put("zaglavlje-broj", Cirkulacija.getApp().getEnvironment().getReversHeight());


    JasperPrint jp = JasperFillManager.fillReport(User.class.getResource(
          "/com/gint/app/bisis4/client/circ/jaspers/revers.jasper").openStream(),  //$NON-NLS-1$
          params, new JRTableModelDataSource(lending.getReversTableModel()));
    JRViewer jr = new JRViewer(jp);
    return jr;
  } catch (Exception e) {
    e.printStackTrace();
    log.error(e);
    return null;
  }
}
项目:bisis-v4    文件:SearchReport.java   
public static JasperPrint setPrint(SearchUsersTableModel table, String query){

        try {
        Map<String, Object> params = new HashMap<String, Object>(1);
        params.put("upit", query);

        JasperPrint jp = JasperFillManager.fillReport(SearchReport.class.getResource(
                    "/com/gint/app/bisis4/client/circ/jaspers/searchuser.jasper").openStream(), 
            params, new JRTableModelDataSource(table));
            return jp;
        } catch (Exception e) {
            log.error(e);
            return null;
        }

    }
项目:jasperreports    文件:DataSourceApp.java   
/**
 *
 */
public void fill2() throws JRException
{
    long start = System.currentTimeMillis();
    //Preparing parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("ReportTitle", "Address Report");
    parameters.put("DataFile", "CustomTableModel.java");

    JasperFillManager.fillReportToFile("build/reports/DataSourceReport.jasper", parameters, new JRTableModelDataSource(new CustomTableModel()));
    System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}