Class ClientImageData

java.lang.Object
com.iizix.prop.image.ClientImageData

public class ClientImageData extends Object
The Client image data. This data is transmitted between Server and JavaScript Client for an image. When building this class (adding image styles), this must be done in a thread-safe manner.
Author:
Christopher Mindus
  • Field Details

    • imageType

      public final int imageType
      Type of client image: 0=bitmap, 1=fontIcon, 2=svg.
    • isMulti

      public final boolean isMulti
      Flag indicating multiple image type.
    • alt

      public final String alt
      The "ALT" property string for IMG.
    • width

      public final int width
      Width of image part to display.
    • height

      public final int height
      Height of image part to display.
    • imageWidth

      public final int imageWidth
      Width of entire image (when different device pixel ratio or multiple).
    • imageHeight

      public final int imageHeight
      Height of entire image (when different device pixel ratio or multiple).
  • Constructor Details

    • ClientImageData

      public ClientImageData(FontIconDefinition fontIcon)
      Creates a new instance for font icons.
    • ClientImageData

      public ClientImageData(SVGInfo svgInfo)
      Creates a new instance for SVG.
    • ClientImageData

      public ClientImageData(String resource, String alt, int width, int height)
      Creates a new instance for single-images.
    • ClientImageData

      public ClientImageData(String resource, String alt, int width, int height, int imageWidth, int imageHeight, int offsetX, int offsetY)
      Creates a new instance for multiple-images.
  • Method Details

    • addSingle

      public void addSingle(String resource, int matchMask)
      Adds a single image.
    • addMulti

      public void addMulti(String resource, int matchMask, int offsetX, int offsetY)
      Adds a multiple image.
    • createSingleResolution

      public ClientImageData createSingleResolution(double dpr, String resource, int imageWidth, int imageHeight)
      Creates a new resolution for a single image.
    • createMultiResolution

      public ClientImageData createMultiResolution(double dpr, String resource, int imageWidth, int imageHeight, int offsetX, int offsetY)
      Creates a new resolution for a multiple image.
    • commit

      public void commit()
      Commits this definition for no further changes to be used in transactions.
    • unCommit

      public void unCommit()
      Uncommits the ClientImageData to enable it e.g. to have a new DPR resolution added. The previously committed data remains until a new commit() is performed.
    • append

      public void append(PropMgr propertyManager, SendTransaction trans, double dpr)
      Appends the image data to a transaction for the specified device pixel ratio.
      Parameters:
      propertyManager - The property manager.
      trans - The transaction.
      dpr - The display pixel ratio on the client device.
    • appendNoData

      public static void appendNoData(SendTransaction trans)
      Method to call when no ClientImageData is present and needs to be sent to client.
      Parameters:
      trans - The transaction.
    • toString

      public String toString()
      To debug String.
      Overrides:
      toString in class Object
    • getDefaultResource

      public String getDefaultResource()
      Gets the default image resource string.
      Returns:
      The resource, or null for none.
    • adjustTo

      public ClientImageData adjustTo(double dpr)
      Find best match, i.e. the exact match first, otherwise the one that is just larger in DPR.
      Parameters:
      dpr - The device pixel ratio.
      Returns:
      The ClientImageData to use for the DPR, or "this" if no match was found.
    • isBitmap

      public boolean isBitmap()
      Returns if the image is a bitmap image type.
    • isFontIcon

      public boolean isFontIcon()
      Returns if the image is a font icon image type.
    • isSVG

      public boolean isSVG()
      Returns if the image is SVG.
    • getKStringNonBitmap

      public String getKStringNonBitmap(KStringHTMLImageTag source, IKStringInfoProvider provider)
      Appends the font icon or SVG definition to a KString tag.
      Parameters:
      source - The source KString tag.
      provider - The information provider.
      Returns:
      The string to use.