[Tynstep-svn] r145 - in trunk: step-web-app/src/main/java/com/tyndalehouse/step/web/client/common step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets step-web-app/src/main/java/com/tyndalehouse/step/web/client/view step-web-app/src/main/java/com/tyndalehouse/step/web/public/css step-web-app/src/main/java/com/tyndalehouse/step/web/shared step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result step-web-app/src/main/resources step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view step-web-app/src/main/resources/com/tyndalehouse/step/web/server step-web-app/src/main/resources/com/tyndalehouse/step/web/server/db/queries step-web-app/src/main/resources/xsl step-web-server/src/main step-web-server/src/main/java/com/tyndalehouse/step/web/server step-web-server/src/main/java/com/tyndalehouse/step/web/server/guice step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage step-web-server/src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/step/web step-web-server/src/main/java/com/tyndalehouse/step/web/server/service step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/impl step-web-server/src/main/resources step-web-server/src/main/resources/com step-web-server/src/main/resources/com/tyndalehouse step-web-server/src/main/resources/com/tyndalehouse/step step-web-server/src/main/resources/com/tyndalehouse/step/web step-web-server/src/main/resources/com/tyndalehouse/step/web/server step-web-server/src/main/resources/com/tyndalehouse/step/web/server/db step-web-server/src/main/resources/com/tyndalehouse/step/web/server/db/queries step-web-server/src/main/resources/xsl step-web-server/src/test/java/com/tyndalehouse/step/web/server step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler step-web-server/src/test/java/com/tyndalehouse/step/web/server/service step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/impl step-web-server/src/test/resources step-web-shared step-web-shared/src/main step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture

ChrisBurrell at crosswire.org ChrisBurrell at crosswire.org
Thu Jul 1 14:53:56 MST 2010


Author: ChrisBurrell
Date: 2010-07-01 14:53:55 -0700 (Thu, 01 Jul 2010)
New Revision: 145

Added:
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/StringUtils.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageWidget.java
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/OsisParserFilter.java
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/JSwordService.java
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/impl/
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImpl.java
   trunk/step-web-server/src/main/resources/
   trunk/step-web-server/src/main/resources/com/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/server/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/server/config/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/server/db/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/server/db/queries/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/server/db/queries/maps/
   trunk/step-web-server/src/main/resources/com/tyndalehouse/step/web/server/db/queries/timeline/
   trunk/step-web-server/src/main/resources/log4j.properties
   trunk/step-web-server/src/main/resources/xsl/
   trunk/step-web-server/src/main/resources/xsl/cswing/
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/impl/
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImplTest.java
   trunk/step-web-server/src/test/resources/log4j.properties
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageLanguage.java
   trunk/step-web-shared/src/main/resources/
Removed:
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/beans/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/timeline/
   trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/config/
   trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/db/queries/maps/
   trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/db/queries/timeline/
   trunk/step-web-app/src/main/resources/log4j.properties
   trunk/step-web-app/src/main/resources/xsl/cswing/
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/step/web/server/
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handlers/
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/VerseContent.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java
Modified:
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css
   trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java
   trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandlerTest.java
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandlerTest.java
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandlerTest.java
   trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/JSwordInstallTest.java
   trunk/step-web-shared/pom.xml
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java
   trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java
Log:
committing first part of scripture display

Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/StringUtils.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/StringUtils.java	                        (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/StringUtils.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,29 @@
+package com.tyndalehouse.step.web.client.common;
+
+public class StringUtils {
+    /**
+     * hiding implementation
+     */
+    private StringUtils() {
+        // no implementation
+    }
+
+    /**
+     * @param s
+     *            the string to evaluate
+     * @return true if s == null or s.length == 0
+     */
+    public static boolean isEmpty(final String s) {
+        return s == null || s.length() == 0;
+    }
+
+    /**
+     * @param s
+     *            the string to evaluate
+     * @return true if !(s == null or s.length == 0)
+     */
+    public static boolean isNotEmpty(final String s) {
+        return !isEmpty(s);
+    }
+
+}

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,5 +1,7 @@
 package com.tyndalehouse.step.web.client.presenter;
 
+import static com.tyndalehouse.step.web.client.common.StringUtils.isNotEmpty;
+
 import java.util.List;
 import java.util.SortedMap;
 
@@ -173,21 +175,28 @@
     }
 
     private void refreshView() {
-        final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(view.getCurrentlySelectedVersion(), view
-                .getCurrentPassage());
+        // check whether all parameters are there, otherwise don't fire
+        final String currentlySelectedVersion = view.getCurrentlySelectedVersion();
+        final String currentPassage = view.getCurrentPassage();
 
-        // TODO: decide if this should be made static or UI driven
-        cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+        if (isNotEmpty(currentlySelectedVersion) && isNotEmpty(currentPassage)) {
 
-        dispatcher.execute(cmd, new AsyncCallback<GetCurrentBibleTextResult>() {
-            public void onFailure(final Throwable e) {
-                Log.error("An error has occurred", e);
-            }
+            final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(currentlySelectedVersion,
+                    currentPassage);
 
-            public void onSuccess(final GetCurrentBibleTextResult result) {
-                view.setPassage(result.getPassage());
-            }
-        });
+            // TODO: decide if this should be made static or UI driven
+            cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
+
+            dispatcher.execute(cmd, new AsyncCallback<GetCurrentBibleTextResult>() {
+                public void onFailure(final Throwable e) {
+                    Log.error("An error has occurred", e);
+                }
+
+                public void onSuccess(final GetCurrentBibleTextResult result) {
+                    view.setPassage(result.getPassage());
+                }
+            });
+        }
     }
 
     public void onLemmaClicked(final List<String> lemmas) {

Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java	                        (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,77 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import java.util.List;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
+import com.tyndalehouse.step.web.shared.scripture.PassageElement;
+
+public class PassageElementWidget extends Widget {
+
+    public PassageElementWidget(final PassageElement passageElement) {
+        switch (passageElement.getTypeOfElement()) {
+            case TITLE:
+                setElementAsLabel(passageElement, "passageTitle", new Label());
+                break;
+            case VERSE:
+                // for each child, go and create children for them
+                final List<PassageElement> children = passageElement.getChildren();
+                final FlowPanel versePanel = new FlowPanel();
+
+                for (final PassageElement child : children) {
+                    versePanel.add(new PassageElementWidget(child));
+                }
+                setElement(versePanel.getElement());
+                break;
+            case TEXT:
+                setElementAsLabel(passageElement, "passageWord", new InlineLabel());
+                // super.setElement(createLabel(passageElement,
+                // "passageWord").getElement());
+                break;
+            case LINE_BREAK:
+                final Label lineBreak = new Label();
+                lineBreak.addStyleName("passageLineBreak");
+                setElement(lineBreak.getElement());
+                break;
+            default:
+                Log.warn("Unrendered element of type: " + passageElement.getTypeOfElement());
+                setElement(new FlowPanel().getElement());
+                break;
+        }
+    }
+
+    /**
+     * sets the widget's element to be a label
+     * 
+     * @param passageElement
+     *            the element to scan
+     * @param style
+     *            the style to set
+     */
+    private void setElementAsLabel(final PassageElement passageElement, final String style, final Label label) {
+        styleLabel(passageElement, style, label);
+        super.setElement(label.getElement());
+    }
+
+    /**
+     * crates a label and returns it
+     * 
+     * @param passageElement
+     *            the element to use as the basis
+     * @param style
+     *            the style to set on the element
+     * @return the label
+     */
+    private void styleLabel(final PassageElement passageElement, final String style, final Label label) {
+        final PassageElement textNode = OsisElementType.TEXT.equals(passageElement.getTypeOfElement()) ? passageElement
+                : passageElement.getFirstChild();
+        final String text = textNode.getAttribute(OsisElementType.TEXT);
+
+        label.setText(text);
+        label.addStyleName(style);
+    }
+}

Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageWidget.java	                        (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageWidget.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,158 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.Widget;
+import com.tyndalehouse.step.web.client.toolkit.scripture.ScriptureDisplayConstants;
+import com.tyndalehouse.step.web.client.toolkit.scripture.VerseLabel;
+import com.tyndalehouse.step.web.shared.scripture.Passage;
+import com.tyndalehouse.step.web.shared.scripture.PassageElement;
+
+public class PassageWidget extends Widget {
+    /**
+     * a list of VerseLabel (wrappers of bible text) that are currently being
+     * displayed and contain lemmas
+     */
+    private final List<VerseLabel> lemmaWords = new ArrayList<VerseLabel>();
+
+    /**
+     * a list of VerseLabel (wrappers of bible text) that are currently being
+     * displayed and contain morphs
+     */
+    private final List<VerseLabel> morphs = new ArrayList<VerseLabel>();
+
+    /** a label that does not need to be recreated each time */
+    private final Label passageTitle = new Label();
+    private final Panel passageHolder = new FlowPanel();
+    private final Panel mainPassage = new FlowPanel();
+
+    public PassageWidget() {
+        super.setElement(passageHolder.getElement());
+        passageHolder.add(passageTitle);
+        passageHolder.add(mainPassage);
+
+        setStyles();
+    }
+
+    private void setStyles() {
+        passageTitle.addStyleName("passageTitle");
+
+    }
+
+    /**
+     * sets a new passage up.
+     * 
+     * @param passage
+     */
+    public void setPassage(final Passage passage) {
+        mainPassage.clear();
+
+        final List<PassageElementWidget> passageElementWidgets = new ArrayList<PassageElementWidget>();
+
+        Log.info("" + System.currentTimeMillis());
+        final List<PassageElement> passageElements = passage.getRootPassageNode().getChildren();
+        for (final PassageElement passageElement : passageElements) {
+            passageElementWidgets.add(new PassageElementWidget(passageElement));
+        }
+
+        Log.info("" + System.currentTimeMillis());
+
+        // add all verses to holder
+        for (final PassageElementWidget passageElementWidget : passageElementWidgets) {
+            mainPassage.add(passageElementWidget);
+        }
+        Log.info("" + System.currentTimeMillis());
+    }
+
+    /**
+     * at least now we're doing verses in one go, but maybe we can find a way of
+     * doing everything in one go if this is faster.
+     * 
+     * @param verses
+     *            a list of verses to add
+     */
+    private void addAllVerses(final List<Panel> verses) {
+        for (final Panel v : verses) {
+            mainPassage.add(v);
+        }
+    }
+
+    /**
+     * highlights a particular word in a passage, according to the lemmas that
+     * are similar
+     * 
+     * @param lemmaList
+     *            the list of lemmas to highlight in the passage
+     */
+    public void highlight(final List<String> lemmaList) {
+        for (final VerseLabel vl : lemmaWords) {
+            for (final String l : lemmaList) {
+                if (vl.getLemma().contains(l)) {
+                    vl.setStyleName(ScriptureDisplayConstants.EMPHASISE);
+                } else {
+                    vl.removeStyleName(ScriptureDisplayConstants.EMPHASISE);
+                }
+            }
+        }
+    }
+
+    // /**
+    // * Create an element to display a title
+    // *
+    // * @param v
+    // * the logical representation of a title
+    // */
+    // private void doTitle(final Title v) {
+    // passageTitle.setText(v.getText());
+    // }
+    //
+    // /**
+    // * Create a display for the verse
+    // *
+    // * @param v
+    // * the logical representation of the verse
+    // */
+    // private Panel doVerse(final Verse v) {
+    // VerseLabel vl;
+    // final Panel verseContainer = new FlowPanel();
+    //
+    // for (final TextualElement text : v.getVerseContent()) {
+    // if (!shouldShow(text)) {
+    // continue;
+    // }
+    //
+    // // check that text is not nullable
+    // if (text.getText() != null) {
+    // vl = new VerseLabel(text.getText());
+    // verseContainer.add(vl);
+    //
+    // // then do specifics
+    // if (text instanceof Word) {
+    // final Word w = (Word) text;
+    // // if there's an alternative, then we ensure that we set
+    // // that up
+    // // eventually UI design will mean changes here
+    // vl.setAlternativeWord(w.getAlternativeWord());
+    //
+    // final List<String> lemma = w.getLemma();
+    // if (lemma != null) {
+    // lemmaWords.add(vl);
+    // vl.setLemmas(lemma);
+    // }
+    //
+    // final List<String> morph = w.getMorph();
+    // if (morph != null) {
+    // vl.setMorphs(morph);
+    // morphs.add(vl);
+    // }
+    // }
+    // }
+    // }
+    // return verseContainer;
+    // }
+}

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -6,6 +6,9 @@
 import com.google.gwt.event.dom.client.FocusEvent;
 import com.google.gwt.event.dom.client.FocusHandler;
 import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.Button;
@@ -65,6 +68,14 @@
             }
         });
 
+        referenceTextbox.addKeyUpHandler(new KeyUpHandler() {
+
+            public void onKeyUp(final KeyUpEvent kue) {
+                if (kue.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+                    selectReferenceButton.click();
+                }
+            }
+        });
     }
 
     public HasClickHandlers getSelectReferenceButton() {

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -3,14 +3,12 @@
 import static com.tyndalehouse.step.web.client.toolkit.DecoratorUtils.removePadding;
 import static java.lang.Double.valueOf;
 
-import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.SortedMap;
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.BlurHandler;
 import com.google.gwt.event.dom.client.FocusEvent;
 import com.google.gwt.event.dom.client.FocusHandler;
 import com.google.gwt.event.dom.client.HasChangeHandlers;
@@ -23,7 +21,6 @@
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.InlineLabel;
 import com.google.gwt.user.client.ui.LayoutPanel;
 import com.google.gwt.user.client.ui.Panel;
 import com.google.gwt.user.client.ui.TextBox;
@@ -32,16 +29,10 @@
 import com.google.gwt.user.client.ui.Widget;
 import com.tyndalehouse.step.web.client.presenter.ScripturePresenter;
 import com.tyndalehouse.step.web.client.toolkit.HasSource;
-import com.tyndalehouse.step.web.client.toolkit.scripture.ScriptureDisplayConstants;
-import com.tyndalehouse.step.web.client.toolkit.scripture.VerseLabel;
+import com.tyndalehouse.step.web.client.toolkit.widgets.PassageWidget;
 import com.tyndalehouse.step.web.client.view.internal.Area;
 import com.tyndalehouse.step.web.client.view.internal.Version;
 import com.tyndalehouse.step.web.shared.scripture.Passage;
-import com.tyndalehouse.step.web.shared.scripture.TextualElement;
-import com.tyndalehouse.step.web.shared.scripture.Title;
-import com.tyndalehouse.step.web.shared.scripture.Verse;
-import com.tyndalehouse.step.web.shared.scripture.VerseContent;
-import com.tyndalehouse.step.web.shared.scripture.Word;
 
 /**
  * This view aims to show Scripture to the user. In order to do this, the user
@@ -56,31 +47,12 @@
     /** where the top of the scripture holder should be placed */
     private static final int SCRIPTURE_HOLDER_TOP = 20;
 
-    private String currentPassage;
-
-    /**
-     * a list of VerseLabel (wrappers of bible text) that are currently being
-     * displayed and contain lemmas
-     */
-    private final List<VerseLabel> lemmaWords;
-
-    /**
-     * a list of VerseLabel (wrappers of bible text) that are currently being
-     * displayed and contain morphs
-     */
-    private final List<VerseLabel> morphs;
-
     interface Binder extends UiBinder<Widget, ScriptureView> {
     }
 
     private static Binder binder = GWT.create(Binder.class);
 
-    /**
-     * a logical display of scripture, in that events can be attached to each of
-     * the elements on this panel
-     */
-    @UiField
-    protected Panel scriptureHolder;
+    private String currentPassage;
 
     /**
      * text box in which to filter by bible versions
@@ -102,18 +74,37 @@
     @UiField
     protected Panel selectorPanel;
     @UiField
-    Panel treePanel;
+    protected Panel treePanel;
     @UiField
-    Panel scriptureHolderDecorator;
+    protected Panel scriptureHolderDecorator;
 
     /**
+     * a logical display of scripture, in that events can be attached to each of
+     * the elements on this panel
+     */
+    protected @UiField
+    PassageWidget scriptureHolder;
+
+    private final KeyUpHandler typingFilterHandler = new KeyUpHandler() {
+        public void onKeyUp(final KeyUpEvent keyUp) {
+            if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
+                hideSuggestions();
+            } else if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+                // check for single item showing:
+                selectVersionIfAvailable();
+            } else if (!keyUp.isAnyModifierKeyDown()) {
+                showSuggestions();
+                refilterTree();
+            }
+        }
+    };
+
+    /**
      * The default constructor
      * 
      */
     public ScriptureView() {
         super.initWidget(binder.createAndBindUi(this));
-        lemmaWords = new ArrayList<VerseLabel>();
-        morphs = new ArrayList<VerseLabel>();
 
         // set initial properties
         bibleVersionSuggestion.setStyleName("prompt");
@@ -123,8 +114,30 @@
         hideSuggestions();
         addHandlersForFilterBox();
         addHandlersForTree();
+
     }
 
+    private void selectVersionIfAvailable() {
+        final String selectedVersion = this.bibleVersionSuggestion.getText();
+        final Iterator<TreeItem> treeIterator = bibleVersions.treeItemIterator();
+        while (treeIterator.hasNext()) {
+            final TreeItem nextItem = treeIterator.next();
+            final Object userObject = nextItem.getUserObject();
+            if (userObject instanceof Version) {
+                final Version v = (Version) userObject;
+                if (v.getInitials().equalsIgnoreCase(selectedVersion) || v.getName().equalsIgnoreCase(selectedVersion)) {
+                    bibleVersions.setSelectedItem(nextItem);
+                    // final SelectionEvent<TreeItem> selectionEventItem = new
+                    // SelectionEvent<TreeItem>(nextItem) {
+                    // };
+                    // bibleVersions.fireEvent(selectionEventItem);
+
+                    return;
+                }
+            }
+        }
+    }
+
     @Override
     public void setWidth(final String width) {
         // super.setWidth(width);
@@ -148,33 +161,6 @@
         }
     }
 
-    public void highlight(final List<String> lemmaList) {
-        for (final VerseLabel vl : lemmaWords) {
-            for (final String l : lemmaList) {
-                if (vl.getLemma().contains(l)) {
-                    vl.setStyleName(ScriptureDisplayConstants.EMPHASISE);
-                } else {
-                    vl.removeStyleName(ScriptureDisplayConstants.EMPHASISE);
-                }
-            }
-        }
-    }
-
-    public void setPassage(final Passage passage) {
-        final List<VerseContent> verseContent = passage.getVerseContent();
-
-        // clear current text:
-        scriptureHolder.clear();
-
-        for (final VerseContent v : verseContent) {
-            if (v instanceof Title) {
-                doTitle((Title) v);
-            } else if (v instanceof Verse) {
-                doVerse((Verse) v);
-            }
-        }
-    }
-
     public void startProcessing() {
     }
 
@@ -182,56 +168,6 @@
     }
 
     /**
-     * Create an element to display a title
-     * 
-     * @param v
-     *            the logical representation of a title
-     */
-    private void doTitle(final Title v) {
-        final InlineLabel il = new InlineLabel(v.getText());
-        scriptureHolder.add(il);
-    }
-
-    /**
-     * Create a display for the verse
-     * 
-     * @param v
-     *            the logical representation of the verse
-     */
-    private void doVerse(final Verse v) {
-        VerseLabel vl;
-
-        for (final TextualElement text : v.getVerseContent()) {
-            // check that text is not nullable
-            if (text.getText() != null) {
-                vl = new VerseLabel(text.getText() /* TODO eventBus */);
-                scriptureHolder.add(vl);
-
-                // then do specifics
-                if (text instanceof Word) {
-                    final Word w = (Word) text;
-                    // if there's an alternative, then we ensure that we set
-                    // that up
-                    // eventually UI design will mean changes here
-                    vl.setAlternativeWord(w.getAlternativeWord());
-
-                    final List<String> lemma = w.getLemma();
-                    if (lemma != null) {
-                        lemmaWords.add(vl);
-                        vl.setLemmas(lemma);
-                    }
-
-                    final List<String> morph = w.getMorph();
-                    if (morph != null) {
-                        vl.setMorphs(morph);
-                        morphs.add(vl);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
      * @return the currentPassage
      */
     public String getCurrentPassage() {
@@ -250,17 +186,7 @@
      * adds the default handlers for the filter box
      */
     private void addHandlersForFilterBox() {
-        // add internal handlers
-        bibleVersionSuggestion.addKeyUpHandler(new KeyUpHandler() {
-            public void onKeyUp(final KeyUpEvent keyUp) {
-                if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
-                    hideSuggestions();
-                } else if (!keyUp.isAnyModifierKeyDown()) {
-                    showSuggestions();
-                    refilterTree();
-                }
-            }
-        });
+        bibleVersionSuggestion.addKeyUpHandler(typingFilterHandler);
 
         bibleVersionSuggestion.addFocusHandler(new FocusHandler() {
             public void onFocus(final FocusEvent focusEvent) {
@@ -268,16 +194,12 @@
                     bibleVersionSuggestion.setText("");
                     bibleVersionSuggestion.removeStyleName("prompt");
                 }
+
+                // show the tree
+                showSuggestions();
             }
         });
 
-        // });
-        //
-        // bibleVersionSuggestion.addBlurHandler(new BlurHandler() {
-        // public void onBlur(final BlurEvent arg0) {
-        // // DeferredCommand.addCommand(hideSuggestionsCommand);
-        // }
-        // });
     }
 
     private void showSuggestions() {
@@ -292,6 +214,7 @@
      * adds handlers for tree
      */
     private void addHandlersForTree() {
+        bibleVersions.addKeyUpHandler(typingFilterHandler);
         bibleVersions.addSelectionHandler(new SelectionHandler<TreeItem>() {
             public void onSelection(final SelectionEvent<TreeItem> selectionEvent) {
                 if (selectionEvent.getSelectedItem().getChildCount() == 0) {
@@ -308,13 +231,6 @@
                 showSuggestions();
             }
         });
-
-        bibleVersions.addBlurHandler(new BlurHandler() {
-
-            public void onBlur(final BlurEvent arg0) {
-                hideSuggestions();
-            }
-        });
     }
 
     /**
@@ -457,19 +373,17 @@
         return newChild;
     }
 
-    //
-    // public HasClickHandlers getVersionSelectionButton() {
-    // return changeBibleVersion;
-    // }
-
     public HasKeyPressHandlers getVersionSelectionEntered() {
         return bibleVersionSuggestion;
     }
 
     public String getCurrentlySelectedVersion() {
-        final Area area = (Area) bibleVersions.getSelectedItem().getUserObject();
-        if (area != null && area instanceof Version) {
-            return ((Version) area).getInitials();
+        final TreeItem selectedItem = bibleVersions.getSelectedItem();
+        if (!(selectedItem == null)) {
+            final Area area = (Area) selectedItem.getUserObject();
+            if (area != null && area instanceof Version) {
+                return ((Version) area).getInitials();
+            }
         }
         return null;
     }
@@ -492,4 +406,12 @@
     public Widget getContainerWidget() {
         return this;
     }
+
+    public void highlight(final List<String> lemmas) {
+        // scriptureHolder.highlight(lemmas);
+    }
+
+    public void setPassage(final Passage passage) {
+        scriptureHolder.setPassage(passage);
+    }
 }

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css	2010-07-01 21:53:55 UTC (rev 145)
@@ -30,6 +30,22 @@
 	padding: 0 0.5em 0.5em 0;
 }
 
+.passageTitle {
+	font-family: Tahoma;
+	font-size: 14px;
+	font-weight: bold;	
+}
+
+.passageWord {
+	font-family: Tahoma;
+	font-size: 12px;
+	font-weight: italics;			
+}
+
+.passageLineBreak {
+	
+}
+
 /****************************************************************************
 * Scripture display component
 *****************************************************************************/

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,38 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import java.util.List;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.tyndalehouse.step.web.shared.result.beans.BibleVersion;
-
-/**
- * This is in response to a @see
- * {@link com.tyndalehouse.step.web.share.command.GetAvailableBibleVersionsCommand}
- * In essence, this contains a sorted map of books to be displayed on the UI.
- * The intials are the key into JSword and should be used at all times when sent
- * back to the server.
- * 
- * @author cjburrell
- * 
- */
-public class GetAvailableBibleVersionsResult implements Result {
-    private static final long serialVersionUID = 1441380470741483969L;
-
-    List<BibleVersion> bibleVersions;
-
-    /**
-     * @return the bibleVersions
-     */
-    public List<BibleVersion> getBibleVersions() {
-        return bibleVersions;
-    }
-
-    /**
-     * @param bibleVersions
-     *            the bibleVersions to set
-     */
-    public void setBibleVersions(final List<BibleVersion> bibleVersions) {
-        this.bibleVersions = bibleVersions;
-    }
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,53 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-/**
- * Result from the GetBibleBooksCommand which contains the list of books
- * 
- * @author CJBurrell
- * 
- */
-public class GetBibleBooksCommandResult implements Result {
-
-    /**
-	 * 
-	 */
-    private static final long serialVersionUID = -26170538247007172L;
-
-    /**
-     * the list of books
-     */
-    private List<String> books;
-
-    /**
-     * the list of bible books provided to the constructor
-     * 
-     * @param books
-     *            the list of books
-     */
-    public GetBibleBooksCommandResult(final List<String> books) {
-        this.books = books;
-    }
-
-    /**
-     * this constructor is used for reflection and must be present
-     */
-    @SuppressWarnings("unused")
-    private GetBibleBooksCommandResult() {
-
-    }
-
-    /**
-     * returns a list of books
-     * 
-     * @return the list of books
-     */
-    public Collection<String> getBooks() {
-        return Collections.unmodifiableList(books);
-    }
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,86 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.tyndalehouse.step.web.shared.scripture.Passage;
-
-/**
- * Result from a command, representing a biblical text
- * 
- * @author CJBurrell
- * 
- */
-public class GetCurrentBibleTextResult implements Result {
-
-    /**
-	 * 
-	 */
-    private static final long serialVersionUID = -5781394877510591218L;
-
-    /**
-     * the passage in logical form
-     */
-    private Passage passage;
-
-    /**
-     * the passage text
-     */
-    private String passageText;
-
-    /**
-     * The xslted text
-     */
-    private String xsltedText;
-
-    /**
-     * returns the logical form passage
-     * 
-     * @return the logical form of the passage
-     */
-    public Passage getPassage() {
-        return passage;
-    }
-
-    /**
-     * returns the passage text
-     * 
-     * @return the passage text
-     */
-    public String getPassageText() {
-        return passageText;
-    }
-
-    /**
-     * @return the xsltedText
-     */
-    public String getXsltedText() {
-        return xsltedText;
-    }
-
-    /**
-     * sets the logical form of the passage
-     * 
-     * @param p
-     *            passage
-     */
-    public void setPassage(final Passage p) {
-        this.passage = p;
-    }
-
-    /**
-     * @param passageText
-     *            the passageText to set
-     */
-    public void setPassageText(final String passageText) {
-        this.passageText = passageText;
-    }
-
-    /**
-     * @param xsltedText
-     *            the xsltedText to set
-     */
-    public void setXsltedText(final String xsltedText) {
-        this.xsltedText = xsltedText;
-    }
-
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,55 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-/**
- * The dictionary definition that was looked up from the
- * GetDictionaryDefinitionCommand
- * 
- * @author CJBurrell
- * 
- */
-public class GetDictionaryDefinitionResult implements Result {
-
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = 3121326970467885008L;
-
-    /**
-     * the xslted definition of the definition that was looked up
-     */
-    private String xsltedDefinition;
-
-    /**
-     * Default constructor
-     */
-    public GetDictionaryDefinitionResult() {
-
-    }
-
-    /**
-     * @return the xsltedDefinition
-     */
-    public String getXsltedDefinition() {
-        return xsltedDefinition;
-    }
-
-    /**
-     * sets the definition
-     * 
-     * @param xsltedDefinition
-     *            the definition to be set
-     */
-    public void setDefinition(final String xsltedDefinition) {
-        this.xsltedDefinition = xsltedDefinition;
-    }
-
-    /**
-     * @param xsltedDefinition
-     *            the xsltedDefinition to set
-     */
-    public void setXsltedDefinition(final String xsltedDefinition) {
-        this.xsltedDefinition = xsltedDefinition;
-    }
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,58 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.tyndalehouse.step.web.shared.common.timeline.TimelineEventBean;
-
-/**
- * Result containing all events requested within a particular date range.
- * 
- * @author CJBurrell
- * 
- */
-public class GetEventsForDateRangeResult implements Result {
-
-    /**
-     * default serial id
-     */
-    private static final long serialVersionUID = 7118668612721569823L;
-
-    /** list of events */
-    private List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
-
-    /**
-     * public constructor
-     */
-    public GetEventsForDateRangeResult() {
-
-    }
-
-    /**
-     * Adds a new Event in Tim to the response
-     * 
-     * @param teb
-     *            the event to add to the response
-     */
-    public void add(final TimelineEventBean teb) {
-        getEvents().add(teb);
-
-    }
-
-    /**
-     * @return a list of events within a specified date range
-     */
-    public List<TimelineEventBean> getEvents() {
-        return events;
-    }
-
-    /**
-     * @param events
-     *            the events to set
-     */
-    public void setEvents(final List<TimelineEventBean> events) {
-        this.events = events;
-    }
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,51 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.tyndalehouse.step.web.shared.common.maps.GeoLocation;
-
-/**
- * This object contains the result from a geographical location, containing
- * enough data to display a marker on the screen, and a hover over.
- * 
- * @author CJBurrell
- * 
- */
-public class GetLocationsResult implements Result {
-
-    /**
-     * serial id for serialisation
-     */
-    private static final long serialVersionUID = 1516648078862839012L;
-
-    /**
-     * list of locations
-     */
-    private List<GeoLocation> locations;
-
-    /**
-     * default constructor
-     */
-    public GetLocationsResult() {
-        locations = new ArrayList<GeoLocation>();
-    }
-
-    /**
-     * @return the locations
-     */
-    public final List<GeoLocation> getLocations() {
-        return locations;
-    }
-
-    /**
-     * @param locations
-     *            the locations to set
-     */
-    public final void setLocations(final List<GeoLocation> locations) {
-        this.locations = locations;
-    }
-
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,139 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.tyndalehouse.step.web.shared.timeline.Unit;
-
-/**
- * Result from querying the server for the best event to use as the origin of
- * the timeline. This event is the one that best suits the verse range provided
- * by the user
- * 
- * @author CJBurrell
- * 
- */
-public class GetTimelineOriginForScriptureResult implements Result {
-    /**
-     * generated serial version id
-     */
-    private static final long serialVersionUID = 4256230588330550554L;
-
-    /**
-     * whether no data was returned, because no events matched the biblical
-     * reference
-     */
-    private boolean isEmpty;
-
-    /**
-     * the date of the recommended
-     */
-    private Long originDate;
-
-    /**
-     * the suggested timescale the UI should use
-     */
-    private Unit suggestedTimeScale;
-
-    /**
-     * the timeband id on which this date should be used
-     */
-    private int timebandId;
-
-    /**
-     * public constructor for this result object
-     * 
-     * @param isEmpty
-     *            true if no data was found
-     */
-    public GetTimelineOriginForScriptureResult(final boolean isEmpty) {
-        this.isEmpty = isEmpty;
-    }
-
-    /**
-     * another constructor to provide the correct origin information, including
-     * 
-     * @param originDate
-     *            the date at which the timeline should be positioned
-     * @param unit
-     *            the unit that should be used for this timeband
-     * @param timebandId
-     *            the timeband id
-     */
-    public GetTimelineOriginForScriptureResult(final Long originDate, final Unit unit, final int timebandId) {
-        this.originDate = originDate;
-        this.suggestedTimeScale = unit;
-        this.timebandId = timebandId;
-        isEmpty = false;
-    }
-
-    /**
-     * private constructor, used by GWT serialisation
-     */
-    @SuppressWarnings("unused")
-    private GetTimelineOriginForScriptureResult() {
-
-    }
-
-    /**
-     * @return the originDate
-     */
-    public Long getOriginDate() {
-        return originDate;
-    }
-
-    /**
-     * @return the suggestedTimeScale
-     */
-    public Unit getSuggestedTimeScale() {
-        return suggestedTimeScale;
-    }
-
-    /**
-     * gets the timeband id
-     * 
-     * @return timebandId
-     */
-    public int getTimebandId() {
-        return timebandId;
-    }
-
-    /**
-     * @return the isEmpty
-     */
-    public boolean isEmpty() {
-        return isEmpty;
-    }
-
-    /**
-     * @param isEmpty
-     *            the isEmpty to set
-     */
-    public void setEmpty(final boolean isEmpty) {
-        this.isEmpty = isEmpty;
-    }
-
-    /**
-     * @param originDate
-     *            the originDate to set
-     */
-    public void setOriginDate(final Long originDate) {
-        this.originDate = originDate;
-    }
-
-    /**
-     * @param unit
-     *            the suggestedTimeScale to set
-     */
-    public void setSuggestedTimeScale(final Unit unit) {
-        this.suggestedTimeScale = unit;
-    }
-
-    /**
-     * @param timebandId
-     *            the timebandId to set
-     */
-    public void setTimebandId(final int timebandId) {
-        this.timebandId = timebandId;
-    }
-
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,54 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import java.util.List;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-import com.tyndalehouse.step.web.shared.common.timeline.TimelineBean;
-
-/**
- * Response from a @see
- * {@link com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand}
- * This contains details on how to set up each timeband, their units, etc.
- * 
- * @author cjburrell
- * 
- */
-public class GetTimelineUISetupResult implements Result {
-
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = -566447989637280143L;
-
-    /**
-     * A list of timebands
-     */
-    private List<TimelineBean> tlb;
-
-    /**
-     * Default constructor made public
-     */
-    public GetTimelineUISetupResult() {
-
-    }
-
-    /**
-     * returns a list of timebands
-     * 
-     * @return a list of timeband beans
-     */
-    public List<TimelineBean> getTimelines() {
-        return tlb;
-    }
-
-    /**
-     * sets the list. made available for reflection
-     * 
-     * @param tlb
-     *            the list of timeline beans
-     */
-    public void setTimelines(final List<TimelineBean> tlb) {
-        this.tlb = tlb;
-    }
-}

Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,56 +0,0 @@
-package com.tyndalehouse.step.web.shared.result;
-
-import net.customware.gwt.dispatch.shared.Result;
-
-/**
- * Response from a @see
- * {@link com.tyndalehouse.step.web.shared.command.InstallJswordModuleCommand}
- * indicating whether the installation was succesful
- * 
- * @author cjburrell
- * 
- */
-public class InstallJswordModuleResult implements Result {
-    /**
-     * generated serial id
-     */
-    private static final long serialVersionUID = -5063510082176727310L;
-
-    /**
-     * true if installation was successful
-     */
-    private boolean successful;
-
-    /**
-     * Default constructor made public
-     */
-    public InstallJswordModuleResult() {
-
-    }
-
-    /**
-     * Constructor with the success flag passed in
-     * 
-     * @param successful
-     *            true to indicate success
-     */
-    public InstallJswordModuleResult(final boolean successful) {
-        this.successful = successful;
-
-    }
-
-    /**
-     * @return the successful
-     */
-    public boolean isSuccessful() {
-        return successful;
-    }
-
-    /**
-     * @param successful
-     *            the successful to set
-     */
-    public void setSuccessful(final boolean successful) {
-        this.successful = successful;
-    }
-}

Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,5 +1,5 @@
 <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'
-	xmlns:step='urn:import:com.tyndalehouse.step.web.client.view'>
+	xmlns:step='urn:import:com.tyndalehouse.step.web.client.toolkit.widgets'>
 
 	<ui:with type='com.tyndalehouse.step.web.client.framework.StepResources' field='resources' />
 	<ui:style src="views.css" />
@@ -14,17 +14,15 @@
 		</g:layer>
 
 		<g:layer top='25px' height='300px'>
-			<g:DecoratorPanel ui:field='scriptureHolderDecorator'>
-				<g:FlowPanel ui:field='scriptureHolder' >
-					<g:HTML>hello</g:HTML>
-				</g:FlowPanel>
+			<g:DecoratorPanel ui:field='scriptureHolderDecorator'>	
+				<step:PassageWidget ui:field='scriptureHolder' />
 			</g:DecoratorPanel>
 		</g:layer>
 
  		<g:layer top='20px' height='300px'>
-			<g:SimplePanel ui:field='treePanel'>
+			<g:ScrollPanel ui:field='treePanel'>
 				<g:Tree ui:field='bibleVersions' addStyleNames="{style.lightPanelBackground}" />				
-			</g:SimplePanel>
+			</g:ScrollPanel>
 		</g:layer>
 	</g:LayoutPanel>
 </ui:UiBinder>

Deleted: trunk/step-web-app/src/main/resources/log4j.properties
===================================================================
--- trunk/step-web-app/src/main/resources/log4j.properties	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-app/src/main/resources/log4j.properties	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,17 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1, A2
-
-# A1 is set to be a ConsoleAppender.
-# A1 uses PatternLayout.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
-
-
-# messages on second appender
-log4j.appender.A2=org.apache.log4j.RollingFileAppender
-log4j.appender.A2.File=../logs/step-server.log
-log4j.appender.A2.MaxFileSize=100KB
-log4j.appender.A2.MaxBackupIndex=1
-log4j.appender.A2.layout=org.apache.log4j.PatternLayout
-log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n

Modified: trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java
===================================================================
--- trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -14,6 +14,8 @@
 import com.tyndalehouse.step.web.server.handler.GetEventsForDateRangeHandler;
 import com.tyndalehouse.step.web.server.handler.GetTimelineOriginForScriptureHandler;
 import com.tyndalehouse.step.web.server.handler.GetTimelineUISetupHandler;
+import com.tyndalehouse.step.web.server.service.JSwordService;
+import com.tyndalehouse.step.web.server.service.impl.JSwordServiceImpl;
 
 /**
  * Module which binds the handlers and configurations
@@ -31,7 +33,7 @@
         bindHandler(GetTimelineUISetupHandler.class);
         bindHandler(GetTimelineOriginForScriptureHandler.class);
         bindHandler(GetDictionaryDefinitionHandler.class);
-
+        bind(JSwordService.class).to(JSwordServiceImpl.class).in(Singleton.class);
         bind(StepQueryRunner.class).to(StepQueryRunnerImpl.class).in(Singleton.class);
     }
 }

Modified: trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java
===================================================================
--- trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,49 +1,37 @@
 package com.tyndalehouse.step.web.server.handler;
 
+import static com.tyndalehouse.step.web.shared.scripture.PassageLanguage.resolveFromCode;
+import static org.apache.commons.lang.StringUtils.isEmpty;
+import static org.apache.commons.lang.StringUtils.split;
+
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
-import javax.xml.transform.TransformerException;
-
 import net.customware.gwt.dispatch.server.ExecutionContext;
 import net.customware.gwt.dispatch.shared.ActionException;
 
-import org.apache.commons.lang.StringUtils;
-import org.crosswire.common.util.Reporter;
-import org.crosswire.common.xml.SAXEventProvider;
-import org.crosswire.common.xml.TransformingSAXEventProvider;
-import org.crosswire.common.xml.XMLUtil;
-import org.crosswire.jsword.book.Book;
-import org.crosswire.jsword.book.BookData;
-import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.BookMetaData;
-import org.crosswire.jsword.book.Books;
 import org.crosswire.jsword.book.OSISUtil;
-import org.crosswire.jsword.passage.NoSuchKeyException;
 import org.jdom.Attribute;
 import org.jdom.Content;
 import org.jdom.Element;
 import org.jdom.Text;
 import org.jdom.filter.Filter;
-import org.xml.sax.SAXException;
 
 import com.google.inject.Inject;
 import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
 import com.tyndalehouse.step.web.server.common.JSwordConstants;
+import com.tyndalehouse.step.web.server.handler.util.passage.OsisParserFilter;
 import com.tyndalehouse.step.web.server.handler.util.passage.StrongMorphMap;
-import com.tyndalehouse.step.web.server.jsword.ConfigurableHTMLConverter;
+import com.tyndalehouse.step.web.server.service.JSwordService;
 import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
 import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
-import com.tyndalehouse.step.web.shared.scripture.Milestone;
-import com.tyndalehouse.step.web.shared.scripture.Note;
-import com.tyndalehouse.step.web.shared.scripture.OSISConstants;
+import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
 import com.tyndalehouse.step.web.shared.scripture.Passage;
-import com.tyndalehouse.step.web.shared.scripture.TextualElement;
-import com.tyndalehouse.step.web.shared.scripture.Title;
-import com.tyndalehouse.step.web.shared.scripture.TransChange;
-import com.tyndalehouse.step.web.shared.scripture.Verse;
-import com.tyndalehouse.step.web.shared.scripture.VerseContent;
-import com.tyndalehouse.step.web.shared.scripture.Word;
+import com.tyndalehouse.step.web.shared.scripture.PassageElement;
+import com.tyndalehouse.step.web.shared.scripture.PassageLanguage;
 
 /**
  * Command handler returning a portion of scripture in different formats
@@ -53,62 +41,62 @@
  */
 public class GetCurrentBibleTextHandler extends
         AbstractStepHandler<GetCurrentBibleTextCommand, GetCurrentBibleTextResult> {
+    private static final String LEMMA_MORPH_SEPARATOR = ",";
+    private Set<OsisElementType> elementFilter;
+    private Set<OsisElementType> attributeFilter;
+    private final JSwordService jsword;
+    private String version;
+    private String reference;
 
-    /**
-     * default constructor with the getLogger
-     * 
-     */
     @Inject
-    public GetCurrentBibleTextHandler() {
-
+    public GetCurrentBibleTextHandler(final JSwordService jsword) {
+        this.jsword = jsword;
     }
 
     public GetCurrentBibleTextResult execute(final GetCurrentBibleTextCommand command, final ExecutionContext arg1)
             throws ActionException {
-        final String version = command.getVersion();
-        final String reference = command.getReference();
+        version = command.getVersion();
+        reference = command.getReference();
 
+        // TODO drive filter from UI
+        initFilters();
+
         // check information has been passed in
         // TODO: ensure error handling is handled properly
-        if (StringUtils.isEmpty(version)) {
+        if (isEmpty(version)) {
             throw new ActionException("Version was not provided");
         }
-        if (StringUtils.isEmpty(reference)) {
+        if (isEmpty(reference)) {
             throw new ActionException("Reference was not provided");
         }
 
         final GetCurrentBibleTextResult result = new GetCurrentBibleTextResult();
 
-        final BookData data = getBookData(version, reference);
-
         switch (command.getTypeOfLookup()) {
             case CLASSIC_INTERLINEAR:
-                addClassicInterlinear(result.getPassage(), reference);
+                addClassicInterlinear(result.getPassage());
                 break;
             case LOGICAL:
-                addLogicalLookup(result, data);
+                addLogicalLookup(result);
                 break;
-            case PLAIN_TEXT:
-                try {
-                    result.setPassageText(OSISUtil.getCanonicalText(data.getOsis()));
-                } catch (final BookException e) {
-                    throw new ActionException("Unable to get simple canonical text from book", e);
-                }
-                break;
             case REVERSE_INTERLINEAR:
-                addLogicalLookup(result, data);
-                addReverseInterlinear(result.getPassage(), reference);
+                addLogicalLookup(result);
+                addReverseInterlinear(result.getPassage());
                 break;
-            case XSLT:
-                result.setXsltedText(doXslt(data));
-                break;
-            default:
-                // do nothing since nothing was requested
-                break;
         }
         return result;
     }
 
+    void initFilters() {
+        if (elementFilter == null) {
+            elementFilter = OsisParserFilter.DEFAULT_ELEMENT_FILTER;
+        }
+
+        if (attributeFilter == null) {
+            attributeFilter = OsisParserFilter.DEFAULT_ATTRIBUTE_FILTER;
+        }
+    }
+
     public void rollback(final GetCurrentBibleTextCommand arg0, final GetCurrentBibleTextResult arg1,
             final ExecutionContext arg2) throws ActionException {
         getLogger().error("Get Current Bible Text rolling back");
@@ -120,10 +108,8 @@
      * 
      * @param p
      *            the logical passage to be populated
-     * @param reference
-     *            the reference
      */
-    private void addClassicInterlinear(final Passage p, final String reference) {
+    private void addClassicInterlinear(final Passage p) {
         // TODO: feature
         // identify the hebrew/greek version of the text, and get book data for
         // the appropriate version
@@ -145,8 +131,8 @@
      * @throws ActionException
      *             an exception thrown if the parsing or lookup goes bad
      */
-    private void addLogicalLookup(final GetCurrentBibleTextResult result, final BookData data) throws ActionException {
-        final Passage p = parseForGwt(data);
+    void addLogicalLookup(final GetCurrentBibleTextResult result) throws ActionException {
+        final Passage p = parseForGwt();
         result.setPassage(p);
     }
 
@@ -155,24 +141,23 @@
      * 
      * @param translatedText
      *            the passage as looked up in an non-original version
-     * @param reference
-     *            the reference of the text so we can add the original text onto
-     *            it
      * @throws ActionException
      *             action exception thrown during execution of the reverse
      *             interlinear process
      */
-    private void addReverseInterlinear(final Passage translatedText, final String reference) throws ActionException {
+    private void addReverseInterlinear(final Passage translatedText) throws ActionException {
         // first lookup passage from LXX or TODO user chosen version
         // TODO: cope with Hebrew
-        String versionToUse;
+        final String versionToUse;
         StrongMorphMap strongMorphMap;
 
-        if (isGreek(translatedText)) {
+        if (PassageLanguage.GREEK.equals(translatedText.getLanguage())) {
             versionToUse = JSwordConstants.DEFAULT_GREEK_INTERLINEAR_TEXT;
-        } else {
-            // assume Hebrew
+        } else if (PassageLanguage.HEBREW.equals(translatedText)) {
             versionToUse = JSwordConstants.DEFAULT_HEBREW_INTERLINEAR_TEXT;
+        } else {
+            // TODO remove all references to Action exceptions if possible
+            throw new ActionException("Unable to do reverse interlinear since base passage is neither Greek nor Hebrew");
         }
 
         // TODO: we need to do something different here,
@@ -180,199 +165,12 @@
         // allows us to use filters to get all children of a certain kind,
         // we want to end up with a keyed map, looking like [strong, morph?] ->
         // word
-        try {
-            strongMorphMap = getStrongMorphMap(getBookData(versionToUse, reference));
-        } catch (final BookException e) {
-            throw new ActionException("Unable to lookup source text and parse to StrongMorphMap", e);
-        }
+        strongMorphMap = getStrongMorphMap(versionToUse);
 
         mergePassages(translatedText, strongMorphMap);
     }
 
     /**
-     * parsing a milestone into a logical element
-     * 
-     * @param verseContent
-     *            the Content on which to append the logical element
-     * @param v
-     *            the verse
-     */
-    private void doMilestone(final Element verseContent, final Verse v) {
-        final Milestone m = new Milestone();
-        m.setMarker(verseContent.getAttributeValue(OSISConstants.MARKER));
-        m.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
-        v.addTextualElement(m);
-    }
-
-    /**
-     * parsing a note into a logical element
-     * 
-     * @param verseContent
-     *            the Content on which to append the logical element
-     * @param v
-     *            the verse
-     */
-    private void doNote(final Element verseContent, final Verse v) {
-        final Note n = new Note();
-        n.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
-        n.setText(verseContent.getText());
-        v.addTextualElement(n);
-    }
-
-    /**
-     * parses a title
-     * 
-     * @param titleElement
-     *            the xml title element
-     * @param passage
-     *            the passage to be parsed into
-     */
-    private void doTitle(final Element titleElement, final Passage passage) {
-        final Title title = new Title();
-        title.setType(titleElement.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
-        title.setText(titleElement.getText());
-        passage.addPassageElement(title);
-    }
-
-    /**
-     * parses a TransChange element
-     * 
-     * @param verseContent
-     *            the trans change element
-     * @param v
-     *            the verse to be parsed into
-     */
-    private void doTransChange(final Element verseContent, final Verse v) {
-        final TransChange t = new TransChange();
-        t.setType(verseContent.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE));
-        t.setText(verseContent.getText());
-        v.addTextualElement(t);
-    }
-
-    /**
-     * parses a verse xml element
-     * 
-     * @param e
-     *            the verse element
-     * @param passage
-     *            the passage to be parsed into
-     */
-    private void doVerse(final Element e, final Passage passage) {
-        final List<Content> verseWords = e.getContent();
-        final Verse v = new Verse();
-        v.setOsisID(e.getAttributeValue(OSISUtil.OSIS_ATTR_OSISID));
-        passage.addPassageElement(v);
-
-        for (final Content c : verseWords) {
-            if (c instanceof Element) {
-                final Element verseContent = (Element) c;
-                final String tagName = verseContent.getName();
-                if (tagName.equals(OSISUtil.OSIS_ELEMENT_W)) {
-                    doWord(verseContent, v);
-                } else if (tagName.equals(OSISUtil.OSIS_ELEMENT_NOTE)) {
-                    doNote(verseContent, v);
-                } else if (tagName.equals(OSISConstants.MILESTONE)) {
-                    doMilestone(verseContent, v);
-                } else if (tagName.equals(OSISConstants.TRANS_CHANGE)) {
-                    doTransChange(verseContent, v);
-                } else {
-                    getLogger().warn(String.format("Unexpected element %s", tagName));
-                }
-            } else if (c instanceof Text) {
-                final Text textElement = (Text) c;
-                final com.tyndalehouse.step.web.shared.scripture.Text t = new com.tyndalehouse.step.web.shared.scripture.Text(
-                        textElement.getText());
-                v.addTextualElement(t);
-            } else {
-                // we're in trouble
-                getLogger().warn("Content c is not recognised: " + c.getClass().getCanonicalName());
-            }
-        }
-    }
-
-    /**
-     * processes a word from the bible text passed in as XML
-     * 
-     * @param verseContent
-     *            verseContent in XML
-     * @param v
-     *            the object version of this word
-     */
-    private void doWord(final Element verseContent, final Verse v) {
-        final Word w = new Word();
-
-        final String lemmas = verseContent.getAttributeValue(OSISUtil.ATTRIBUTE_W_LEMMA);
-        final String morphs = verseContent.getAttributeValue(OSISUtil.ATTRIBUTE_W_MORPH);
-
-        // TODO: make a constant
-        if (lemmas != null) {
-            w.addLemmas(lemmas.split(" "));
-        }
-        if (morphs != null) {
-            w.addMorphs(morphs.split(" "));
-        }
-        w.setText(verseContent.getText());
-        v.addTextualElement(w);
-    }
-
-    /**
-     * does an xslt transformation on some OSIS text
-     * 
-     * @param data
-     *            data of the book to use and the key in the book.
-     * @return the passage xslted version
-     */
-    private String doXslt(final BookData data) {
-        if (data == null) {
-            return "";
-        }
-
-        // Make sure Hebrew displays from Right to Left
-        final BookMetaData bmd = data.getFirstBook().getBookMetaData();
-        if (bmd == null) {
-            return "";
-        }
-
-        try {
-            final SAXEventProvider osissep = data.getSAXEventProvider();
-
-            final TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) new ConfigurableHTMLConverter()
-                    .convert(osissep);
-            final String text = XMLUtil.writeToString(htmlsep);
-            return text;
-        } catch (final SAXException e) {
-            Reporter.informUser(this, e);
-        } catch (final BookException e) {
-            Reporter.informUser(this, e);
-        } catch (final TransformerException e) {
-            Reporter.informUser(this, e);
-        }
-        return "";
-    }
-
-    /**
-     * returns the book data using the JSword API
-     * 
-     * @param version
-     *            version to be looked up
-     * @param reference
-     *            reference of the passage
-     * @return the JSword BookData object
-     * @throws ActionException
-     *             an exception should an problem happen
-     */
-    private BookData getBookData(final String version, final String reference) throws ActionException {
-        try {
-            final Book currentBook = Books.installed().getBook(version);
-            final BookData data = new BookData(currentBook, currentBook.getKey(reference));
-            return data;
-        } catch (final NoSuchKeyException e) {
-            getLogger().error("An error occurred looking up the passage", e);
-            throw new ActionException(e);
-        }
-    }
-
-    /**
      * given a book data (referencing a biblical reference + a book), retrieves
      * the morphs and the Strong numbers (lemmas) in the passage to help in the
      * interlinear processing
@@ -381,12 +179,10 @@
      *            the bookData from JSword specialised for the reference and
      *            bible book
      * @return a map of strong numbers and morphs
-     * @throws BookException
-     *             an exception occuring during parsing of the OSIS XML
      */
     @SuppressWarnings("unchecked")
-    private StrongMorphMap getStrongMorphMap(final BookData bookData) throws BookException {
-        final Element osis = bookData.getOsisFragment();
+    private StrongMorphMap getStrongMorphMap(final String version) {
+        final Element osis = jsword.getOsisText(version, this.reference);
         final StrongMorphMap strongMorphMap = new StrongMorphMap();
         final Iterator<Element> it = osis.getDescendants(new Filter() {
             /**
@@ -418,30 +214,6 @@
     }
 
     /**
-     * Look at the first word with a lemma and return lemma[0] == 'G'
-     * 
-     * @param p
-     *            passage to be looked up
-     * @return true if the word with the first lemma is in Greek
-     */
-    private boolean isGreek(final Passage p) {
-        for (final VerseContent vc : p.getVerseContent()) {
-            if (vc instanceof Verse) {
-                final Verse v = (Verse) vc;
-                for (final TextualElement te : v.getVerseContent()) {
-                    if (te instanceof Word) {
-                        final Word w = (Word) te;
-                        if (w.getLemma() != null) {
-                            return w.getLemma().get(0).charAt(JSwordConstants.STRONG_PATTERN_START.length()) == JSwordConstants.STRONG_GREEK_MARKER;
-                        }
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
      * Iterates through the master passage and incorporates into it, the text
      * given and mapped in the strongMorphMap
      * 
@@ -450,44 +222,37 @@
      * @param strongMorphMap
      *            the map containing the links.
      */
-    // TODO: tidy up all the different iterator approaches, widely using
-    // instanceof
     private void mergePassages(final Passage masterPassage, final StrongMorphMap strongMorphMap) {
-        // iterate through the masterPassage, and lookup the strong morph map
-        final List<VerseContent> verseContent = masterPassage.getVerseContent();
-        List<String> lemma, morph;
-        for (final VerseContent vc : verseContent) {
-            if (vc instanceof Verse) {
-                final Verse v = (Verse) vc;
-                for (final TextualElement te : v.getVerseContent()) {
-                    if (te instanceof Word) {
-                        final Word w = (Word) te;
+        final List<PassageElement> passageElements = masterPassage.getRootPassageNode().getChildren();
 
-                        // we have several lemmas for each word, and therefore,
-                        // we need to loop round them
-                        lemma = w.getLemma();
-                        morph = w.getMorph();
+        String[] lemma, morph;
+        for (final PassageElement pe : passageElements) {
+            // of interest, only the words!
+            if (OsisElementType.WORD.equals(pe.getTypeOfElement())) {
+                // we have several lemmas for each word, and therefore,
+                // we need to loop round them
+                lemma = split(pe.getAttribute(OsisElementType.LEMMA), LEMMA_MORPH_SEPARATOR);
+                morph = split(pe.getAttribute(OsisElementType.MORPH), LEMMA_MORPH_SEPARATOR);
 
-                        final StringBuffer alternativeWording = new StringBuffer(64);
+                final StringBuffer alternativeWording = new StringBuffer(64);
 
-                        // we iterate through each lemma, knowing that we may
-                        // not have morphs at all (Hebrew text)
-                        // we cannot use the morph without the lemma, although
-                        // TODO: check what we're supposed to do
-                        // when we only have one morphology for several lemmas
-                        // always 0 or equal to number of lemmas
-                        for (int ii = 0; ii < lemma.size(); ii++) {
-                            final String l = lemma.get(ii);
-                            final String m = ii < morph.size() ? morph.get(ii) : null;
-                            final String text = strongMorphMap.get(l, m);
-                            if (text != null) {
-                                alternativeWording.append(text);
-                                alternativeWording.append(' ');
-                            }
-                            w.setAlternativeWord(alternativeWording.toString());
-                        }
+                // we iterate through each lemma, knowing that we may
+                // not have morphs at all (Hebrew text)
+                // we cannot use the morph without the lemma, although
+                // TODO: check what we're supposed to do
+                // when we only have one morphology for several lemmas
+                // always 0 or equal to number of lemmas
+                for (int ii = 0; ii < lemma.length; ii++) {
+                    final String l = lemma[ii];
+                    final String m = ii < morph.length ? morph[ii] : null;
+                    final String text = strongMorphMap.get(l, m);
+                    if (text != null) {
+                        alternativeWording.append(text);
+                        alternativeWording.append(' ');
                     }
+                    pe.addAttribute(OsisElementType.ALTERNATIVE_WORDING, alternativeWording.toString());
                 }
+
             }
         }
     }
@@ -495,42 +260,88 @@
     /**
      * parsing an element
      * 
-     * @param data
-     *            the book data to used as a basis for parsing
      * @return the passage once parsed, et al.
      * @throws ActionException
      *             an exception to bubble up to the web UI
      */
     @SuppressWarnings("unchecked")
     // TODO: upgrade to latest JSword version for generics
-    private Passage parseForGwt(final BookData data) throws ActionException {
-        Element osisFragment;
-        try {
-            osisFragment = data.getOsisFragment();
-        } catch (final BookException e1) {
-            throw new ActionException("Unable to get OSIS Fragment from selected version");
+    private Passage parseForGwt() throws ActionException {
+        final Passage passage = new Passage();
+        final PassageElement rootPassage = new PassageElement();
+        final Element osisFragment = jsword.getOsisText(version, reference);
+        final List<Content> contentItems = osisFragment.getContent();
+        passage.setRootPassageNode(rootPassage);
+        traverseTree(contentItems, rootPassage);
+        passage.setLanguage(resolveFromCode(jsword.getLanguage(version)));
+        return passage;
+    }
+
+    /**
+     * traverses the dom and creates passage
+     * 
+     * @param contentItems
+     *            the dom children
+     * @param passage
+     *            the passage that gets populated
+     */
+    void traverseTree(final List<Content> contentItems, final PassageElement passage) {
+        for (final Content item : contentItems) {
+            if (item instanceof Element) {
+                final Element elementToParse = (Element) item;
+                final PassageElement createdChild = processAttributes(elementToParse, passage);
+                // if this hasn't been filtered out:
+                if (createdChild != null) {
+                    final List<Content> children = elementToParse.getContent();
+                    traverseTree(children, createdChild);
+                } else {
+                    // TODO use slf4j
+                    getLogger().warn(
+                            ((Element) item).getName() + " with value " + ((Element) item).getValue() + " not created");
+                }
+            } else if (item instanceof Text) {
+                final String text = ((Text) item).getText();
+                final Map<OsisElementType, String> textProperties = new HashMap<OsisElementType, String>();
+                textProperties.put(OsisElementType.TEXT, text);
+                passage.addChildElement(new PassageElement(OsisElementType.TEXT, textProperties));
+            }
         }
+    }
 
-        final List<Content> l = osisFragment.getContent();
-        final Passage passage = new Passage();
+    /**
+     * maps the list of attributes in an element to a map
+     * 
+     * 
+     * @param element
+     *            the element to be parsed
+     * @param typeOfTag
+     *            the type of tag
+     * @param passage
+     *            the passage for which to add an element if necessary
+     */
+    PassageElement processAttributes(final Element element, final PassageElement passage) {
+        final OsisElementType typeOfTag = OsisElementType.forOsisType(element.getName());
+        // now let's see if we filter something out
+        if (elementFilter.contains(typeOfTag)) {
 
-        // First level can be title or verse
-        for (final Content el : l) {
-            // check whether we've just got text, or a verse or something
-            if (el instanceof Element) {
-                final Element e = (Element) el;
+            final Map<OsisElementType, String> attributeMap = new HashMap<OsisElementType, String>();
 
-                if (e.getName().equals(OSISUtil.OSIS_ELEMENT_TITLE)) {
-                    doTitle(e, passage);
-                } else if (e.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
-                    doVerse(e, passage);
+            // TODO: at the moment, adding all attributes?
+            final List<Attribute> attributes = element.getAttributes();
+            for (final Attribute a : attributes) {
+
+                final OsisElementType forOsisType = OsisElementType.forOsisType(a.getName());
+                if (forOsisType == null || !attributeFilter.contains(forOsisType)) {
+                    getLogger().debug("Attribute not returned: " + a + "in tag of type " + typeOfTag);
+                } else {
+                    attributeMap.put(forOsisType, a.getValue());
                 }
-            } else {
-                // this shouldn't happen
-                getLogger().warn("Unexpected text while parsing gwt");
             }
-        }
 
-        return passage;
+            final PassageElement pe = new PassageElement(typeOfTag, attributeMap);
+            passage.addChildElement(pe);
+            return pe;
+        }
+        return null;
     }
 }

Added: trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/OsisParserFilter.java
===================================================================
--- trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/OsisParserFilter.java	                        (rev 0)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/OsisParserFilter.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,37 @@
+package com.tyndalehouse.step.web.server.handler.util.passage;
+
+import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.TITLE;
+import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.VERSE;
+import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.WORD;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
+
+/**
+ * A set of filters for common use, that filter in particular components of the
+ * OSIS spec
+ * 
+ * @author CJBurrell
+ * 
+ */
+public class OsisParserFilter {
+    public static Set<OsisElementType> DEFAULT_ELEMENT_FILTER = initDefaultElementFilter();
+    public static Set<OsisElementType> DEFAULT_ATTRIBUTE_FILTER = initDefaultAttributeFilter();
+
+    private static Set<OsisElementType> initDefaultElementFilter() {
+        final Set<OsisElementType> defaultFilter = new HashSet<OsisElementType>();
+        defaultFilter.add(TITLE);
+        defaultFilter.add(VERSE);
+        defaultFilter.add(WORD);
+        defaultFilter.add(OsisElementType.LINE_BREAK);
+        return defaultFilter;
+    }
+
+    private static Set<OsisElementType> initDefaultAttributeFilter() {
+        final Set<OsisElementType> defaultFilter = new HashSet<OsisElementType>();
+        defaultFilter.add(OsisElementType.OSIS_ID);
+        return defaultFilter;
+    }
+}

Added: trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/JSwordService.java
===================================================================
--- trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/JSwordService.java	                        (rev 0)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/JSwordService.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,25 @@
+package com.tyndalehouse.step.web.server.service;
+
+import org.jdom.Element;
+
+public interface JSwordService {
+    /**
+     * returns the biblical text as xml dom
+     * 
+     * @param version
+     *            version to lookup
+     * @param reference
+     *            the reference to lookup
+     * @return
+     */
+    Element getOsisText(String version, String reference);
+
+    /**
+     * returns the language of the version specified
+     * 
+     * @param version
+     *            the version to lookup
+     * @return the language code
+     */
+    String getLanguage(String version);
+}

Added: trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImpl.java
===================================================================
--- trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImpl.java	                        (rev 0)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImpl.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,65 @@
+package com.tyndalehouse.step.web.server.service.impl;
+
+import org.apache.log4j.Logger;
+import org.crosswire.common.util.Language;
+import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookData;
+import org.crosswire.jsword.book.BookException;
+import org.crosswire.jsword.book.Books;
+import org.crosswire.jsword.passage.NoSuchKeyException;
+import org.jdom.Element;
+
+import com.tyndalehouse.step.web.server.service.JSwordService;
+import com.tyndalehouse.step.web.shared.InternalException;
+
+/**
+ * a service providing a wrapper around JSword
+ * 
+ * @author CJBurrell
+ * 
+ */
+// TODO go through implementing correct exception handling with runtime
+// exceptions being caught
+public class JSwordServiceImpl implements JSwordService {
+    private final Logger logger = Logger.getLogger(getClass());
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.tyndalehouse.step.web.server.service.JSwordService#getOsisText(java
+     * .lang.String, java.lang.String)
+     */
+    public Element getOsisText(final String version, final String reference) {
+        try {
+            final Book currentBook = Books.installed().getBook(version);
+            final BookData bookData = new BookData(currentBook, currentBook.getKey(reference));
+
+            return bookData.getOsisFragment();
+        } catch (final NoSuchKeyException e) {
+            throw new InternalException("The verse specified was not found: [" + reference + "]", e);
+        } catch (final BookException e) {
+            throw new InternalException("Unable to query the book data to retrieve specified passage [" + version
+                    + "] [" + reference + "]");
+        }
+    }
+
+    /**
+     * returns the language for a particular version
+     * 
+     * @param version
+     * @return
+     */
+    public String getLanguage(final String version) {
+        final Book currentBook = Books.installed().getBook(version);
+        if (currentBook == null) {
+            return null;
+        }
+
+        final Language language = currentBook.getLanguage();
+        if (language != null) {
+            return language.getCode();
+        }
+        return null;
+    }
+}

Copied: trunk/step-web-server/src/main/resources/log4j.properties (from rev 141, trunk/step-web-app/src/main/resources/log4j.properties)
===================================================================
--- trunk/step-web-server/src/main/resources/log4j.properties	                        (rev 0)
+++ trunk/step-web-server/src/main/resources/log4j.properties	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,17 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=DEBUG, A1, A2
+
+# A1 is set to be a ConsoleAppender.
+# A1 uses PatternLayout.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+
+# messages on second appender
+log4j.appender.A2=org.apache.log4j.RollingFileAppender
+log4j.appender.A2.File=../logs/step-server.log
+log4j.appender.A2.MaxFileSize=100KB
+log4j.appender.A2.MaxBackupIndex=1
+log4j.appender.A2.layout=org.apache.log4j.PatternLayout
+log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n

Modified: trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandlerTest.java
===================================================================
--- trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java	2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandlerTest.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,19 +1,20 @@
-package com.tyndalehouse.step.web.server.handlers;
+package com.tyndalehouse.step.web.server.handler;
 
-import net.customware.gwt.dispatch.shared.ActionException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 
-import org.apache.commons.logging.Log;
-import org.jmock.Expectations;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jdom.Content;
+import org.jdom.Element;
 import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
-import com.tyndalehouse.step.web.server.handler.GetCurrentBibleTextHandler;
-import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
-import com.tyndalehouse.step.web.shared.common.scripturelookup.BibleTextLookupType;
-import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
+import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
+import com.tyndalehouse.step.web.shared.scripture.PassageElement;
 
 /**
  * Tests the handler that retrieves scripture from the server
@@ -21,120 +22,201 @@
  * @author CJBurrell
  * 
  */
- at RunWith(JMock.class)
 public class GetCurrentBibleTextHandlerTest {
     /**
      * The standard context for mocking objects
      */
-    private final Mockery context = new Mockery();
+    private Mockery context;
 
+    @Before
+    public void setUp() {
+        context = new Mockery();
+    }
+
     /**
-     * tests a greek reverse interlinear
-     * 
-     * @throws ActionException
-     *             exception during test
-     **/
+     * tests a single node with no extras
+     */
     @Test
-    public void testGreekReverseInterlinear() throws ActionException {
-        final Log log = context.mock(Log.class);
+    public void testProcessAttributes() {
+        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(null);
+        final PassageElement passage = new PassageElement();
+        final Element title = new Element("title");
+        handler.initFilters();
+        final PassageElement element = handler.processAttributes(title, passage);
+        assertEquals(element.getTypeOfElement(), OsisElementType.TITLE);
+    }
 
-        context.checking(new Expectations() {
-            {
-                ignoring(log);
-            }
-        });
-
-        final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "acts 1:1");
-        cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
-
-        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
-        final GetCurrentBibleTextResult result = handler.execute(cmd, null);
-
-        Assert.assertNotNull(result.getPassage());
-        Assert.assertNotNull(result.getPassage().getVerseContent());
-        Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
-
-        // TODO: add interlinear specific stuff
-
+    /**
+     * tests a single node with multiple attributes
+     */
+    @Test
+    public void testProcessAttributesMultiple() {
+        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(null);
+        final PassageElement passage = new PassageElement();
+        final Element title = new Element("title");
+        title.setAttribute("osisID", "Gen.1.1");
+        title.setAttribute("blah", "interesting");
+        handler.initFilters();
+        final PassageElement element = handler.processAttributes(title, passage);
+        assertEquals(OsisElementType.TITLE, element.getTypeOfElement());
+        assertEquals("Gen.1.1", element.getAttribute(OsisElementType.OSIS_ID));
+        assertFalse(element.getValues().containsValue("interesting"));
     }
 
     /**
-     * tests hebrew reverse interlinear
-     * 
-     * @throws ActionException
-     *             an exception during execution
+     * tests tag filtered out
      */
     @Test
-    public void testHebrewReverseInterlinear() throws ActionException {
-        final Log log = context.mock(Log.class);
-
-        context.checking(new Expectations() {
-            {
-                ignoring(log);
-            }
-        });
-
-        final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "Gen 1:1");
-        cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
-
-        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
-        final GetCurrentBibleTextResult result = handler.execute(cmd, null);
-
-        Assert.assertNotNull(result.getPassage());
-        Assert.assertNotNull(result.getPassage().getVerseContent());
-        Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
-
-        // TODO: add interlinear specific stuff
-
+    public void testProcessAttributesSkipped() {
+        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(null);
+        final PassageElement passage = new PassageElement();
+        final Element title = new Element("blah");
+        handler.initFilters();
+        assertNull(handler.processAttributes(title, passage));
     }
 
     /**
-     * tests a logical lookup of the passage, as opposed to plain text
+     * Testing the following structure:
      * 
-     * @throws ActionException
-     *             exception during running
+     * <pre>
+     * - Title
+     *         => Text (xml)
+     * - Verse
+     *         => Word
+     *                  => Text (a word)
+     *         => Text(something)
+     * </pre>
      */
     @Test
-    public void testLogicalPassage() throws ActionException {
-        final Log log = context.mock(Log.class);
+    public void testTraverseTree() {
+        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(null);
+        final PassageElement passage = new PassageElement();
+        final List<Content> xmlContent = new ArrayList<Content>();
+        final Element title = new Element("title");
+        final Element verse = new Element("verse");
+        final Element word = new Element("w");
 
-        context.checking(new Expectations() {
-            {
-                ignoring(log);
-            }
-        });
+        title.setText("xml");
+        verse.addContent(word);
+        verse.addContent("Something");
 
-        final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
-        cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
+        word.addContent("a word");
 
-        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
-        final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+        xmlContent.add(title);
+        xmlContent.add(verse);
 
-        Assert.assertEquals(result.getPassage().getText(), "In the beginning, God created the heavens and the earth.");
-    }
+        handler.initFilters();
+        handler.traverseTree(xmlContent, passage);
 
-    /**
-     * An lookup for plain text
-     * 
-     * @throws ActionException
-     *             exception during the retrieval of the text
-     */
-    @Test
-    public void testLookupText() throws ActionException {
-        final Log log = context.mock(Log.class);
+        assertEquals(passage.getChildren().size(), 2);
+        final PassageElement verseElement = passage.getChildren().get(1);
+        assertEquals(verseElement.getTypeOfElement(), OsisElementType.VERSE);
 
-        context.checking(new Expectations() {
-            {
-                ignoring(log);
-            }
-        });
+        // children of verse
+        final PassageElement childWord = verseElement.getFirstChild();
+        final PassageElement childText = verseElement.getChild(1);
+        assertEquals(childWord.getTypeOfElement(), OsisElementType.WORD);
+        assertEquals(childText.getTypeOfElement(), OsisElementType.TEXT);
 
-        final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
-        cmd.setTypeOfLookup(BibleTextLookupType.PLAIN_TEXT);
+        assertEquals("a word", childWord.getFirstChild().getAttribute(OsisElementType.TEXT));
+        assertEquals("Something", childText.getAttribute(OsisElementType.TEXT));
 
-        final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
-        final GetCurrentBibleTextResult result = handler.execute(cmd, null);
-
-        Assert.assertEquals(result.getPassageText(), "In the beginning, God created the heavens and the earth.");
     }
+    // /**
+    // * tests a greek reverse interlinear
+    // *
+    // * @throws ActionException
+    // * exception during test
+    // **/
+    // @Test
+    // public void testGreekReverseInterlinear() throws ActionException {
+    // final Log log = context.mock(Log.class);
+    //
+    // context.checking(new Expectations() {
+    // {
+    // ignoring(log);
+    // }
+    // });
+    //
+    // final GetCurrentBibleTextCommand cmd = new
+    // GetCurrentBibleTextCommand("KJV", "acts 1:1");
+    // cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+    //
+    // final GetCurrentBibleTextHandler handler = new
+    // GetCurrentBibleTextHandler();
+    // final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+    //
+    // Assert.assertNotNull(result.getPassage());
+    // Assert.assertNotNull(result.getPassage().getVerseContent());
+    // Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
+    //
+    // // TODO: add interlinear specific stuff
+    //
+    // }
+    //
+    // /**
+    // * tests hebrew reverse interlinear
+    // *
+    // * @throws ActionException
+    // * an exception during execution
+    // */
+    // @Test
+    // public void testHebrewReverseInterlinear() throws ActionException {
+    // final Log log = context.mock(Log.class);
+    //
+    // context.checking(new Expectations() {
+    // {
+    // ignoring(log);
+    // }
+    // });
+    //
+    // final GetCurrentBibleTextCommand cmd = new
+    // GetCurrentBibleTextCommand("KJV", "Gen 1:1");
+    // cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+    //
+    // final GetCurrentBibleTextHandler handler = new
+    // GetCurrentBibleTextHandler();
+    // final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+    //
+    // Assert.assertNotNull(result.getPassage());
+    // Assert.assertNotNull(result.getPassage().getVerseContent());
+    // Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
+    //
+    // // TODO: add interlinear specific stuff
+    //
+    // }
+    //
+    // /**
+    // * tests a logical lookup of the passage, as opposed to plain text
+    // *
+    // * @throws ActionException
+    // * exception during running
+    // */
+    // @Test
+    // public void testLogicalPassage() throws ActionException {
+    // final GetCurrentBibleTextCommand cmd = new
+    // GetCurrentBibleTextCommand("ESV", "Gen 1:1");
+    // cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
+    //
+    // final GetCurrentBibleTextHandler handler = new
+    // GetCurrentBibleTextHandler();
+    // final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+    //
+    // Assert.assertEquals(result.getPassage().getText(),
+    // "In the beginning, God created the heavens and the earth.");
+    // }
+    //
+    // @Test
+    // public void testLogicalPassageCrossOverChapter() throws ActionException {
+    // final GetCurrentBibleTextCommand cmd = new
+    // GetCurrentBibleTextCommand("ESV", "Gen 1:15-2:5");
+    // cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
+    //
+    // final GetCurrentBibleTextHandler handler = new
+    // GetCurrentBibleTextHandler();
+    // final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+    //
+    // Assert.assertEquals(result.getPassage().getText(),
+    // "In the beginning, God created the heavens and the earth.");
+    // }
 }

Modified: trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandlerTest.java
===================================================================
--- trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java	2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandlerTest.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,4 +1,4 @@
-package com.tyndalehouse.step.web.server.handlers;
+package com.tyndalehouse.step.web.server.handler;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandlerTest.java
===================================================================
--- trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java	2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandlerTest.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,4 +1,4 @@
-package com.tyndalehouse.step.web.server.handlers;
+package com.tyndalehouse.step.web.server.handler;
 
 import java.util.ArrayList;
 

Modified: trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/JSwordInstallTest.java
===================================================================
--- trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java	2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/JSwordInstallTest.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,4 +1,4 @@
-package com.tyndalehouse.step.web.server.handlers;
+package com.tyndalehouse.step.web.server.handler;
 
 import net.customware.gwt.dispatch.shared.ActionException;
 

Added: trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImplTest.java
===================================================================
--- trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImplTest.java	                        (rev 0)
+++ trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/service/impl/JSwordServiceImplTest.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,40 @@
+package com.tyndalehouse.step.web.server.service.impl;
+
+import static com.tyndalehouse.step.web.shared.scripture.PassageLanguage.GREEK;
+import static com.tyndalehouse.step.web.shared.scripture.PassageLanguage.HEBREW;
+import static com.tyndalehouse.step.web.shared.scripture.PassageLanguage.OTHER;
+import static com.tyndalehouse.step.web.shared.scripture.PassageLanguage.resolveFromCode;
+import static org.junit.Assert.assertTrue;
+
+import org.jdom.Element;
+import org.junit.Test;
+
+import com.tyndalehouse.step.web.server.service.JSwordService;
+import com.tyndalehouse.step.web.shared.scripture.PassageLanguage;
+
+public class JSwordServiceImplTest {
+
+    @Test
+    public void testGetOsisText() {
+        final String version = "ESV";
+        final String reference = "Gen.1.1";
+
+        final JSwordService service = new JSwordServiceImpl();
+        final Element osisText = service.getOsisText(version, reference);
+        // a title and a verse
+        assertTrue(osisText.getContent().size() == 2);
+        assertTrue("title".equals(((Element) osisText.getChildren().get(0)).getName()));
+        assertTrue("verse".equals(((Element) osisText.getChildren().get(1)).getName()));
+    }
+
+    @Test
+    public void testGetLanguageOther() {
+        final String[] version = { "ESV", "WLC", "LXX", "" };
+        final PassageLanguage[] language = new PassageLanguage[] { OTHER, HEBREW, GREEK, OTHER };
+        final JSwordService service = new JSwordServiceImpl();
+        for (int ii = 0; ii < version.length; ii++) {
+            final String code = service.getLanguage(version[ii]);
+            assertTrue(language[ii].equals(resolveFromCode(code)));
+        }
+    }
+}

Added: trunk/step-web-server/src/test/resources/log4j.properties
===================================================================
--- trunk/step-web-server/src/test/resources/log4j.properties	                        (rev 0)
+++ trunk/step-web-server/src/test/resources/log4j.properties	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,17 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1, A2
+
+# A1 is set to be a ConsoleAppender.
+# A1 uses PatternLayout.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+
+# messages on second appender
+log4j.appender.A2=org.apache.log4j.RollingFileAppender
+log4j.appender.A2.File=../logs/step-server.log
+log4j.appender.A2.MaxFileSize=100KB
+log4j.appender.A2.MaxBackupIndex=1
+log4j.appender.A2.layout=org.apache.log4j.PatternLayout
+log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n

Modified: trunk/step-web-shared/pom.xml
===================================================================
--- trunk/step-web-shared/pom.xml	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/pom.xml	2010-07-01 21:53:55 UTC (rev 145)
@@ -13,7 +13,6 @@
 	<packaging>jar</packaging>
 	<name>step-web-shared</name>
 
-
 	<dependencies>
 		<dependency>
 			<groupId>net.customware.gwt.dispatch</groupId>
@@ -22,13 +21,15 @@
 	</dependencies>
 
 	<build>
-	    <resources>
-	      <resource>
-	        <directory>src/main/java</directory>
-	      </resource>
-	      <resource>
-	        <directory>src/main/resources</directory>
-	      </resource>
-	    </resources>
+
+		<resources>
+			<resource>
+				<directory>src/main/java</directory>
+			</resource>
+			<resource>
+				<directory>src/main/resources</directory>
+			</resource>
+		</resources>
+
 	</build>
 </project>

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -22,9 +22,6 @@
  * 
  */
 public class GetCurrentBibleTextCommand implements Action<GetCurrentBibleTextResult> {
-    /**
-     * serial id
-     */
     private static final long serialVersionUID = -6828956918275592036L;
 
     /**
@@ -44,6 +41,8 @@
      */
     private String version;
 
+    // private Set<OsisElementType> filter = null;
+
     /**
      * default constructor TODO: can this be made private? I think so
      */
@@ -109,4 +108,19 @@
         this.version = version;
     }
 
+    // /**
+    // * @return the filter
+    // */
+    // public Set<OsisElementType> getFilter() {
+    // return filter;
+    // }
+    //
+    // /**
+    // * @param filter
+    // * the filter to set
+    // */
+    // public void setFilter(final Set<OsisElementType> filter) {
+    // this.filter = filter;
+    // }
+
 }

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -11,10 +11,6 @@
     CLASSIC_INTERLINEAR,
     /** a logical form, POJO form of the text is required */
     LOGICAL,
-    /** only the text is required */
-    PLAIN_TEXT,
     /** a reverse interlinear is required */
     REVERSE_INTERLINEAR,
-    /** the text, using a default xslt is required */
-    XSLT,
 }

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,63 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-import java.io.Serializable;
-
-/**
- * A marker in the OSIS xml to indicate a break in the normal flow of text.
- * Usually editors layouts, I believe.
- * 
- * @author cjburrell
- * 
- */
-public class Milestone extends Text implements TextualElement, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = 6444472622836494795L;
-
-    /**
-     * optional marker
-     */
-    private String marker;
-
-    /**
-     * Type of milestone, see OSIS details for clarifications
-     */
-    private String type;
-
-    /**
-     * Default constructor made public
-     */
-    public Milestone() {
-    }
-
-    /**
-     * @return the marker
-     */
-    public String getMarker() {
-        return marker;
-    }
-
-    /**
-     * @return the type
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * @param marker
-     *            the marker to set
-     */
-    public void setMarker(final String marker) {
-        this.marker = marker;
-    }
-
-    /**
-     * @param type
-     *            the type to set
-     */
-    public void setType(final String type) {
-        this.type = type;
-    }
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,43 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-import java.io.Serializable;
-
-/**
- * A logical representation of some OSIS xml. This bean is serialised and passed
- * over the wire
- * 
- * @author cjburrell
- * 
- */
-public class Note extends Text implements TextualElement, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = 4592986819523938392L;
-
-    /**
-     * The type of note
-     */
-    private String type;
-
-    /**
-     * Default constructor made public
-     */
-    public Note() {
-    }
-
-    /**
-     * @return the type
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * @param type
-     *            the type to set
-     */
-    public void setType(final String type) {
-        this.type = type;
-    }
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,43 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-/**
- * Some constants not defined in JSword
- * 
- * @author cjburrell
- * 
- */
-public final class OSISConstants {
-    /**
-     * A marker in the text, for formatting purposes: TODO: check this and the
-     * other two with online people
-     */
-    public static final String MARKER = "marker";
-
-    /**
-     * A milestone, between two portions of scripture
-     */
-    public static final String MILESTONE = "milestone";
-
-    /**
-     * A decision by the translator to make a change?
-     */
-    public static final String TRANS_CHANGE = "transChange";
-
-    // public static final String LEMMA = "lemma";
-    // public static final String MORPH = "morph";
-    // public static final Object NOTE = "note";
-    // public static final String OSISID = "osisID";
-    // public static final String TITLE = "title";
-
-    // public static final String TYPE = "type";
-    // public static final String VERSE = "verse";
-    // public static final String WORD = "w";
-
-    /**
-     * Making the constructor private
-     */
-    private OSISConstants() {
-
-    }
-
-}

Added: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java	                        (rev 0)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,57 @@
+package com.tyndalehouse.step.web.shared.scripture;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public enum OsisElementType implements Serializable {
+    WORD("w"), NOTE("note"), MILESTONE("milestone"), TRANS_CHANGE("transChange"), MARKER("marker"), LINE_BREAK("lb"), TITLE(
+            "title"), LEMMA("lemma"), MORPH("morph"), ALTERNATIVE_WORDING("<alternativeWording>"), TEXT("<text>"), VERSE(
+            "verse"), OSIS_ID("osisID");
+
+    private final static Map<String, OsisElementType> cachedTypes = initialiseTypes();
+    private final String osisTag;
+
+    /**
+     * constructs the enum with an osis tag
+     * 
+     * @param osisTag
+     *            the osis tag
+     */
+    OsisElementType(final String osisTag) {
+        this.osisTag = osisTag;
+    }
+
+    /**
+     * initialises the internal map to speed up further lookups
+     * 
+     * @return the map reverse mapping for enum resolving
+     */
+    private static Map<String, OsisElementType> initialiseTypes() {
+        final Map<String, OsisElementType> types = new HashMap<String, OsisElementType>();
+        final OsisElementType[] values = OsisElementType.values();
+        for (final OsisElementType value : values) {
+            types.put(value.getOsisTag(), value);
+        }
+        return types;
+    }
+
+    /**
+     * resolves to the enum from the tag name
+     * 
+     * @param tagName
+     *            the tag name
+     * @return the resolved enum
+     */
+    public static OsisElementType forOsisType(final String tagName) {
+        return cachedTypes.get(tagName);
+    }
+
+    /**
+     * @return the osisTag
+     */
+    public String getOsisTag() {
+        return osisTag;
+    }
+
+}

Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,76 +1,39 @@
 package com.tyndalehouse.step.web.shared.scripture;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
 
-/**
- * Logical form of a passage
- * 
- * @author CJBurrell
- * 
- */
-public class Passage implements TextualElement, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = -3926440372519158967L;
+public class Passage implements Serializable {
+    private static final long serialVersionUID = -8107771273622629610L;
+    private PassageElement rootPassageNode = null;
+    private PassageLanguage language = null;
 
     /**
-     * List of verses/title throughout the passage
+     * @return the language
      */
-    private List<VerseContent> verseContent;
-
-    /**
-     * making the constructor public and initialising list
-     */
-    public Passage() {
-        verseContent = new ArrayList<VerseContent>();
+    public PassageLanguage getLanguage() {
+        return language;
     }
 
     /**
-     * Adding a passage element, such as a {@link Verse} or a {@link Title}
-     * 
-     * @param vc
-     *            a verse or a title
+     * @param language
+     *            the language to set
      */
-    public void addPassageElement(final VerseContent vc) {
-        verseContent.add(vc);
+    public void setLanguage(final PassageLanguage language) {
+        this.language = language;
     }
 
     /**
-     * returns the text representation of a passage. This is NOT performance
-     * optimized and therefore should not be used more than once.
-     * Non-optimization is due to the fact that we won't to reduce traffic over
-     * the wire
-     * 
-     *TODO: this could be further optimized by not relying on strings in
-     * versecontent being returned as strings
-     * 
-     * @return the passage in a string form.
+     * @return the rootPassageNode
      */
-    public String getText() {
-        final StringBuffer text = new StringBuffer(1024);
-        for (final VerseContent vc : verseContent) {
-            if (!(vc instanceof Title)) {
-                text.append(vc.getText());
-            }
-        }
-        return text.toString();
+    public PassageElement getRootPassageNode() {
+        return rootPassageNode;
     }
 
     /**
-     * @return the verseContent list of a combination of verses and titles
+     * @param rootPassageNode
+     *            the rootPassageNode to set
      */
-    public List<VerseContent> getVerseContent() {
-        return verseContent;
+    public void setRootPassageNode(final PassageElement rootPassageNode) {
+        this.rootPassageNode = rootPassageNode;
     }
-
-    /**
-     * @param verseContent
-     *            the verseContent to set
-     */
-    public void setVerseContent(final List<VerseContent> verseContent) {
-        this.verseContent = verseContent;
-    }
 }

Copied: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java (from rev 140, trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java)
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java	                        (rev 0)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,129 @@
+package com.tyndalehouse.step.web.shared.scripture;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Logical form of a passage, as a linear set of elements, one after the other
+ * 
+ * @author CJBurrell
+ * 
+ */
+public class PassageElement implements Serializable {
+    private static final long serialVersionUID = 8109574278673680875L;
+    private OsisElementType typeOfElement;
+    private Map<OsisElementType, String> values;
+    private List<PassageElement> children = null;
+
+    public PassageElement(final OsisElementType typeOfElement, final Map<OsisElementType, String> attributes) {
+        this.typeOfElement = typeOfElement;
+        this.values = attributes;
+    }
+
+    public PassageElement() {
+
+    }
+
+    /**
+     * @return the typeOfElement
+     */
+    public OsisElementType getTypeOfElement() {
+        return typeOfElement;
+    }
+
+    /**
+     * @param typeOfElement
+     *            the typeOfElement to set
+     */
+    public void setTypeOfElement(final OsisElementType typeOfElement) {
+        this.typeOfElement = typeOfElement;
+    }
+
+    /**
+     * @return the values
+     */
+    public Map<OsisElementType, String> getValues() {
+        return values;
+    }
+
+    /**
+     * @param values
+     *            the values to set
+     */
+    public void setValues(final Map<OsisElementType, String> values) {
+        this.values = values;
+    }
+
+    /**
+     * retrieves a value for an attribute
+     * 
+     * @param attributeName
+     *            attribute type
+     * @return the value corresponding to the type passed in
+     */
+    public String getAttribute(final OsisElementType attributeName) {
+        return values.get(attributeName);
+    }
+
+    /**
+     * returns the child at the correct index
+     * 
+     * @param childIndex
+     *            the index to retrieve in the list
+     * @return the passage element at the right index
+     */
+    public PassageElement getChild(final int childIndex) {
+        return this.children.get(childIndex);
+    }
+
+    /**
+     * returns the first child of this passage element
+     * 
+     * @return the first child
+     */
+    public PassageElement getFirstChild() {
+        return this.getChild(0);
+    }
+
+    /**
+     * adds an attribute to this element
+     * 
+     * @param key
+     *            the key as it is known by, identifying the type of attribute
+     * @param value
+     *            the value that is stored with it
+     */
+    public void addAttribute(final OsisElementType key, final String value) {
+        values.put(key, value);
+    }
+
+    /**
+     * adds a child element
+     * 
+     * @param pe
+     *            the passage element to be added as a child
+     */
+    public void addChildElement(final PassageElement pe) {
+        if (this.children == null) {
+            children = new ArrayList<PassageElement>();
+        }
+        this.children.add(pe);
+    }
+
+    /**
+     * @return the children
+     */
+    public List<PassageElement> getChildren() {
+        return children;
+    }
+
+    /**
+     * @param children
+     *            the children to set
+     */
+    public void setChildren(final List<PassageElement> children) {
+        this.children = children;
+    }
+}

Added: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageLanguage.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageLanguage.java	                        (rev 0)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageLanguage.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -0,0 +1,35 @@
+package com.tyndalehouse.step.web.shared.scripture;
+
+public enum PassageLanguage {
+    GREEK("grc"), HEBREW("he"), OTHER("<other>");
+
+    private final String isoCode;
+
+    PassageLanguage(final String isoCode) {
+        this.isoCode = isoCode;
+    }
+
+    /**
+     * @return the isoCode
+     */
+    String getIsoCode() {
+        return isoCode;
+    }
+
+    /**
+     * returns the passage language object corresponding to the code
+     * 
+     * @param code
+     *            the code to lookup
+     * @return
+     */
+    public static PassageLanguage resolveFromCode(final String code) {
+        final PassageLanguage[] values = values();
+        for (final PassageLanguage pl : values) {
+            if (pl.getIsoCode().equals(code)) {
+                return pl;
+            }
+        }
+        return OTHER;
+    }
+}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,53 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-import java.io.Serializable;
-
-/**
- * The Text class, a wrapper for String
- * 
- * @author CJBurrell
- * 
- */
-public class Text implements TextualElement, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = -7068301858306124428L;
-
-    /**
-     * the string representing the portion of scripture for each OSIS element
-     */
-    private String text;
-
-    /**
-     * A simple text, default constructor made public
-     */
-    public Text() {
-    }
-
-    /**
-     * Initialising a text with a String
-     * 
-     * @param text
-     *            text is the string representation of the #text element
-     */
-    public Text(final String text) {
-        this.text = text;
-    }
-
-    /**
-     * @return the text
-     */
-    public String getText() {
-        return text;
-    }
-
-    /**
-     * @param text
-     *            the text to set
-     */
-    public void setText(final String text) {
-        this.text = text;
-    }
-
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,18 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-/**
- * Interface being applied to anything that can contains text (directly or
- * indirectly)
- * 
- * @author CJBurrell
- * 
- */
-public interface TextualElement {
-
-    /**
-     * returns the text
-     * 
-     * @return text to be returned
-     */
-    String getText();
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,44 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-/**
- * Title element in the OSIS as a POJO
- * 
- * @author CJBurrell
- * 
- */
-public class Title extends Text implements VerseContent {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = -4362500737203594954L;
-
-    /**
-     * Type of title as defined in OSIS spec
-     */
-    private String type;
-
-    /**
-     * Making default constructor public
-     */
-    public Title() {
-    }
-
-    /**
-     * @return the type
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * type of title
-     * 
-     * @param type
-     *            title
-     */
-    public void setType(final String type) {
-        this.type = type;
-
-    }
-
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,42 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-import java.io.Serializable;
-
-/**
- * TODO: check OSIS details and update documentation
- * 
- * @author cjburrell
- * 
- */
-public class TransChange extends Text implements TextualElement, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = 4557607388014222750L;
-
-    /**
-     * Type of trans change
-     */
-    private String type;
-
-    /**
-     * Default constructor made public
-     */
-    public TransChange() {
-    }
-
-    /**
-     * @return the type
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * @param type
-     *            the type to set
-     */
-    public void setType(final String type) {
-        this.type = type;
-    }
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,95 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Logical representation of a verse from the OSIS
- * 
- * @author CJBurrell
- * 
- */
-public class Verse implements VerseContent, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = -7000973434382091156L;
-
-    /**
-     * the OSIS key, for e.g. gen 1:1
-     */
-    private String osisID;
-
-    /**
-     * list of textual elements that are contained in this verse
-     */
-    private List<TextualElement> verseContent;
-
-    /**
-     * public constructor to create a logical form of a verse
-     */
-    public Verse() {
-        verseContent = new ArrayList<TextualElement>();
-    }
-
-    /**
-     * adds a textual element to the verse
-     * 
-     * @param te
-     *            textual element
-     */
-    public void addTextualElement(final TextualElement te) {
-        this.verseContent.add(te);
-    }
-
-    /**
-     * @return the osisID
-     */
-    public String getOsisID() {
-        return osisID;
-    }
-
-    /**
-     * This method is not optimized for performance. It iterates through the
-     * list each time it is required. The reason it is not optimized, is that it
-     * should not be used except to display the text once.
-     * 
-     * Not storing the result of the concatenation enables us to have shorted
-     * messages going across the wire
-     * 
-     * @return the concatenated text
-     */
-    public String getText() {
-        final StringBuilder sb = new StringBuilder(128);
-        for (final TextualElement te : verseContent) {
-            if (!(te instanceof Note)) {
-                sb.append(te.getText());
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * @return the text
-     */
-    public List<TextualElement> getVerseContent() {
-        return verseContent;
-    }
-
-    /**
-     * @param osisID
-     *            the osisID to set
-     */
-    public void setOsisID(final String osisID) {
-        this.osisID = osisID;
-    }
-
-    /**
-     * @param text
-     *            the text to set
-     */
-    public void setVerseContent(final List<TextualElement> text) {
-        this.verseContent = text;
-    }
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/VerseContent.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/VerseContent.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/VerseContent.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,12 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-/**
- * This interfaces marks a verse or a title which are direct children of a
- * passage
- * 
- * @author CJBurrell
- * 
- */
-public interface VerseContent extends TextualElement {
-
-}

Deleted: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java	2010-07-01 21:50:21 UTC (rev 144)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java	2010-07-01 21:53:55 UTC (rev 145)
@@ -1,143 +0,0 @@
-package com.tyndalehouse.step.web.shared.scripture;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A Word is a portion of a verse from the Bible. It can be several words or
- * just one. In some versions it is associated with a list of lemmas (strong
- * numbers which link to the Strong Hebrew or Greek Dictionary), as well as a
- * morphological code (morph) which is a coded form of the morphology of the
- * word/set of words (i.e. grammar form and usage in the sentence)
- * 
- * @author cjburrell
- * 
- */
-public class Word extends Text implements TextualElement, Serializable {
-    /**
-     * serial id
-     */
-    private static final long serialVersionUID = -5750252359953024623L;
-
-    /**
-     * An alternative word, such as a different language
-     */
-    private String alternativeWord;
-
-    // TODO: FIX: this is a bug, we can have several lemmas or morphologies for
-    // one translated word
-    /**
-     * a list of lemmas referring to a portion of text
-     */
-    private List<String> lemma;
-
-    /**
-     * A list of morphs referring to a portion of text. A morph is a coded
-     * string indicating the grammar and form of the original word
-     */
-    private List<String> morph;
-
-    /**
-     * default constructor initialises internal lists
-     */
-    public Word() {
-        lemma = new ArrayList<String>();
-        morph = new ArrayList<String>();
-    }
-
-    /**
-     * Adds a new lemma to the Word
-     * 
-     * @param newLemma
-     *            the lemma to set
-     */
-    public void addLemma(final String newLemma) {
-        lemma.add(newLemma);
-    }
-
-    /**
-     * Adds an array of lemmas to the Word
-     * 
-     * @param lemmas
-     *            a list of lemmas
-     */
-    public void addLemmas(final String[] lemmas) {
-        for (final String l : lemmas) {
-            this.lemma.add(l);
-        }
-    }
-
-    /**
-     * Adds an array of morphs to the Word
-     * 
-     * @param morphs
-     *            array of morphs to be associated with the Word (portion of a
-     *            verse)
-     */
-    public void addMorphs(final String[] morphs) {
-        for (final String m : morphs) {
-            this.morph.add(m);
-        }
-
-    }
-
-    /**
-     * @return the alternativeWord
-     */
-    public String getAlternativeWord() {
-        return alternativeWord;
-    }
-
-    /**
-     * @return the lemma
-     */
-    public List<String> getLemma() {
-        return lemma;
-    }
-
-    /**
-     * @return the morph
-     */
-    public List<String> getMorph() {
-        return morph;
-    }
-
-    /**
-     * sets an alternative word (such as a hebrew original word)
-     * 
-     * @param alternativeWord
-     *            a word equivalent, different language. For e.g. Hebrew word
-     * 
-     */
-    public void setAlternativeWord(final String alternativeWord) {
-        this.alternativeWord = alternativeWord;
-    }
-
-    /**
-     * @param lemma
-     *            the lemma to set
-     */
-    public void setLemma(final List<String> lemma) {
-        this.lemma = lemma;
-    }
-
-    /**
-     * @param morph
-     *            the morph to set
-     */
-    public void setMorph(final List<String> morph) {
-        this.morph = morph;
-    }
-
-    /**
-     * Adding a morph to the Word
-     * 
-     * @param newMorph
-     *            the morph to set
-     */
-    public void setMorph(final String newMorph) {
-        morph.add(newMorph);
-    }
-
-}




More information about the Tynstep-svn mailing list