com.creamtec.ajaxswing.v4.render

## Class SnapshotRenderer

- java.lang.Object
- - com.creamtec.ajaxswing.v4.render.SnapshotRenderer

- All Implemented Interfaces:
    ComponentRenderer, java.util.Observer

      public class SnapshotRenderer
      extends java.lang.Object
      implements java.util.Observer, ComponentRenderer

  Generates an image and makes the component draw itself into it. The image is then saved in a temporary directory and a link is added to it on the HTML page.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SnapshotRenderer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.awt.image.BufferedImage` | `generateIconImage(HTMLPage page, java.awt.Component comp, javax.swing.Icon icon)` Generate and return the snapshot image of the icon
    `java.lang.String` | `generateIconImageFile(HTMLPage page, java.awt.image.BufferedImage image, boolean keepUntilRestart)`
    `java.awt.image.BufferedImage` | `generateImage(HTMLPage page, java.awt.Component comp)` Generate and return the snapshot image of the component
    `static SnapshotRenderer` | `getInstance()`
    `void` | `initialize()`
    `void` | `renderComponent(ComponentGraphics g, java.awt.Component comp)`
    `void` | `update(java.util.Observable o, java.lang.Object arg)` Called when the page is being cleared, so clean up generated images
    `void` | `writePNGImage(HTMLPage page, java.lang.String fileName, java.awt.image.BufferedImage image)` Persist the image into the file on disk

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SnapshotRenderer

          public SnapshotRenderer()

  - ### Method Detail

    - #### getInstance

          public static SnapshotRenderer getInstance()

    - #### initialize

          public void initialize()

      Specified by:
        `initialize` in interface `ComponentRenderer`

    - #### renderComponent

          public void renderComponent(ComponentGraphics g,
                             java.awt.Component comp)
                               throws java.lang.Exception

      Specified by:
        `renderComponent` in interface `ComponentRenderer`
      Throws:
        `java.lang.Exception`

    - #### generateIconImage

          public java.awt.image.BufferedImage generateIconImage(HTMLPage page,
                                                       java.awt.Component comp,
                                                       javax.swing.Icon icon)
                                                         throws AjaxSwingException

      Generate and return the snapshot image of the icon
      Throws:
        `AjaxSwingException`

    - #### generateIconImageFile

          public java.lang.String generateIconImageFile(HTMLPage page,
                                               java.awt.image.BufferedImage image,
                                               boolean keepUntilRestart)

    - #### generateImage

          public java.awt.image.BufferedImage generateImage(HTMLPage page,
                                                   java.awt.Component comp)
                                                     throws AjaxSwingException

      Generate and return the snapshot image of the component
      Throws:
        `AjaxSwingException`

    - #### update

          public void update(java.util.Observable o,
                    java.lang.Object arg)

      Called when the page is being cleared, so clean up generated images
      Specified by:
        `update` in interface `java.util.Observer`

    - #### writePNGImage

          public void writePNGImage(HTMLPage page,
                           java.lang.String fileName,
                           java.awt.image.BufferedImage image)
                             throws java.lang.Exception

      Persist the image into the file on disk
      Throws:
        `java.lang.Exception`

Copyright © 2000-2012 CreamTec LLC. All Rights Reserved.