You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by s-...@artefrance.fr on 2004/08/10 17:33:29 UTC

Re: Java App using FOP : How to communicate on the number of pages generated ? (resolved)

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
s-oualid@artefrance.fr
Tél : 01.55.00.73.18
Fax : 01.55.00.73.89
--------------------------------------------------------------





Chris Bowditch <bo...@hotmail.com>
10/08/2004 10:55
Veuillez répondre à fop-user

 
        Pour :  fop-user@xml.apache.org
        cc : 
        Objet : Re: Java App using FOP : How to communicate on the number of pages 
generated ?


s-oualid@artefrance.fr 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: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org