[seam-commits] Seam SVN: r13470 - in sandbox/modules/spreadsheet/src: main/java/org/jboss/seam/spreadsheet/jxl/writer and 2 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Jul 22 04:01:56 EDT 2010
Author: nickarls
Date: 2010-07-22 04:01:55 -0400 (Thu, 22 Jul 2010)
New Revision: 13470
Added:
sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/SettingsHelper.java
sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorkbookSettings.java
sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorksheetSettings.java
Modified:
sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/formatting/ConstantFactory.java
sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/JXLSpreadsheetWriter.java
sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/Worksheet.java
sandbox/modules/spreadsheet/src/test/java/org/jboss/seam/spreadsheet/jxl/format/ConstantFactoryTest.java
Log:
constant factory lazy loading
start of worksheet and workbook settings
Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/formatting/ConstantFactory.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/formatting/ConstantFactory.java 2010-07-22 06:59:54 UTC (rev 13469)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/formatting/ConstantFactory.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -11,6 +11,8 @@
import jxl.write.NumberFormats;
import org.jboss.seam.spreadsheet.SpreadsheetException;
+import org.jboss.seam.spreadsheet.model.WorksheetSettings.PageOrientation;
+import org.jboss.seam.spreadsheet.model.WorksheetSettings.PaperSize;
import org.jboss.seam.spreadsheet.model.formatting.Background.Pattern;
import org.jboss.seam.spreadsheet.model.formatting.Border;
import org.jboss.seam.spreadsheet.model.formatting.Border.BorderLineStyle;
@@ -36,23 +38,9 @@
private Map<Pattern, jxl.format.Pattern> patterns;
private Map<BorderType, jxl.format.Border> borders;
private Map<BorderLineStyle, jxl.format.BorderLineStyle> borderLineStyles;
+ private Map<PaperSize, jxl.format.PaperSize> paperSizes;
+ private Map<PageOrientation, jxl.format.PageOrientation> pageOrientations;
- public ConstantFactory()
- {
- colours = loadConstants(Colour.values(), jxl.format.Colour.class);
- scriptStyles = loadConstants(ScriptStyle.values(), jxl.format.ScriptStyle.class);
- underlineStyles = loadConstants(UnderlineStyle.values(), jxl.format.UnderlineStyle.class);
- numberFormats = loadConstants(DisplayFormat.class, NumberFormats.class);
- dateFormats = loadConstants(DisplayFormat.class, DateFormats.class);
- numberFormatShorthands = loadConstants(String.class, NumberFormat.class, new String[] { "COMPLEX_FORMAT" });
- orientations = loadConstants(Orientation.values(), jxl.format.Orientation.class);
- alignments = loadConstants(Alignment.values(), jxl.format.Alignment.class);
- verticalAlignments = loadConstants(VerticalAlignment.values(), jxl.format.VerticalAlignment.class);
- patterns = loadConstants(Pattern.values(), jxl.format.Pattern.class);
- borders = loadConstants(BorderType.values(), jxl.format.Border.class);
- borderLineStyles = loadConstants(BorderLineStyle.values(), jxl.format.BorderLineStyle.class);
- }
-
@SuppressWarnings("unchecked")
public <V> Map<String, V> loadConstants(Class<V> valueClass, Class<?> sourceClass, String[] ignoreFields)
{
@@ -82,6 +70,10 @@
public jxl.format.Colour getColour(Colour colour)
{
+ if (colours == null)
+ {
+ colours = loadConstants(Colour.values(), jxl.format.Colour.class);
+ }
checkConstantPresent(colours, colour, "Color");
return colours.get(colour);
}
@@ -96,12 +88,20 @@
public jxl.format.ScriptStyle getScriptStyle(ScriptStyle scriptStyle)
{
+ if (scriptStyles == null)
+ {
+ scriptStyles = loadConstants(ScriptStyle.values(), jxl.format.ScriptStyle.class);
+ }
checkConstantPresent(scriptStyles, scriptStyle, "Script style");
return scriptStyles.get(scriptStyle);
}
public jxl.format.UnderlineStyle getUnderlineStyle(UnderlineStyle underlineStyle)
{
+ if (underlineStyles == null)
+ {
+ underlineStyles = loadConstants(UnderlineStyle.values(), jxl.format.UnderlineStyle.class);
+ }
checkConstantPresent(underlineStyles, underlineStyle, "Underline style");
return underlineStyles.get(underlineStyle);
}
@@ -112,7 +112,7 @@
Map<K, V> constants = new HashMap<K, V>();
for (K key : keys)
{
- String fieldName = key.toString().toUpperCase();
+ String fieldName = key.toString();
try
{
V constant = (V) sourceClass.getField(fieldName).get(null);
@@ -133,47 +133,109 @@
public DisplayFormat getNumberFormat(String mask)
{
+ if (numberFormats == null)
+ {
+ numberFormats = loadConstants(DisplayFormat.class, NumberFormats.class);
+ }
return numberFormats.get(mask);
}
public DisplayFormat getDateFormat(String mask)
{
+ if (dateFormats == null)
+ {
+ dateFormats = loadConstants(DisplayFormat.class, DateFormats.class);
+ }
return dateFormats.get(mask);
}
public String getNumberFormatShorthand(String mask)
{
+ if (numberFormatShorthands == null)
+ {
+ numberFormatShorthands = loadConstants(String.class, NumberFormat.class, new String[] { "COMPLEX_FORMAT" });
+ }
return numberFormatShorthands.get(mask);
}
public jxl.format.Alignment getAlignment(Alignment alignment)
{
+ if (alignments == null)
+ {
+ alignments = loadConstants(Alignment.values(), jxl.format.Alignment.class);
+ }
+ checkConstantPresent(alignments, alignment, "Alignment");
return alignments.get(alignment);
}
public jxl.format.Orientation getOrientation(Orientation orientation)
{
+ if (orientations == null)
+ {
+ orientations = loadConstants(Orientation.values(), jxl.format.Orientation.class);
+ }
+ checkConstantPresent(orientations, orientation, "Orientation");
return orientations.get(orientation);
}
public jxl.format.VerticalAlignment getVerticalAlignment(VerticalAlignment verticalAlignment)
{
+ if (verticalAlignments == null)
+ {
+ verticalAlignments = loadConstants(VerticalAlignment.values(), jxl.format.VerticalAlignment.class);
+ }
+ checkConstantPresent(verticalAlignments, verticalAlignment, "Vertical alignment");
return verticalAlignments.get(verticalAlignment);
}
public jxl.format.Pattern getPattern(Pattern pattern)
{
+ if (patterns == null)
+ {
+ patterns = loadConstants(Pattern.values(), jxl.format.Pattern.class);
+ }
+ checkConstantPresent(patterns, pattern, "Pattern");
return patterns.get(pattern);
}
public jxl.format.Border getBorder(BorderType borderType)
{
+ if (borders == null)
+ {
+ borders = loadConstants(BorderType.values(), jxl.format.Border.class);
+ }
+ checkConstantPresent(borders, borderType, "Border");
return borders.get(borderType);
}
public jxl.format.BorderLineStyle getBorderLineStyle(Border.BorderLineStyle lineStyle)
{
+ if (borderLineStyles == null)
+ {
+ borderLineStyles = loadConstants(BorderLineStyle.values(), jxl.format.BorderLineStyle.class);
+ }
+ checkConstantPresent(borderLineStyles, lineStyle, "Border line style");
return borderLineStyles.get(lineStyle);
}
+ public jxl.format.PaperSize getPaperSize(PaperSize paperSize)
+ {
+ if (paperSizes == null)
+ {
+ paperSizes = loadConstants(PaperSize.values(), jxl.format.PaperSize.class);
+ }
+ checkConstantPresent(paperSizes, paperSize, "Paper size");
+ return paperSizes.get(paperSize);
+ }
+
+ public jxl.format.PageOrientation getPageOrientation(PageOrientation orientation)
+ {
+ if (pageOrientations == null)
+ {
+ pageOrientations = loadConstants(PageOrientation.values(), jxl.format.PageOrientation.class);
+ }
+ checkConstantPresent(pageOrientations, orientation, "Page orientation");
+ return pageOrientations.get(orientation);
+ }
+
}
Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/JXLSpreadsheetWriter.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/JXLSpreadsheetWriter.java 2010-07-22 06:59:54 UTC (rev 13469)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/JXLSpreadsheetWriter.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -30,6 +30,8 @@
private CellFormatResolver cellFormatResolver;
private WritableWorkbook jxlWorkbook;
+ private SettingsHelper settingsHelper = new SettingsHelper();
+
@Inject
private Events events;
@@ -74,6 +76,10 @@
cellFormatResolver.setWorksheetRules(worksheet.getCellFormatRules());
events.worksheetCreated(worksheet);
WritableSheet jxlWorksheet = jxlWorkbook.createSheet(worksheet.getName(), jxlWorkbook.getNumberOfSheets());
+ if (worksheet.getSettings() != null)
+ {
+ settingsHelper.applyWorksheetSettings(jxlWorksheet, worksheet.getSettings());
+ }
for (Cell cell : worksheet.getCells())
{
processCell(worksheet, jxlWorksheet, cell);
Added: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/SettingsHelper.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/SettingsHelper.java (rev 0)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/jxl/writer/SettingsHelper.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -0,0 +1,282 @@
+package org.jboss.seam.spreadsheet.jxl.writer;
+
+import java.io.File;
+import java.util.Locale;
+
+import jxl.SheetSettings;
+import jxl.write.WritableSheet;
+
+import org.jboss.seam.spreadsheet.jxl.formatting.ConstantFactory;
+import org.jboss.seam.spreadsheet.model.WorkbookSettings;
+import org.jboss.seam.spreadsheet.model.WorksheetSettings;
+
+public class SettingsHelper
+{
+ private ConstantFactory constantFactory = new ConstantFactory();
+
+ public jxl.WorkbookSettings createWorkbookSettings(WorkbookSettings settings)
+ {
+ jxl.WorkbookSettings workbookSettings = new jxl.WorkbookSettings();
+ if (settings.getArrayGrowSize() != null)
+ {
+ workbookSettings.setArrayGrowSize(settings.getArrayGrowSize());
+ }
+ if (settings.getAutoFilterDisabled() != null)
+ {
+ workbookSettings.setAutoFilterDisabled(settings.getAutoFilterDisabled());
+ }
+ if (settings.getAutoFilterDisabled() != null)
+ {
+ workbookSettings.setCellValidationDisabled(settings.getAutoFilterDisabled());
+ }
+ if (settings.getCharacterSet() != null)
+ {
+ workbookSettings.setCharacterSet(settings.getCharacterSet());
+ }
+ if (settings.getDrawingsDisabled() != null)
+ {
+ workbookSettings.setDrawingsDisabled(settings.getDrawingsDisabled());
+ }
+ if (settings.getEncoding() != null)
+ {
+ workbookSettings.setEncoding(settings.getEncoding());
+ }
+ if (settings.getExcelDisplayLanguage() != null)
+ {
+ workbookSettings.setExcelDisplayLanguage(settings.getExcelDisplayLanguage());
+ }
+ if (settings.getExcelRegionalSettings() != null)
+ {
+ workbookSettings.setExcelRegionalSettings(settings.getExcelRegionalSettings());
+ }
+ if (settings.getFormulaAdjust() != null)
+ {
+ workbookSettings.setFormulaAdjust(settings.getFormulaAdjust());
+ }
+ if (settings.getGcDisabled() != null)
+ {
+ workbookSettings.setGCDisabled(settings.getGcDisabled());
+ }
+ if (settings.getIgnoreBlanks() != null)
+ {
+ workbookSettings.setIgnoreBlanks(settings.getIgnoreBlanks());
+ }
+ if (settings.getLocale() != null)
+ {
+ workbookSettings.setLocale(new Locale(settings.getLocale()));
+ }
+ if (settings.getMergedCellCheckingDisabled() != null)
+ {
+ workbookSettings.setMergedCellChecking(settings.getMergedCellCheckingDisabled());
+ }
+ if (settings.getNamesDisabled() != null)
+ {
+ workbookSettings.setNamesDisabled(settings.getNamesDisabled());
+ }
+ if (settings.getPropertySets() != null)
+ {
+ workbookSettings.setPropertySets(settings.getPropertySets());
+ }
+ if (settings.getRationalization() != null)
+ {
+ workbookSettings.setRationalization(settings.getRationalization());
+ }
+ if (settings.getSupressWarnings() != null)
+ {
+ workbookSettings.setSuppressWarnings(settings.getSupressWarnings());
+ }
+ if (settings.getTemporaryFileDuringWriteDirectory() != null)
+ {
+ workbookSettings.setTemporaryFileDuringWriteDirectory(new File(settings.getTemporaryFileDuringWriteDirectory()));
+ }
+ if (settings.getUseTemporaryFileDuringWrite() != null)
+ {
+ workbookSettings.setUseTemporaryFileDuringWrite(settings.getUseTemporaryFileDuringWrite());
+ }
+ return workbookSettings;
+ }
+
+ public void applyWorksheetSettings(WritableSheet worksheet, WorksheetSettings settings)
+ {
+ SheetSettings sheetSettings = worksheet.getSettings();
+ if (settings.getAutomaticFormulaCalculation() != null)
+ {
+ sheetSettings.setAutomaticFormulaCalculation(settings.getAutomaticFormulaCalculation());
+ }
+ if (settings.getBottomMargin() != null)
+ {
+ sheetSettings.setBottomMargin(settings.getBottomMargin());
+ }
+ if (settings.getCopies() != null)
+ {
+ sheetSettings.setCopies(settings.getCopies());
+ }
+ if (settings.getDefaultColumnWidth() != null)
+ {
+ sheetSettings.setDefaultColumnWidth(settings.getDefaultColumnWidth());
+ }
+ if (settings.getDefaultRowHeight() != null)
+ {
+ sheetSettings.setDefaultRowHeight(settings.getDefaultRowHeight());
+ }
+ if (settings.getDisplayZeroValues() != null)
+ {
+ sheetSettings.setDisplayZeroValues(settings.getDisplayZeroValues());
+ }
+ if (settings.getFitHeight() != null)
+ {
+ sheetSettings.setFitHeight(settings.getFitHeight());
+ }
+ if (settings.getFitToPages() != null)
+ {
+ sheetSettings.setFitToPages(settings.getFitToPages());
+ }
+ if (settings.getFitWidth() != null)
+ {
+ sheetSettings.setFitWidth(settings.getFitWidth());
+ }
+ if (settings.getFooterMargin() != null)
+ {
+ sheetSettings.setFooterMargin(settings.getFooterMargin());
+ }
+ if (settings.getHeaderMargin() != null)
+ {
+ sheetSettings.setHeaderMargin(settings.getHeaderMargin());
+ }
+ if (settings.getHidden() != null)
+ {
+ sheetSettings.setHidden(settings.getHidden());
+ }
+ if (settings.getHorizontalCentre() != null)
+ {
+ sheetSettings.setHorizontalCentre(settings.getHorizontalCentre());
+ }
+ if (settings.getHorizontalFreeze() != null)
+ {
+ sheetSettings.setHorizontalFreeze(settings.getHorizontalFreeze());
+ }
+ if (settings.getHorizontalPrintResolution() != null)
+ {
+ sheetSettings.setHorizontalPrintResolution(settings.getHorizontalPrintResolution());
+ }
+ if (settings.getLeftMargin() != null)
+ {
+ sheetSettings.setLeftMargin(settings.getLeftMargin());
+ }
+ if (settings.getNormalMagnification() != null)
+ {
+ sheetSettings.setNormalMagnification(settings.getNormalMagnification());
+ }
+ if (settings.getOrientation() != null)
+ {
+ sheetSettings.setOrientation(constantFactory.getPageOrientation(settings.getOrientation()));
+ }
+ if (settings.getPageBreakPreviewMagnification() != null)
+ {
+ sheetSettings.setPageBreakPreviewMagnification(settings.getPageBreakPreviewMagnification());
+ }
+ if (settings.getPageBreakPreviewMode() != null)
+ {
+ sheetSettings.setPageBreakPreviewMode(settings.getPageBreakPreviewMode());
+ }
+ if (settings.getPageStart() != null)
+ {
+ sheetSettings.setPageStart(settings.getPageStart());
+ }
+ if (settings.getPaperSize() != null)
+ {
+ sheetSettings.setPaperSize(constantFactory.getPaperSize(settings.getPaperSize()));
+ }
+ if (settings.getPassword() != null)
+ {
+ sheetSettings.setPassword(settings.getPassword());
+ }
+ if (settings.getPasswordHash() != null)
+ {
+ sheetSettings.setPasswordHash(settings.getPasswordHash());
+ }
+ if (settings.getPrintGridLines() != null)
+ {
+ sheetSettings.setPrintGridLines(settings.getPrintGridLines());
+ }
+ if (settings.getPrintHeaders() != null)
+ {
+ sheetSettings.setPrintHeaders(settings.getPrintHeaders());
+ }
+ if (settings.getSheetProtected() != null)
+ {
+ sheetSettings.setProtected(settings.getSheetProtected());
+ }
+ if (settings.getRecalculateFormulasBeforeSave() != null)
+ {
+ sheetSettings.setRecalculateFormulasBeforeSave(settings.getRecalculateFormulasBeforeSave());
+ }
+ if (settings.getRightMargin() != null)
+ {
+ sheetSettings.setRightMargin(settings.getRightMargin());
+ }
+ if (settings.getScaleFactor() != null)
+ {
+ sheetSettings.setScaleFactor(settings.getScaleFactor());
+ }
+ if (settings.getSelected() != null)
+ {
+ sheetSettings.setSelected(settings.getSelected());
+ }
+ if (settings.getShowGridLines() != null)
+ {
+ sheetSettings.setShowGridLines(settings.getShowGridLines());
+ }
+ if (settings.getTopMargin() != null)
+ {
+ sheetSettings.setTopMargin(settings.getTopMargin());
+ }
+ if (settings.getVerticalCentre() != null)
+ {
+ sheetSettings.setVerticalCentre(settings.getVerticalCentre());
+ }
+ if (settings.getVerticalFreeze() != null)
+ {
+ sheetSettings.setVerticalFreeze(settings.getVerticalFreeze());
+ }
+ if (settings.getVerticalPrintResolution() != null)
+ {
+ sheetSettings.setVerticalPrintResolution(settings.getVerticalPrintResolution());
+ }
+ if (settings.getZoomFactor() != null)
+ {
+ sheetSettings.setZoomFactor(settings.getZoomFactor());
+ }
+ // Iterates through the worksheet uiWorksheet child elements (print areas,
+ // print titles and headers/footers)
+ // for (UIComponent child : uiWorksheet.getChildren())
+ // {
+ // if (child.getClass() == UIPrintArea.class)
+ // {
+ // UIPrintArea printArea = (UIPrintArea) child;
+ // settings.setPrintArea(printArea.getFirstColumn(),
+ // printArea.getFirstRow(), printArea.getLastColumn(),
+ // printArea.getLastRow());
+ // }
+ // else if (child.getClass() == UIPrintTitles.class)
+ // {
+ // UIPrintTitles printTitles = (UIPrintTitles) child;
+ // settings.setPrintTitles(printTitles.getFirstCol(),
+ // printTitles.getFirstRow(), printTitles.getLastCol(),
+ // printTitles.getLastRow());
+ // }
+ // else if (child.getClass() == UIHeader.class)
+ // {
+ // UIHeader uiHeader = (UIHeader) child;
+ // settings.setHeader(JXLFactory.createHeaderFooter(uiHeader,
+ // settings.getHeader()));
+ // }
+ // else if (child.getClass() == UIFooter.class)
+ // {
+ // UIFooter uiFooter = (UIFooter) child;
+ // settings.setFooter(JXLFactory.createHeaderFooter(uiFooter,
+ // settings.getFooter()));
+ // }
+ // }
+ }
+}
Added: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorkbookSettings.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorkbookSettings.java (rev 0)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorkbookSettings.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -0,0 +1,236 @@
+package org.jboss.seam.spreadsheet.model;
+
+public class WorkbookSettings
+{
+ private Integer arrayGrowSize;
+ private Boolean autoFilterDisabled;
+ private Boolean cellValidationDisabled;
+ private Integer characterSet;
+ private Boolean drawingsDisabled;
+ private String encoding;
+ private String excelDisplayLanguage;
+ private String excelRegionalSettings;
+ private Boolean formulaAdjust;
+ private Boolean gcDisabled;
+ private Boolean ignoreBlanks;
+ private Integer initialFileSize;
+ private String locale;
+ private Boolean mergedCellCheckingDisabled;
+ private Boolean namesDisabled;
+ private Boolean propertySets;
+ private Boolean rationalization;
+ private Boolean supressWarnings;
+ private String temporaryFileDuringWriteDirectory;
+ private Boolean useTemporaryFileDuringWrite;
+ private Boolean workbookProtected;
+
+ public Integer getArrayGrowSize()
+ {
+ return arrayGrowSize;
+ }
+
+ public void setArrayGrowSize(Integer arrayGrowSize)
+ {
+ this.arrayGrowSize = arrayGrowSize;
+ }
+
+ public Boolean getAutoFilterDisabled()
+ {
+ return autoFilterDisabled;
+ }
+
+ public void setAutoFilterDisabled(Boolean autoFilterDisabled)
+ {
+ this.autoFilterDisabled = autoFilterDisabled;
+ }
+
+ public Boolean getCellValidationDisabled()
+ {
+ return cellValidationDisabled;
+ }
+
+ public void setCellValidationDisabled(Boolean cellValidationDisabled)
+ {
+ this.cellValidationDisabled = cellValidationDisabled;
+ }
+
+ public Integer getCharacterSet()
+ {
+ return characterSet;
+ }
+
+ public void setCharacterSet(Integer characterSet)
+ {
+ this.characterSet = characterSet;
+ }
+
+ public Boolean getDrawingsDisabled()
+ {
+ return drawingsDisabled;
+ }
+
+ public void setDrawingsDisabled(Boolean drawingsDisabled)
+ {
+ this.drawingsDisabled = drawingsDisabled;
+ }
+
+ public String getEncoding()
+ {
+ return encoding;
+ }
+
+ public void setEncoding(String encoding)
+ {
+ this.encoding = encoding;
+ }
+
+ public String getExcelDisplayLanguage()
+ {
+ return excelDisplayLanguage;
+ }
+
+ public void setExcelDisplayLanguage(String excelDisplayLanguage)
+ {
+ this.excelDisplayLanguage = excelDisplayLanguage;
+ }
+
+ public String getExcelRegionalSettings()
+ {
+ return excelRegionalSettings;
+ }
+
+ public void setExcelRegionalSettings(String excelRegionalSettings)
+ {
+ this.excelRegionalSettings = excelRegionalSettings;
+ }
+
+ public Boolean getFormulaAdjust()
+ {
+ return formulaAdjust;
+ }
+
+ public void setFormulaAdjust(Boolean formulaAdjust)
+ {
+ this.formulaAdjust = formulaAdjust;
+ }
+
+ public Boolean getGcDisabled()
+ {
+ return gcDisabled;
+ }
+
+ public void setGcDisabled(Boolean gcDisabled)
+ {
+ this.gcDisabled = gcDisabled;
+ }
+
+ public Boolean getIgnoreBlanks()
+ {
+ return ignoreBlanks;
+ }
+
+ public void setIgnoreBlanks(Boolean ignoreBlanks)
+ {
+ this.ignoreBlanks = ignoreBlanks;
+ }
+
+ public Integer getInitialFileSize()
+ {
+ return initialFileSize;
+ }
+
+ public void setInitialFileSize(Integer initialFileSize)
+ {
+ this.initialFileSize = initialFileSize;
+ }
+
+ public String getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(String locale)
+ {
+ this.locale = locale;
+ }
+
+ public Boolean getMergedCellCheckingDisabled()
+ {
+ return mergedCellCheckingDisabled;
+ }
+
+ public void setMergedCellCheckingDisabled(Boolean mergedCellCheckingDisabled)
+ {
+ this.mergedCellCheckingDisabled = mergedCellCheckingDisabled;
+ }
+
+ public Boolean getNamesDisabled()
+ {
+ return namesDisabled;
+ }
+
+ public void setNamesDisabled(Boolean namesDisabled)
+ {
+ this.namesDisabled = namesDisabled;
+ }
+
+ public Boolean getPropertySets()
+ {
+ return propertySets;
+ }
+
+ public void setPropertySets(Boolean propertySets)
+ {
+ this.propertySets = propertySets;
+ }
+
+ public Boolean getRationalization()
+ {
+ return rationalization;
+ }
+
+ public void setRationalization(Boolean rationalization)
+ {
+ this.rationalization = rationalization;
+ }
+
+ public Boolean getSupressWarnings()
+ {
+ return supressWarnings;
+ }
+
+ public void setSupressWarnings(Boolean supressWarnings)
+ {
+ this.supressWarnings = supressWarnings;
+ }
+
+ public String getTemporaryFileDuringWriteDirectory()
+ {
+ return temporaryFileDuringWriteDirectory;
+ }
+
+ public void setTemporaryFileDuringWriteDirectory(String temporaryFileDuringWriteDirectory)
+ {
+ this.temporaryFileDuringWriteDirectory = temporaryFileDuringWriteDirectory;
+ }
+
+ public Boolean getUseTemporaryFileDuringWrite()
+ {
+ return useTemporaryFileDuringWrite;
+ }
+
+ public void setUseTemporaryFileDuringWrite(Boolean useTemporaryFileDuringWrite)
+ {
+ this.useTemporaryFileDuringWrite = useTemporaryFileDuringWrite;
+ }
+
+ public Boolean getWorkbookProtected()
+ {
+ return workbookProtected;
+ }
+
+ public void setWorkbookProtected(Boolean workbookProtected)
+ {
+ this.workbookProtected = workbookProtected;
+ }
+}
Modified: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/Worksheet.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/Worksheet.java 2010-07-22 06:59:54 UTC (rev 13469)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/Worksheet.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -12,6 +12,7 @@
private List<Cell> cells = new ArrayList<Cell>();
private List<CellFormatRule> cellFormatRules = new ArrayList<CellFormatRule>();
private List<Command> commands = new ArrayList<Command>();
+ private WorksheetSettings settings = null;
protected Worksheet(String name)
{
@@ -68,4 +69,14 @@
{
return String.format("Worksheet %s", name);
}
+
+ public WorksheetSettings getSettings()
+ {
+ return settings;
+ }
+
+ public void setSettings(WorksheetSettings settings)
+ {
+ this.settings = settings;
+ }
}
Added: sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorksheetSettings.java
===================================================================
--- sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorksheetSettings.java (rev 0)
+++ sandbox/modules/spreadsheet/src/main/java/org/jboss/seam/spreadsheet/model/WorksheetSettings.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -0,0 +1,422 @@
+package org.jboss.seam.spreadsheet.model;
+
+public class WorksheetSettings
+{
+ public enum PaperSize
+ {
+ A2, A3, A3_EXTRA, A3_EXTRA_TRANSVERSE, A3_ROTATED, A3_TRANSVERSE, A4, A4_EXTRA, A4_PLUS, A4_ROTATED, A4_SMALL, A4_TRANSVERSE, A5, A5_EXTRA, A5_ROTATED, A5_TRANSVERSE, A6, A6_ROTATED, B4, B4_ISO, B4_ISO_2, B4_ROTATED, B5, B5_EXTRA, B5_ISO, B5_ROTATED, B5_TRANSVERSE, B6, B6_ISO, B6_ROTATED, C, D, DOUBLE_JAPANESE_POSTCARD, DOUBLE_JAPANESE_POSTCARD_ROTATED, E, ENVELOPE_10, ENVELOPE_11, ENVELOPE_12, ENVELOPE_14, ENVELOPE_6_75, ENVELOPE_9, ENVELOPE_C3, ENVELOPE_C4, ENVELOPE_C5, ENVELOPE_C6, ENVELOPE_C6_C5, ENVELOPE_DL, ENVELOPE_INVITE, ENVELOPE_ITALY, ENVELOPE_MONARCH, EXECUTIVE, FOLIO, GERMAN_FANFOLD, GERMAN_LEGAL_FANFOLD, JAPANESE_POSTCARD, JAPANESE_POSTCARD_ROTATED, LEDGER, LEGAL, LEGAL_EXTRA, LETTER, LETTER_EXTRA, LETTER_EXTRA_TRANSVERSE, LETTER_PLUS, LETTER_ROTATED, LETTER_SMALL, LETTER_TRANSVERSE, NOTE, QUARTO, SIZE_10x11, SIZE_10x14, SIZE_10x17, SIZE_15x11, SIZE_9x11, STATEMENT, SUPER_A_A4, SUPER_B_A3, TABLOID, TABLOID_EXTRA, UNDEFINED, US_FANFOLD
+ }
+
+ public enum PageOrientation
+ {
+ LANDSCAPE, PORTRAIT
+ }
+
+ private Boolean automaticFormulaCalculation;
+ private Double bottomMargin;
+ private Integer copies;
+ private Integer defaultColumnWidth;
+ private Integer defaultRowHeight;
+ private Boolean displayZeroValues;
+ private Integer fitHeight;
+ private Boolean fitToPages;
+ private Integer fitWidth;
+ private Double footerMargin;
+ private Double headerMargin;
+ private Boolean hidden;
+ private Boolean horizontalCentre;
+ private Integer horizontalFreeze;
+ private Integer horizontalPrintResolution;
+ private Double leftMargin;
+ private Integer normalMagnification;
+ private PageOrientation orientation;
+ private Integer pageBreakPreviewMagnification;
+ private Boolean pageBreakPreviewMode;
+ private Integer pageStart;
+ private PaperSize paperSize;
+ private String password;
+ private Integer passwordHash;
+ private Boolean printGridLines;
+ private Boolean printHeaders;
+ private Boolean sheetProtected;
+ private Boolean recalculateFormulasBeforeSave;
+ private Double rightMargin;
+ private Integer scaleFactor;
+ private Boolean selected;
+ private Boolean showGridLines;
+ private Double topMargin;
+ private Boolean verticalCentre;
+ private Integer verticalFreeze;
+ private Integer verticalPrintResolution;
+ private Integer zoomFactor;
+
+ public Boolean getAutomaticFormulaCalculation()
+ {
+ return automaticFormulaCalculation;
+ }
+
+ public void setAutomaticFormulaCalculation(Boolean automaticFormulaCalculation)
+ {
+ this.automaticFormulaCalculation = automaticFormulaCalculation;
+ }
+
+ public Double getBottomMargin()
+ {
+ return bottomMargin;
+ }
+
+ public void setBottomMargin(Double bottomMargin)
+ {
+ this.bottomMargin = bottomMargin;
+ }
+
+ public Integer getCopies()
+ {
+ return copies;
+ }
+
+ public void setCopies(Integer copies)
+ {
+ this.copies = copies;
+ }
+
+ public Integer getDefaultColumnWidth()
+ {
+ return defaultColumnWidth;
+ }
+
+ public void setDefaultColumnWidth(Integer defaultColumnWidth)
+ {
+ this.defaultColumnWidth = defaultColumnWidth;
+ }
+
+ public Integer getDefaultRowHeight()
+ {
+ return defaultRowHeight;
+ }
+
+ public void setDefaultRowHeight(Integer defaultRowHeight)
+ {
+ this.defaultRowHeight = defaultRowHeight;
+ }
+
+ public Boolean getDisplayZeroValues()
+ {
+ return displayZeroValues;
+ }
+
+ public void setDisplayZeroValues(Boolean displayZeroValues)
+ {
+ this.displayZeroValues = displayZeroValues;
+ }
+
+ public Integer getFitHeight()
+ {
+ return fitHeight;
+ }
+
+ public void setFitHeight(Integer fitHeight)
+ {
+ this.fitHeight = fitHeight;
+ }
+
+ public Boolean getFitToPages()
+ {
+ return fitToPages;
+ }
+
+ public void setFitToPages(Boolean fitToPages)
+ {
+ this.fitToPages = fitToPages;
+ }
+
+ public Integer getFitWidth()
+ {
+ return fitWidth;
+ }
+
+ public void setFitWidth(Integer fitWidth)
+ {
+ this.fitWidth = fitWidth;
+ }
+
+ public Double getFooterMargin()
+ {
+ return footerMargin;
+ }
+
+ public void setFooterMargin(Double footerMargin)
+ {
+ this.footerMargin = footerMargin;
+ }
+
+ public Double getHeaderMargin()
+ {
+ return headerMargin;
+ }
+
+ public void setHeaderMargin(Double headerMargin)
+ {
+ this.headerMargin = headerMargin;
+ }
+
+ public Boolean getHidden()
+ {
+ return hidden;
+ }
+
+ public void setHidden(Boolean hidden)
+ {
+ this.hidden = hidden;
+ }
+
+ public Boolean getHorizontalCentre()
+ {
+ return horizontalCentre;
+ }
+
+ public void setHorizontalCentre(Boolean horizontalCentre)
+ {
+ this.horizontalCentre = horizontalCentre;
+ }
+
+ public Integer getHorizontalFreeze()
+ {
+ return horizontalFreeze;
+ }
+
+ public void setHorizontalFreeze(Integer horizontalFreeze)
+ {
+ this.horizontalFreeze = horizontalFreeze;
+ }
+
+ public Integer getHorizontalPrintResolution()
+ {
+ return horizontalPrintResolution;
+ }
+
+ public void setHorizontalPrintResolution(Integer horizontalPrintResolution)
+ {
+ this.horizontalPrintResolution = horizontalPrintResolution;
+ }
+
+ public Double getLeftMargin()
+ {
+ return leftMargin;
+ }
+
+ public void setLeftMargin(Double leftMargin)
+ {
+ this.leftMargin = leftMargin;
+ }
+
+ public Integer getNormalMagnification()
+ {
+ return normalMagnification;
+ }
+
+ public void setNormalMagnification(Integer normalMagnification)
+ {
+ this.normalMagnification = normalMagnification;
+ }
+
+ public PageOrientation getOrientation()
+ {
+ return orientation;
+ }
+
+ public void setOrientation(PageOrientation orientation)
+ {
+ this.orientation = orientation;
+ }
+
+ public Integer getPageBreakPreviewMagnification()
+ {
+ return pageBreakPreviewMagnification;
+ }
+
+ public void setPageBreakPreviewMagnification(Integer pageBreakPreviewMagnification)
+ {
+ this.pageBreakPreviewMagnification = pageBreakPreviewMagnification;
+ }
+
+ public Boolean getPageBreakPreviewMode()
+ {
+ return pageBreakPreviewMode;
+ }
+
+ public void setPageBreakPreviewMode(Boolean pageBreakPreviewMode)
+ {
+ this.pageBreakPreviewMode = pageBreakPreviewMode;
+ }
+
+ public Integer getPageStart()
+ {
+ return pageStart;
+ }
+
+ public void setPageStart(Integer pageStart)
+ {
+ this.pageStart = pageStart;
+ }
+
+ public PaperSize getPaperSize()
+ {
+ return paperSize;
+ }
+
+ public void setPaperSize(PaperSize paperSize)
+ {
+ this.paperSize = paperSize;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public Integer getPasswordHash()
+ {
+ return passwordHash;
+ }
+
+ public void setPasswordHash(Integer passwordHash)
+ {
+ this.passwordHash = passwordHash;
+ }
+
+ public Boolean getPrintGridLines()
+ {
+ return printGridLines;
+ }
+
+ public void setPrintGridLines(Boolean printGridLines)
+ {
+ this.printGridLines = printGridLines;
+ }
+
+ public Boolean getPrintHeaders()
+ {
+ return printHeaders;
+ }
+
+ public void setPrintHeaders(Boolean printHeaders)
+ {
+ this.printHeaders = printHeaders;
+ }
+
+ public Boolean getSheetProtected()
+ {
+ return sheetProtected;
+ }
+
+ public void setSheetProtected(Boolean sheetProtected)
+ {
+ this.sheetProtected = sheetProtected;
+ }
+
+ public Boolean getRecalculateFormulasBeforeSave()
+ {
+ return recalculateFormulasBeforeSave;
+ }
+
+ public void setRecalculateFormulasBeforeSave(Boolean recalculateFormulasBeforeSave)
+ {
+ this.recalculateFormulasBeforeSave = recalculateFormulasBeforeSave;
+ }
+
+ public Double getRightMargin()
+ {
+ return rightMargin;
+ }
+
+ public void setRightMargin(Double rightMargin)
+ {
+ this.rightMargin = rightMargin;
+ }
+
+ public Integer getScaleFactor()
+ {
+ return scaleFactor;
+ }
+
+ public void setScaleFactor(Integer scaleFactor)
+ {
+ this.scaleFactor = scaleFactor;
+ }
+
+ public Boolean getSelected()
+ {
+ return selected;
+ }
+
+ public void setSelected(Boolean selected)
+ {
+ this.selected = selected;
+ }
+
+ public Boolean getShowGridLines()
+ {
+ return showGridLines;
+ }
+
+ public void setShowGridLines(Boolean showGridLines)
+ {
+ this.showGridLines = showGridLines;
+ }
+
+ public Double getTopMargin()
+ {
+ return topMargin;
+ }
+
+ public void setTopMargin(Double topMargin)
+ {
+ this.topMargin = topMargin;
+ }
+
+ public Boolean getVerticalCentre()
+ {
+ return verticalCentre;
+ }
+
+ public void setVerticalCentre(Boolean verticalCentre)
+ {
+ this.verticalCentre = verticalCentre;
+ }
+
+ public Integer getVerticalFreeze()
+ {
+ return verticalFreeze;
+ }
+
+ public void setVerticalFreeze(Integer verticalFreeze)
+ {
+ this.verticalFreeze = verticalFreeze;
+ }
+
+ public Integer getVerticalPrintResolution()
+ {
+ return verticalPrintResolution;
+ }
+
+ public void setVerticalPrintResolution(Integer verticalPrintResolution)
+ {
+ this.verticalPrintResolution = verticalPrintResolution;
+ }
+
+ public Integer getZoomFactor()
+ {
+ return zoomFactor;
+ }
+
+ public void setZoomFactor(Integer zoomFactor)
+ {
+ this.zoomFactor = zoomFactor;
+ }
+}
Modified: sandbox/modules/spreadsheet/src/test/java/org/jboss/seam/spreadsheet/jxl/format/ConstantFactoryTest.java
===================================================================
--- sandbox/modules/spreadsheet/src/test/java/org/jboss/seam/spreadsheet/jxl/format/ConstantFactoryTest.java 2010-07-22 06:59:54 UTC (rev 13469)
+++ sandbox/modules/spreadsheet/src/test/java/org/jboss/seam/spreadsheet/jxl/format/ConstantFactoryTest.java 2010-07-22 08:01:55 UTC (rev 13470)
@@ -3,12 +3,13 @@
import java.util.Map;
import jxl.biff.DisplayFormat;
-import jxl.write.DateFormat;
import jxl.write.DateFormats;
import jxl.write.NumberFormat;
import jxl.write.NumberFormats;
import org.jboss.seam.spreadsheet.jxl.formatting.ConstantFactory;
+import org.jboss.seam.spreadsheet.model.WorksheetSettings.PageOrientation;
+import org.jboss.seam.spreadsheet.model.WorksheetSettings.PaperSize;
import org.jboss.seam.spreadsheet.model.formatting.Background.Pattern;
import org.jboss.seam.spreadsheet.model.formatting.Border.BorderLineStyle;
import org.jboss.seam.spreadsheet.model.formatting.Border.BorderType;
@@ -104,7 +105,26 @@
Assert.assertNotNull(constantFactory.getOrientation(orientation));
}
}
+
+ @Test
+ public void pageOrientationTest()
+ {
+ for (PageOrientation orientation : PageOrientation.values())
+ {
+ Assert.assertNotNull(constantFactory.getPageOrientation(orientation));
+ }
+ }
+
+ @Test
+ public void paperSizeTest()
+ {
+ for (PaperSize orientation : PaperSize.values())
+ {
+ Assert.assertNotNull(constantFactory.getPaperSize(orientation));
+ }
+ }
+
@Test
public void alignmentTest()
{
More information about the seam-commits
mailing list