1 19 20 package org.efs.openreports.actions.admin; 21 22 import com.opensymphony.xwork.ActionSupport; 23 24 import org.apache.log4j.Logger; 25 26 import org.efs.openreports.objects.Report; 27 import org.efs.openreports.objects.ReportExportOption; 28 import org.efs.openreports.providers.ReportProvider; 29 import org.efs.openreports.providers.ReportProviderAware; 30 31 public class EditExportOptionsAction extends ActionSupport implements ReportProviderAware 32 { 33 protected static Logger log = 34 Logger.getLogger(EditExportOptionsAction.class); 35 36 private String command; 37 private String submitType; 38 39 private int id; 40 41 private boolean xlsRemoveEmptySpaceBetweenRows; 42 private boolean xlsOnePagePerSheet; 43 private boolean xlsAutoDetectCellType; 44 private boolean xlsWhitePageBackground; 45 46 private boolean htmlRemoveEmptySpaceBetweenRows; 47 private boolean htmlWhitePageBackground; 48 private boolean htmlUsingImagesToAlign; 49 private boolean htmlWrapBreakWord; 50 51 private Report report; 52 53 private ReportProvider reportProvider; 54 55 public String execute() 56 { 57 try 58 { 59 report = reportProvider.getReport(new Integer (id)); 60 ReportExportOption exportOption = report.getReportExportOption(); 61 62 if (command.equals("edit") && submitType == null) 63 { 64 id = report.getId().intValue(); 65 66 xlsRemoveEmptySpaceBetweenRows = exportOption.isXlsRemoveEmptySpaceBetweenRows(); 67 xlsOnePagePerSheet = exportOption.isXlsOnePagePerSheet(); 68 xlsAutoDetectCellType = exportOption.isXlsAutoDetectCellType(); 69 xlsWhitePageBackground = exportOption.isXlsWhitePageBackground(); 70 71 htmlRemoveEmptySpaceBetweenRows = exportOption.isHtmlRemoveEmptySpaceBetweenRows(); 72 htmlUsingImagesToAlign = exportOption.isHtmlUsingImagesToAlign(); 73 htmlWhitePageBackground = exportOption.isHtmlWhitePageBackground(); 74 htmlWrapBreakWord = exportOption.isHtmlWrapBreakWord(); 75 } 76 77 if (submitType == null) 78 return INPUT; 79 80 81 exportOption.setXlsOnePagePerSheet(xlsOnePagePerSheet); 82 exportOption.setXlsRemoveEmptySpaceBetweenRows(xlsRemoveEmptySpaceBetweenRows); 83 exportOption.setXlsAutoDetectCellType(xlsAutoDetectCellType); 84 exportOption.setXlsWhitePageBackground(xlsWhitePageBackground); 85 86 exportOption.setHtmlRemoveEmptySpaceBetweenRows(htmlRemoveEmptySpaceBetweenRows); 87 exportOption.setHtmlUsingImagesToAlign(htmlUsingImagesToAlign); 88 exportOption.setHtmlWhitePageBackground(htmlWhitePageBackground); 89 exportOption.setHtmlWrapBreakWord(htmlWrapBreakWord); 90 91 report.setReportExportOption(exportOption); 92 93 reportProvider.updateReport(report); 94 95 return SUCCESS; 96 } 97 catch (Exception e) 98 { 99 log.error(e.toString()); 100 addActionError(e.getMessage()); 101 return INPUT; 102 } 103 } 104 105 public String getCommand() 106 { 107 return command; 108 } 109 110 public void setCommand(String command) 111 { 112 this.command = command; 113 } 114 115 public String getSubmitType() 116 { 117 return submitType; 118 } 119 120 public void setSubmitType(String submitType) 121 { 122 this.submitType = submitType; 123 } 124 125 public int getId() 126 { 127 return id; 128 } 129 130 public void setId(int id) 131 { 132 this.id = id; 133 } 134 135 public void setReportProvider(ReportProvider reportProvider) 136 { 137 this.reportProvider = reportProvider; 138 } 139 140 public ReportProvider getReportProvider() 141 { 142 return reportProvider; 143 } 144 145 public Report getReport() 146 { 147 return report; 148 } 149 150 public void setReport(Report report) 151 { 152 this.report = report; 153 } 154 155 public boolean isHtmlRemoveEmptySpaceBetweenRows() 156 { 157 return htmlRemoveEmptySpaceBetweenRows; 158 } 159 160 public void setHtmlRemoveEmptySpaceBetweenRows(boolean htmlRemoveEmptySpaceBetweenRows) 161 { 162 this.htmlRemoveEmptySpaceBetweenRows = htmlRemoveEmptySpaceBetweenRows; 163 } 164 165 public boolean isHtmlUsingImagesToAlign() 166 { 167 return htmlUsingImagesToAlign; 168 } 169 170 public void setHtmlUsingImagesToAlign(boolean htmlUsingImagesToAlign) 171 { 172 this.htmlUsingImagesToAlign = htmlUsingImagesToAlign; 173 } 174 175 public boolean isHtmlWhitePageBackground() 176 { 177 return htmlWhitePageBackground; 178 } 179 180 public void setHtmlWhitePageBackground(boolean htmlWhitePageBackground) 181 { 182 this.htmlWhitePageBackground = htmlWhitePageBackground; 183 } 184 185 public boolean isHtmlWrapBreakWord() 186 { 187 return htmlWrapBreakWord; 188 } 189 190 public void setHtmlWrapBreakWord(boolean htmlWrapBreakWord) 191 { 192 this.htmlWrapBreakWord = htmlWrapBreakWord; 193 } 194 195 public boolean isXlsAutoDetectCellType() 196 { 197 return xlsAutoDetectCellType; 198 } 199 200 public void setXlsAutoDetectCellType(boolean xlsAutoDetectCellType) 201 { 202 this.xlsAutoDetectCellType = xlsAutoDetectCellType; 203 } 204 205 public boolean isXlsOnePagePerSheet() 206 { 207 return xlsOnePagePerSheet; 208 } 209 210 public void setXlsOnePagePerSheet(boolean xlsOnePagePerSheet) 211 { 212 this.xlsOnePagePerSheet = xlsOnePagePerSheet; 213 } 214 215 public boolean isXlsRemoveEmptySpaceBetweenRows() 216 { 217 return xlsRemoveEmptySpaceBetweenRows; 218 } 219 220 public void setXlsRemoveEmptySpaceBetweenRows(boolean xlsRemoveEmptySpaceBetweenRows) 221 { 222 this.xlsRemoveEmptySpaceBetweenRows = xlsRemoveEmptySpaceBetweenRows; 223 } 224 225 public boolean isXlsWhitePageBackground() 226 { 227 return xlsWhitePageBackground; 228 } 229 230 public void setXlsWhitePageBackground(boolean xlsWhitePageBackground) 231 { 232 this.xlsWhitePageBackground = xlsWhitePageBackground; 233 } 234 235 } | Popular Tags |