Ejemplo n.º 1
0
  /**
   * Create a default popup menu for an ISBN.
   * 
   * @param pageAnalysis Page analysis.
   * @param position Position in the text.
   * @param isbn ISBN.
   * @return Popup menu.
   */
  protected JPopupMenu createDefaultPopupISBN(
      PageAnalysis pageAnalysis, int position,
      PageElementISBN isbn) {
    if (isbn == null) {
      return null;
    }

    // Menu creation
    BasicMenuCreator menu = new BasicMenuCreator();
    JPopupMenu popup = menu.createPopupMenu(GT._(
        "ISBN: {0}",
        limitTextLength(isbn.getISBN(), 50)));
    ISBNInformation infos = ISBNRange.getInformation(isbn.getISBN());
    if ((infos != null) && (infos.getTexts() != null)) {
      for (String info : infos.getTexts()) {
        menu.addDisabledText(popup, info);
      }
    }
    menu.addCurrentChapter(popup, position, pageAnalysis);

    return popup;
  }