Version: 1.1.1

org.biomoby.service.dashboard.renderers
Interface Renderer

All Known Implementing Classes:
AbstractMobyRenderer, AbstractRenderer, Base64Image, BoxCollectionRenderer, CollectionRenderer, ICISPedigreeTree, PlainMobyText, PlainText, TabCollectionRenderer, XMLTreeRenderer

public interface Renderer

SPI for rendering a data container.

Version:
$Id: Renderer.java,v 1.3 2006/02/19 18:42:56 senger Exp $
Author:
Martin Senger (based on work by Matthew Pocock for Taverna)

Field Summary
static String CLASS
           
static String CLASS_NAME
           
static String DATA
           
static String DATA_CONTAINER
           
static String MIME_TYPE
           
static String MOBY_TYPE
           
 
Method Summary
 boolean canHandle(String criterion, Object value)
          Return true if this SPI can handle (render) data whose type complies with given value within given criterion.
 JComponent getComponent(DataContainer data)
          Return a JComponent displaying (rendering) given data.
 Icon getIcon()
          An icon for this SPI.
 String getName()
          A human-readable name for this SPI.
 boolean save2File(DataContainer data, File file)
          Save given data in the given file.
 

Field Detail

CLASS_NAME

static final String CLASS_NAME
See Also:
Constant Field Values

CLASS

static final String CLASS
See Also:
Constant Field Values

DATA_CONTAINER

static final String DATA_CONTAINER
See Also:
Constant Field Values

DATA

static final String DATA
See Also:
Constant Field Values

MOBY_TYPE

static final String MOBY_TYPE
See Also:
Constant Field Values

MIME_TYPE

static final String MIME_TYPE
See Also:
Constant Field Values
Method Detail

canHandle

boolean canHandle(String criterion,
                  Object value)
Return true if this SPI can handle (render) data whose type complies with given value within given criterion.

Any renderer should handle also a collection of objects that it can handle - see examples in getComponent(org.biomoby.service.dashboard.data.DataContainer) and save2File(org.biomoby.service.dashboard.data.DataContainer, java.io.File).

Parameters:
criterion - is a category of the value, e.g. "MIME-TYPE"
value - is a value from the category criterion, e.g. "text/xml"

getComponent

JComponent getComponent(DataContainer data)
                        throws MobyException
Return a JComponent displaying (rendering) given data.

If it gets an array of data, it can always delegate their accumulation to the CollectionRenderer by saying:

   if (data.getData().getClass().isArray())
      return new BoxCollectionRenderer (this).getComponent (data);

Parameters:
data - to be rendered
Returns:
a component for displaying data, or null if there is a problem with data
Throws:
MobyException - if called with wrong type of data

save2File

boolean save2File(DataContainer data,
                  File file)
                  throws MobyException
Save given data in the given file. Only a renderer knows what kind of data should be savd.

If it gets an array of data, ad if it wants to save them separately, to more files, it can delegate it to the CollectionRenderer by saying:

   if (data.getData().getClass().isArray())
      return new TabCollectionRenderer (this).save2File (data, file);

Returns:
true on success, return false if you even did nt try to save data (probably because it does not make sense to store such data)
Throws:
MobyException - if saving was tried but failed

getName

String getName()
A human-readable name for this SPI. Will be used in a selection lists of available renderers.

Returns:
a shortish name of this viewer

getIcon

Icon getIcon()
An icon for this SPI. Will be used in a selection lists of available renderers.

Returns:
an icon, or null

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010