Hi,

Thank you, that's exactly what I did... In fact, I thought there was a prettier way to implement this. Something like a "PageGenerationListener"...

But this hack works correctly, here is the code snippets, if someone is interested in a such trivial thing...

// --------------------------------------------------------------------------------

public class FOPLogger implements Logger {

private JLabel gui = null;

public FOPLogger(JLabel gui) {
        this.gui = gui;
}

public void info(String arg0) {
    System.out.println("[FOPLOGGER] " + arg0);
    if (arg0.indexOf("[") != -1) {
        int firstBalise = arg0.lastIndexOf("[");
        int lastBalise = arg0.lastIndexOf("]");
        int page = 0;
        try {
            page = Integer.parseInt(arg0.substring(firstBalise+1,lastBalise));
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (gui != null) gui.setText("page "+ page);
    }
}

/* Other methods implementation here... */

}

// --------------------------------------------------------------------------------
--------------------------------------------------------------
Simon OUALID
--------------------------------------------------------------
ARTE FRANCE
Analyste Programmeur
[EMAIL PROTECTED]
Tél : 01.55.00.73.18
Fax : 01.55.00.73.89
--------------------------------------------------------------




Chris Bowditch <[EMAIL PROTECTED]>

10/08/2004 10:55
Veuillez répondre à fop-user

       
        Pour :        [EMAIL PROTECTED]
        cc :        
        Objet :        Re: Java App using FOP : How to communicate on the number of pages generated ?



[EMAIL PROTECTED] wrote:

<snip/>

> Is there a better way than using a specific logger ?

Implementing a logger class that looks for the

[INFO] [1]
[INFO] [2]
etc

messages is the only way to report progress to the user. There is no way to
know the total page count before hand either.

Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to