jview
Class JWebcam

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by jview.AbstractDisplayable
                  extended by jview.JWebcam
All Implemented Interfaces:
Cloneable, Displayable, DisplayChronology, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying
Direct Known Subclasses:
JDaycam

public class JWebcam
extends AbstractDisplayable
implements DisplayChronology

A webcam canvas is connected to a webcam somewhere accessible via internet. The background image of the canvas is fetched from this site at regular intervalls. It is possible to overplot some shapes onto the image.


Nested Class Summary
private static class JWebcam.SimpleAuthenticator
          A authenticator for plain usernames/passwords.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFDATECOLOR
          Default date color.
private static float DEFDATEHORJUST
          Default horizontal justification (left).
private static Point2D DEFDATEPOS
          Default date position up left.
private static float DEFDATEVERTJUST
          Default horizontal justification (left).
private static String DEFPROTOCOL
          Default protocol is http.
private static boolean DEFSHOWDATE
          Default do not show date.
private static long DEFUPDATE
          Default update interval is 60 minutes.
static String KEY_CLIPRAW
          Clipping to be performaed on the raw image, immediately after fetch.
static String KEY_DATECOLOR
          color of displayed date.
static String KEY_DATEFONT
          Font of displayed date.
static String KEY_DATEFORMAT
          If given, the date format.
static String KEY_DATEHORJUST
          Horizontal justification of date.
static String KEY_DATEPOS
          Position of date text.
static String KEY_DATEVERTJUST
          Vertical justification of date.
static String KEY_HOST
          The host name of the server providing the baycam images.
static String KEY_PASSPHRASE
          If this field is present we have a user name and password.
static String KEY_PATH
          The path name of the server providing the baycam images directory.
static String KEY_PROTOCOL
          The protocol of the server providing the baycam images.
static String KEY_SHOWDATE
          If true, we also show the date.
static String KEY_TIMEMETHOD
          The method in the URL connection that tells us a date.
static String KEY_UPDATE
          The update interval for webcam images in server push.
private  long lastmodified
          The last URL-modification time we retrieved from.
private  Authenticator password
          If the login requires a password.
 
Fields inherited from class jview.AbstractDisplayable
KEY_COMPONENTNAME, KEY_ICON, KEY_INSETS
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
JWebcam(Map prop)
          Constructs a new webcam canvas.
 
Method Summary
 boolean canDeliver()
          We can deliver if the modification time on the server is below the modification time of our latest retrieval.
protected  PasswordAuthentication getAuthentication()
          Returns the password authentication or null.
protected  URL getDownloadUrl(Date ignored)
          Returns the url we can download the image from.
 long getRefreshInterval()
          We return our minimum interval.
 Component getRepresentation()
          We return the webcam image in a viewport canvas to allow zooming.
 Component getRepresentationAt(Date now)
          We get the representation at the desired date.
protected  BufferedImage getWebcamImage(URL download)
          Returns the webcam image from the stated url.
 void init()
          Loads URL-resources, if there are any.
 
Methods inherited from class jview.AbstractDisplayable
getComponentName, getIcon, getIcon
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jview.Displayable
getIcon
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

KEY_PROTOCOL

public static final String KEY_PROTOCOL
The protocol of the server providing the baycam images.

See Also:
Constant Field Values

KEY_HOST

public static final String KEY_HOST
The host name of the server providing the baycam images.

See Also:
Constant Field Values

KEY_PATH

public static final String KEY_PATH
The path name of the server providing the baycam images directory.

See Also:
Constant Field Values

KEY_UPDATE

public static final String KEY_UPDATE
The update interval for webcam images in server push.

See Also:
Constant Field Values

KEY_TIMEMETHOD

public static final String KEY_TIMEMETHOD
The method in the URL connection that tells us a date.

See Also:
Constant Field Values

KEY_PASSPHRASE

public static final String KEY_PASSPHRASE
If this field is present we have a user name and password.

See Also:
Constant Field Values

KEY_SHOWDATE

public static final String KEY_SHOWDATE
If true, we also show the date.

See Also:
Constant Field Values

KEY_DATEFORMAT

public static final String KEY_DATEFORMAT
If given, the date format.

See Also:
Constant Field Values

KEY_DATEPOS

public static final String KEY_DATEPOS
Position of date text.

See Also:
Constant Field Values

KEY_DATEHORJUST

public static final String KEY_DATEHORJUST
Horizontal justification of date.

See Also:
Constant Field Values

KEY_DATEVERTJUST

public static final String KEY_DATEVERTJUST
Vertical justification of date.

See Also:
Constant Field Values

KEY_DATECOLOR

public static final String KEY_DATECOLOR
color of displayed date.

See Also:
Constant Field Values

KEY_DATEFONT

public static final String KEY_DATEFONT
Font of displayed date.

See Also:
Constant Field Values

KEY_CLIPRAW

public static final String KEY_CLIPRAW
Clipping to be performaed on the raw image, immediately after fetch.

See Also:
Constant Field Values

DEFPROTOCOL

private static final String DEFPROTOCOL
Default protocol is http.

See Also:
Constant Field Values

DEFUPDATE

private static final long DEFUPDATE
Default update interval is 60 minutes.

See Also:
Constant Field Values

DEFSHOWDATE

private static final boolean DEFSHOWDATE
Default do not show date.

See Also:
Constant Field Values

DEFDATEPOS

private static final Point2D DEFDATEPOS
Default date position up left.


DEFDATEHORJUST

private static final float DEFDATEHORJUST
Default horizontal justification (left).

See Also:
Constant Field Values

DEFDATEVERTJUST

private static final float DEFDATEVERTJUST
Default horizontal justification (left).

See Also:
Constant Field Values

DEFDATECOLOR

private static final String DEFDATECOLOR
Default date color.

See Also:
Constant Field Values

lastmodified

private long lastmodified
The last URL-modification time we retrieved from.


password

private Authenticator password
If the login requires a password.

Constructor Detail

JWebcam

public JWebcam(Map prop)
Constructs a new webcam canvas.

Method Detail

init

public void init()
Description copied from class: PropertyResources
Loads URL-resources, if there are any.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

getRefreshInterval

public long getRefreshInterval()
We return our minimum interval.

Specified by:
getRefreshInterval in interface DisplayChronology

canDeliver

public boolean canDeliver()
We can deliver if the modification time on the server is below the modification time of our latest retrieval.

Specified by:
canDeliver in interface DisplayChronology

getRepresentation

public Component getRepresentation()
We return the webcam image in a viewport canvas to allow zooming.

Specified by:
getRepresentation in interface Displayable

getRepresentationAt

public Component getRepresentationAt(Date now)
We get the representation at the desired date. Default action is to ignore the time stamp and retrieve the actual data from the webcam


getWebcamImage

protected BufferedImage getWebcamImage(URL download)
                                throws IOException
Returns the webcam image from the stated url. The default implementation pipes this to ImageIO

Throws:
IOException

getDownloadUrl

protected URL getDownloadUrl(Date ignored)
Returns the url we can download the image from.


getAuthentication

protected PasswordAuthentication getAuthentication()
Returns the password authentication or null.