Пример #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);
   }
 }