I'll keep the properties map instead of the get/setImageProvider to avoid 
the proliferation of get/set methods.

Paulo

----- Original Message ----- 
From: "robert engels" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, May 26, 2007 6:51 PM
Subject: Re: [iText-questions] HTMLWorker image handling improvements 
(PauloSoares)


> Having the ImageProvider interface allows for easy custom protocol
> handling, and simple embedded image processing.
>
> The code below is what we are doing in our custom 1.4.8 derivation.
>
> Adding get/setImageProvider to HTMLWorker would be a better solution
> than using the properties map.
>
> In this way, HTMLWorker would look like
>
> public class HTMLWorker {
>
>     private ImageProvider ip = new DefaultImageProvider();
>
>     public ImageProvider getImageProvider() {
>          return ip;
>     }
>
>    public void setImageProvider(ImageProvider ip) [
>        if(ip==null)
>             throw new IllegalArgumentException("image provider
> cannot be null");
>        this.ip = ip;
>    }
>
>   .... change the handle tag to just
>
>   Image img = ip.getImage(src);
>
>   ... process image according to other properties
>
> }
>
> then
>
> public class DefaultImageProvider implements ImageProvider [
>
>       Image getImage(String src) {
>               ... put the current image retrieval code from the img
> tag handling here ...
>
> }
>
> In this way a user can then create
>
> public class MyImageProvider extends DefaultImageProvider {
>
>       Image getImage(String src) {
>            if(I understand the src) {
>                 return the image;
>            else
>                 return super.getImage(src);
> }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to