/**
   * Entry point for running the demo application...
   *
   * @param args ignored.
   */
  public static void main(final String[] args)
      throws ReportDefinitionException, ReportProcessingException, IOException {
    // initialize JFreeReport
    ClassicEngineBoot.getInstance().start();

    final BookstoreDemo handler = new BookstoreDemo();

    //    HtmlReportUtil.createDirectoryHTML(handler.createReport(), "/tmp/report.html");
    //    ExcelReportUtil.createXLS(handler.createReport(), "/tmp/report.xls");
    final MasterReport report = handler.createReport();
    final PreviewDialog dialog = new PreviewDialog();
    dialog.setReportJob(report);
    dialog.setSize(500, 500);
    dialog.setModal(true);
    dialog.setVisible(true);
    System.exit(0);
    //
    //    final SimpleDemoFrame frame = new SimpleDemoFrame(handler);
    //    frame.init();
    //    frame.pack();
    //    RefineryUtilities.centerFrameOnScreen(frame);
    //    frame.setVisible(true);

  }
  public void attemptPreview() {
    try {
      final MasterReport report = handler.createReport();

      final PreviewDialog frame = new PreviewDialog(report);
      frame.setToolbarFloatable(true);
      frame.setReportController(new DemoReportController());
      frame.pack();
      LibSwingUtil.positionFrameRandomly(frame);
      frame.setVisible(true);
      frame.requestFocus();
    } catch (ReportDefinitionException e) {
      logger.error("Unable to create the report; report definition contained errors.", e);
      AbstractDemoFrame.showExceptionDialog(
          handler.getPresentationComponent(), "report.definitionfailure", e);
    }
  }