Class AbstractImageRegistry

java.lang.Object
fr.opensagres.xdocreport.document.images.AbstractImageRegistry
All Implemented Interfaces:
IImageRegistry

public abstract class AbstractImageRegistry extends Object implements IImageRegistry
Abstract class for IImageRegistry.
  • 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: 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:
      fr.opensagres.xdocreport.core.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 fr.opensagres.xdocreport.core.XDocReportException
      Description copied from interface: IImageRegistry
      Called before processing of the template engine.
      Specified by:
      preProcess in interface IImageRegistry
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
    • postProcess

      public void postProcess() throws fr.opensagres.xdocreport.core.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:
      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

      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 fr.opensagres.xdocreport.template.formatter.FieldsMetadata getFieldsMetadata()
    • getSize

      public abstract String getSize(float sizeAsPixel)
      Parameters:
      sizeAsPixel -
      Returns:
      sizeAsDxa
    • getSize

      public abstract Float getSize(String sizeAsDxa)
      Parameters:
      sizeAsDxa -
      Returns:
      sizeAsPixel null in case the size cannot be computed