|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.clients.web.plugins.PlainTextTemplate
public class PlainTextTemplate
A plain text template that exports data in tab-delimited format.
Field Summary | |
---|---|
private int |
colNum
|
private Writer |
exportStream
|
private List<ExportedProperty> |
properties
|
private static Pattern |
UNSAFE
|
Constructor Summary | |
---|---|
PlainTextTemplate(Writer exportStream,
List<ExportedProperty> properties,
Item itemType)
Create a new template. |
Method Summary | |
---|---|
void |
beginDocument()
Do nothing. |
void |
beginItem(int id)
Reset column number. |
void |
endDocument()
Do nothing. |
void |
endItem()
Write a newline. |
private String |
escape(String data)
Replace newlines and tabs with a space. |
String |
getMimeType()
Get the MIME type to assign to files generated by this template. |
void |
writeAnnotations(ExportedProperty ep,
List<?> values,
String unit)
Join the annotation values into a single string with a comma. |
void |
writeCollection(ExportedProperty ep,
Collection<?> values)
Writes a collection of values. |
void |
writeHeaders()
Write the headers on a single line. |
void |
writeProperty(ExportedProperty ep,
Object data)
Write the data object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Writer exportStream
private final List<ExportedProperty> properties
private int colNum
private static final Pattern UNSAFE
Constructor Detail |
---|
public PlainTextTemplate(Writer exportStream, List<ExportedProperty> properties, Item itemType)
exportStream
- The stream to write toproperties
- All exported propertiesitemType
- The type of items we are exportingMethod Detail |
---|
public String getMimeType()
ExportTemplate
getMimeType
in interface ExportTemplate
public void beginDocument() throws IOException
beginDocument
in interface ExportTemplate
IOException
- If there is an errorpublic void writeHeaders() throws IOException
writeHeaders
in interface ExportTemplate
IOException
- If there is an errorpublic void beginItem(int id) throws IOException
beginItem
in interface ExportTemplate
id
- Id of the new item.
IOException
- If there is an errorpublic void writeAnnotations(ExportedProperty ep, List<?> values, String unit) throws IOException
writeAnnotations
in interface ExportTemplate
ep
- Exported property the annotations belongs tovalues
- Annotation values to be written.unit
- The unit of the annotation values, or null
to not display write a unit
IOException
- If there is an errorpublic void writeProperty(ExportedProperty ep, Object data) throws IOException
writeProperty
in interface ExportTemplate
ep
- The exported property the data
belongs to.data
- Data to be written.
IOException
- If there is an errorpublic void writeCollection(ExportedProperty ep, Collection<?> values) throws IOException
writeCollection
in interface ExportTemplate
ep
- Exported property the values belong tovalues
- The values to be written
IOException
public void endItem() throws IOException
endItem
in interface ExportTemplate
IOException
- If there is an errorpublic void endDocument() throws IOException
endDocument
in interface ExportTemplate
IOException
- If there is an errorprivate String escape(String data)
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |