fr.opensagres.xdocreport.document.images
Class AbstractImageRegistry

java.lang.Object
  extended by fr.opensagres.xdocreport.document.images.AbstractImageRegistry
All Implemented Interfaces:
IImageRegistry
Direct Known Subclasses:
DocxImageRegistry, ODPImageRegistry, ODSImageRegistry, ODTImageRegistry, PPTXImageRegistry

public abstract class AbstractImageRegistry
extends Object
implements IImageRegistry

Abstract class for IImageRegistry.


Field Summary
protected  IEntryOutputStreamProvider outputStreamProvider
           
protected  IEntryReaderProvider readerProvider
           
protected  IEntryWriterProvider writerProvider
           
 
Fields inherited from interface fr.opensagres.xdocreport.document.images.IImageRegistry
GET_HEIGHT_METHOD, GET_PATH_METHOD, GET_WIDTH_METHOD, IMAGE_INFO, REGISTER_IMAGE_METHOD
 
Constructor Summary
AbstractImageRegistry(IEntryReaderProvider readerProvider, IEntryWriterProvider writerProvider, IEntryOutputStreamProvider outputStreamProvider, FieldsMetadata fieldsMetadata)
           
 
Method Summary
protected  ImageProviderInfo createImageProviderInfo(IImageProvider imageProvider)
           
 FieldsMetadata getFieldsMetadata()
           
 String getHeight(ImageProviderInfo info, String defaultHeight)
          Returns the height of the image provider if not null and the given defaultHeight otherwise.
protected abstract  String getImageBasePath()
           
protected  String getImageEntryName(ImageProviderInfo imageProviderInfo)
           
protected  String getImageId()
           
 List<ImageProviderInfo> getImageProviderInfos()
          Returns list of image provider info.
protected abstract  String getPath(ImageProviderInfo info)
           
 String getPath(ImageProviderInfo info, String defaultPath)
           
protected abstract  String getSize(float sizeAsPixel)
           
 String getWidth(ImageProviderInfo info, String defaultWidth)
          Returns the width of the image provider if not null and the given defaultWidth otherwise.
 void postProcess()
          Called after processing of the template engine.
 void preProcess()
          Called before processing of the template engine.
 ImageProviderInfo registerImage(Object image, String fieldName, IContext context)
          Register the instance of imageProvider in the registry.
protected  void saveBinaryImage(ImageProviderInfo imageProviderInfo)
           
protected  void saveBinaryImages()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readerProvider

protected final IEntryReaderProvider readerProvider

writerProvider

protected final IEntryWriterProvider writerProvider

outputStreamProvider

protected final IEntryOutputStreamProvider outputStreamProvider
Constructor Detail

AbstractImageRegistry

public AbstractImageRegistry(IEntryReaderProvider readerProvider,
                             IEntryWriterProvider writerProvider,
                             IEntryOutputStreamProvider outputStreamProvider,
                             FieldsMetadata fieldsMetadata)
Method Detail

registerImage

public ImageProviderInfo registerImage(Object image,
                                       String fieldName,
                                       IContext context)
                                throws XDocReportException,
                                       IOException
Description copied from interface: IImageRegistry
Register the instance of imageProvider in the registry. This done when context model is tracked while processing of the template engine.

Specified by:
registerImage in interface IImageRegistry
Returns:
Throws:
XDocReportException
IOException

getImageProviderInfos

public List<ImageProviderInfo> getImageProviderInfos()
Description copied from interface: IImageRegistry
Returns list of image provider info.

Specified by:
getImageProviderInfos in interface IImageRegistry
Returns:

createImageProviderInfo

protected ImageProviderInfo createImageProviderInfo(IImageProvider imageProvider)

getImageId

protected String getImageId()

preProcess

public void preProcess()
                throws XDocReportException
Description copied from interface: IImageRegistry
Called before processing of the template engine.

Specified by:
preProcess in interface IImageRegistry
Throws:
XDocReportException

postProcess

public void postProcess()
                 throws XDocReportException
Description copied from interface: IImageRegistry
Called after processing of the template engine. In this step, list of image provider is populated. This method can be implemented to copy the binary data of the images in the generated report.

Specified by:
postProcess in interface IImageRegistry
Throws:
XDocReportException

saveBinaryImages

protected void saveBinaryImages()
                         throws XDocReportException
Throws:
XDocReportException

saveBinaryImage

protected void saveBinaryImage(ImageProviderInfo imageProviderInfo)
                        throws XDocReportException
Throws:
XDocReportException

getImageEntryName

protected String getImageEntryName(ImageProviderInfo imageProviderInfo)

getImageBasePath

protected abstract String getImageBasePath()

getPath

public String getPath(ImageProviderInfo info,
                      String defaultPath)

getPath

protected abstract String getPath(ImageProviderInfo info)

getWidth

public String getWidth(ImageProviderInfo info,
                       String defaultWidth)
                throws IOException
Description copied from interface: IImageRegistry
Returns the width of the image provider if not null and the given defaultWidth otherwise.

Specified by:
getWidth in interface IImageRegistry
Returns:
Throws:
IOException

getHeight

public String getHeight(ImageProviderInfo info,
                        String defaultHeight)
                 throws IOException
Description copied from interface: IImageRegistry
Returns the height of the image provider if not null and the given defaultHeight otherwise.

Specified by:
getHeight in interface IImageRegistry
Returns:
Throws:
IOException

getFieldsMetadata

public FieldsMetadata getFieldsMetadata()

getSize

protected abstract String getSize(float sizeAsPixel)


Copyright © 2013. All rights reserved.