|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.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 |
getDefaultFileExtension()
Get the default file extension to give to files generated by this template. |
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 exporting| Method Detail |
|---|
public String getMimeType()
ExportTemplate
getMimeType in interface ExportTemplatepublic String getDefaultFileExtension()
ExportTemplate
getDefaultFileExtension in interface ExportTemplate
public void beginDocument()
throws IOException
beginDocument in interface ExportTemplateIOException - If there is an error
public void writeHeaders()
throws IOException
writeHeaders in interface ExportTemplateIOException - If there is an error
public void beginItem(int id)
throws IOException
beginItem in interface ExportTemplateid - Id of the new item.
IOException - If there is an error
public void writeAnnotations(ExportedProperty ep,
List<?> values,
String unit)
throws IOException
writeAnnotations in interface ExportTemplateep - 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 error
public void writeProperty(ExportedProperty ep,
Object data)
throws IOException
writeProperty in interface ExportTemplateep - The exported property the data belongs to.data - Data to be written.
IOException - If there is an error
public void writeCollection(ExportedProperty ep,
Collection<?> values)
throws IOException
writeCollection in interface ExportTemplateep - Exported property the values belong tovalues - The values to be written
IOException
public void endItem()
throws IOException
endItem in interface ExportTemplateIOException - If there is an error
public void endDocument()
throws IOException
endDocument in interface ExportTemplateIOException - If there is an errorprivate String escape(String data)
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||