You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2008/12/17 19:55:08 UTC
svn commit: r727469 - in /poi/trunk/src: documentation/content/xdocs/
java/org/apache/poi/hssf/usermodel/
ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/
testcases/org/apache/poi/hssf/usermodel/
Author: yegor
Date: Wed Dec 17 10:55:07 2008
New Revision: 727469
URL: http://svn.apache.org/viewvc?rev=727469&view=rev
Log:
Added getters to parent objects: HSSFSheet.getWorkbook(), HSSFRow.getSheet() and HSSFCell.getRow()
Modified:
poi/trunk/src/documentation/content/xdocs/changes.xml
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java
poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Row.java
poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java
poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java
Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Wed Dec 17 10:55:07 2008
@@ -37,6 +37,7 @@
<!-- Don't forget to update status.xml too! -->
<release version="3.5-beta5" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Added getters to parent objects: HSSFSheet.getWorkbook(), HSSFRow.getSheet() and HSSFCell.getRow()</action>
<action dev="POI-DEVELOPERS" type="fix">46385 - (also patch 46362) fix serialization of StyleRecord with unicode name</action>
<action dev="POI-DEVELOPERS" type="fix">46368 - Fix HSSFRichTextRun and strings longer than 32768 characters</action>
<action dev="POI-DEVELOPERS" type="add">Support sheet-level names</action>
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Wed Dec 17 10:55:07 2008
@@ -34,6 +34,7 @@
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.5-beta5" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Added getters to parent objects: HSSFSheet.getWorkbook(), HSSFRow.getSheet() and HSSFCell.getRow()</action>
<action dev="POI-DEVELOPERS" type="fix">46385 - (also patch 46362) fix serialization of StyleRecord with unicode name</action>
<action dev="POI-DEVELOPERS" type="fix">46368 - Fix HSSFRichTextRun and strings longer than 32768 characters</action>
<action dev="POI-DEVELOPERS" type="add">Support sheet-level names</action>
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=727469&r1=727468&r2=727469&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 Wed Dec 17 10:55:07 2008
@@ -127,11 +127,27 @@
short xfindex = sheet.getSheet().getXFIndexForColAt(col);
setCellType(CELL_TYPE_BLANK, false, row, col,xfindex);
}
+
+ /**
+ * Returns the HSSFSheet this cell belongs to
+ *
+ * @return the HSSFSheet that owns this cell
+ */
public HSSFSheet getSheet() {
return sheet;
}
/**
+ * Returns the HSSFRow this cell belongs to
+ *
+ * @return the HSSFRow that owns this cell
+ */
+ public HSSFRow getRow() {
+ int rowIndex = getRowIndex();
+ return sheet.getRow(rowIndex);
+ }
+
+ /**
* Creates new Cell - Should only be called by HSSFRow. This creates a cell
* from scratch.
*
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java Wed Dec 17 10:55:07 2008
@@ -234,6 +234,16 @@
}
/**
+ * Returns the HSSFSheet this row belongs to
+ *
+ * @return the HSSFSheet that owns this row
+ */
+ public HSSFSheet getSheet()
+ {
+ return sheet;
+ }
+
+ /**
* Returns the rows outline level. Increased as you
* put it into more groups (outlines), reduced as
* you take it out of them.
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=727469&r1=727468&r2=727469&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 Wed Dec 17 10:55:07 2008
@@ -128,6 +128,14 @@
return new HSSFSheet(workbook, sheet.cloneSheet());
}
+ /**
+ * Return the parent workbook
+ *
+ * @return the parent workbook
+ */
+ public HSSFWorkbook getWorkbook(){
+ return workbook;
+ }
/**
* used internally to set the properties given a Sheet object
Modified: poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java (original)
+++ poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Cell.java Wed Dec 17 10:55:07 2008
@@ -99,6 +99,13 @@
Sheet getSheet();
/**
+ * Returns the Row this cell belongs to
+ *
+ * @return the Row that owns this cell
+ */
+ Row getRow();
+
+ /**
* Set the cells type (numeric, formula or string)
*
* @throws IllegalArgumentException if the specified cell type is invalid
Modified: poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Row.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Row.java?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Row.java (original)
+++ poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Row.java Wed Dec 17 10:55:07 2008
@@ -184,6 +184,13 @@
Iterator<Cell> cellIterator();
/**
+ * Returns the Sheet this row belongs to
+ *
+ * @return the Sheet that owns this row
+ */
+ Sheet getSheet();
+
+ /**
* Used to specify the different possible policies
* if for the case of null and blank cells
*/
Modified: poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java (original)
+++ poi/trunk/src/ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/Sheet.java Wed Dec 17 10:55:07 2008
@@ -712,4 +712,11 @@
*/
Drawing createDrawingPatriarch();
+
+ /**
+ * Return the parent workbook
+ *
+ * @return the parent workbook
+ */
+ Workbook getWorkbook();
}
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java?rev=727469&r1=727468&r2=727469&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java Wed Dec 17 10:55:07 2008
@@ -545,4 +545,30 @@
assertTrue("file exists",file.exists());
}
+
+ public void testParentReferences(){
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet();
+ assertSame(workbook, sheet.getWorkbook());
+
+ HSSFRow row = sheet.createRow(0);
+ assertSame(sheet, row.getSheet());
+
+ HSSFCell cell = row.createCell(1);
+ assertSame(sheet, cell.getSheet());
+ assertSame(row, cell.getRow());
+
+ workbook = HSSFTestDataSamples.writeOutAndReadBack(workbook);
+ sheet = workbook.getSheetAt(0);
+ assertSame(workbook, sheet.getWorkbook());
+
+ row = sheet.getRow(0);
+ assertSame(sheet, row.getSheet());
+
+ cell = row.getCell(1);
+ assertSame(sheet, cell.getSheet());
+ assertSame(row, cell.getRow());
+
+
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org