|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.biomoby.service.dashboard.renderers.AbstractRenderer
public abstract class AbstractRenderer
Abstract rendering class.
Field Summary |
---|
Fields inherited from interface org.biomoby.service.dashboard.renderers.Renderer |
---|
CLASS, CLASS_NAME, DATA, DATA_CONTAINER, MIME_TYPE, MOBY_TYPE |
Constructor Summary | |
---|---|
AbstractRenderer(String name)
|
|
AbstractRenderer(String name,
Icon icon)
|
|
AbstractRenderer(String name,
String iconFileName)
|
Method Summary | |
---|---|
abstract boolean |
canHandle(String criterion,
Object value)
Return true if this SPI can handle (render) data whose type complies with given value within given criterion. |
abstract 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)
Default implementation. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractRenderer(String name)
public AbstractRenderer(String name, Icon icon)
public AbstractRenderer(String name, String iconFileName)
Method Detail |
---|
public Icon getIcon()
Renderer
getIcon
in interface Renderer
public final String getName()
Renderer
getName
in interface Renderer
public boolean save2File(DataContainer data, File file) throws MobyException
If it gets a byte array, it saves it in the given file.
If it gets any other array, it looks at its elements and - if
the elements are of type byte array, they all are stored
separately, to more files (this is done with the help of the
CollectionRenderer
). Other types of elements are
converted to strings by calling their toString() method, and
all of them are store in one file.
It 'data' do not contain an array, they are treated similarly as above: they are converted to string using its toString() method and put in a file.
save2File
in interface Renderer
MobyException
- if saving was tried but failedpublic abstract boolean canHandle(String criterion, Object value)
Renderer
Any renderer should handle also a collection of objects that it
can handle - see examples in Renderer.getComponent(org.biomoby.service.dashboard.data.DataContainer)
and Renderer.save2File(org.biomoby.service.dashboard.data.DataContainer, java.io.File)
.
canHandle
in interface Renderer
criterion
- is a category of the value, e.g. "MIME-TYPE"value
- is a value from the category criterion, e.g. "text/xml"public abstract JComponent getComponent(DataContainer data) throws MobyException
Renderer
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);
getComponent
in interface Renderer
data
- to be rendered
MobyException
- if called with wrong type of data
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |