Package com.iizix.prop.image
Class ClientImageData
java.lang.Object
com.iizix.prop.image.ClientImageData
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 SummaryFieldsModifier and TypeFieldDescription- final StringThe "ALT" property string for IMG.- final intHeight of image part to display.- final intHeight of entire image (when different device pixel ratio or multiple).- final intType of client image: 0=bitmap, 1=fontIcon, 2=svg.- final intWidth of entire image (when different device pixel ratio or multiple).- final booleanFlag indicating multiple image type.- final intWidth of image part to display.
- Constructor SummaryConstructorsConstructorDescription- ClientImageData- (FontIconDefinition fontIcon) Creates a new instance for font icons.- ClientImageData- (SVGInfo svgInfo) Creates a new instance for SVG.- ClientImageData- (String resource, String alt, int width, int height) Creates a new instance for single-images.- ClientImageData- (String resource, String alt, int width, int height, int imageWidth, int imageHeight) Creates a new instance for single-images.- 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 SummaryModifier and TypeMethodDescription- voidAdds a multiple image.- voidAdds a single image.- adjustTo- (double dpr) Find best match, i.e.- void- append- (PropMgr propertyManager, SendTransaction trans, double dpr) Appends the image data to a transaction for the specified device pixel ratio.- static void- appendNoData- (SendTransaction trans) Method to call when no ClientImageData is present and needs to be sent to client.- void- commit()Commits this definition for no further changes to be used in transactions.- createMultiResolution- (double dpr, String resource, int imageWidth, int imageHeight, int offsetX, int offsetY) Creates a new resolution for a multiple image.- createSingleResolution- (double dpr, String resource, int imageWidth, int imageHeight) Creates a new resolution for a single image.- createSingleResolution- (String resource, int imageWidth, int imageHeight) Creates a new resolution for a single image, auto-calculating the DPR.Gets the default image resource string.- getKStringNonBitmap- (KStringHTMLImageTag source, IKStringInfoProvider provider) Appends the font icon or SVG definition to a KString tag.- getSVGString- (double cx, double cy) If the image is an SVG, the returned, perhaps scaled SVG image.- boolean- isBitmap()Returns if the image is a bitmap image type.- booleanReturns if the image is a font icon image type.- boolean- isSVG()Returns if the image is SVG.- toString()To debug String.- void- unCommit()Uncommits the ClientImageData to enable it e.g.
- Field Details- imageTypepublic final int imageTypeType of client image: 0=bitmap, 1=fontIcon, 2=svg.
- isMultipublic final boolean isMultiFlag indicating multiple image type.
- altThe "ALT" property string for IMG.
- widthpublic final int widthWidth of image part to display.
- heightpublic final int heightHeight of image part to display.
- imageWidthpublic final int imageWidthWidth of entire image (when different device pixel ratio or multiple).
- imageHeightpublic final int imageHeightHeight of entire image (when different device pixel ratio or multiple).
 
- Constructor Details- ClientImageDataCreates a new instance for font icons.
- ClientImageDataCreates a new instance for SVG.
- ClientImageDataCreates a new instance for single-images.
- ClientImageDatapublic ClientImageData- (String resource, String alt, int width, int height, int imageWidth, int imageHeight) Creates a new instance for single-images.
- ClientImageDatapublic 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- addSingleAdds a single image.
- addMultiAdds a multiple image.
- createSingleResolutionCreates a new resolution for a single image, auto-calculating the DPR.- Parameters:
- resource- The resource.
- imageWidth- The width of the image.
- imageHeight- The height of the image.
- Throws:
- IllegalArgumentException- If the DPR in width/height is not the same.
 
- createSingleResolutionpublic ClientImageData createSingleResolution- (double dpr, String resource, int imageWidth, int imageHeight) Creates a new resolution for a single image.- Parameters:
- dpr- The Display Pixel Ratio.
- resource- The resource.
- imageWidth- The width of the image.
- imageHeight- The height of the image.
 
- createMultiResolutionpublic ClientImageData createMultiResolution- (double dpr, String resource, int imageWidth, int imageHeight, int offsetX, int offsetY) Creates a new resolution for a multiple image.
- commitpublic void commit()Commits this definition for no further changes to be used in transactions.
- unCommitpublic 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.
- appendAppends 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.
 
- appendNoDataMethod to call when no ClientImageData is present and needs to be sent to client.- Parameters:
- trans- The transaction.
 
- toStringTo debug String.
- getDefaultResourceGets the default image resource string.- Returns:
- The resource, or null for none.
 
- adjustToFind 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.
 
- isBitmappublic boolean isBitmap()Returns if the image is a bitmap image type.
- isFontIconpublic boolean isFontIcon()Returns if the image is a font icon image type.
- isSVGpublic boolean isSVG()Returns if the image is SVG.
- getKStringNonBitmapAppends 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.
 
- getSVGStringIf the image is an SVG, the returned, perhaps scaled SVG image.- Parameters:
- cx- Requested scaled width if larger than zero.
- cy- Requested scaled height if larger than zero.
- Returns:
- The SVG string, or nullfor failure or it's not an SVG image.