Browse Source

try to make CommentsTable more extensible

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895176 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_0
PJ Fanning 2 years ago
parent
commit
b4f36926dc

+ 10
- 0
poi-ooxml/src/main/java/org/apache/poi/xssf/model/Comments.java View File

@@ -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);
}

+ 13
- 0
poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java View File

@@ -141,6 +141,7 @@ public class CommentsTable extends POIXMLDocumentPart implements 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
*/
@Override
@@ -151,6 +152,18 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
}
}

/**
* 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();

+ 4
- 0
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFComment.java View File

@@ -92,6 +92,7 @@ public class XSSFComment implements Comment {
@Override
public void setAuthor(String author) {
_comment.setAuthorId(_comments.findAuthor(author));
_comments.commentUpdated(this);
}

/**
@@ -152,6 +153,7 @@ public class XSSFComment implements Comment {
}
}
}
_comments.commentUpdated(this);
}
@Override
@@ -182,6 +184,7 @@ public class XSSFComment implements Comment {
avoidXmlbeansCorruptPointer(_vmlShape);
}
_comments.commentUpdated(this);
}

/**
@@ -232,6 +235,7 @@ public class XSSFComment implements Comment {
}
_str = (XSSFRichTextString)string;
_comment.setText(_str.getCTRst());
_comments.commentUpdated(this);
}
public void setString(String string) {

Loading…
Cancel
Save