net.atlanticbb.tantlinger.ui.text
Class CachedImageView

java.lang.Object
  extended by javax.swing.text.View
      extended by javax.swing.text.html.ImageView
          extended by net.atlanticbb.tantlinger.ui.text.CachedImageView
All Implemented Interfaces:
javax.swing.SwingConstants

public class CachedImageView
extends javax.swing.text.html.ImageView

An ImageView which caches images to a local directory after they're initially loaded. After the images are cached, they're subsequently loaded from the local directory, thereby reducing the overhead of refetching them from their remote location.

Author:
Bob Tantlinger

Field Summary
static java.lang.String IMG_CACHE_DIR
           
static java.lang.String PROP_DIR
          Directory where app properties are stored
static java.lang.String USER_HOME
           
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
CachedImageView(javax.swing.text.Element elem)
           
 
Method Summary
 java.net.URL getImageURL()
          Return a URL for the image source, or null if it could not be determined.
 void paint(java.awt.Graphics g, java.awt.Shape a)
           
 
Methods inherited from class javax.swing.text.html.ImageView
changedUpdate, getAlignment, getAltText, getAttributes, getImage, getLoadingImageIcon, getLoadsSynchronously, getNoImageIcon, getPreferredSpan, getStyleSheet, getToolTipText, modelToView, setLoadsSynchronously, setParent, setPropertiesFromAttributes, setSize, viewToModel
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, removeUpdate, replace, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_HOME

public static final java.lang.String USER_HOME

PROP_DIR

public static final java.lang.String PROP_DIR
Directory where app properties are stored


IMG_CACHE_DIR

public static final java.lang.String IMG_CACHE_DIR
Constructor Detail

CachedImageView

public CachedImageView(javax.swing.text.Element elem)
Method Detail

paint

public void paint(java.awt.Graphics g,
                  java.awt.Shape a)
Overrides:
paint in class javax.swing.text.html.ImageView

getImageURL

public java.net.URL getImageURL()
Return a URL for the image source, or null if it could not be determined. If the image is cached, the local file URL is returned. The superclass treats this the same as the actual url, but the image is loaded from the local cache rather than redownloading it

Overrides:
getImageURL in class javax.swing.text.html.ImageView