poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r893051 - in /poi/trunk/src: java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/record/aggregates/ java/org/apache/poi/hssf/usermodel/ testcases/org/apache/poi/hssf/model/ testcases/org/apache/poi/hssf...
Date Tue, 22 Dec 2009 01:08:35 GMT
Author: josh
Date: Tue Dec 22 01:08:33 2009
New Revision: 893051

URL: http://svn.apache.org/viewvc?rev=893051&view=rev
Log:
Renamed model.Sheet to InternalSheet to alleviate name clash.

Added:
    poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java
      - copied, changed from r893050, poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java
Removed:
    poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java
Modified:
    poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
    poi/trunk/src/java/org/apache/poi/hssf/record/CellValueRecordInterface.java
    poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheet.java
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java

Copied: poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java (from r893050, poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java)
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java?p2=poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java&p1=poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java&r1=893050&r2=893051&rev=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/Sheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java Tue Dec 22 01:08:33 2009
@@ -70,6 +70,7 @@
 import org.apache.poi.hssf.record.formula.FormulaShifter;
 import org.apache.poi.hssf.util.PaneInformation;
 import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.util.Internal;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
@@ -94,13 +95,14 @@
  * @see org.apache.poi.hssf.model.InternalWorkbook
  * @see org.apache.poi.hssf.usermodel.HSSFSheet
  */
-public final class Sheet {
+@Internal
+public final class InternalSheet {
     public static final short   LeftMargin = 0;
     public static final short   RightMargin = 1;
     public static final short   TopMargin = 2;
     public static final short   BottomMargin = 3;
 
-    private static POILogger            log              = POILogFactory.getLogger(Sheet.class);
+    private static POILogger            log              = POILogFactory.getLogger(InternalSheet.class);
 
     private List<RecordBase>             _records;
     protected PrintGridlinesRecord       printGridlines    =     null;
@@ -154,10 +156,10 @@
      * @see org.apache.poi.hssf.model.InternalWorkbook
      * @see org.apache.poi.hssf.record.Record
      */
-    public static Sheet createSheet(RecordStream rs) {
-        return new Sheet(rs);
+    public static InternalSheet createSheet(RecordStream rs) {
+        return new InternalSheet(rs);
     }
-    private Sheet(RecordStream rs) {
+    private InternalSheet(RecordStream rs) {
         _mergedCellsTable = new MergedCellsTable();
         RowRecordsAggregate rra = null;
 
@@ -367,7 +369,7 @@
      * When adding a new record, implement a public clone method if and only if the record
      * belongs to a sheet.
      */
-    public Sheet cloneSheet() {
+    public InternalSheet cloneSheet() {
         List<RecordBase> clonedRecords = new ArrayList<RecordBase>(_records.size());
         for (int i = 0; i < _records.size(); i++) {
             RecordBase rb = _records.get(i);
@@ -388,10 +390,10 @@
      *
      * @return Sheet object with all values set to defaults
      */
-    public static Sheet createSheet() {
-        return new Sheet();
+    public static InternalSheet createSheet() {
+        return new InternalSheet();
     }
-    private Sheet() {
+    private InternalSheet() {
         _mergedCellsTable = new MergedCellsTable();
         List<RecordBase> records = new ArrayList<RecordBase>(32);
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/InternalWorkbook.java Tue Dec 22 01:08:33
2009
@@ -2274,7 +2274,7 @@
      *
      * @param sheet the cloned sheet
      */
-    public void cloneDrawings(Sheet sheet){
+    public void cloneDrawings(InternalSheet sheet){
 
         findDrawingGroup();
 

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/CellValueRecordInterface.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/CellValueRecordInterface.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/CellValueRecordInterface.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/CellValueRecordInterface.java Tue Dec 22
01:08:33 2009
@@ -25,7 +25,6 @@
  * @author Andrew C. Oliver (acoliver at apache dot org)
  * @author Jason Height (jheight at chariot dot net dot au)
  *
- * @see org.apache.poi.hssf.model.Sheet
  * @see org.apache.poi.hssf.record.Record
  * @see org.apache.poi.hssf.record.RecordFactory
  */

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java Tue Dec
22 01:08:33 2009
@@ -23,7 +23,7 @@
 import java.util.Arrays;
 
 import org.apache.poi.hssf.model.RecordStream;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.record.*;
 
 /**
@@ -404,10 +404,10 @@
 
 	private Margin getMarginRec(int marginIndex) {
 		switch (marginIndex) {
-			case Sheet.LeftMargin:   return _leftMargin;
-			case Sheet.RightMargin:  return _rightMargin;
-			case Sheet.TopMargin:    return _topMargin;
-			case Sheet.BottomMargin: return _bottomMargin;
+			case InternalSheet.LeftMargin:   return _leftMargin;
+			case InternalSheet.RightMargin:  return _rightMargin;
+			case InternalSheet.TopMargin:    return _topMargin;
+			case InternalSheet.BottomMargin: return _bottomMargin;
 		}
 		throw new IllegalArgumentException( "Unknown margin constant:  " + marginIndex );
 	}
@@ -424,10 +424,10 @@
 			return m.getMargin();
 		}
 		switch (margin) {
-			case Sheet.LeftMargin:   return .75;
-			case Sheet.RightMargin:  return .75;
-			case Sheet.TopMargin:    return 1.0;
-			case Sheet.BottomMargin: return 1.0;
+			case InternalSheet.LeftMargin:   return .75;
+			case InternalSheet.RightMargin:  return .75;
+			case InternalSheet.TopMargin:    return 1.0;
+			case InternalSheet.BottomMargin: return 1.0;
 		}
 		throw new IllegalArgumentException( "Unknown margin constant:  " + margin );
 	}
@@ -441,19 +441,19 @@
 		Margin m = getMarginRec(margin);
 		if (m  == null) {
 			switch (margin) {
-				case Sheet.LeftMargin:
+				case InternalSheet.LeftMargin:
 					_leftMargin = new LeftMarginRecord();
 					m = _leftMargin;
 					break;
-				case Sheet.RightMargin:
+				case InternalSheet.RightMargin:
 					_rightMargin = new RightMarginRecord();
 					m = _rightMargin;
 					break;
-				case Sheet.TopMargin:
+				case InternalSheet.TopMargin:
 					_topMargin = new TopMarginRecord();
 					m = _topMargin;
 					break;
-				case Sheet.BottomMargin:
+				case InternalSheet.BottomMargin:
 					_bottomMargin = new BottomMarginRecord();
 					m = _bottomMargin;
 					break;

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java Tue Dec 22 01:08:33 2009
@@ -22,7 +22,7 @@
 import java.util.*;
 
 import org.apache.poi.hssf.model.HSSFFormulaParser;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.BlankRecord;
 import org.apache.poi.hssf.record.BoolErrRecord;
@@ -1056,7 +1056,7 @@
      *
      * @return cell comment or <code>null</code> if not found
      */
-    protected static HSSFComment findCellComment(Sheet sheet, int row, int column) {
+    protected static HSSFComment findCellComment(InternalSheet sheet, int row, int column)
{
         // TODO - optimise this code by searching backwards, find NoteRecord first, quit
if not found. Find one TXO by id
         HSSFComment comment = null;
         Map<Integer, TextObjectRecord> noteTxo =

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Tue Dec 22 01:08:33 2009
@@ -31,7 +31,7 @@
 import java.util.TreeMap;
 
 import org.apache.poi.ddf.EscherRecord;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.CellValueRecordInterface;
 import org.apache.poi.hssf.record.DVRecord;
@@ -77,9 +77,9 @@
     public final static int INITIAL_CAPACITY = 20;
 
     /**
-     * reference to the low level {@link Sheet} object
+     * reference to the low level {@link InternalSheet} object
      */
-    private final Sheet _sheet;
+    private final InternalSheet _sheet;
     /** stores rows by zero-based row number */
     private final TreeMap<Integer, HSSFRow> _rows;
     protected final InternalWorkbook _book;
@@ -95,7 +95,7 @@
      * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
      */
     protected HSSFSheet(HSSFWorkbook workbook) {
-        _sheet = Sheet.createSheet();
+        _sheet = InternalSheet.createSheet();
         _rows = new TreeMap<Integer, HSSFRow>();
         this._workbook = workbook;
         this._book = workbook.getWorkbook();
@@ -109,7 +109,7 @@
      * @param sheet - lowlevel Sheet object this sheet will represent
      * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
      */
-    protected HSSFSheet(HSSFWorkbook workbook, Sheet sheet) {
+    protected HSSFSheet(HSSFWorkbook workbook, InternalSheet sheet) {
         this._sheet = sheet;
         _rows = new TreeMap<Integer, HSSFRow>();
         this._workbook = workbook;
@@ -133,7 +133,7 @@
     /**
      * used internally to set the properties given a Sheet object
      */
-    private void setPropertiesFromSheet(Sheet sheet) {
+    private void setPropertiesFromSheet(InternalSheet sheet) {
 
         RowRecord row = sheet.getNextRow();
         boolean rowRecordsAlreadyPresent = row!=null;
@@ -714,7 +714,7 @@
      * Object.
      * @return Sheet - low level representation of this HSSFSheet.
      */
-    Sheet getSheet() {
+    InternalSheet getSheet() {
         return _sheet;
     }
 
@@ -1277,7 +1277,7 @@
 
         int nSheets = _workbook.getNumberOfSheets();
         for(int i=0; i<nSheets; i++) {
-            Sheet otherSheet = _workbook.getSheetAt(i).getSheet();
+            InternalSheet otherSheet = _workbook.getSheetAt(i).getSheet();
             if (otherSheet == this._sheet) {
                 continue;
             }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Tue Dec 22 01:08:33
2009
@@ -37,7 +37,7 @@
 import org.apache.poi.hssf.OldExcelFormatException;
 import org.apache.poi.hssf.model.HSSFFormulaParser;
 import org.apache.poi.hssf.model.RecordStream;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.AbstractEscherHolderRecord;
 import org.apache.poi.hssf.record.BackupRecord;
@@ -285,7 +285,7 @@
         convertLabelRecords(records, recOffset);
         RecordStream rs = new RecordStream(records, recOffset);
         while (rs.hasNext()) {
-            Sheet sheet = Sheet.createSheet(rs);
+            InternalSheet sheet = InternalSheet.createSheet(rs);
             _sheets.add(new HSSFSheet(this, sheet));
         }
 
@@ -1225,9 +1225,6 @@
      *
      * @return byte[] array containing the binary representation of this workbook and all
contained
      *         sheets, rows, cells, etc.
-     *
-     * @see org.apache.poi.hssf.model.InternalWorkbook
-     * @see org.apache.poi.hssf.model.Sheet
      */
     public byte[] getBytes() {
         if (log.check( POILogger.DEBUG )) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheet.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheet.java Tue Dec 22 01:08:33 2009
@@ -55,16 +55,16 @@
 import org.apache.poi.ss.util.CellRangeAddress;
 
 /**
- * Unit test for the {@link Sheet} class.
+ * Unit test for the {@link InternalSheet} class.
  *
  * @author Glen Stampoultzis (glens at apache.org)
  */
 public final class TestSheet extends TestCase {
-	private static Sheet createSheet(List<Record> inRecs) {
-		return Sheet.createSheet(new RecordStream(inRecs, 0));
+	private static InternalSheet createSheet(List<Record> inRecs) {
+		return InternalSheet.createSheet(new RecordStream(inRecs, 0));
 	}
 
-	private static Record[] getSheetRecords(Sheet s, int offset) {
+	private static Record[] getSheetRecords(InternalSheet s, int offset) {
 		RecordCollector rc = new RecordCollector();
 		s.visitContainedRecords(rc, offset);
 		return rc.getRecords();
@@ -77,7 +77,7 @@
 		records.add( new DimensionsRecord() );
 		records.add(createWindow2Record());
 		records.add(EOFRecord.instance);
-		Sheet sheet = createSheet(records);
+		InternalSheet sheet = createSheet(records);
 		Record[] outRecs = getSheetRecords(sheet, 0);
 
 		int pos = 0;
@@ -116,7 +116,7 @@
 	}
 
 	public void testAddMergedRegion() {
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 		int regionsToAdd = 4096;
 
 		//simple test that adds a load of regions
@@ -156,7 +156,7 @@
 	}
 
 	public void testRemoveMergedRegion() {
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 		int regionsToAdd = 4096;
 
 		for (int n = 0; n < regionsToAdd; n++) {
@@ -201,7 +201,7 @@
 		records.add(EOFRecord.instance);
 		records.add(merged);
 
-		Sheet sheet = createSheet(records);
+		InternalSheet sheet = createSheet(records);
 		sheet.getRecords().remove(0); // TODO - what does this line do?
 
 		//stub object to throw off list INDEX operations
@@ -224,7 +224,7 @@
 	public void testRowAggregation() {
 		List<Record> records = new ArrayList<Record>();
 
-		records.add(Sheet.createBOF());
+		records.add(InternalSheet.createBOF());
 		records.add(new DimensionsRecord());
 		records.add(new RowRecord(0));
 		records.add(new RowRecord(1));
@@ -236,7 +236,7 @@
 		records.add(createWindow2Record());
 		records.add(EOFRecord.instance);
 
-		Sheet sheet = createSheet(records);
+		InternalSheet sheet = createSheet(records);
 		assertNotNull("Row [2] was skipped", sheet.getRow(2));
 	}
 
@@ -248,7 +248,7 @@
 		short colFrom = 0;
 		short colTo = 255;
 
-		Sheet worksheet = Sheet.createSheet();
+		InternalSheet worksheet = InternalSheet.createSheet();
 		PageSettingsBlock sheet = worksheet.getPageSettings();
 		sheet.setRowBreak(0, colFrom, colTo);
 
@@ -304,7 +304,7 @@
 		short rowFrom = 0;
 		short rowTo = (short)65535;
 
-		Sheet worksheet = Sheet.createSheet();
+		InternalSheet worksheet = InternalSheet.createSheet();
 		PageSettingsBlock sheet = worksheet.getPageSettings();
 		sheet.setColumnBreak((short)0, rowFrom, rowTo);
 
@@ -365,7 +365,7 @@
 		final short TEST_IDX = 10;
 		final short DEFAULT_IDX = 0xF; // 15
 		short xfindex = Short.MIN_VALUE;
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 
 		// without ColumnInfoRecord
 		xfindex = sheet.getXFIndexForColAt((short) 0);
@@ -460,7 +460,7 @@
 		records.add(new DimensionsRecord());
 		records.add(createWindow2Record());
 		records.add(EOFRecord.instance);
-		Sheet sheet = createSheet(records);
+		InternalSheet sheet = createSheet(records);
 
 		// The original bug was due to different logic for collecting records for sizing and
 		// serialization. The code has since been refactored into a single method for visiting
@@ -479,7 +479,7 @@
 	 */
 	public void testRowValueAggregatesOrder_bug45145() {
 
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 
 		RowRecord rr = new RowRecord(5);
 		sheet.addRow(rr);
@@ -510,7 +510,7 @@
 	 * @return the value calculated for the position of the first DBCELL record for this sheet.
 	 * That value is found on the IndexRecord.
 	 */
-	private static int getDbCellRecordPos(Sheet sheet) {
+	private static int getDbCellRecordPos(InternalSheet sheet) {
 
 		MyIndexRecordListener myIndexListener = new MyIndexRecordListener();
 		sheet.visitContainedRecords(myIndexListener, 0);
@@ -544,7 +544,7 @@
 	 */
 	public void testGutsRecord_bug45640() {
 
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 		sheet.addRow(new RowRecord(0));
 		sheet.addRow(new RowRecord(1));
 		sheet.groupRowRange( 0, 1, true );
@@ -611,7 +611,7 @@
 		inRecs.add(nr);
 		inRecs.add(createWindow2Record());
 		inRecs.add(EOFRecord.instance);
-		Sheet sheet;
+		InternalSheet sheet;
 		try {
 			sheet = createSheet(inRecs);
 		} catch (RuntimeException e) {
@@ -641,7 +641,7 @@
 	 */
 	public void testShiftFormulasAddCondFormat_bug46547() {
 		// Create a sheet with data validity (similar to bugzilla attachment id=23131).
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 
 		List<RecordBase> sheetRecs = sheet.getRecords();
 		assertEquals(23, sheetRecs.size());
@@ -659,7 +659,7 @@
 	 */
 	public void testAddCondFormatAfterDataValidation_bug46547() {
 		// Create a sheet with data validity (similar to bugzilla attachment id=23131).
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 		sheet.getOrCreateDataValidityTable();
 
 		ConditionalFormattingTable cft;
@@ -675,7 +675,7 @@
 
 	public void testCloneMulBlank_bug46776() {
 		Record[]  recs = {
-				Sheet.createBOF(),
+				InternalSheet.createBOF(),
 				new DimensionsRecord(),
 				new RowRecord(1),
 				new MulBlankRecord(1, 3, new short[] { 0x0F, 0x0F, 0x0F, } ),
@@ -684,9 +684,9 @@
 				EOFRecord.instance,
 		};
 
-		Sheet sheet = createSheet(Arrays.asList(recs));
+		InternalSheet sheet = createSheet(Arrays.asList(recs));
 
-		Sheet sheet2;
+		InternalSheet sheet2;
 		try {
 			sheet2 = sheet.cloneSheet();
 		} catch (RuntimeException e) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestSheetAdditional.java Tue Dec 22
01:08:33 2009
@@ -6,7 +6,7 @@
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
 
-       http://www.apache.org/licenses/LICENSE-2.0
+	   http://www.apache.org/licenses/LICENSE-2.0
 
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
@@ -25,44 +25,44 @@
  * @author Tony Poppleton
  */
 public final class TestSheetAdditional extends TestCase {
-	
+
 	public void testGetCellWidth() {
-		Sheet sheet = Sheet.createSheet();
+		InternalSheet sheet = InternalSheet.createSheet();
 		ColumnInfoRecord nci = new ColumnInfoRecord();
 
 		// Prepare test model
-		nci.setFirstColumn((short)5);
-		nci.setLastColumn((short)10);
-		nci.setColumnWidth((short)100);
-		
-		
+		nci.setFirstColumn(5);
+		nci.setLastColumn(10);
+		nci.setColumnWidth(100);
+
+
 		sheet._columnInfos.insertColumn(nci);
 
-		assertEquals((short)100,sheet.getColumnWidth((short)5));
-		assertEquals((short)100,sheet.getColumnWidth((short)6));
-		assertEquals((short)100,sheet.getColumnWidth((short)7));
-		assertEquals((short)100,sheet.getColumnWidth((short)8));
-		assertEquals((short)100,sheet.getColumnWidth((short)9));
-		assertEquals((short)100,sheet.getColumnWidth((short)10));
-
-		sheet.setColumnWidth((short)6,(short)200);
-
-		assertEquals((short)100,sheet.getColumnWidth((short)5));
-		assertEquals((short)200,sheet.getColumnWidth((short)6));
-		assertEquals((short)100,sheet.getColumnWidth((short)7));
-		assertEquals((short)100,sheet.getColumnWidth((short)8));
-		assertEquals((short)100,sheet.getColumnWidth((short)9));
-		assertEquals((short)100,sheet.getColumnWidth((short)10));
+		assertEquals(100,sheet.getColumnWidth(5));
+		assertEquals(100,sheet.getColumnWidth(6));
+		assertEquals(100,sheet.getColumnWidth(7));
+		assertEquals(100,sheet.getColumnWidth(8));
+		assertEquals(100,sheet.getColumnWidth(9));
+		assertEquals(100,sheet.getColumnWidth(10));
+
+		sheet.setColumnWidth(6,200);
+
+		assertEquals(100,sheet.getColumnWidth(5));
+		assertEquals(200,sheet.getColumnWidth(6));
+		assertEquals(100,sheet.getColumnWidth(7));
+		assertEquals(100,sheet.getColumnWidth(8));
+		assertEquals(100,sheet.getColumnWidth(9));
+		assertEquals(100,sheet.getColumnWidth(10));
 	}
 
-    public void testMaxColumnWidth() {
-        Sheet sheet = Sheet.createSheet();
-        sheet.setColumnWidth(0, 255*256); //the limit
-        try {
-            sheet.setColumnWidth(0, 256*256); //the limit
-            fail("expected exception");
-        } catch (Exception e){
-            ;
-        }
-    }
+	public void testMaxColumnWidth() {
+		InternalSheet sheet = InternalSheet.createSheet();
+		sheet.setColumnWidth(0, 255*256); //the limit
+		try {
+			sheet.setColumnWidth(0, 256*256); //the limit
+			fail("expected exception");
+		} catch (IllegalArgumentException e){
+			assertEquals(e.getMessage(), "The maximum column width for an individual cell is 255 characters.");
+		}
+	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingsBlock.java
Tue Dec 22 01:08:33 2009
@@ -24,7 +24,7 @@
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.model.RecordStream;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -84,9 +84,9 @@
 				EOFRecord.instance,
 		};
 		RecordStream rs = new RecordStream(Arrays.asList(recs), 0);
-		Sheet sheet;
+		InternalSheet sheet;
 		try {
-			sheet = Sheet.createSheet(rs);
+			sheet = InternalSheet.createSheet(rs);
 		} catch (RuntimeException e) {
 			if (e.getMessage().equals("two Page Settings Blocks found in the same sheet")) {
 				throw new AssertionFailedError("Identified bug 46480");
@@ -122,7 +122,7 @@
 				EOFRecord.instance,
 		};
 		RecordStream rs = new RecordStream(Arrays.asList(recs), 0);
-		Sheet sheet = Sheet.createSheet(rs);
+		InternalSheet sheet = InternalSheet.createSheet(rs);
 
 		RecordCollector rv = new RecordCollector();
 		sheet.visitContainedRecords(rv, 0);
@@ -166,9 +166,9 @@
 		};
 		RecordStream rs = new RecordStream(Arrays.asList(recs), 0);
 
-		Sheet sheet;
+		InternalSheet sheet;
 		try {
-			sheet = Sheet.createSheet(rs);
+			sheet = InternalSheet.createSheet(rs);
 		} catch (RuntimeException e) {
 			if (e.getMessage().equals("two Page Settings Blocks found in the same sheet")) {
 				throw new AssertionFailedError("Identified bug 47199a - failed to process late margings
records");
@@ -328,9 +328,9 @@
                 EOFRecord.instance,
         };
         RecordStream rs = new RecordStream(Arrays.asList(recs), 0);
-        Sheet sheet;
+        InternalSheet sheet;
         try {
-            sheet = Sheet.createSheet(rs);
+            sheet = InternalSheet.createSheet(rs);
         } catch (RuntimeException e) {
             if (e.getMessage().equals("Duplicate PageSettingsBlock record (sid=0x89c)"))
{
                 throw new AssertionFailedError("Identified bug 48026");

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java Tue Dec 22 01:08:33
2009
@@ -20,7 +20,7 @@
 package org.apache.poi.hssf.usermodel;
 
 import junit.framework.Assert;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.aggregates.PageSettingsBlock;
@@ -218,8 +218,7 @@
 //        checkRecordsTogether(records, workbookRecords);
     }
 
-    private void checkSheetRecords(Sheet sheet)
-    {
+    private void checkSheetRecords(InternalSheet sheet) {
         List records = sheet.getRecords();
         assertTrue(records.get(0) instanceof BOFRecord);
         assertTrue(records.get(records.size() - 1) instanceof EOFRecord);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java Tue Dec 22 01:08:33
2009
@@ -23,7 +23,7 @@
 import junit.framework.AssertionFailedError;
 
 import org.apache.poi.hssf.HSSFITestDataProvider;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.record.DBCellRecord;
 import org.apache.poi.hssf.record.FormulaRecord;
 import org.apache.poi.hssf.record.Record;
@@ -131,7 +131,7 @@
 
 		//check initial position
 		HSSFSheet umSheet = book.getSheetAt(0);
-		Sheet s = umSheet.getSheet();
+		InternalSheet s = umSheet.getSheet();
 		assertEquals("Initial active cell should be in col 0",
 			(short) 0, s.getActiveCellCol());
 		assertEquals("Initial active cell should be on row 1",

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java Tue Dec 22 01:08:33
2009
@@ -23,17 +23,27 @@
 
 import junit.framework.AssertionFailedError;
 
-import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.ddf.EscherDgRecord;
 import org.apache.poi.hssf.HSSFITestDataProvider;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.model.DrawingManager2;
-import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.DimensionsRecord;
+import org.apache.poi.hssf.record.GridsetRecord;
+import org.apache.poi.hssf.record.HCenterRecord;
+import org.apache.poi.hssf.record.ObjectProtectRecord;
+import org.apache.poi.hssf.record.PasswordRecord;
+import org.apache.poi.hssf.record.ProtectRecord;
+import org.apache.poi.hssf.record.Record;
+import org.apache.poi.hssf.record.SCLRecord;
+import org.apache.poi.hssf.record.ScenarioProtectRecord;
+import org.apache.poi.hssf.record.VCenterRecord;
+import org.apache.poi.hssf.record.WSBoolRecord;
+import org.apache.poi.hssf.record.WindowTwoRecord;
 import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock;
 import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
+import org.apache.poi.ss.usermodel.BaseTestSheet;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddressList;
-import org.apache.poi.ss.usermodel.BaseTestSheet;
-import org.apache.poi.ddf.EscherDgRecord;
 import org.apache.poi.util.TempFile;
 
 /**
@@ -60,11 +70,10 @@
     public void testBackupRecord() {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet s = wb.createSheet();
-        Sheet sheet = s.getSheet();
-
-        assertEquals(true, sheet.getGridsetRecord().getGridset());
+        GridsetRecord gridsetRec = s.getSheet().getGridsetRecord();
+		assertEquals(true, gridsetRec.getGridset());
         s.setGridsPrinted(true);
-        assertEquals(false, sheet.getGridsetRecord().getGridset());
+        assertEquals(false, gridsetRec.getGridset());
     }
 
     /**
@@ -73,8 +82,7 @@
     public void testVerticallyCenter() {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet s = wb.createSheet();
-        Sheet sheet = s.getSheet();
-        VCenterRecord record = sheet.getPageSettings().getVCenter();
+        VCenterRecord record = s.getSheet().getPageSettings().getVCenter();
 
         assertEquals(false, record.getVCenter());
         s.setVerticallyCenter(true);
@@ -89,8 +97,7 @@
     public void testHorizontallyCenter() {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet s = wb.createSheet();
-        Sheet sheet = s.getSheet();
-        HCenterRecord record = sheet.getPageSettings().getHCenter();
+        HCenterRecord record = s.getSheet().getPageSettings().getHCenter();
 
         assertEquals(false, record.getHCenter());
         s.setHorizontallyCenter(true);
@@ -104,9 +111,8 @@
     public void testWSBool() {
         HSSFWorkbook wb = new HSSFWorkbook();
         HSSFSheet s = wb.createSheet();
-        Sheet sheet = s.getSheet();
         WSBoolRecord record =
-                (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
+                (WSBoolRecord) s.getSheet().findFirstRecordBySid(WSBoolRecord.sid);
 
         // Check defaults
         assertEquals(true, record.getAlternateExpression());

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java Tue Dec 22
01:08:33 2009
@@ -26,7 +26,7 @@
 import org.apache.poi.hssf.HSSFITestDataProvider;
 import org.apache.poi.hssf.model.HSSFFormulaParser;
 import org.apache.poi.hssf.model.InternalWorkbook;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.record.NameRecord;
 import org.apache.poi.hssf.record.Record;
 import org.apache.poi.hssf.record.RecordBase;
@@ -356,7 +356,7 @@
      */
     public void testSheetSerializeSizeMismatch_bug45066() {
         HSSFWorkbook wb = new HSSFWorkbook();
-        Sheet sheet = wb.createSheet("Sheet1").getSheet();
+        InternalSheet sheet = wb.createSheet("Sheet1").getSheet();
         List<RecordBase> sheetRecords = sheet.getRecords();
         // one way (of many) to cause the discrepancy is with a badly behaved record:
         sheetRecords.add(new BadlyBehavedRecord());

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java?rev=893051&r1=893050&r2=893051&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java Tue Dec
22 01:08:33 2009
@@ -23,7 +23,7 @@
 import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.model.Sheet;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.record.BOFRecord;
 import org.apache.poi.hssf.record.EOFRecord;
 
@@ -49,7 +49,7 @@
         HSSFCell cell = row.createCell(1);
 
         cell.setCellValue(22);
-        Sheet newSheet = workbook.getSheetAt(0).getSheet();
+        InternalSheet newSheet = workbook.getSheetAt(0).getSheet();
         List  records  = newSheet.getRecords();
 
         assertTrue(records.get(0) instanceof BOFRecord);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message