Example #1
0
  @Override
  public Element processTag(Book book, Key key, Element ele, Attributes attrs) {
    Element lb = OSISUtil.factory().createLB();

    if (ele != null) {
      ele.addContent(lb);
    }

    return lb;
  }
Example #2
0
  @Override
  public Element processTag(Book book, Key key, Element ele, Attributes attrs) {
    Element img = OSISUtil.factory().createFigure();
    img.setAttribute(OSISUtil.ATTRIBUTE_FIGURE_SRC, attrs.getValue("src"));

    if (ele != null) {
      ele.addContent(img);
    }

    return img;
  }
Example #3
0
 /** Sort the keys for a more meaningful presentation order. */
 public Element toOSIS() {
   OSISUtil.OSISFactory factory = OSISUtil.factory();
   Element ele = factory.createTable();
   toOSIS(factory, ele, "BasicInfo", BASIC_INFO);
   toOSIS(factory, ele, "LangInfo", LANG_INFO);
   toOSIS(factory, ele, "LicenseInfo", COPYRIGHT_INFO);
   toOSIS(factory, ele, "FeatureInfo", FEATURE_INFO);
   toOSIS(factory, ele, "SysInfo", SYSTEM_INFO);
   toOSIS(factory, ele, "Extra", extra);
   return ele;
 }
Example #4
0
  public void testGetStrongs() throws NoSuchKeyException, BookException {
    Book book = Books.installed().getBook("KJV");
    assertTrue(
        "Should have Strongs", book.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS));

    Key key = book.getKey("Gen 1:1");
    BookData data = new BookData(book, key);
    Element osis = data.getOsisFragment();

    String strongsNumbers = OSISUtil.getStrongsNumbers(osis);
    assertTrue("No Strongs in KJV", strongsNumbers.length() > 0);
  }
  /**
   * Customize something to display the Passage component
   *
   * @return The customized component
   */
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean selected, boolean focus) {
    if (selected) {
      label.setBackground(list.getSelectionBackground());
      label.setForeground(list.getSelectionForeground());
    } else {
      label.setBackground(list.getBackground());
      label.setForeground(list.getForeground());
    }

    if (value instanceof VerseRange) {
      try {
        VerseRange range = (VerseRange) value;
        String text = (String) hash.get(range);

        if (text == null) {
          BookData bdata = new BookData(bible, range);
          String simple = OSISUtil.getCanonicalText(bdata.getOsisFragment());
          text = "<html><b>" + range.getName() + "</b> " + simple;
          hash.put(range, text);
        }

        label.setText(text);
      } catch (Exception ex) {
        Reporter.informUser(this, ex);
        // TRANSLATOR: Unexpected error condition.
        label.setText(Msg.gettext("Error"));
      }
    } else {
      label.setText((value == null) ? "" : value.toString());
    }

    label.setEnabled(list.isEnabled());
    label.setFont(list.getFont());
    label.setBorder(focus ? UIManager.getBorder("List.focusCellHighlightBorder") : border);

    return label;
  }