Hi,

PS: I'm using JasperReports 1.2.0 + Swing/JDK5.

I'd like to know:

1) How could I contrib with viewer.properties file, creating a 
translating to pt-BR? There is only pt-PT available.

2) After this contrib, do I need to recompile all JasperReports changing 
the default viewer.properties file to work it? Or is there a method to 
call to setup the properties language file in runtime?

3) Is there some method to call saying to JasperViewer doesn't appear if 
the ResultSet doesn't contain any data? I only want the message dialog 
''The document has no pages.".

4) I had thought a way to show a Progress Bar when the report is 
processing by a long way time. Then, I did a method like this:

    JSplashTime splash = new 
JSplashTime(cl,princ.getDirImagens()+"hourglass.gif","Processing report 
...");
    try {
    try {
      String SQL = "something..."
      //
      Statement stmt = princ.getconnLocal().createStatement();
      ResultSet rs = stmt.executeQuery(SQL);
      //=======================
      // call Jasper with many code... only final 3 lines below for 
simplicity...
     try {
        JasperReport jasperReport = 
(JasperReport)JRLoader.loadObject(URLFile);
        JasperPrint jasperPrint = 
JasperFillManager.fillReport(jasperReport, parameters, new 
JRResultSetDataSource(rs));
        JasperViewer.viewReport(jasperPrint,false);
      }
      catch (JRException e) { e.printStackTrace(); }
      }
      //=======================
      stmt.close();
      return true;
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    } finally {
    splash.dispose();
    }

Then, I made a JSplashTime (JWindow):
public class JSplashTime extends JWindow {
  JLabel msgLabel;
  String msgtime;
  int cttime;
  JProgressBar progress;
  Timer timer;
 
  /** Creates a new instance of JSplash */
  public JSplashTime(ClassLoader cl, String icone, String msg) {
    super();
    getContentPane().setLayout(new 
BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
    msgtime = msg;
    //
    JPanel panel = new JPanel();
    panel.setBorder(new BevelBorder(BevelBorder.RAISED));
    panel.setLayout(new BoxLayout(panel,BoxLayout.X_AXIS));
    if (icone != null && cl.getResource(icone) != null)
      panel.add(new JLabel(new ImageIcon(cl.getResource(icone))));
    msgLabel = new JLabel(msg);
    panel.add(msgLabel);
    getContentPane().add(panel);
    //
    progress = new JProgressBar(0,100);
    progress.setStringPainted(true);
    progress.setIndeterminate(true);
    getContentPane().add(progress);
    //
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
    //
    cttime = 0;
    int delay = 0;   // delay for 5 sec.
    int period = 1000;  // repeat every sec.
    timer = new Timer();
    timer.scheduleAtFixedRate(new TimerTask() {
      public void run() {
        cttime++;
        progress.setValue(cttime);
        progress.repaint();
        progress.getParent().validate();
        progress.getParent().repaint();
        System.out.println(cttime);
      }
    }, delay, period);
  }
 
  public void dispose() {
    if (timer != null)
      timer.cancel();
    if (progress != null) {
      progress.setValue(100);
      progress.setIndeterminate(false);
    }
    super.dispose();
  }
 
}

========================
But the JWindow (with labels and progressbar) doesn't repaint anything!
I don't know what can I do to solve this... The users become lost, they 
don't know if the report is working or if the system is down.

Thanks for this help...



_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to