|
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 org.biomoby.service.dashboard.renderers.AbstractMobyRenderer org.biomoby.service.dashboard.renderers.Base64Image
public class Base64Image
Decode a byte array from a Base64 encoded Biomoby data types, and convert the resulting byte array to an image.
It can handle several Biomoby data types containing encoded images,
but there is no automatic way (at least I do not know about any)
how to detect which Biomoby objects have images, and
where. Therefore, whenever a new Biomoby image data type appears,
somebody must change here canHandle(java.lang.String, java.lang.Object)
method. Note, however,
that you do not need to add anything here if a new Biomoby data
types just inherits from those that are already here - those will
be found.
Field Summary |
---|
Fields inherited from interface org.biomoby.service.dashboard.renderers.Renderer |
---|
CLASS, CLASS_NAME, DATA, DATA_CONTAINER, MIME_TYPE, MOBY_TYPE |
Constructor Summary | |
---|---|
Base64Image()
|
|
Base64Image(String name,
String iconName)
|
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. |
boolean |
save2File(DataContainer data,
File file)
Default implementation. |
Methods inherited from class org.biomoby.service.dashboard.renderers.AbstractRenderer |
---|
getIcon, getName |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Base64Image()
public Base64Image(String name, String iconName)
Method Detail |
---|
public 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
canHandle
in class AbstractRenderer
criterion
- is a category of the value, e.g. "MIME-TYPE"value
- is a value from the category criterion, e.g. "text/xml"public 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
getComponent
in class AbstractRenderer
data
- to be rendered
MobyException
- if called with wrong type of datapublic boolean save2File(DataContainer data, File file) throws MobyException
AbstractRenderer
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
save2File
in class AbstractRenderer
MobyException
- if saving was tried but failed
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |