refresh();
}
void export(final String exportFormat)
{
final GanttChart ganttChart = createGanttChart();
if (ganttChart == null) {
return;
}
ImageFormat imageFormat = null;
final String suffix;
if (GanttChartEditForm.EXPORT_JPG.equals(exportFormat) == true) {
suffix = ".jpg";
imageFormat = ImageFormat.JPEG;
} else if (GanttChartEditForm.EXPORT_MS_PROJECT_MPX.equals(exportFormat) == true) {
suffix = ".mpx";
} else if (GanttChartEditForm.EXPORT_MS_PROJECT_XML.equals(exportFormat) == true) {
suffix = ".xml";
} else if (GanttChartEditForm.EXPORT_PDF.equals(exportFormat) == true) {
suffix = ".pdf";
imageFormat = ImageFormat.PDF;
} else if (GanttChartEditForm.EXPORT_PNG.equals(exportFormat) == true) {
suffix = ".png";
imageFormat = ImageFormat.PNG;
} else if (GanttChartEditForm.EXPORT_PROJECTFORGE.equals(exportFormat) == true) {
suffix = ".xml";
} else if (GanttChartEditForm.EXPORT_SVG.equals(exportFormat) == true) {
suffix = ".svg";
imageFormat = ImageFormat.SVG;
} else {
log.error("Oups, exportFormat '" + exportFormat + "' not supported. Assuming png format.");
suffix = ".png";
imageFormat = ImageFormat.PNG;
}
final String filename = FileHelper.createSafeFilename(getData().getName(), suffix, 50, true);
final byte[] content;
if (imageFormat != null) {
final Document document = ganttChart.create();
content = BatikImageRenderer.getByteArray(document, ganttChart.getWidth(), imageFormat);
DownloadUtils.setDownloadTarget(content, filename);
} else {
final MimeType type;
if (GanttChartEditForm.EXPORT_MS_PROJECT_MPX.equals(exportFormat) == true) {
content = ExportMSProject.exportMpx(ganttChart);