コード例 #1
0
  /** if id can be resolved then simply return a word, otherwise return a resolvable area */
  private InlineArea getPageNumberCitationLastInlineArea(LayoutManager parentLM) {
    TextArea text = null;
    int level = getBidiLevel();
    if (!getPSLM().associateLayoutManagerID(fobj.getRefId())) {
      text = new UnresolvedPageNumber(fobj.getRefId(), font, UnresolvedPageNumber.LAST);
      getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable) text);
      String str = "MMM"; // reserve three spaces for page number
      int width = getStringWidth(str);
      text.setBidiLevel(level);
      text.setIPD(width);
      resolved = false;
    } else {
      PageViewport page = getPSLM().getLastPVWithID(fobj.getRefId());
      String str = page.getPageNumberString();
      // get page string from parent, build area
      text = new TextArea();
      int width = getStringWidth(str);
      text.setBidiLevel(level);
      text.addWord(str, 0, level);
      text.setIPD(width);
      resolved = true;
    }

    updateTextAreaTraits(text);

    return text;
  }
コード例 #2
0
  /** if id can be resolved then simply return a word, otherwise return a resolvable area */
  private InlineArea getPageNumberCitationInlineArea() {
    final PageViewport page = getPSLM().getFirstPVWithID(this.fobj.getRefId());
    TextArea text = null;
    if (page != null) {
      final String str = page.getPageNumberString();
      // get page string from parent, build area
      text = new TextArea();
      final int width = getStringWidth(str);
      text.addWord(str, 0);
      text.setIPD(width);
      this.resolved = true;
    } else {
      this.resolved = false;
      text = new UnresolvedPageNumber(this.fobj.getRefId(), this.font);
      final String str = "MMM"; // reserve three spaces for page number
      final int width = getStringWidth(str);
      text.setIPD(width);
    }
    updateTextAreaTraits(text);

    return text;
  }