You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/11/17 13:08:49 UTC
svn commit: r1895105 - in /poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf: model/CommentsTable.java usermodel/XSSFComment.java
Author: fanningpj
Date: Wed Nov 17 13:08:48 2021
New Revision: 1895105
URL: http://svn.apache.org/viewvc?rev=1895105&view=rev
Log:
try to make comments table more extensible
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFComment.java
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java?rev=1895105&r1=1895104&r2=1895105&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java Wed Nov 17 13:08:48 2021
@@ -30,6 +30,7 @@ import org.apache.poi.ooxml.POIXMLDocume
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.util.Internal;
+import org.apache.poi.util.Removal;
import org.apache.poi.util.Units;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFComment;
@@ -99,9 +100,12 @@ public class CommentsTable extends POIXM
/**
* Called after the reference is updated, so that
* we can reflect that in our cache
- * @param oldReference the comment to remove from the commentRefs map
- * @param comment the comment to replace in the commentRefs map
+ * @param oldReference the comment to remove from the commentRefs map
+ * @param comment the comment to replace in the commentRefs map
+ * @deprecated use {@link #referenceUpdated(CellAddress, XSSFComment)}
*/
+ @Deprecated
+ @Removal(version = "6.0.0")
public void referenceUpdated(CellAddress oldReference, CTComment comment) {
if(commentRefs != null) {
commentRefs.remove(oldReference);
@@ -109,6 +113,20 @@ public class CommentsTable extends POIXM
}
}
+ /**
+ * Called after the reference is updated, so that
+ * we can reflect that in our cache
+ * @param oldReference the comment to remove from the commentRefs map
+ * @param comment the comment to replace in the commentRefs map
+ * @since POI 5.2.0
+ */
+ public void referenceUpdated(CellAddress oldReference, XSSFComment comment) {
+ if(commentRefs != null) {
+ commentRefs.remove(oldReference);
+ commentRefs.put(comment.getAddress(), comment.getCTComment());
+ }
+ }
+
@Override
public int getNumberOfComments() {
return comments.getCommentList().sizeOfCommentArray();
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFComment.java?rev=1895105&r1=1895104&r2=1895105&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFComment.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFComment.java Wed Nov 17 13:08:48 2021
@@ -163,7 +163,7 @@ public class XSSFComment implements Comm
}
_comment.setRef(address.formatAsString());
- _comments.referenceUpdated(oldRef, _comment);
+ _comments.referenceUpdated(oldRef, this);
if (_vmlShape != null) {
CTClientData clientData = _vmlShape.getClientDataArray(0);
@@ -244,8 +244,9 @@ public class XSSFComment implements Comm
/**
* @return the xml bean holding this comment's properties
+ * @since POI 5.2.0 (was protected before POI 5.2.0)
*/
- protected CTComment getCTComment(){
+ public CTComment getCTComment(){
return _comment;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org