JHotDraw 6.0b1

org.jhotdraw.contrib.html
Class URLContentProducer

java.lang.Object
  extended by org.jhotdraw.contrib.html.AbstractContentProducer
      extended by org.jhotdraw.contrib.html.FigureDataContentProducer
          extended by org.jhotdraw.contrib.html.URLContentProducer
All Implemented Interfaces:
java.io.Serializable, ContentProducer, Storable

public class URLContentProducer
extends FigureDataContentProducer
implements java.io.Serializable

URLContentProducer produces string contents from URLs.
Anything the URL.openStream() method can get can be retrieved by this producer, that includes resources, local files, web documents, web queries, FTP files, and you name it.
It can either be specific if set for a specific URL, or generic, retrieving any URL passed to the getContents method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jhotdraw.contrib.html.ContentProducer
ENTITY_ARROW_MODE, ENTITY_FIGURE_HEIGHT, ENTITY_FIGURE_POSX, ENTITY_FIGURE_POSY, ENTITY_FIGURE_WIDTH, ENTITY_FILL_COLOR, ENTITY_FONT_NAME, ENTITY_FONT_SIZE, ENTITY_FONT_STYLE, ENTITY_FRAME_COLOR
 
Constructor Summary
URLContentProducer()
          Constructor for the URLContentProducer object
URLContentProducer(java.net.URL url)
          Constructor for the URLContentProducer object
 
Method Summary
 java.lang.Object getContent(ContentProducerContext context, java.lang.String ctxAttrName, java.lang.Object ctxAttrValue)
          Retrieves the contents of the URL pointed object
 java.net.URL getURL()
           
 void read(StorableInput dr)
          Writes the storable
protected  void setURL(java.net.URL newURL)
           
 void write(StorableOutput dw)
          Writes the storable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLContentProducer

public URLContentProducer()
Constructor for the URLContentProducer object


URLContentProducer

public URLContentProducer(java.net.URL url)
Constructor for the URLContentProducer object

Parameters:
url - the specific URL
Method Detail

getContent

public java.lang.Object getContent(ContentProducerContext context,
                                   java.lang.String ctxAttrName,
                                   java.lang.Object ctxAttrValue)
Retrieves the contents of the URL pointed object

Specified by:
getContent in interface ContentProducer
Overrides:
getContent in class FigureDataContentProducer
Parameters:
context - the calling client context
ctxAttrName - the attribute name that led to this being called
ctxAttrValue - the value of the URL attribute
Returns:
the contents of the URL pointed object as a string

write

public void write(StorableOutput dw)
Writes the storable

Specified by:
write in interface Storable
Overrides:
write in class FigureDataContentProducer
Parameters:
dw - the storable output

read

public void read(StorableInput dr)
          throws java.io.IOException
Writes the storable

Specified by:
read in interface Storable
Overrides:
read in class FigureDataContentProducer
Parameters:
dr - the storable input
Throws:
java.io.IOException - thrown by called methods

getURL

public java.net.URL getURL()

setURL

protected void setURL(java.net.URL newURL)

JHotDraw 6.0b1