示例#1
0
  public CTComment newComment() {
    CTComment ct = comments.getCommentList().addNewComment();
    ct.setRef("A1");
    ct.setAuthorId(0);

    if (commentRefs != null) {
      commentRefs.put(ct.getRef(), ct);
    }
    return ct;
  }
示例#2
0
  @SuppressWarnings(
      "deprecation") // YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5
                     // support
  public CTComment getCTComment(String cellRef) {
    // Create the cache if needed
    if (commentRefs == null) {
      commentRefs = new HashMap<String, CTComment>();
      for (CTComment comment : comments.getCommentList().getCommentArray()) {
        commentRefs.put(comment.getRef(), comment);
      }
    }

    // Return the comment, or null if not known
    return commentRefs.get(cellRef);
  }
示例#3
0
  public boolean removeComment(String cellRef) {
    CTCommentList lst = comments.getCommentList();
    if (lst != null)
      for (int i = 0; i < lst.sizeOfCommentArray(); i++) {
        CTComment comment = lst.getCommentArray(i);
        if (cellRef.equals(comment.getRef())) {
          lst.removeComment(i);

          if (commentRefs != null) {
            commentRefs.remove(cellRef);
          }
          return true;
        }
      }
    return false;
  }
示例#4
0
 /** Called after the reference is updated, so that we can reflect that in our cache */
 public void referenceUpdated(String oldReference, CTComment comment) {
   if (commentRefs != null) {
     commentRefs.remove(oldReference);
     commentRefs.put(comment.getRef(), comment);
   }
 }