Class AbstractImageRegistry
java.lang.Object
fr.opensagres.xdocreport.document.images.AbstractImageRegistry
- All Implemented Interfaces:
IImageRegistry
Abstract class for
IImageRegistry.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final fr.opensagres.xdocreport.core.io.IEntryOutputStreamProviderprotected final fr.opensagres.xdocreport.core.io.IEntryReaderProviderprotected final fr.opensagres.xdocreport.core.io.IEntryWriterProviderFields 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
ConstructorsConstructorDescriptionAbstractImageRegistry(fr.opensagres.xdocreport.core.io.IEntryReaderProvider readerProvider, fr.opensagres.xdocreport.core.io.IEntryWriterProvider writerProvider, fr.opensagres.xdocreport.core.io.IEntryOutputStreamProvider outputStreamProvider, fr.opensagres.xdocreport.template.formatter.FieldsMetadata fieldsMetadata) -
Method Summary
Modifier and TypeMethodDescriptionprotected ImageProviderInfocreateImageProviderInfo(IImageProvider imageProvider) fr.opensagres.xdocreport.template.formatter.FieldsMetadatagetHeight(ImageProviderInfo info, String defaultHeight) Returns the height of the image provider if not null and the given defaultHeight otherwise.protected abstract Stringprotected StringgetImageEntryName(ImageProviderInfo imageProviderInfo) protected StringReturns list of image provider info.protected abstract StringgetPath(ImageProviderInfo info) getPath(ImageProviderInfo info, String defaultPath) abstract StringgetSize(float sizeAsPixel) abstract FloatgetWidth(ImageProviderInfo info, String defaultWidth) Returns the width of the image provider if not null and the given defaultWidth otherwise.voidCalled after processing of the template engine.voidCalled before processing of the template engine.registerImage(Object image, String fieldName, fr.opensagres.xdocreport.template.IContext context) Register the instance of imageProvider in the registry.protected voidsaveBinaryImage(ImageProviderInfo imageProviderInfo) protected void
-
Field Details
-
readerProvider
protected final fr.opensagres.xdocreport.core.io.IEntryReaderProvider readerProvider -
writerProvider
protected final fr.opensagres.xdocreport.core.io.IEntryWriterProvider writerProvider -
outputStreamProvider
protected final fr.opensagres.xdocreport.core.io.IEntryOutputStreamProvider outputStreamProvider
-
-
Constructor Details
-
AbstractImageRegistry
public AbstractImageRegistry(fr.opensagres.xdocreport.core.io.IEntryReaderProvider readerProvider, fr.opensagres.xdocreport.core.io.IEntryWriterProvider writerProvider, fr.opensagres.xdocreport.core.io.IEntryOutputStreamProvider outputStreamProvider, fr.opensagres.xdocreport.template.formatter.FieldsMetadata fieldsMetadata)
-
-
Method Details
-
registerImage
public ImageProviderInfo registerImage(Object image, String fieldName, fr.opensagres.xdocreport.template.IContext context) throws fr.opensagres.xdocreport.core.XDocReportException, IOException Description copied from interface:IImageRegistryRegister the instance of imageProvider in the registry. This done when context model is tracked while processing of the template engine.- Specified by:
registerImagein interfaceIImageRegistry- Returns:
- Throws:
fr.opensagres.xdocreport.core.XDocReportExceptionIOException
-
getImageProviderInfos
Description copied from interface:IImageRegistryReturns list of image provider info.- Specified by:
getImageProviderInfosin interfaceIImageRegistry- Returns:
-
createImageProviderInfo
-
getImageId
-
preProcess
public void preProcess() throws fr.opensagres.xdocreport.core.XDocReportExceptionDescription copied from interface:IImageRegistryCalled before processing of the template engine.- Specified by:
preProcessin interfaceIImageRegistry- Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
postProcess
public void postProcess() throws fr.opensagres.xdocreport.core.XDocReportExceptionDescription copied from interface:IImageRegistryCalled 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:
postProcessin interfaceIImageRegistry- Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
saveBinaryImages
protected void saveBinaryImages() throws fr.opensagres.xdocreport.core.XDocReportException- Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
saveBinaryImage
protected void saveBinaryImage(ImageProviderInfo imageProviderInfo) throws fr.opensagres.xdocreport.core.XDocReportException - Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
getImageEntryName
-
getImageBasePath
-
getPath
-
getPath
-
getWidth
Description copied from interface:IImageRegistryReturns the width of the image provider if not null and the given defaultWidth otherwise.- Specified by:
getWidthin interfaceIImageRegistry- Returns:
- Throws:
IOException
-
getHeight
Description copied from interface:IImageRegistryReturns the height of the image provider if not null and the given defaultHeight otherwise.- Specified by:
getHeightin interfaceIImageRegistry- Returns:
- Throws:
IOException
-
getFieldsMetadata
public fr.opensagres.xdocreport.template.formatter.FieldsMetadata getFieldsMetadata() -
getSize
- Parameters:
sizeAsPixel-- Returns:
- sizeAsDxa
-
getSize
- Parameters:
sizeAsDxa-- Returns:
- sizeAsPixel null in case the size cannot be computed
-