Holger's Java API

## com.antelmann.image
Class ImageHolder

    java.lang.Object
      com.antelmann.image.ImageHolder

All Implemented Interfaces:
  Imageable, ValueRetriever<Image>, ValueSetter<Image>, Serializable

    public class ImageHolder

extends Object
implements Serializable, ValueRetriever<Image>, ValueSetter<Image>, Imageable

allows to keep an image while supporting serialization of the same via a given format or a URLImageRetriever. This method is very useful if you need to support serialization for a class that embeds an image. If `setImage(URL)` or `ImageHolder(URL)` is used, only the URL will be serialized.

Since:
  06.01.2010, 13:53:43
Author:
  Holger Antelmann
See Also:
  `getSerializationFormat()`, `setImage(URL)`, `Placeholder`, `BinaryData`, Serialized Form

Constructor Summary
`ImageHolder()`
`ImageHolder(BinaryData data)`
`ImageHolder(Image value)`
`ImageHolder(URL url)`
`ImageHolder(ValueRetriever<Image> retriever)`

Method Summary
`void` `addPropertyChangeListener(PropertyChangeListener listener)`
`void` `addVetoableChangeListener(VetoableChangeListener listener)`
`static ValueRetriever<Image>` `createRetriever(ValueRetriever<Connection> conRetriever, String table, String keyColumn, Object keyValue, String dataColumn, DBTransaction tx)`
`Image` `getDisplayIcon()` returns an image that is suitable for use as an icon for this instance.
`Image` `getDisplayImage()` returns an image that represents a visual representation of this instance.
`ValueRetriever<Image>` `getImageRetriever()`
`URL` `getInternalURL()`
`PropertyChangeListener[]` `getPropertyChangeListeners()`
`Image` `getRelevantValue()` returns the relevant value for this instance at the time of calling
`String` `getSerializationFormat()` this implementation simply returns 'png'
`VetoableChangeListener[]` `getVetoableChangeListeners()`
`boolean` `isBasedOnURL()`
`void` `removePropertyChangeListener(PropertyChangeListener listener)`
`void` `removeVetoableChangeListener(VetoableChangeListener listener)`
`void` `setImage(BinaryData data)`
`void` `setImage(Image image)`
`void` `setImage(URL url)` if this method is used, serialization will only serialize the URL
`void` `setImageRetriever(ValueRetriever<Image> retriever)`
`void` `setRelevantValue(Image value)` sets the relevant value for this instance with the given value

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ImageHolder

    public ImageHolder()

### ImageHolder

    public ImageHolder(URL url)

### ImageHolder

    public ImageHolder(BinaryData data)

### ImageHolder

    public ImageHolder(Image value)

### ImageHolder

    public ImageHolder(ValueRetriever<Image> retriever)

Method Detail

### getSerializationFormat

    public String getSerializationFormat()

  this implementation simply returns 'png'

### getDisplayImage

    public final Image getDisplayImage()
                                throws IOException

  Description copied from interface: `Imageable`
  returns an image that represents a visual representation of this instance. The method may return null;

  Specified by:
    `getDisplayImage` in interface `Imageable`
  Throws:
    `IOException`

### setImage

    public void setImage(Image image)

### setImage

    public void setImage(BinaryData data)

### setImage

    public void setImage(URL url)

  if this method is used, serialization will only serialize the URL

### isBasedOnURL

    public boolean isBasedOnURL()

### getInternalURL

    public URL getInternalURL()
                       throws OptionNotAvailableWarning

  Throws:
    `OptionNotAvailableWarning`

### setImageRetriever

    public final void setImageRetriever(ValueRetriever<Image> retriever)
                                 throws IllegalArgumentException

  Throws:
    `IllegalArgumentException` - if a `VetoableChangeListener` is throwing a `PropertyVetoException`

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

### getPropertyChangeListeners

    public PropertyChangeListener[] getPropertyChangeListeners()

### addVetoableChangeListener

    public void addVetoableChangeListener(VetoableChangeListener listener)

### removeVetoableChangeListener

    public void removeVetoableChangeListener(VetoableChangeListener listener)

### getVetoableChangeListeners

    public VetoableChangeListener[] getVetoableChangeListeners()

### getImageRetriever

    public ValueRetriever<Image> getImageRetriever()

### setRelevantValue

    public void setRelevantValue(Image value)
                          throws Exception

  Description copied from interface: `ValueSetter`
  sets the relevant value for this instance with the given value

  Specified by:
    `setRelevantValue` in interface `ValueSetter<Image>`
  Throws:
    `Exception`

### getRelevantValue

    public Image getRelevantValue()
                           throws IOException

  Description copied from interface: `ValueRetriever`
  returns the relevant value for this instance at the time of calling

  Specified by:
    `getRelevantValue` in interface `ValueRetriever<Image>`
  Throws:
    `IOException` - if any resource to fulfill the request is not accessible

### createRetriever

    public static ValueRetriever<Image> createRetriever(ValueRetriever<Connection> conRetriever,
                                                        String table,
                                                        String keyColumn,
                                                        Object keyValue,
                                                        String dataColumn,
                                                        DBTransaction tx)

### getDisplayIcon

    public Image getDisplayIcon()
                         throws IOException

  Description copied from interface: `Imageable`
  returns an image that is suitable for use as an icon for this instance. The method may return null;

  Specified by:
    `getDisplayIcon` in interface `Imageable`
  Throws:
    `IOException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads