fedora.client.objecteditor
Class ContentViewer

java.lang.Object
  extended by fedora.client.objecteditor.ContentViewer
Direct Known Subclasses:
ContentEditor, ImageContentViewer, SVGContentViewer

public abstract class ContentViewer
extends java.lang.Object

Views content of certain types in a JComponent.


Constructor Summary
ContentViewer()
           
 
Method Summary
abstract  javax.swing.JComponent getComponent()
          Get the JComponent.
abstract  java.lang.String[] getTypes()
          Returns a list of content types that this component can handle.
abstract  void init(java.lang.String type, java.io.InputStream data, boolean viewOnly)
          Initializes the handler.
 boolean isEditor()
          Tells whether this component just does viewing or can do editing as well.
protected  ContentViewer newInstance(java.lang.String type, java.io.InputStream data, boolean viewOnly)
          Gets a new instance of this class, which has been constructed and immediately thereafter, init(...)'ed.
abstract  void setContent(java.io.InputStream data)
          Re-initializes the handler given new input data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentViewer

public ContentViewer()
Method Detail

isEditor

public boolean isEditor()
Tells whether this component just does viewing or can do editing as well. Implementers will simply subclass either ContentViewer or ContentEditor, and this method will automatically return the correct value.


getComponent

public abstract javax.swing.JComponent getComponent()
Get the JComponent.


newInstance

protected final ContentViewer newInstance(java.lang.String type,
                                          java.io.InputStream data,
                                          boolean viewOnly)
                                   throws java.io.IOException
Gets a new instance of this class, which has been constructed and immediately thereafter, init(...)'ed. Intended to be called by ContentHandlerFactory only.

Throws:
java.io.IOException

getTypes

public abstract java.lang.String[] getTypes()
Returns a list of content types that this component can handle. This will usually be a list of MIME Types, but may also include other notions of type known to be understood by the users of ContentHandlerFactory.


init

public abstract void init(java.lang.String type,
                          java.io.InputStream data,
                          boolean viewOnly)
                   throws java.io.IOException
Initializes the handler. This should only be called once per instance, and is guaranteed to have been called when this component is provided by the ContentHandlerFactory. The viewOnly parameter signals to ContentEditor implementations that editing capabilities are not desired by the caller.

Throws:
java.io.IOException

setContent

public abstract void setContent(java.io.InputStream data)
                         throws java.io.IOException
Re-initializes the handler given new input data. The old data can be discarded.

Throws:
java.io.IOException