creamtec.webcream.rendering.html
Class SnapshotRenderer

java.lang.Object
  extended by creamtec.webcream.rendering.html.AbstractHTMLComponentRenderer
      extended by creamtec.webcream.rendering.html.SnapshotRenderer
All Implemented Interfaces:
ComponentRenderer, HTMLComponentRenderer, java.util.Observer

public class SnapshotRenderer
extends AbstractHTMLComponentRenderer
implements java.util.Observer

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
SnapshotRenderer()
           
 
Method Summary
 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.awt.image.BufferedImage generateImage(HTMLPage page, java.awt.Component comp)
          Generate and return the snapshot image of the component
 java.lang.String generateImageFile(HTMLPage page, java.awt.image.BufferedImage image)
           
 void renderComponent(HTMLPage page, java.lang.Object component)
          Generates an image and makes the component draw itself into it.
 void update(java.util.Observable o, java.lang.Object arg)
          Called when the page is being cleared, so clean up generated images
 void writeJpegImage(HTMLPage page, java.lang.String fileName, java.awt.image.BufferedImage image)
          Persist the image into the file on disk
 
Methods inherited from class creamtec.webcream.rendering.html.AbstractHTMLComponentRenderer
renderComponent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnapshotRenderer

public SnapshotRenderer()
Method Detail

renderComponent

public void renderComponent(HTMLPage page,
                            java.lang.Object component)
                     throws java.lang.Exception
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. If the component is rendered enabled, a mouse listener is added in JavaScript which submits the page whenever a user clicks on the image.

Specified by:
renderComponent in interface HTMLComponentRenderer
Specified by:
renderComponent in class AbstractHTMLComponentRenderer
Parameters:
page - HTMLPage
component - Object
Throws:
java.lang.Exception

generateImageFile

public java.lang.String generateImageFile(HTMLPage page,
                                          java.awt.image.BufferedImage image)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

generateImage

public java.awt.image.BufferedImage generateImage(HTMLPage page,
                                                  java.awt.Component comp)
                                           throws WebCreamException
Generate and return the snapshot image of the component

Throws:
WebCreamException

generateIconImage

public java.awt.image.BufferedImage generateIconImage(HTMLPage page,
                                                      java.awt.Component comp,
                                                      javax.swing.Icon icon)
                                               throws WebCreamException
Generate and return the snapshot image of the icon

Throws:
WebCreamException

writeJpegImage

public void writeJpegImage(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

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


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