Author: fanningpj
Date: Fri Nov 19 14:26:15 2021
New Revision: 1895176

URL: http://svn.apache.org/viewvc?rev=1895176&view=rev
Log:
try to make CommentsTable more extensible

Modified:
    poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/Comments.java
    
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/Comments.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/Comments.java?rev=1895176&r1=1895175&r2=1895176&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/Comments.java 
(original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/model/Comments.java 
Fri Nov 19 14:26:15 2021
@@ -91,7 +91,17 @@ public interface Comments {
      *  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
+     * @see #commentUpdated(XSSFComment)                
      * @since POI 5.2.0
      */
     void referenceUpdated(CellAddress oldReference, XSSFComment comment);
+
+    /**
+     * Called after the comment is updated, so that
+     *  we can reflect that in our cache
+     * @param comment the comment to replace in the commentRefs map
+     * @since POI 5.2.0
+     * @see #referenceUpdated(CellAddress, XSSFComment)
+     */
+    void commentUpdated(XSSFComment comment);
 }

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=1895176&r1=1895175&r2=1895176&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 
Fri Nov 19 14:26:15 2021
@@ -141,6 +141,7 @@ public class CommentsTable extends POIXM
      *  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
+     * @see #commentUpdated(XSSFComment)
      * @since POI 5.2.0
      */
     @Override
@@ -151,6 +152,18 @@ public class CommentsTable extends POIXM
         }
     }
 
+    /**
+     * Called after the comment is updated, so that
+     *  we can reflect that in our cache
+     * @param comment the comment to replace in the commentRefs map
+     * @since POI 5.2.0
+     * @see #referenceUpdated(CellAddress, XSSFComment)
+     */
+    @Override
+    public void commentUpdated(XSSFComment comment) {
+        //no-op in this implementation
+    }
+
     @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=1895176&r1=1895175&r2=1895176&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
 Fri Nov 19 14:26:15 2021
@@ -92,6 +92,7 @@ public class XSSFComment implements Comm
     @Override
     public void setAuthor(String author) {
         _comment.setAuthorId(_comments.findAuthor(author));
+        _comments.commentUpdated(this);
     }
 
     /**
@@ -152,6 +153,7 @@ public class XSSFComment implements Comm
                 }
             }
         }
+        _comments.commentUpdated(this);
     }
     
     @Override
@@ -182,6 +184,7 @@ public class XSSFComment implements Comm
            
             avoidXmlbeansCorruptPointer(_vmlShape);
         }
+        _comments.commentUpdated(this);
     }
 
     /**
@@ -232,6 +235,7 @@ public class XSSFComment implements Comm
         }
         _str = (XSSFRichTextString)string;
         _comment.setText(_str.getCTRst());
+        _comments.commentUpdated(this);
     }
     
     public void setString(String string) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to