Search in sources :

Example 1 with MultiInterlinearProviderImpl

use of com.tyndalehouse.step.core.xsl.impl.MultiInterlinearProviderImpl in project step by STEPBible.

the class JSwordPassageServiceImpl method setInterlinearOptions.

/**
 * sets up the default interlinear options
 *
 * @param tsep                the transformer that we want to set up
 * @param masterVersion       the master version for this lookup
 * @param masterVersification the versification of the top line
 * @param interlinearVersion  the interlinear version(s) that the users have requested
 * @param reference           the reference the user is interested in
 * @param displayMode         the mode to display the passage, i.e. interlinear, interleaved, etc.
 * @param key                 the key to the passage
 * @param options             the list of options to be applied (used to determine accenting
 */
private MultiInterlinearProvider setInterlinearOptions(final TransformingSAXEventProvider tsep, final String masterVersion, final Versification masterVersification, final String interlinearVersion, final String reference, final InterlinearMode displayMode, final Key key, final List<LookupOption> options) {
    if (displayMode == InterlinearMode.INTERLINEAR) {
        tsep.setParameter("VLine", false);
        // TODO: work out OT or NT
        Iterator<Key> keys = key.iterator();
        if (keys.hasNext()) {
            Key firstKey = keys.next();
            if (firstKey instanceof Verse) {
                final Verse verse = (Verse) firstKey;
                Testament t = masterVersification.getTestament(verse.getOrdinal());
                tsep.setParameter("isOT", t == Testament.OLD);
            }
        }
        if (isNotBlank(interlinearVersion)) {
            tsep.setParameter("interlinearVersion", interlinearVersion);
        }
        boolean stripGreekAccents, stripHebrewAccents, stripVowels = stripHebrewAccents = stripGreekAccents = true;
        for (LookupOption option : options) {
            if (LookupOption.GREEK_ACCENTS == option) {
                stripGreekAccents = false;
            } else if (LookupOption.HEBREW_ACCENTS == option) {
                stripHebrewAccents = false;
            } else if (LookupOption.HEBREW_VOWELS == option) {
                stripVowels = false;
            }
        }
        final MultiInterlinearProviderImpl multiInterlinear = new MultiInterlinearProviderImpl(masterVersion, masterVersification, interlinearVersion, reference, this.versificationService, this.vocabProvider, stripGreekAccents, stripHebrewAccents, stripVowels);
        tsep.setParameter("interlinearProvider", multiInterlinear);
        return multiInterlinear;
    }
    return null;
}
Also used : MultiInterlinearProviderImpl(com.tyndalehouse.step.core.xsl.impl.MultiInterlinearProviderImpl) LookupOption(com.tyndalehouse.step.core.models.LookupOption) Key(org.crosswire.jsword.passage.Key) Verse(org.crosswire.jsword.passage.Verse) Testament(org.crosswire.jsword.versification.Testament)

Aggregations

LookupOption (com.tyndalehouse.step.core.models.LookupOption)1 MultiInterlinearProviderImpl (com.tyndalehouse.step.core.xsl.impl.MultiInterlinearProviderImpl)1 Key (org.crosswire.jsword.passage.Key)1 Verse (org.crosswire.jsword.passage.Verse)1 Testament (org.crosswire.jsword.versification.Testament)1