[Tynstep-svn] r148 - in trunk: step-web-app step-web-app/src/main/java/com/tyndalehouse/step/web step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework 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/handlers 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 step-web-app/src/main/java/com/tyndalehouse/step/web/public/css step-web-app/src/main/java/com/tyndalehouse/step/web/server step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/step step-web-app/src/main/resources/com/tyndalehouse/step/web 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/test/java/com/tyndalehouse/step/web/server/handler step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Wed Jul 14 08:02:55 MST 2010
Author: ChrisBurrell
Date: 2010-07-14 08:02:55 -0700 (Wed, 14 Jul 2010)
New Revision: 148
Added:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/HasOptionsHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionHandler.java
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/step.gwt.xml
trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptionGroups.java
trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/ScriptureDisplayOptions.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/step/web/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml
Modified:
trunk/step-web-app/pom.xml
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java
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/toolkit/widgets/BibleVersionsDropDownWidget.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java
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-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/StepView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/Step.html
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css
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/util/passage/OsisParserFilter.java
trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandlerTest.java
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/result/GetAvailableBibleVersionsResult.java
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
Log:
commits for options button plus fix for acts 1.5
Modified: trunk/step-web-app/pom.xml
===================================================================
--- trunk/step-web-app/pom.xml 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/pom.xml 2010-07-14 15:02:55 UTC (rev 148)
@@ -19,7 +19,7 @@
to /war
-->
<war.directory>${basedir}/war</war.directory>
- <output.directory>${basedir}/war/WEB-INF/classes</output.directory>
+ <!-- <output.directory>${basedir}/war/WEB-INF/classes</output.directory> -->
</properties>
<dependencies>
@@ -55,6 +55,13 @@
</dependency>
<dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+
+ <dependency>
<groupId>com.googlecode.gwt.inject</groupId>
<artifactId>gin</artifactId>
</dependency>
@@ -93,10 +100,38 @@
<build>
- <outputDirectory>${output.directory}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+
+ <!-- <outputDirectory>${output.directory}</outputDirectory> -->
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <configuration>
+ <classpathScope>compile</classpathScope>
+ <mainClass>com.google.gwt.dev.Compiler</mainClass>
+ <commandlineArgs>com.tyndalehouse.step.web.step</commandlineArgs>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <phase>compile</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
@@ -114,7 +149,15 @@
</goals>
</execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
+ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -81,5 +81,4 @@
*/
@Event(handlers = ScripturePresenter.class)
void versionChanged(String newVersion);
-
}
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-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -3,6 +3,7 @@
import static com.tyndalehouse.step.web.client.common.StringUtils.isNotEmpty;
import java.util.List;
+import java.util.Map;
import java.util.SortedMap;
import net.customware.gwt.dispatch.client.DispatchAsync;
@@ -13,6 +14,7 @@
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
@@ -20,10 +22,12 @@
import com.tyndalehouse.step.web.client.framework.StepEventBus;
import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.toolkit.HasSource;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionEvent;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
import com.tyndalehouse.step.web.client.view.ScriptureView;
import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
-import com.tyndalehouse.step.web.shared.common.scripturelookup.BibleTextLookupType;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
import com.tyndalehouse.step.web.shared.result.beans.BibleVersion;
@@ -88,6 +92,10 @@
HasKeyPressHandlers getVersionSelectionEntered();
String getCurrentlySelectedVersion();
+
+ HandlerRegistration addOptionHandler(OptionHandler handler);
+
+ Map<String, ScriptureDisplayOptions> getSelectedOptions();
}
/**
@@ -115,8 +123,6 @@
@Override
public void bind() {
- // super.eventBus.setLeftColumn(super.view);
-
dispatcher.execute(new GetAvailableBibleVersionsCommand(),
new AsyncCallback<GetAvailableBibleVersionsResult>() {
@@ -134,8 +140,19 @@
});
addHandlersForVersionSelection();
+ addHandlersForOptionChange();
}
+ private void addHandlersForOptionChange() {
+ view.addOptionHandler(new OptionHandler() {
+ public void onOptionSelected(final OptionEvent oe) {
+ // if oe == verse numbers, then can do something now
+ // if show notes, etc. then need to get that from elsewhere
+ refreshView();
+ }
+ });
+ }
+
public void onStart() {
// eventBus.setLeftColumn(view);
}
@@ -144,7 +161,6 @@
* adds the click and key handlers that would trigger a version change
*/
private void addHandlersForVersionSelection() {
-
super.view.getVersionSelectionEntered().addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(final KeyPressEvent keyPressEvent) {
if (keyPressEvent.getCharCode() == KeyCodes.KEY_ENTER) {
@@ -183,9 +199,10 @@
final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(currentlySelectedVersion,
currentPassage);
+ cmd.setDisplayOptions(view.getSelectedOptions());
// TODO: decide if this should be made static or UI driven
- cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
+ // cmd.(view.getSelectedOptions());
dispatcher.execute(cmd, new AsyncCallback<GetCurrentBibleTextResult>() {
public void onFailure(final Throwable e) {
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/HasOptionsHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/HasOptionsHandler.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/HasOptionsHandler.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -0,0 +1,8 @@
+package com.tyndalehouse.step.web.client.toolkit.handlers;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+public interface HasOptionsHandler extends HasHandlers {
+ HandlerRegistration addOptionHandler(OptionHandler handler);
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionEvent.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionEvent.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -0,0 +1,34 @@
+package com.tyndalehouse.step.web.client.toolkit.handlers;
+
+import com.google.gwt.event.shared.GwtEvent;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
+
+public class OptionEvent extends GwtEvent<OptionHandler> {
+ private static Type<OptionHandler> TYPE = new Type<OptionHandler>();
+ private final ScriptureDisplayOptions selectedOption;
+
+ public OptionEvent(final ScriptureDisplayOptions sdo) {
+ this.selectedOption = sdo;
+ }
+
+ @Override
+ public void dispatch(final OptionHandler handler) {
+ handler.onOptionSelected(this);
+ }
+
+ public static Type<OptionHandler> getType() {
+ return TYPE;
+ }
+
+ @Override
+ public Type<OptionHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ /**
+ * @return the selectedOption
+ */
+ public ScriptureDisplayOptions getSelectedOption() {
+ return selectedOption;
+ }
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionHandler.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/handlers/OptionHandler.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -0,0 +1,7 @@
+package com.tyndalehouse.step.web.client.toolkit.handlers;
+
+import com.google.gwt.event.shared.EventHandler;
+
+public interface OptionHandler extends EventHandler {
+ void onOptionSelected(OptionEvent oe);
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -2,6 +2,8 @@
import java.util.Iterator;
+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.HasKeyPressHandlers;
@@ -12,10 +14,12 @@
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
import com.tyndalehouse.step.web.client.view.internal.Area;
import com.tyndalehouse.step.web.client.view.internal.Version;
@@ -29,23 +33,31 @@
// since memory footprint
// TODO: use optGroup instead to handle events better !
public class BibleVersionsDropDownWidget extends Composite {
+ private static final String INITIAL_TEXT = "Please enter a bible version name";
protected FlowPanel bibleVersionPanel = new FlowPanel();
private final TextBox filterBox = new TextBox();
private final Tree bibleVersions = new Tree();
+ private final PopupPanel popup = new PopupPanel();
public BibleVersionsDropDownWidget() {
final ScrollPanel versionScroll = new ScrollPanel();
versionScroll.setHeight("85%");
versionScroll.add(bibleVersions);
bibleVersionPanel.add(filterBox);
- bibleVersionPanel.add(versionScroll);
+ popup.add(versionScroll);
+ popup.setAutoHideEnabled(true);
+ popup.addAutoHidePartner(bibleVersions.getElement());
+ popup.setStylePrimaryName("popupBibleVersions");
+
+ // bibleVersionPanel.add(versionScroll);
+
addHandlersForFilterBox();
addHandlersForTree();
addStyles();
setSuggestionsVisible(false);
- filterBox.setText("Please enter a bible version name");
+ filterBox.setText(INITIAL_TEXT);
initWidget(bibleVersionPanel);
}
@@ -104,6 +116,18 @@
setSuggestionsVisible(true);
}
});
+
+ // TODO: make textbox into widget
+ filterBox.addBlurHandler(new BlurHandler() {
+ public void onBlur(final BlurEvent event) {
+ if (filterBox.getText().length() == 0) {
+ filterBox.setText(INITIAL_TEXT);
+ if (!filterBox.getStyleName().contains("prompt")) {
+ filterBox.addStyleName("prompt");
+ }
+ }
+ }
+ });
}
/**
@@ -113,8 +137,21 @@
* true to show the suggestions from the tree
*/
private void setSuggestionsVisible(final boolean visible) {
- bibleVersions.addStyleName(visible ? "visible" : "invisible");
- bibleVersions.removeStyleName(!visible ? "visible" : "invisible");
+ if (visible) {
+ popup.setPopupPositionAndShow(new PositionCallback() {
+
+ public void setPosition(final int offsetWidth, final int offsetHeight) {
+ popup.setPopupPosition(filterBox.getAbsoluteLeft(), filterBox.getAbsoluteTop()
+ + filterBox.getOffsetHeight());
+ popup.setWidth(filterBox.getOffsetWidth() + "px");
+ }
+ });
+ } else {
+ popup.hide();
+ }
+
+ // bibleVersions.addStyleName(visible ? "visible" : "invisible");
+ // bibleVersions.removeStyleName(!visible ? "visible" : "invisible");
}
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -2,25 +2,56 @@
import static com.tyndalehouse.step.web.client.framework.StepResources.RESOURCES;
+import java.util.HashMap;
+import java.util.Map;
+
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.tyndalehouse.step.web.client.toolkit.handlers.HasOptionsHandler;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionEvent;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
-public class OptionsButtonWidget extends Composite {
+//TODO: move this to the scripture display part, since it needs to float right and prevent text from being on it.
+public class OptionsButtonWidget extends Composite implements HasOptionsHandler {
final private AbsolutePanel holder = new AbsolutePanel();
final private PopupPanel menu = new PopupPanel(false);
private final Image image;
+ private final HandlerManager handlerManager = new HandlerManager(this);
+ private final Map<String, ScriptureDisplayOptions> selectedOptions = new HashMap<String, ScriptureDisplayOptions>();
+ private final ValueChangeHandler<Boolean> valueChangeHandler = new ValueChangeHandler<Boolean>() {
+ public void onValueChange(final ValueChangeEvent<Boolean> valueChangeEvent) {
+ final CheckBox option = (CheckBox) valueChangeEvent.getSource();
+ final Boolean checked = valueChangeEvent.getValue();
+ final String key = option.getName();
+ final ScriptureDisplayOptions scriptureDisplayOption = ScriptureDisplayOptions.getByKeyName(key);
+ if (checked.booleanValue()) {
+ selectedOptions.put(key, scriptureDisplayOption);
+ } else {
+ selectedOptions.remove(key);
+ }
+ handlerManager.fireEvent(new OptionEvent(scriptureDisplayOption));
+ menu.hide();
+ }
+ };
+
/**
* creates an options button
*/
@@ -72,17 +103,29 @@
// menus in...
final VerticalPanel vp = new VerticalPanel();
menu.add(vp);
+ menu.setGlassEnabled(false);
final ScriptureDisplayOptions[] scriptureDisplayOptions = ScriptureDisplayOptions.getScriptureDisplayOptions();
for (final ScriptureDisplayOptions option : scriptureDisplayOptions) {
- final CheckBox menuItem = new CheckBox(option.getDisplayValue());
+
+ CheckBox menuItem;
+ if (option.getGroup() != null) {
+ menuItem = new RadioButton(option.getKey(), option.getDisplayValue());
+ } else {
+ menuItem = new CheckBox(option.getDisplayValue());
+ menuItem.setName(option.getKey());
+ }
+
+ if (option.isDefaultOption()) {
+ menuItem.setValue(option.isDefaultOption());
+
+ }
+
+ if (option.isDefaultOption()) {
+ selectedOptions.put(option.getKey(), option);
+ }
vp.add(menuItem);
- menuItem.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent arg0) {
- // menu.hide();
- // TODO fire event to presenter
- }
- });
+ menuItem.addValueChangeHandler(valueChangeHandler);
}
// menu.setPopupPosition(menu.getOffsetWidth(), image.getAbsoluteTop());
@@ -99,4 +142,12 @@
super.onLoad();
setupMenu();
}
+
+ public HandlerRegistration addOptionHandler(final OptionHandler handler) {
+ return this.handlerManager.addHandler(OptionEvent.getType(), handler);
+ }
+
+ public Map<String, ScriptureDisplayOptions> getSelectedOptions() {
+ return selectedOptions;
+ }
}
Modified: 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 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -1,5 +1,7 @@
package com.tyndalehouse.step.web.client.toolkit.widgets;
+import static com.tyndalehouse.step.web.client.common.StringUtils.isNotEmpty;
+
import java.util.List;
import com.allen_sauer.gwt.log.client.Log;
@@ -18,27 +20,33 @@
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();
-
- // TODO; verses can be empty!? ACTS 1:5
- for (final PassageElement child : children) {
- versePanel.add(new PassageElementWidget(child));
- }
- setElement(versePanel.getElement());
+ addChildren(passageElement, null);
break;
case WORD:
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;
+ case QUOTE:
+ // if quote has children, then render those instead
+ if (passageElement.getNumChildren() != 0) {
+ addChildren(passageElement, "passageQuotePanel");
+ } else {
+ final String markerAttribute = passageElement.getAttribute(OsisElementType.MARKER);
+ if (markerAttribute != null) {
+ setElementAsLabel(null, "passageQuote", new InlineLabel(markerAttribute));
+ } else {
+ setElementAsLabel(passageElement, "passageQuote", new InlineLabel());
+ }
+ }
+ break;
+ case TRANS_CHANGE:
+ setElementAsLabel(passageElement, "passageTransChange", new InlineLabel());
+ break;
default:
Log.warn("Unrendered element of type: " + passageElement.getTypeOfElement());
setElement(new FlowPanel().getElement());
@@ -47,6 +55,29 @@
}
/**
+ * adds children to a panel
+ *
+ * @param passageElement
+ * parent element for which to add all the children
+ * @param parentPanelStyleName
+ * style to apply to the flow panel that gets created
+ * */
+ private void addChildren(final PassageElement passageElement, final String parentPanelStyleName) {
+ // for each child, go and create children for them
+ final List<PassageElement> children = passageElement.getChildren();
+ final FlowPanel containerPanel = new FlowPanel();
+ setElement(containerPanel.getElement());
+
+ if (isNotEmpty(parentPanelStyleName)) {
+ containerPanel.addStyleName(parentPanelStyleName);
+ }
+
+ for (final PassageElement child : children) {
+ containerPanel.add(new PassageElementWidget(child));
+ }
+ }
+
+ /**
* sets the widget's element to be a label
*
* @param passageElement
@@ -69,12 +100,14 @@
* @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();
+ if (passageElement != null) {
+ final PassageElement textNode = OsisElementType.TEXT.equals(passageElement.getTypeOfElement()) ? passageElement
+ : passageElement.getFirstChild();
- if (textNode != null) {
- final String text = textNode.getAttribute(OsisElementType.TEXT);
- label.setText(text);
+ if (textNode != null) {
+ final String text = textNode.getAttribute(OsisElementType.TEXT);
+ label.setText(text);
+ }
}
label.addStyleName(style);
}
Modified: 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 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageWidget.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -70,19 +70,6 @@
}
/**
- * 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
*
@@ -100,59 +87,4 @@
}
}
}
-
- // /**
- // * 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;
- // }
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/ScriptureDisplayOptions.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/ScriptureDisplayOptions.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/ScriptureDisplayOptions.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -1,40 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit.widgets;
-
-import java.util.Arrays;
-import java.util.Comparator;
-
-public enum ScriptureDisplayOptions implements Comparable<ScriptureDisplayOptions> {
- NO_INTERLINEAR("No interlinear"), CLASSIC_INTERLINEAR("Classic interlinear"), REVERSE_INTERLINEAR(
- "Reverse interlinear"), VERSE_NUMBERS("Verse numbers"), NOTES("Notes"), CROSS_REFERENCES("Cross References");
-
- private static final ScriptureDisplayOptions[] cachedOrderedOptions = initOptions();
- private final String displayValue;
-
- private static Comparator<ScriptureDisplayOptions> sdoComparator = new Comparator<ScriptureDisplayOptions>() {
- public int compare(final ScriptureDisplayOptions sdo1, final ScriptureDisplayOptions sdo2) {
- return sdo1.getDisplayValue().compareTo(sdo2.getDisplayValue());
- }
- };
-
- ScriptureDisplayOptions(final String displayValue) {
- this.displayValue = displayValue;
-
- }
-
- private static ScriptureDisplayOptions[] initOptions() {
- final ScriptureDisplayOptions[] values = ScriptureDisplayOptions.values();
- Arrays.sort(values, sdoComparator);
- return values;
- }
-
- /**
- * @return the displayValue
- */
- public String getDisplayValue() {
- return displayValue;
- }
-
- public static ScriptureDisplayOptions[] getScriptureDisplayOptions() {
- return cachedOrderedOptions;
- }
-}
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-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -3,19 +3,23 @@
import static com.tyndalehouse.step.web.client.toolkit.DecoratorUtils.removePadding;
import java.util.List;
+import java.util.Map;
import java.util.SortedMap;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratorPanel;
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.handlers.OptionHandler;
import com.tyndalehouse.step.web.client.toolkit.widgets.BibleVersionsDropDownWidget;
import com.tyndalehouse.step.web.client.toolkit.widgets.OptionsButtonWidget;
import com.tyndalehouse.step.web.client.toolkit.widgets.PassageWidget;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
import com.tyndalehouse.step.web.shared.scripture.Passage;
/**
@@ -40,6 +44,7 @@
private final PassageWidget scriptureHolder = new PassageWidget();
private final BibleVersionsDropDownWidget bibleVersionsDropDown = new BibleVersionsDropDownWidget();
private final AbsolutePanel scripturePanel = new AbsolutePanel();
+ private final OptionsButtonWidget optionsButtonWidget;
/**
* The default constructor
@@ -50,7 +55,8 @@
decorator.add(scriptureHolder);
scripturePanel.add(bibleVersionsDropDown, 0, 0);
scripturePanel.add(decorator, 0, SCRIPTURE_HOLDER_TOP);
- scripturePanel.add(new OptionsButtonWidget());
+ optionsButtonWidget = new OptionsButtonWidget();
+ scripturePanel.add(optionsButtonWidget);
// layoutPanel.add(decorator);
initWidget(scripturePanel);
}
@@ -141,4 +147,12 @@
public HasKeyPressHandlers getVersionSelectionEntered() {
return bibleVersionsDropDown.getVersionSelectionEntered();
}
+
+ public HandlerRegistration addOptionHandler(final OptionHandler handler) {
+ return optionsButtonWidget.addOptionHandler(handler);
+ }
+
+ public Map<String, ScriptureDisplayOptions> getSelectedOptions() {
+ return optionsButtonWidget.getSelectedOptions();
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -46,8 +46,8 @@
final private static int TOP_PANEL_HEIGHT = 75;
final private static int COLUMN_TOP = TOP_PANEL_TOP + TOP_PANEL_HEIGHT;
final private static int COLUMN_BOTTOM = 10;
- final private static int CENTER_PANEL_TOP = COLUMN_TOP + 10;
- final private static int CENTER_PANEL_BOTTOM = COLUMN_BOTTOM + 10;
+ final private static int CENTER_PANEL_TOP = COLUMN_TOP + 50;
+ final private static int CENTER_PANEL_BOTTOM = COLUMN_BOTTOM + 50;
final private static int CENTER_PANEL_WIDTH = 80;
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/Step.html
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/Step.html 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/Step.html 2010-07-14 15:02:55 UTC (rev 148)
@@ -1,47 +1,15 @@
<!DOCTYPE html>
-
-<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
-<!-- above set at the top of the file will set -->
-<!-- the browser's rendering engine into -->
-<!-- "Quirks Mode". Replacing this declaration -->
-<!-- with a "Standards Mode" doctype is supported, -->
-<!-- but may lead to some differences in layout. -->
-
<html>
<head>
<!-- TODO: Wonder if we need to set this to unicode -->
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
-
-
- <!-- -->
- <!-- Any title is fine -->
- <!-- -->
<title>STEP :: Scripture Tools for Every Pastor</title>
-
- <!-- -->
- <!-- This script loads your compiled module. -->
- <!-- If you add any GWT meta tags, they must -->
- <!-- be added before this line. -->
- <!-- -->
<script type="text/javascript" language="javascript" src="step.nocache.js"></script>
-
- <!-- -->
- <!-- Consider inlining CSS to reduce the number of requested files -->
<link rel="stylesheet" href="css/step.css" />
</head>
-
- <!-- -->
- <!-- The body can have arbitrary html, or -->
- <!-- you can leave the body empty if you want -->
- <!-- to create a completely dynamic UI. -->
- <!-- -->
<body>
-
- <!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
-
<div id="main_panel"></div>
-
</body>
</html>
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-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css 2010-07-14 15:02:55 UTC (rev 148)
@@ -15,14 +15,14 @@
width: 100%;
}
-.bibleVersionsDropDown * {
- text-align: left;
-
+.popupBibleVersions {
+ border: black solid 0px;
+ padding: 0px;
}
.bibleVersionsDropDown input {
text-align: left;
- width: 99%;
+ width: 98%;
padding: 0px;
margin: 0px;
}
@@ -64,7 +64,6 @@
.gwt-Tree {
background-color: #BCD56D;
border: black solid 1px;
- border: black solid 1px;
padding: 0px 0px 0px 1px;
margin:-1px 0px 0px 1px;
z-index: 1000;
@@ -96,10 +95,25 @@
.passageWord {
font-family: Tahoma;
- font-size: 12px;
- font-weight: italics;
+ font-size: 12px;
}
+.passageQuotePanel {
+ display: inline;
+ color: red;
+}
+
+
+.passageTransChange {
+ font-family: Tahoma;
+ font-size: 12px;
+ font-style: italic;
+}
+
+.passageTransChange {
+ font-style: italic;
+}
+
.passageLineBreak {
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml 2010-07-14 15:02:55 UTC (rev 148)
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
-<module rename-to='step'>
- <!-- Inherit the core Web Toolkit libraries. -->
- <inherits name="com.google.gwt.user.User" />
- <inherits name="com.google.gwt.inject.Inject" />
- <inherits name="com.google.gwt.resources.Resources" />
- <inherits name='com.mvp4g.Mvp4gModule' />
-
- <inherits name='net.customware.gwt.dispatch.Dispatch' />
-
- <!-- Inherit the default GWT style sheet. You can change -->
- <!-- the theme of your GWT application by uncommenting -->
- <!-- any one of the following lines. -->
- <inherits name='com.google.gwt.user.theme.standard.Standard' />
- <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
- <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
-
-
-
- <!-- Specify the app entry point class. -->
- <entry-point class='com.tyndalehouse.step.web.client.StepEntryPoint' />
-
- <!--
- <entry-point class='com.tyndalehouse.step.web.client.StepEntryPoint'
- />
- -->
-
- <!--
- Add gwt-log support, default level `OFF` - check for extended property
- 'log_level' to see if this is overridden
- -->
- <inherits name="com.allen_sauer.gwt.log.gwt-log-OFF" />
-
- <!-- including GWT-EXT for timeline module -->
- <inherits name='com.google.gwt.json.JSON' />
- <inherits name='com.extjs.gxt.ui.GXT' />
-
- <!-- Also compile Logger at `INFO` level -->
- <extend-property name="log_level" values="DEBUG,INFO" />
- <set-property name="log_level" value="INFO" />
-
- <!--
- Turn off the floating logger - output will be shown in the hosted mode
- console
- -->
- <set-property name="log_DivLogger" value="DISABLED" />
-
-
- <source path="shared" />
- <source path="client" />
-
- <!-- <stylesheet src="js/api/ext/resources/css/ext-all.css" /> -->
- <stylesheet src="gwtext/css/gxt-all.css" />
-
-
-</module>
Copied: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/step.gwt.xml (from rev 141, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml)
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/step.gwt.xml (rev 0)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/step.gwt.xml 2010-07-14 15:02:55 UTC (rev 148)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
+<module rename-to='step'>
+ <!-- Inherit the core Web Toolkit libraries. -->
+ <inherits name="com.google.gwt.user.User" />
+ <inherits name="com.google.gwt.inject.Inject" />
+ <inherits name="com.google.gwt.resources.Resources" />
+ <inherits name='com.mvp4g.Mvp4gModule' />
+
+ <inherits name='net.customware.gwt.dispatch.Dispatch' />
+
+ <!-- Inherit the default GWT style sheet. You can change -->
+ <!-- the theme of your GWT application by uncommenting -->
+ <!-- any one of the following lines. -->
+ <inherits name='com.google.gwt.user.theme.standard.Standard' />
+ <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
+ <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
+
+
+
+ <!-- Specify the app entry point class. -->
+ <entry-point class='com.tyndalehouse.step.web.client.StepEntryPoint' />
+
+ <!--
+ <entry-point class='com.tyndalehouse.step.web.client.StepEntryPoint'
+ />
+ -->
+
+ <!--
+ Add gwt-log support, default level `OFF` - check for extended property
+ 'log_level' to see if this is overridden
+ -->
+ <inherits name="com.allen_sauer.gwt.log.gwt-log-OFF" />
+
+ <!-- including GWT-EXT for timeline module -->
+ <inherits name='com.google.gwt.json.JSON' />
+ <inherits name='com.extjs.gxt.ui.GXT' />
+
+ <!-- Also compile Logger at `INFO` level -->
+ <extend-property name="log_level" values="DEBUG,INFO" />
+ <set-property name="log_level" value="INFO" />
+
+ <!--
+ Turn off the floating logger - output will be shown in the hosted mode
+ console
+ -->
+ <set-property name="log_DivLogger" value="DISABLED" />
+
+
+ <source path="shared" />
+ <source path="client" />
+
+ <!-- <stylesheet src="js/api/ext/resources/css/ext-all.css" /> -->
+ <stylesheet src="gwtext/css/gxt-all.css" />
+
+
+</module>
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-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -27,6 +27,8 @@
import com.tyndalehouse.step.web.server.handler.util.passage.StrongMorphMap;
import com.tyndalehouse.step.web.server.service.JSwordService;
import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptionGroups;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
import com.tyndalehouse.step.web.shared.scripture.Passage;
@@ -72,18 +74,23 @@
final GetCurrentBibleTextResult result = new GetCurrentBibleTextResult();
- switch (command.getTypeOfLookup()) {
+ final Map<String, ScriptureDisplayOptions> displayOptions = command.getDisplayOptions();
+ // move groups to enums too?
+ switch (displayOptions.get(ScriptureDisplayOptionGroups.INTERLINEAR.name())) {
case CLASSIC_INTERLINEAR:
addClassicInterlinear(result.getPassage());
break;
- case LOGICAL:
+ case NO_INTERLINEAR:
addLogicalLookup(result);
break;
case REVERSE_INTERLINEAR:
addLogicalLookup(result);
addReverseInterlinear(result.getPassage());
break;
+ default:
+ break;
}
+
return result;
}
@@ -300,7 +307,8 @@
} else {
// TODO use slf4j
getLogger().warn(
- ((Element) item).getName() + " with value " + ((Element) item).getValue() + " not created");
+ ((Element) item).getName() + " with value [" + ((Element) item).getValue()
+ + "] not created");
}
} else if (item instanceof Text) {
final String text = ((Text) item).getText();
@@ -335,7 +343,7 @@
final OsisElementType forOsisType = OsisElementType.forOsisType(a.getName());
if (forOsisType == null || !attributeFilter.contains(forOsisType)) {
- getLogger().debug("Attribute not returned: " + a + "in tag of type " + typeOfTag);
+ getLogger().debug("Attribute not returned: [" + a + "] in tag of type [" + typeOfTag + "]");
} else {
attributeMap.put(forOsisType, a.getValue());
}
Modified: 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 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-server/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/OsisParserFilter.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -1,6 +1,9 @@
package com.tyndalehouse.step.web.server.handler.util.passage;
+import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.LINE_BREAK;
+import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.QUOTE;
import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.TITLE;
+import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.TRANS_CHANGE;
import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.VERSE;
import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.WORD;
@@ -25,13 +28,16 @@
defaultFilter.add(TITLE);
defaultFilter.add(VERSE);
defaultFilter.add(WORD);
- defaultFilter.add(OsisElementType.LINE_BREAK);
+ defaultFilter.add(QUOTE);
+ defaultFilter.add(LINE_BREAK);
+ defaultFilter.add(TRANS_CHANGE);
return defaultFilter;
}
private static Set<OsisElementType> initDefaultAttributeFilter() {
final Set<OsisElementType> defaultFilter = new HashSet<OsisElementType>();
defaultFilter.add(OsisElementType.OSIS_ID);
+ defaultFilter.add(OsisElementType.MARKER);
return defaultFilter;
}
}
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/handler/GetCurrentBibleTextHandlerTest.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-server/src/test/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandlerTest.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -2,17 +2,27 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import net.customware.gwt.dispatch.shared.ActionException;
+
import org.jdom.Content;
import org.jdom.Element;
import org.jmock.Mockery;
import org.junit.Before;
import org.junit.Test;
+import com.tyndalehouse.step.web.server.service.impl.JSwordServiceImpl;
+import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptionGroups;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
+import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
import com.tyndalehouse.step.web.shared.scripture.PassageElement;
@@ -122,6 +132,30 @@
assertEquals("Something", childText.getAttribute(OsisElementType.TEXT));
}
+
+ /**
+ * there is something special going on with the KJV for this verse
+ *
+ * @throws ActionException
+ */
+ @Test
+ public void testGetActs1v5() throws ActionException {
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler(new JSwordServiceImpl());
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand();
+ cmd.setReference("Acts 1:4-5");
+ cmd.setVersion("KJV");
+ cmd.setDisplayOptions(getNoInterlinearOptions());
+ final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+
+ assertNotNull(result);
+ }
+
+ private Map<String, ScriptureDisplayOptions> getNoInterlinearOptions() {
+ final Map<String, ScriptureDisplayOptions> map = new HashMap<String, ScriptureDisplayOptions>();
+ map.put(ScriptureDisplayOptionGroups.INTERLINEAR.name(), ScriptureDisplayOptions.NO_INTERLINEAR);
+ return map;
+ }
+
// /**
// * tests a greek reverse interlinear
// *
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-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -1,8 +1,10 @@
package com.tyndalehouse.step.web.shared.command;
+import java.util.Map;
+
import net.customware.gwt.dispatch.shared.Action;
-import com.tyndalehouse.step.web.shared.common.scripturelookup.BibleTextLookupType;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
/**
@@ -24,24 +26,19 @@
public class GetCurrentBibleTextCommand implements Action<GetCurrentBibleTextResult> {
private static final long serialVersionUID = -6828956918275592036L;
+ // TODO: add validation to the handler/client to ensure that
+ // version/interlinear matches correctly
/**
* the biblical reference, for e.g. Gen 1:1
*/
private String reference;
/**
- * type of lookup to make
- */
- private BibleTextLookupType typeOfLookup;
-
- // TODO: add validation to the handler/client to ensure that
- // version/interlinear matches correctly
- /**
* the version of the bible to use.
*/
private String version;
- // private Set<OsisElementType> filter = null;
+ private Map<String, ScriptureDisplayOptions> displayOptions;
/**
* default constructor TODO: can this be made private? I think so
@@ -71,13 +68,6 @@
}
/**
- * @return the typeOfLookup
- */
- public final BibleTextLookupType getTypeOfLookup() {
- return typeOfLookup;
- }
-
- /**
* @return the initials of the version to be used in the lookup
*/
public String getVersion() {
@@ -93,14 +83,6 @@
}
/**
- * @param typeOfLookup
- * the typeOfLookup to set
- */
- public final void setTypeOfLookup(final BibleTextLookupType typeOfLookup) {
- this.typeOfLookup = typeOfLookup;
- }
-
- /**
* @param version
* the version to set
*/
@@ -108,19 +90,18 @@
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;
- // }
+ /**
+ * @return the displayOptions
+ */
+ public Map<String, ScriptureDisplayOptions> getDisplayOptions() {
+ return displayOptions;
+ }
+ /**
+ * @param displayOptions
+ * the displayOptions to set
+ */
+ public void setDisplayOptions(final Map<String, ScriptureDisplayOptions> displayOptions) {
+ this.displayOptions = displayOptions;
+ }
}
Added: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptionGroups.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptionGroups.java (rev 0)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptionGroups.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -0,0 +1,7 @@
+package com.tyndalehouse.step.web.shared.common;
+
+public enum ScriptureDisplayOptionGroups {
+ /** group of options that describe the interlinear option */
+ INTERLINEAR,
+
+}
Added: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java (rev 0)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/common/ScriptureDisplayOptions.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -0,0 +1,112 @@
+package com.tyndalehouse.step.web.shared.common;
+
+import static com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptionGroups.INTERLINEAR;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+public enum ScriptureDisplayOptions implements Comparable<ScriptureDisplayOptions> {
+ /**
+ * selects a standard passage and displays without any extra languages such
+ * as greek or hebrew
+ */
+ NO_INTERLINEAR("Interlinear - None", INTERLINEAR, true),
+ /**
+ * displays a classic interlienar, that is the hebrew/greek version of the
+ * text with the associated English/contemporary language below
+ */
+ CLASSIC_INTERLINEAR("Interlinear - Classic", INTERLINEAR),
+ /**
+ * displays a reverse interlinear, that is the english/contemporary language
+ * as the main language, with the words from the greek or hebrew below
+ */
+ REVERSE_INTERLINEAR("Interlinear - Reverse", INTERLINEAR),
+ /** displays verse numbers */
+ VERSE_NUMBERS("Verse numbers"),
+ /** displays notes */
+ NOTES("Notes"),
+ /** displays cross references */
+ CROSS_REFERENCES("Cross References");
+
+ private static final ScriptureDisplayOptions[] cachedOrderedOptions = initOrderedOptions();
+ private static final Map<String, ScriptureDisplayOptions> cachedKeyedOptions = initKeyedOptions();
+
+ private static Comparator<ScriptureDisplayOptions> sdoComparator = new Comparator<ScriptureDisplayOptions>() {
+ public int compare(final ScriptureDisplayOptions sdo1, final ScriptureDisplayOptions sdo2) {
+ return sdo1.getDisplayValue().compareTo(sdo2.getDisplayValue());
+ }
+ };
+
+ /**
+ * group identifying options that cannot be selected together
+ */
+ private final ScriptureDisplayOptionGroups group;
+
+ /** value to be displayed on the screen */
+ private final String displayValue;
+
+ private final boolean defaultOption;
+
+ ScriptureDisplayOptions(final String displayValue) {
+ this(displayValue, null);
+ }
+
+ private ScriptureDisplayOptions(final String displayValue, final ScriptureDisplayOptionGroups group) {
+ this(displayValue, group, false);
+ }
+
+ ScriptureDisplayOptions(final String displayValue, final ScriptureDisplayOptionGroups group,
+ final boolean defaultOption) {
+ this.displayValue = displayValue;
+ this.group = group;
+ this.defaultOption = defaultOption;
+ }
+
+ private static ScriptureDisplayOptions[] initOrderedOptions() {
+ final ScriptureDisplayOptions[] values = ScriptureDisplayOptions.values();
+ Arrays.sort(values, sdoComparator);
+ return values;
+ }
+
+ private static Map<String, ScriptureDisplayOptions> initKeyedOptions() {
+ final ScriptureDisplayOptions[] values = ScriptureDisplayOptions.values();
+ final Map<String, ScriptureDisplayOptions> keyedOptions = new HashMap<String, ScriptureDisplayOptions>();
+ for (final ScriptureDisplayOptions scriptureDisplayOptions : values) {
+ keyedOptions.put(scriptureDisplayOptions.getKey(), scriptureDisplayOptions);
+ }
+ return keyedOptions;
+ }
+
+ /**
+ * @return the displayValue
+ */
+ public String getDisplayValue() {
+ return displayValue;
+ }
+
+ public static ScriptureDisplayOptions[] getScriptureDisplayOptions() {
+ return cachedOrderedOptions;
+ }
+
+ public ScriptureDisplayOptionGroups getGroup() {
+ return group;
+ }
+
+ public String getKey() {
+ return group == null ? name() : group.name();
+ }
+
+ /**
+ * @return the defaultOption
+ */
+ public boolean isDefaultOption() {
+ return defaultOption;
+ }
+
+ public static ScriptureDisplayOptions getByKeyName(final String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Modified: trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java
===================================================================
--- trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -19,7 +19,7 @@
public class GetAvailableBibleVersionsResult implements Result {
private static final long serialVersionUID = 1441380470741483969L;
- List<BibleVersion> bibleVersions;
+ private List<BibleVersion> bibleVersions;
/**
* @return the bibleVersions
Modified: 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 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/OsisElementType.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -7,7 +7,14 @@
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");
+ "verse"),
+ /** this gives us the verse number */
+ OSIS_ID("osisID"),
+ /**
+ * a quote, which is not a quote from someone, but part of the text that is
+ * quoted
+ */
+ QUOTE("q");
private final static Map<String, OsisElementType> cachedTypes = initialiseTypes();
private final String osisTag;
Modified: 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/PassageElement.java 2010-07-12 15:31:07 UTC (rev 147)
+++ trunk/step-web-shared/src/main/java/com/tyndalehouse/step/web/shared/scripture/PassageElement.java 2010-07-14 15:02:55 UTC (rev 148)
@@ -91,6 +91,18 @@
}
/**
+ * returns the number of children contained
+ *
+ * @return the number of children
+ */
+ public int getNumChildren() {
+ if (this.children == null) {
+ return 0;
+ }
+ return this.children.size();
+ }
+
+ /**
* adds an attribute to this element
*
* @param key
More information about the Tynstep-svn
mailing list