[Tynstep-svn] r142 - in trunk/step-web-app: . src/main/java/com/tyndalehouse/step/web/client/presenter src/main/java/com/tyndalehouse/step/web/client/toolkit src/main/java/com/tyndalehouse/step/web/client/view src/main/java/com/tyndalehouse/step/web/public/css src/main/java/com/tyndalehouse/step/web/server src/main/java/com/tyndalehouse/step/web/server/db src/main/java/com/tyndalehouse/step/web/server/handler src/main/java/com/tyndalehouse/step/web/server/handler/util src/main/java/com/tyndalehouse/step/web/server/jsword src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/step/web src/main/resources/com/tyndalehouse/step/web/client/view src/test/java/com/tyndalehouse/step/web/server src/test/java/com/tyndalehouse/step/web/server/db src/test/resources/com/tyndalehouse/step/web/server/db/queries
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Fri Jun 25 13:49:31 MST 2010
Author: ChrisBurrell
Date: 2010-06-25 13:49:31 -0700 (Fri, 25 Jun 2010)
New Revision: 142
Added:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetLocationsHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/XSLTProperty.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/step/web/server/
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/
trunk/step-web-app/src/test/resources/com/tyndalehouse/step/web/server/db/queries/tests/
Modified:
trunk/step-web-app/pom.xml
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.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/client/view/StepView.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/BookmarkView.ui.xml
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/FilterResultsView.ui.xml
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ModuleSideBarView.ui.xml
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.ui.xml
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml
Log:
refactoring of step-web-app to split out the step-web-server and step-web-shared projects
Modified: trunk/step-web-app/pom.xml
===================================================================
--- trunk/step-web-app/pom.xml 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/pom.xml 2010-06-25 20:49:31 UTC (rev 142)
@@ -23,6 +23,17 @@
</properties>
<dependencies>
+ <dependency>
+ <groupId>com.tyndalehouse</groupId>
+ <artifactId>step-web-shared</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.tyndalehouse</groupId>
+ <artifactId>step-web-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!--
TO BE REMOVED ONCE MVP4g IS MAVEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -38,16 +49,7 @@
</dependency>
<dependency>
- <groupId>org.crosswire</groupId>
- <artifactId>jsword</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
@@ -56,18 +58,8 @@
<groupId>com.googlecode.gwt.inject</groupId>
<artifactId>gin</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- </dependency>
<dependency>
- <groupId>com.google.inject.extensions
- </groupId>
- <artifactId>guice-servlet</artifactId>
- </dependency>
-
- <dependency>
<groupId>net.customware.gwt.dispatch
</groupId>
<artifactId>gwt-dispatch</artifactId>
@@ -85,27 +77,8 @@
<artifactId>gxt</artifactId>
</dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
<dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<scope>test</scope>
@@ -116,19 +89,8 @@
<artifactId>jmock-junit4</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbyclient</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <scope>runtime</scope>
- </dependency>
</dependencies>
+
<build>
<outputDirectory>${output.directory}</outputDirectory>
@@ -253,8 +215,37 @@
</execution>
</executions>
</plugin>
-
-
</plugins>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <additionalProjectnatures>
+ <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
+ <projectnature>com.google.gdt.eclipse.core.webAppNature</projectnature>
+ </additionalProjectnatures>
+ <additionalBuildcommands>
+ <buildCommand>
+ <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
+ <arguments>
+ </arguments>
+ <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </additionalBuildcommands>
+ <classpathContainers>
+ <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
+ <classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</classpathContainer>
+ </classpathContainers>
+ <buildOutputDirectory>war/WEB-INF/classes</buildOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
</build>
</project>
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -26,6 +26,9 @@
/** returns the current reference, as typed in the box */
HasText getScriptureReference();
+ /** enabled or disables components in the view */
+ void setEnabled(boolean enabled);
+
}
@Inject
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -51,8 +51,11 @@
view.setRightColumn(eventBus.addHandler(ScripturePresenter.class).getView());
view.setTopLeftPanel(eventBus.addHandler(ScriptureSelectorPresenter.class).getView());
- view.setTopRightPanel(eventBus.addHandler(ScriptureSelectorPresenter.class).getView());
+ final ScriptureSelectorPresenter.Display rightScriptureSelector = eventBus.addHandler(
+ ScriptureSelectorPresenter.class).getView();
+ view.setTopRightPanel(rightScriptureSelector);
+ rightScriptureSelector.setEnabled(false);
}
@Override
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -0,0 +1,46 @@
+package com.tyndalehouse.step.web.client.toolkit;
+
+import static com.tyndalehouse.step.web.client.toolkit.DecoratorUtils.removePadding;
+
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Automatically decorates the panel
+ *
+ * @author CJBurrell
+ *
+ */
+public class DecoratedComposite extends Composite {
+ /**
+ * The main component in the composite
+ */
+ private Widget mainWidget;
+
+ @Override
+ protected void initWidget(final Widget mainWidget) {
+ this.mainWidget = mainWidget;
+
+ final DecoratorPanel dp = new DecoratorPanel();
+ dp.add(mainWidget);
+ super.initWidget(dp);
+ }
+
+ @Override
+ public void setWidth(final String width) {
+ super.setWidth(width);
+ if (mainWidget != null) {
+ mainWidget.setWidth(removePadding(width));
+ }
+ }
+
+ @Override
+ public void setHeight(final String height) {
+ super.setHeight(height);
+ if (mainWidget != null) {
+ mainWidget.setHeight(removePadding(height));
+ }
+ }
+
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -0,0 +1,37 @@
+package com.tyndalehouse.step.web.client.toolkit;
+
+import static java.lang.Integer.valueOf;
+
+public class DecoratorUtils {
+ /** The string representation of a pixel */
+ private static final String PIXEL_UNIT = "px";
+ /** default padding to assign */
+ private final static int DECORATOR_PADDING = 10;
+
+ /**
+ * hiding implementation
+ */
+ private DecoratorUtils() {
+ }
+
+ /**
+ * removes the last part of the dimension and adjusts
+ *
+ * @param dimension
+ * dimension to be adjusted for padding
+ * @return the new dimension
+ */
+ public static String removePadding(final String dimension) {
+ if (dimension.endsWith(PIXEL_UNIT)) {
+ final int dim = valueOf(dimension.substring(0, dimension.length() - 2));
+ return String.valueOf(dim - DECORATOR_PADDING) + PIXEL_UNIT;
+ }
+ return dimension;
+ }
+
+ /** removes padding based on a double **/
+ public static double removePadding(final double dimension) {
+ return dimension - DECORATOR_PADDING;
+ }
+
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -0,0 +1,32 @@
+package com.tyndalehouse.step.web.client.toolkit;
+
+import static java.lang.String.valueOf;
+
+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.shared.InternalException;
+
+/**
+ * Exposing extra functionality to do allow dynamic resizing
+ *
+ * @author CJBurrell
+ *
+ */
+public class StepComposite extends Composite {
+ private final static int DECORATOR_PADDING = 10;
+
+ public void setDecoratingPanelChildSize(final int width, final int height) {
+ // main widget for composite:
+ final Widget w = this.getWidget();
+ if (w instanceof DecoratorPanel) {
+ final DecoratorPanel parentPanel = (DecoratorPanel) w;
+ final Widget childPanel = parentPanel.getWidget();
+ childPanel.setWidth(valueOf(width - StepComposite.DECORATOR_PADDING) + "px");
+ childPanel.setHeight(valueOf(height - StepComposite.DECORATOR_PADDING) + "px");
+ return;
+ }
+
+ throw new InternalException("Trying to set the size of a panel which is not contained in a DecoratorPanel");
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -2,11 +2,11 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.presenter.BookmarkPresenter;
+import com.tyndalehouse.step.web.client.toolkit.DecoratedComposite;
-public class BookmarkView extends Composite implements BookmarkPresenter.Display {
+public class BookmarkView extends DecoratedComposite implements BookmarkPresenter.Display {
interface MyUiBinder extends UiBinder<Widget, BookmarkView> {
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -3,13 +3,13 @@
import com.google.gwt.core.client.GWT;
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.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.presenter.FilterResultsPresenter.Display;
+import com.tyndalehouse.step.web.client.toolkit.DecoratedComposite;
-public class FilterResultsView extends Composite implements Display {
+public class FilterResultsView extends DecoratedComposite implements Display {
interface FilterResultsUiBinder extends UiBinder<Widget, FilterResultsView> {
}
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-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,6 +1,10 @@
package com.tyndalehouse.step.web.client.view;
import com.google.gwt.core.client.GWT;
+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.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
@@ -16,6 +20,8 @@
interface Binder extends UiBinder<Widget, ScriptureSelectorView> {
}
+ private static final String INITIAL_TEXT = "Please enter a passage reference, for e.g. Gen 1:1";
+
private static Binder uiBinder = GWT.create(Binder.class);
@UiField
@@ -25,12 +31,51 @@
public ScriptureSelectorView() {
initWidget(ScriptureSelectorView.uiBinder.createAndBindUi(this));
+ addInternalHandlers();
+ setInitialState();
}
+ private void setInitialState() {
+ referenceTextbox.setText(INITIAL_TEXT);
+ referenceTextbox.addStyleName("prompt");
+ }
+
+ private void addInternalHandlers() {
+ referenceTextbox.addBlurHandler(new BlurHandler() {
+
+ public void onBlur(final BlurEvent be) {
+ if (referenceTextbox.getText().length() == 0) {
+ referenceTextbox.setText(INITIAL_TEXT);
+ if (!referenceTextbox.getStyleName().contains("prompt")) {
+ referenceTextbox.addStyleName("prompt");
+ }
+ }
+ }
+ });
+
+ referenceTextbox.addFocusHandler(new FocusHandler() {
+
+ public void onFocus(final FocusEvent fe) {
+ if (INITIAL_TEXT.equals(referenceTextbox.getText())) {
+ referenceTextbox.setText("");
+ }
+
+ // everytime, remove style
+ referenceTextbox.removeStyleName("prompt");
+ }
+ });
+
+ }
+
public HasClickHandlers getSelectReferenceButton() {
return selectReferenceButton;
}
+ public void setEnabled(final boolean enabled) {
+ referenceTextbox.setEnabled(enabled);
+ selectReferenceButton.setEnabled(enabled);
+ }
+
public HasText getScriptureReference() {
return referenceTextbox;
}
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-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,10 +1,14 @@
package com.tyndalehouse.step.web.client.view;
+import static com.tyndalehouse.step.web.client.toolkit.DecoratorUtils.removePadding;
+import static java.lang.Double.valueOf;
+
import java.util.ArrayList;
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;
@@ -19,7 +23,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.FlowPanel;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Panel;
@@ -50,6 +53,9 @@
*
*/
public class ScriptureView extends Composite implements ScripturePresenter.Display {
+ /** where the top of the scripture holder should be placed */
+ private static final int SCRIPTURE_HOLDER_TOP = 20;
+
private String currentPassage;
/**
@@ -74,7 +80,7 @@
* the elements on this panel
*/
@UiField
- protected FlowPanel scriptureHolder;
+ protected Panel scriptureHolder;
/**
* text box in which to filter by bible versions
@@ -88,12 +94,6 @@
@UiField
protected Tree bibleVersions;
- // /**
- // * a button to click ok!
- // */
- // @UiField
- // Button changeBibleVersion;
-
/**
* layout panel
*/
@@ -103,19 +103,21 @@
protected Panel selectorPanel;
@UiField
Panel treePanel;
+ @UiField
+ Panel scriptureHolderDecorator;
/**
* The default constructor
*
*/
public ScriptureView() {
- initWidget(binder.createAndBindUi(this));
+ super.initWidget(binder.createAndBindUi(this));
lemmaWords = new ArrayList<VerseLabel>();
morphs = new ArrayList<VerseLabel>();
// set initial properties
bibleVersionSuggestion.setStyleName("prompt");
- scriptureLayoutPanel.getWidgetContainerElement(scriptureHolder).getStyle().setZIndex(1000);
+ scriptureLayoutPanel.getWidgetContainerElement(scriptureHolderDecorator).getStyle().setZIndex(1000);
scriptureLayoutPanel.getWidgetContainerElement(selectorPanel).getStyle().setZIndex(1000);
scriptureLayoutPanel.getWidgetContainerElement(treePanel).getStyle().setZIndex(2000);
hideSuggestions();
@@ -123,6 +125,29 @@
addHandlersForTree();
}
+ @Override
+ public void setWidth(final String width) {
+ // super.setWidth(width);
+ if (scriptureHolder != null) {
+ scriptureHolder.setWidth(removePadding(width));
+ }
+ }
+
+ @Override
+ public void setHeight(final String height) {
+ final Double heightInPixels = valueOf(height.substring(0, height.length() - 2));
+ final double adjustedHeight = removePadding(heightInPixels - SCRIPTURE_HOLDER_TOP);
+
+ // finally reset the layer height
+ scriptureLayoutPanel.setWidgetTopHeight(scriptureHolderDecorator, SCRIPTURE_HOLDER_TOP, Unit.PX,
+ heightInPixels, Unit.PX);
+
+ // super.setHeight(height);
+ if (scriptureHolder != null) {
+ scriptureHolder.setHeight(adjustedHeight + "px");
+ }
+ }
+
public void highlight(final List<String> lemmaList) {
for (final VerseLabel vl : lemmaWords) {
for (final String l : lemmaList) {
@@ -467,5 +492,4 @@
public Widget getContainerWidget() {
return this;
}
-
}
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-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,5 +1,7 @@
package com.tyndalehouse.step.web.client.view;
+import static java.lang.String.valueOf;
+
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
@@ -110,7 +112,7 @@
}
public void setTopRightPanel(final StepViewInterface w) {
- replaceContents(topLeftPanel, w);
+ replaceContents(topRightPanel, w);
}
public void setCenterPanel(final StepViewInterface w) {
@@ -149,22 +151,60 @@
final int windowWidth = Window.getClientWidth();
final int sidePanelHeight = sidePanel.getWidget().getOffsetHeight();
final int centerPanelLeft = (windowWidth - CENTER_PANEL_WIDTH + SIDE_PANEL_WIDTH) / 2;
+ final int columnWidth = (windowWidth - CENTER_PANEL_WIDTH - SIDE_PANEL_WIDTH) / 2;
+ final int columnHeight = windowHeight - COLUMN_TOP - COLUMN_BOTTOM;
repositionVertically(sidePanel, windowHeight, sidePanelHeight);
repositionVertically(filterPanel, windowHeight, sidePanelHeight);
stepPanelLayout.setWidgetLeftWidth(centerPanel, centerPanelLeft, Unit.PX, CENTER_PANEL_WIDTH, Unit.PX);
+ stepPanelLayout.setWidgetLeftWidth(topLeftPanel, SCRIPTURE_PANEL_LEFT, Unit.PX, columnWidth, Unit.PX);
+ stepPanelLayout.setWidgetLeftWidth(leftColumnPanel, SCRIPTURE_PANEL_LEFT, Unit.PX, columnWidth, Unit.PX);
+ stepPanelLayout.setWidgetLeftWidth(topRightPanel, centerPanelLeft + CENTER_PANEL_WIDTH, Unit.PX, columnWidth,
+ Unit.PX);
+ stepPanelLayout.setWidgetLeftWidth(rightColumnPanel, centerPanelLeft + CENTER_PANEL_WIDTH, Unit.PX,
+ columnWidth, Unit.PX);
- stepPanelLayout.setWidgetLeftRight(topLeftPanel, SCRIPTURE_PANEL_LEFT, Unit.PX, centerPanelLeft
- + CENTER_PANEL_WIDTH - SIDE_PANEL_WIDTH, Unit.PX);
- stepPanelLayout.setWidgetLeftRight(leftColumnPanel, SCRIPTURE_PANEL_LEFT, Unit.PX, centerPanelLeft
- + CENTER_PANEL_WIDTH - SIDE_PANEL_WIDTH, Unit.PX);
+ // TODO: change to set size?
+ filterPanel.getWidget().setHeight(valueOf(sidePanelHeight) + "px");
+ filterPanel.getWidget().setWidth(valueOf(StepView.FILTER_PANEL_WIDTH) + "px");
+ sidePanel.getWidget().setHeight(valueOf(sidePanelHeight) + "px");
+ sidePanel.getWidget().setWidth(valueOf(StepView.SIDE_PANEL_WIDTH) + "px");
+ centerPanel.getWidget().setHeight(valueOf(windowHeight - CENTER_PANEL_TOP - CENTER_PANEL_BOTTOM) + "px");
+ centerPanel.getWidget().setWidth(valueOf(CENTER_PANEL_WIDTH) + "px");
+ leftColumnPanel.getWidget().setWidth(valueOf(columnWidth) + "px");
+ leftColumnPanel.getWidget().setHeight(valueOf(columnHeight) + "px");
+ rightColumnPanel.getWidget().setWidth(valueOf(columnWidth) + "px");
+ rightColumnPanel.getWidget().setHeight(valueOf(columnHeight) + "px");
- stepPanelLayout.setWidgetLeftRight(topRightPanel, centerPanelLeft + CENTER_PANEL_WIDTH, Unit.PX, 0, Unit.PX);
- stepPanelLayout.setWidgetLeftRight(rightColumnPanel, centerPanelLeft + CENTER_PANEL_WIDTH, Unit.PX, 0, Unit.PX);
+ // resizeDecoratedPanel(filterPanel, StepView.FILTER_PANEL_WIDTH,
+ // sidePanelHeight);
+ // resizeDecoratedPanel(sidePanel, StepView.SIDE_PANEL_WIDTH,
+ // sidePanelHeight);
+ // resizeDecoratedPanel(centerPanel, CENTER_PANEL_WIDTH, windowHeight -
+ // CENTER_PANEL_TOP - CENTER_PANEL_BOTTOM);
+ // resizeDecoratedPanel(leftColumnPanel, (windowWidth -
+ // CENTER_PANEL_WIDTH - SIDE_PANEL_WIDTH) / 2, windowHeight
+ // - COLUMN_TOP - COLUMN_BOTTOM);
+
+ // TODO use this instead of above left/right measurements
+ // final int columnWidth = windowWidth - CENTER_PANEL_WIDTH -
+ // SIDE_PANEL_WIDTH;
+ // resizeDecoratedPanel(rightColumnPanel, columnWidth / 2, windowHeight
+ // - COLUMN_TOP - COLUMN_BOTTOM);
+
setFilterPanelVisible(false);
}
+ //
+ // private void resizeDecoratedPanel(final SimplePanel decoratingPanel,
+ // final int width, final int height) {
+ // final Widget viewWidget = decoratingPanel.getWidget();
+ // if (viewWidget instanceof StepComposite) {
+ // ((StepComposite) viewWidget).setDecoratingPanelChildSize(width, height);
+ // }
+ // }
+
/**
* some changes that will cause to relayout
*/
@@ -179,7 +219,6 @@
private void repositionVertically(final SimplePanel childPanel, final int windowHeight, final int widgetHeight) {
final Widget childWidget = childPanel.getWidget();
if (childWidget != null) {
- // final int widgetHeight = childWidget.getOffsetHeight();
final int newGap = (windowHeight - widgetHeight) / 2;
stepPanelLayout.setWidgetTopBottom(childPanel, newGap, Unit.PX, newGap, Unit.PX);
}
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-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css 2010-06-25 20:49:31 UTC (rev 142)
@@ -7,7 +7,7 @@
}
.prompt {
- color: lightgrey;
+ color: grey;
}
.bibleVersionsDropDown {
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,72 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import org.apache.commons.logging.Log;
-import org.crosswire.jsword.book.Book;
-import org.crosswire.jsword.book.BookCategory;
-import org.crosswire.jsword.book.Books;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
-import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
-import com.tyndalehouse.step.web.shared.result.beans.BibleVersion;
-
-/**
- * Command handler returning all available bible versions
- *
- * @author CJBurrell TODO: add logging to this class
- */
-public class GetAvailableBibleVersionsHandler extends
- AbstractStepHandler<GetAvailableBibleVersionsCommand, GetAvailableBibleVersionsResult> {
- /**
- * Default logger
- */
- private final Log logger;
-
- /**
- * normal constructor
- *
- * @param logger
- * provided by Gin
- */
- @Inject
- public GetAvailableBibleVersionsHandler(final Log logger) {
- this.logger = logger;
- }
-
- public GetAvailableBibleVersionsResult execute(final GetAvailableBibleVersionsCommand cmd,
- final ExecutionContext arg1) throws ActionException {
- // TODO: add handling of different types of book: bibles, commentaries,
- // versions, etc.
- @SuppressWarnings("unchecked")
- final List<Book> books = Books.installed().getBooks();
- final SortedMap<String, String> map = new TreeMap<String, String>();
-
- final List<BibleVersion> versions = new ArrayList<BibleVersion>();
- for (final Book b : books) {
- if (b.getBookCategory().equals(BookCategory.BIBLE)) {
- final BibleVersion bibleVersion = new BibleVersion();
- bibleVersion.setInitials(b.getInitials());
- bibleVersion.setName(b.getName());
- bibleVersion.setLanguage(b.getLanguage().getName());
- versions.add(bibleVersion);
- }
- }
- final GetAvailableBibleVersionsResult result = new GetAvailableBibleVersionsResult();
- result.setBibleVersions(versions);
- return result;
- }
-
- public void rollback(final GetAvailableBibleVersionsCommand arg0, final GetAvailableBibleVersionsResult arg1,
- final ExecutionContext arg2) throws ActionException {
- logger.error("Rolling back GetAvailableBibleVersions");
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,68 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.ArrayList;
-import java.util.Locale;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import org.crosswire.jsword.passage.NoSuchVerseException;
-import org.crosswire.jsword.versification.BibleInfo;
-import org.crosswire.jsword.versification.BibleNames;
-import org.crosswire.jsword.versification.BookName;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.shared.command.GetBibleBooksCommand;
-import com.tyndalehouse.step.web.shared.result.GetBibleBooksCommandResult;
-
-/**
- * Command handler for retrieving the different names of the books in a
- * particular version TODO: only currently works for KJV
- *
- * @author CJBurrell
- *
- */
-public class GetBibleBooksHandler extends AbstractStepHandler<GetBibleBooksCommand, GetBibleBooksCommandResult> {
- /**
- * public constructor
- */
- @Inject
- public GetBibleBooksHandler() {
- }
-
- public GetBibleBooksCommandResult execute(final GetBibleBooksCommand command, final ExecutionContext arg1)
- throws ActionException {
-
- getLogger().debug("GetBibleBooksCommandResult has been called...");
-
- // TODO: on start up, we should check a whole load of things: jsword
- // installed, database can be started, database has got data
-
- // find selection of books and then add stuff to the suggestbox.
- final ArrayList<String> suggestions = new ArrayList<String>();
-
- // http://www.crosswire.org/jsword/java2html/org/crosswire/jsword/bridge/BibleScope.java.html
- // TODO: currently based on KJV versification, when better to base it on
- // preferred version
- // of the bible...
- try {
- final int booksInBible = BibleInfo.booksInBible();
- BookName bn;
- final BibleNames all = new BibleNames(Locale.getDefault());
- for (int ii = 1; ii <= booksInBible; ii++) {
- bn = all.getName(ii);
- suggestions.add(bn.getPreferredName());
- }
- } catch (final NoSuchVerseException e) {
- getLogger().error("Failed to generate list of bible books", e);
- }
-
- return new GetBibleBooksCommandResult(suggestions);
- }
-
- public void rollback(final GetBibleBooksCommand arg0, final GetBibleBooksCommandResult arg1,
- final ExecutionContext context) throws ActionException {
-
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,536 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.Iterator;
-import java.util.List;
-
-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.StrongMorphMap;
-import com.tyndalehouse.step.web.server.jsword.ConfigurableHTMLConverter;
-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.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;
-
-/**
- * Command handler returning a portion of scripture in different formats
- *
- * @author CJBurrell
- *
- */
-public class GetCurrentBibleTextHandler extends
- AbstractStepHandler<GetCurrentBibleTextCommand, GetCurrentBibleTextResult> {
-
- /**
- * default constructor with the getLogger
- *
- */
- @Inject
- public GetCurrentBibleTextHandler() {
-
- }
-
- public GetCurrentBibleTextResult execute(final GetCurrentBibleTextCommand command, final ExecutionContext arg1)
- throws ActionException {
- final String version = command.getVersion();
- final String reference = command.getReference();
-
- // check information has been passed in
- // TODO: ensure error handling is handled properly
- if (StringUtils.isEmpty(version)) {
- throw new ActionException("Version was not provided");
- }
- if (StringUtils.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);
- break;
- case LOGICAL:
- addLogicalLookup(result, data);
- 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);
- break;
- case XSLT:
- result.setXsltedText(doXslt(data));
- break;
- default:
- // do nothing since nothing was requested
- break;
- }
- return result;
- }
-
- public void rollback(final GetCurrentBibleTextCommand arg0, final GetCurrentBibleTextResult arg1,
- final ExecutionContext arg2) throws ActionException {
- getLogger().error("Get Current Bible Text rolling back");
-
- }
-
- /**
- * does a classic interlinear and populates the Passage
- *
- * @param p
- * the logical passage to be populated
- * @param reference
- * the reference
- */
- private void addClassicInterlinear(final Passage p, final String reference) {
- // TODO: feature
- // identify the hebrew/greek version of the text, and get book data for
- // the appropriate version
- // final VerseRange vrf = VerseRangeFactory.fromString(reference);
- // TODO updgrade to latest jsword version
-
- // VerseRange.remainder(vrf, null);
-
- // getBookData(version, reference);
- }
-
- /**
- * adds a logical lookup to the result objet
- *
- * @param result
- * the result object to populate
- * @param data
- * the data to base the lookup upon
- * @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);
- result.setPassage(p);
- }
-
- /**
- * doing a reverse interlinear
- *
- * @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 {
- // first lookup passage from LXX or TODO user chosen version
- // TODO: cope with Hebrew
- String versionToUse;
- StrongMorphMap strongMorphMap;
-
- if (isGreek(translatedText)) {
- versionToUse = JSwordConstants.DEFAULT_GREEK_INTERLINEAR_TEXT;
- } else {
- // assume Hebrew
- versionToUse = JSwordConstants.DEFAULT_HEBREW_INTERLINEAR_TEXT;
- }
-
- // TODO: we need to do something different here,
- // we don't need to parse through the whole lot, and probably JDom
- // 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);
- }
-
- 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
- *
- * @param bookData
- * 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();
- final StrongMorphMap strongMorphMap = new StrongMorphMap();
- final Iterator<Element> it = osis.getDescendants(new Filter() {
- /**
- * serial id
- */
- private static final long serialVersionUID = 4171956787222841308L;
-
- public boolean matches(final Object obj) {
- return obj instanceof Element && ((Element) obj).getName().equals(OSISUtil.OSIS_ELEMENT_W);
- }
-
- });
-
- while (it.hasNext()) {
- final Element word = it.next();
- final Attribute lemmaAttribute = word.getAttribute(OSISUtil.ATTRIBUTE_W_LEMMA);
- final Attribute morphAttribute = word.getAttribute(OSISUtil.ATTRIBUTE_W_MORPH);
-
- if (lemmaAttribute != null) {
- if (morphAttribute != null) {
- strongMorphMap.addWord(lemmaAttribute.getValue(), morphAttribute.getValue(), word.getValue());
- } else {
- strongMorphMap.addWord(lemmaAttribute.getValue(), word.getValue());
- }
- }
- }
-
- return strongMorphMap;
- }
-
- /**
- * 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
- *
- * @param masterPassage
- * the passage to be enriched
- * @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;
-
- // we have several lemmas for each word, and therefore,
- // we need to loop round them
- lemma = w.getLemma();
- morph = w.getMorph();
-
- 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());
- }
- }
- }
- }
- }
- }
-
- /**
- * 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");
- }
-
- final List<Content> l = osisFragment.getContent();
- final Passage passage = new Passage();
-
- // 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;
-
- if (e.getName().equals(OSISUtil.OSIS_ELEMENT_TITLE)) {
- doTitle(e, passage);
- } else if (e.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
- doVerse(e, passage);
- }
- } else {
- // this shouldn't happen
- getLogger().warn("Unexpected text while parsing gwt");
- }
- }
-
- return passage;
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,176 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.List;
-
-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.Books;
-import org.crosswire.jsword.passage.NoSuchKeyException;
-import org.jdom.Element;
-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.jsword.ConfigurableHTMLConverter;
-import com.tyndalehouse.step.web.shared.command.GetDictionaryDefinitionCommand;
-import com.tyndalehouse.step.web.shared.result.GetDictionaryDefinitionResult;
-
-/**
- * Looks up the dictionary definition in a JSword module and returns it to the
- * client
- *
- * @author CJBurrell
- *
- */
-public class GetDictionaryDefinitionHandler extends
- AbstractStepHandler<GetDictionaryDefinitionCommand, GetDictionaryDefinitionResult> {
-
- /**
- * The dictionary definition handler's constructor
- */
- @Inject
- public GetDictionaryDefinitionHandler() {
- }
-
- public GetDictionaryDefinitionResult execute(final GetDictionaryDefinitionCommand command,
- final ExecutionContext arg1) throws ActionException {
- final List<String> referenceList = command.getLookupReferencce();
- final GetDictionaryDefinitionResult result = new GetDictionaryDefinitionResult();
-
- final StringBuffer definitions = new StringBuffer(300);
- // for each definition: TODO : probably want to pass back a list of
- // definitions, and tab them
- // on the popup!
- for (final String reference : referenceList) {
- definitions.append(lookUpDefinition(reference));
- definitions.append("<hr />");
-
- }
- result.setDefinition(definitions.toString());
- return result;
- }
-
- public void rollback(final GetDictionaryDefinitionCommand arg0, final GetDictionaryDefinitionResult arg1,
- final ExecutionContext arg2) throws ActionException {
- getLogger().error("Get Dictionary definition Text rolling back");
-
- }
-
- /**
- * does a simple xslt transformation to show the definition on the screen
- *
- * @param data
- * data to be shown
- * @param osisFragment
- * osisFragment to transform
- * @return the xslted definition ready to be displayed on the user's screen
- */
- private String doXslt(final BookData data, final Element osisFragment) {
- if (data == null) {
- return "";
- }
-
- try {
- final SAXEventProvider osissep = data.getSAXEventProvider();
- // TODO: do some work on the XSLT definition
- 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 "";
- }
-
- /**
- * dependant on the reference, we return a different module to lookup the
- * definition. For e.g. we use a Greek dictionary to lookup a reference
- * starting strong:Gxxxxx
- *
- * @param reference
- * reference to be looked up
- * @return the module initials to use for the dictionary lookup
- * @throws ActionException
- * an exception to be thrown if the reference is not recognised
- */
- private String getInitialsFromReference(final String reference) throws ActionException {
- if (reference.toLowerCase().startsWith(JSwordConstants.STRONG_PATTERN_START)) {
- final int charPosition = JSwordConstants.STRONG_PATTERN_START.length();
- if (reference.charAt(charPosition) == JSwordConstants.STRONG_HEBREW_MARKER) {
- return JSwordConstants.STRONG_HEBREW_DICTIONARY_INITIALS;
- } else if (reference.charAt(charPosition) == JSwordConstants.STRONG_GREEK_MARKER) {
- return JSwordConstants.STRONG_GREEK_DICTIONARY_INITIALS;
- }
- // continuing will throw exception
- }
- throw new ActionException(String.format("Dictionary reference not recognised: %s", reference));
- }
-
- /**
- * returns the actual reference, removing the strong pattern + first
- * initial. For e.g. removes strong:H from "strong:H00002"
- *
- * @param reference
- * reference to parse
- * @return the key in the dictionary to be used for lookup purposes
- * @throws ActionException
- * the action exception
- */
- private String getLookupKeyFromReference(final String reference) throws ActionException {
- if (reference.toLowerCase().startsWith(JSwordConstants.STRONG_PATTERN_START)) {
- // remove strong:H or strong:G
- return reference.substring(JSwordConstants.STRONG_PATTERN_START.length() + 1);
- }
- throw new ActionException(String.format("Lookup key not recognised: %s", reference));
- }
-
- /**
- * Looks up a definition given a reference in the default JSword module
- *
- * @param reference
- * reference, for e.g. a Strong number
- * @return the definition
- * @throws ActionException
- * an exception occurring if the reference is invalid
- */
- private String lookUpDefinition(final String reference) throws ActionException {
- if (StringUtils.isEmpty(reference)) {
- throw new ActionException("Reference was not provided");
- }
- getLogger().error("definition lookup command");
- final String initials = getInitialsFromReference(reference);
- final String lookupKey = getLookupKeyFromReference(reference);
-
- try {
- // TODO: ensure a lookup key exists!
- // TODO: make a common adapter api to access JSword
- final Book currentBook = Books.installed().getBook(initials);
- final BookData data = new BookData(currentBook, currentBook.getKey(lookupKey));
- final String xsltedDefinition = doXslt(data, data.getOsisFragment());
- return xsltedDefinition;
- } catch (final NoSuchKeyException e) {
- getLogger().error("An error occurred looking up the passage", e);
- throw new ActionException(e);
- } catch (final BookException e) {
- getLogger().error("A book exception has occurred whilte looking up the passage", e);
- throw new ActionException(e);
- }
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,101 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
-import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
-import com.tyndalehouse.step.web.server.db.timeline.TimeBandVisibleDateProcessor;
-import com.tyndalehouse.step.web.shared.command.GetEventsForDateRangeCommand;
-import com.tyndalehouse.step.web.shared.common.timeline.TimeBandVisibleDate;
-import com.tyndalehouse.step.web.shared.common.timeline.TimelineEventBean;
-import com.tyndalehouse.step.web.shared.result.GetEventsForDateRangeResult;
-
-/**
- * Command that gets relevant events on a date range. Currently this executes
- * multiple queries against the database
- *
- * @author CJBurrell
- *
- */
-public class GetEventsForDateRangeHandler extends
- AbstractStepHandler<GetEventsForDateRangeCommand, GetEventsForDateRangeResult> {
-
- /**
- * The step query runner to run queries against the database
- */
- private final StepQueryRunner queryRunner;
-
- /**
- * public constructor for this handler
- *
- * @param queryRunner
- * the query runner object to use for executing the query
- */
- @Inject
- public GetEventsForDateRangeHandler(final StepQueryRunner queryRunner) {
- this.queryRunner = queryRunner;
- }
-
- // TODO: this needs to change to take into account the three different types
- // of date precision but for now,
- // let's get something working
- public GetEventsForDateRangeResult execute(final GetEventsForDateRangeCommand event, final ExecutionContext arg1)
- throws ActionException {
- final GetEventsForDateRangeResult result = new GetEventsForDateRangeResult();
- final List<TimeBandVisibleDate> timebands = event.getVisbleDates();
- try {
- for (final TimeBandVisibleDate tvd : timebands) {
- List<TimelineEventBean> events;
- events = queryRunner.run(new TimeBandVisibleDateProcessor(tvd.getMinDate(), tvd.getMaxDate(), tvd
- .getTimebandId()));
- result.getEvents().addAll(events);
- }
- } catch (final UnableToRunQueryException e) {
- getLogger().error("An error occured while trying to retrieve new events from the datbase", e);
- throw new ActionException(e);
- }
-
- logEventsRetrieved(result.getEvents());
- return result;
- }
-
- public void rollback(final GetEventsForDateRangeCommand arg0, final GetEventsForDateRangeResult arg1,
- final ExecutionContext arg2) throws ActionException {
-
- }
-
- /**
- * Logs which events have been retrieved in trace mode
- *
- * @param events
- * events to be traced
- */
- private void logEventsRetrieved(final List<TimelineEventBean> events) {
- final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy G");
-
- if (getLogger().isTraceEnabled()) {
- for (final TimelineEventBean teb : events) {
- if (teb.getFromDate() != null && teb.getToDate() != null) {
- getLogger().trace(
- String.format("returning: %s %s-%s (tb_id: %d)", teb.getName(), sdf.format(new Date(teb
- .getFromDate())), sdf.format(new Date(teb.getToDate())), teb.getTimelineId()));
-
- } else if (teb.getFromDate() != null) {
- getLogger().trace(
- String.format("returning: %s %s (tb_id: %d)", teb.getName(), sdf.format(new Date(teb
- .getFromDate())), teb.getTimelineId()));
- } else {
- getLogger().trace(String.format("returning: %s (tb_id: %d)", teb.getName(), teb.getTimelineId()));
- }
- }
- }
- getLogger().trace(String.format("Returning %d events to the client", events.size()));
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetLocationsHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetLocationsHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetLocationsHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,50 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
-import com.tyndalehouse.step.web.shared.command.GetLocationsCommand;
-import com.tyndalehouse.step.web.shared.result.GetLocationsResult;
-
-/**
- * The GetLocations command gets geographical locations from the server
- * datasources and sends them back to the client
- *
- * @author CJBurrell
- *
- */
-public class GetLocationsHandler extends AbstractStepHandler<GetLocationsCommand, GetLocationsResult> {
-
- /**
- * Default constructor
- *
- * @param queryRunner
- * a query runner
- */
- @Inject
- public GetLocationsHandler(final StepQueryRunner queryRunner) {
- // this.queryRunner = queryRunner;
- }
-
- public GetLocationsResult execute(final GetLocationsCommand arg0, final ExecutionContext arg1)
- throws ActionException {
- // try {
- // final List<GeoLoc> timelines = queryRunner.run(new
- // TimelineSetupDataProcessor());
- final GetLocationsResult r = new GetLocationsResult();
- return r;
- // } catch (final UnableToRunQueryException e) {
- // getLogger().error("An error occured while loading the config for the query",
- // e);
- // throw new ActionException(e);
- // }
- }
-
- public void rollback(final GetLocationsCommand arg0, final GetLocationsResult arg1, final ExecutionContext arg2)
- throws ActionException {
- getLogger().error("Get Locations Handler rolling back");
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,118 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.List;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import org.crosswire.jsword.passage.Key;
-import org.crosswire.jsword.passage.KeyFactory;
-import org.crosswire.jsword.passage.NoSuchKeyException;
-import org.crosswire.jsword.passage.PassageKeyFactory;
-import org.crosswire.jsword.passage.RestrictionType;
-import org.crosswire.jsword.passage.RocketPassage;
-import org.crosswire.jsword.passage.VerseRange;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor;
-import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
-import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
-import com.tyndalehouse.step.web.server.db.timeline.TimelineOriginDbBean;
-import com.tyndalehouse.step.web.server.db.timeline.TimelineOriginProcessor;
-import com.tyndalehouse.step.web.shared.command.GetTimelineOriginForScriptureCommand;
-import com.tyndalehouse.step.web.shared.result.GetTimelineOriginForScriptureResult;
-
-/**
- * returns the timeline origin, i.e the best (closest in time) event for a given
- * verse range.
- *
- * @author CJBurrell
- *
- */
-public class GetTimelineOriginForScriptureHandler extends
- AbstractStepHandler<GetTimelineOriginForScriptureCommand, GetTimelineOriginForScriptureResult> {
- /**
- * The step query runner to run queries against the database
- */
- private final StepQueryRunner queryRunner;
-
- /**
- * constructor for this handler
- *
- * @param queryRunner
- * the query runner framework
- */
- @Inject
- public GetTimelineOriginForScriptureHandler(final StepQueryRunner queryRunner) {
- this.queryRunner = queryRunner;
- }
-
- // TODO: build a proper sql statement to query all time bands in one go
- // TODO: this needs to change to take into account the three different types
- // of date precision but for now,
- // let's get something working
- public GetTimelineOriginForScriptureResult execute(final GetTimelineOriginForScriptureCommand event,
- final ExecutionContext arg1) throws ActionException {
- try {
- // TODO: this is bad - look at JSword to work out how to properly
- // get the verserange out
- final RocketPassage passage = (RocketPassage) resolveScriptureToVerseNumbers(event.getScriptureReference());
-
- if (passage.isEmpty()) {
- getLogger().warn("No passage was requested");
- } else {
-
- // TODO: we're doing only the first range - ignoring others...
- // What would we do with several ranges? Interesting question -
- // perhaps we could use as min/max
- final VerseRange range = passage.getRangeAt(0, RestrictionType.NONE);
- final int startVerseNo = range.getStart().getOrdinal();
- final int endVerseNo = range.getEnd().getOrdinal();
-
- final ResultSetProcessor<TimelineOriginDbBean> originProcessor = new TimelineOriginProcessor(
- startVerseNo, endVerseNo);
-
- // TODO: should be able to ensure this is implied, rather having
- // to cast directly
- final List<TimelineOriginDbBean> originList = queryRunner.run(originProcessor);
-
- if (originList.size() != 0) {
- final TimelineOriginDbBean origin = originList.get(0);
- return new GetTimelineOriginForScriptureResult(origin.getOrigin(), origin.getUnit(), origin
- .getTimebandId());
- } // else {
- // // TODO: work out the nearest passage and redo this...
- // }
- }
- } catch (final NoSuchKeyException e) {
- getLogger().warn("Could not resolve verse number", e);
- // TODO: return a proper exception and show error message on the UI
- return new GetTimelineOriginForScriptureResult(true);
- } catch (final UnableToRunQueryException e) {
- getLogger().error("An error occured while loading the config for the query", e);
- throw new ActionException(e);
- }
- return new GetTimelineOriginForScriptureResult(true);
- }
-
- public void rollback(final GetTimelineOriginForScriptureCommand arg0,
- final GetTimelineOriginForScriptureResult arg1, final ExecutionContext arg2) throws ActionException {
-
- }
-
- /**
- * resolves a string to a range of verses
- *
- * @return the OSIS key to use to look up a particular scripture reference
- * in a JSword module
- * @throws NoSuchKeyException
- * thrown if the passed in reference cannot be parsed //TODO:
- * make into seperate util classes
- */
- private Key resolveScriptureToVerseNumbers(final String scriptureReference) throws NoSuchKeyException {
- final KeyFactory keyFactory = PassageKeyFactory.instance();
- return keyFactory.getKey(scriptureReference);
-
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,65 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.List;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.server.db.framework.StepQueryRunner;
-import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
-import com.tyndalehouse.step.web.server.db.timeline.TimelineSetupDataProcessor;
-import com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand;
-import com.tyndalehouse.step.web.shared.common.timeline.TimelineBean;
-import com.tyndalehouse.step.web.shared.result.GetTimelineUISetupResult;
-
-/**
- * the timeline UI setup handler, which returns the initial set of data for the
- * timeline module including the different bands, their recommended scales, etc.
- *
- * @author CJBurrell
- *
- */
-public class GetTimelineUISetupHandler extends AbstractStepHandler<GetTimelineUISetupCommand, GetTimelineUISetupResult> {
- /**
- * The step query runner to run queries against the database
- */
- private final StepQueryRunner queryRunner;
-
- /**
- * Default constructor
- *
- * @param queryRunner
- * a query runner
- */
- @Inject
- public GetTimelineUISetupHandler(final StepQueryRunner queryRunner) {
- this.queryRunner = queryRunner;
- }
-
- // TODO: this can be cached quite succesfully on the server
-
- public GetTimelineUISetupResult execute(final GetTimelineUISetupCommand cmd, final ExecutionContext arg1)
- throws ActionException {
- try {
- final List<TimelineBean> timelines = queryRunner.run(new TimelineSetupDataProcessor());
- final GetTimelineUISetupResult r = new GetTimelineUISetupResult();
- r.setTimelines(timelines);
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(String.format("Returning %d timebands to the client.", timelines.size()));
- }
- return r;
- } catch (final UnableToRunQueryException e) {
- getLogger().error("An error occured while loading the config for the query", e);
- throw new ActionException(e);
- }
- }
-
- public void rollback(final GetTimelineUISetupCommand arg0, final GetTimelineUISetupResult arg1,
- final ExecutionContext arg2) throws ActionException {
- getLogger().error("Get Timeline UI Setup Handler rolling back");
-
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,147 +0,0 @@
-package com.tyndalehouse.step.web.server.handler;
-
-import java.util.Set;
-
-import net.customware.gwt.dispatch.server.ExecutionContext;
-import net.customware.gwt.dispatch.shared.ActionException;
-
-import org.crosswire.common.progress.JobManager;
-import org.crosswire.common.progress.Progress;
-import org.crosswire.jsword.book.Book;
-import org.crosswire.jsword.book.BookException;
-import org.crosswire.jsword.book.Books;
-import org.crosswire.jsword.book.install.sword.HttpSwordInstaller;
-
-import com.google.inject.Inject;
-import com.tyndalehouse.step.web.server.common.AbstractStepHandler;
-import com.tyndalehouse.step.web.shared.command.InstallJswordModuleCommand;
-import com.tyndalehouse.step.web.shared.result.InstallJswordModuleResult;
-
-/**
- * Handler that installs a JSword module (bible, etc.) on to the server (perhaps
- * a localhost server)
- *
- * @author CJBurrell
- *
- */
-public class InstallJswordModuleHandler extends
- AbstractStepHandler<InstallJswordModuleCommand, InstallJswordModuleResult> {
-
- // TODO: move the lookup to properties file
- /**
- * proxy to use to access the internet from step
- */
- private static final String PROXY_HOST = "step.proxy.host";
-
- /**
- * proxy port to use for accessing the internet form step
- */
- private static final String PROXY_PORT = "step.proxy.port";
-
- /**
- * the time to wait for installer to kick in, so that we can then wait for
- * it
- */
- private static final int WAIT_TIME_FOR_INSTALLER = 2000;
-
- /**
- * constructor to create this handler, usually via Guice
- */
- @Inject
- public InstallJswordModuleHandler() {
- }
-
- public InstallJswordModuleResult execute(final InstallJswordModuleCommand cmd, final ExecutionContext context)
- throws ActionException {
-
- final String initials = cmd.getInitials();
- if (initials == null) {
- throw new ActionException("Module initials provided was null");
- }
-
- try {
- final HttpSwordInstaller newCustomInstaller = getNewCustomInstaller();
-
- // remove if already installed
- final Book installed = Books.installed().getBook(initials);
- if (installed != null) {
- // remove first
- // Books.installed().removeBook(installed);
- installed.getDriver().delete(installed);
- getLogger()
- .debug(
- String.format("%s (%s) is already installed, so removing first", initials, installed
- .getName()));
- }
-
- // now kick off install
- final Book bookToBeInstalled = newCustomInstaller.getBook(initials);
- newCustomInstaller.install(bookToBeInstalled);
-
- getLogger().debug(String.format("Installing %s", initials));
-
- // finally wait for install to finish
- // hack to wait for the thread to register with the manager
- // TODO: check with jsword community
- // TODO: use a timer instead...
- Thread.sleep(InstallJswordModuleHandler.WAIT_TIME_FOR_INSTALLER);
-
- @SuppressWarnings("unchecked")
- final Set<Progress> jswordJobs = JobManager.getJobs();
- for (final Progress p : jswordJobs) {
- if (p.getJobName().equals("Installing book: " + bookToBeInstalled.getName())) {
- // TODO: expose join on the thread and wait for it to exit
- // this will depend on the JSword community
- while (!p.isFinished()) {
- // sleep
- Thread.sleep(InstallJswordModuleHandler.WAIT_TIME_FOR_INSTALLER);
- }
- }
- }
- } catch (final BookException e) {
- getLogger().error("An error occured during the installation of the book", e);
- } catch (final InterruptedException e) {
- getLogger().error("An error occurred during the downloading of the book", e);
- }
-
- // wait for module to be completed
-
- return new InstallJswordModuleResult(true);
- }
-
- public void rollback(final InstallJswordModuleCommand arg0, final InstallJswordModuleResult arg1,
- final ExecutionContext arg2) throws ActionException {
- getLogger().error("Rolling back InstallJswordModule");
- }
-
- /**
- * TODO: needs redoing to ensure we take all the installers provided by
- * JSword
- *
- * @return a custom installer configured with the crosswire proxy
- */
- private HttpSwordInstaller getNewCustomInstaller() {
- getLogger().info("Creating new installer for JSword");
- final HttpSwordInstaller resourceInstaller = new HttpSwordInstaller();
-
- getLogger().info("Currently hardcoded installer host to:" + "www.crosswire.org");
- getLogger().info("Currently hardcoded property names for step");
- final String host = "www.crosswire.org";
- final String proxyHost = System.getProperty(InstallJswordModuleHandler.PROXY_HOST);
- final String proxyPort = System.getProperty(InstallJswordModuleHandler.PROXY_PORT);
- getLogger().info(String.format("Setting to (%1$s via %2$s:%3$s)", "www.crosswire.org", proxyHost, proxyPort));
-
- resourceInstaller.setHost(host);
- if (proxyHost != null) {
- resourceInstaller.setProxyHost(proxyHost);
- }
- if (proxyPort != null) {
- resourceInstaller.setProxyPort(Integer.parseInt(proxyPort));
- }
-
- getLogger().info("Setting package and catalog directories");
- resourceInstaller.setPackageDirectory("/ftpmirror/pub/sword/packages/rawzip");
- resourceInstaller.setCatalogDirectory("/ftpmirror/pub/sword/raw");
- return resourceInstaller;
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,172 +0,0 @@
-/**
- * Distribution License:
- * BibleDesktop is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 2 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * The License is available on the internet at:
- * http://www.gnu.org/copyleft/gpl.html
- * or by writing to:
- * Free Software Foundation, Inc.
- * 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- * The copyright to this program is held by it's authors.
- *
- * ID: $Id: ConfigurableSwingConverter.java 1583 2007-07-30 17:04:04Z dmsmith $
- */
-package com.tyndalehouse.step.web.server.jsword;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.MissingResourceException;
-
-import javax.xml.transform.TransformerException;
-
-import org.crosswire.common.util.FileUtil;
-import org.crosswire.common.util.NetUtil;
-import org.crosswire.common.util.ResourceUtil;
-import org.crosswire.common.util.URIFilter;
-import org.crosswire.common.xml.Converter;
-import org.crosswire.common.xml.SAXEventProvider;
-import org.crosswire.common.xml.TransformingSAXEventProvider;
-
-/**
- * Turn XML from a Bible into HTML according to a Display style.
- *
- * @see gnu.gpl.License for license details. The copyright to this program is
- * held by it's authors.
- * @author Joe Walker [joe at eireneh dot com]
- */
-public class ConfigurableHTMLConverter implements Converter {
- /**
- *
- */
- static final class XSLTFilter implements URIFilter {
-
- public boolean accept(final String name) {
- return name.endsWith(FileUtil.EXTENSION_XSLT);
- }
- }
-
- /**
- * The font to be used in OSIS->HTML generation
- */
- private static String font = "Serif-PLAIN-14"; //$NON-NLS-1$
-
- /**
- * The stylesheet we are transforming using
- */
- private static String style = "simple.xsl"; //$NON-NLS-1$
-
- /**
- * ripped off JSWord: TODO: needs to be down properly
- */
- public ConfigurableHTMLConverter() {
-
- }
-
- //
- // /**
- // * Accessor for the stylesheet we are transforming using
- // */
- // public static Font toFont()
- // {
- // return null;
- // //return GuiConvert.string2Font(font);
- // }
-
- // /**
- // * Accessor for the stylesheet we are transforming using
- // */
- // public static void setFont(String font)
- // {
- // ConfigurableHTMLConverter.font = font;
- // XSLTProperty.FONT.setState(font);
- // }
-
- /**
- * Accessor for the stylesheet we are transforming using
- *
- * @return the font
- */
- public static String getFont() {
- return ConfigurableHTMLConverter.font;
- }
-
- /**
- * Accessor for the stylesheet we are transforming using
- *
- * @return the resource name
- */
- public static String getResourceName() {
- return ConfigurableHTMLConverter.style;
- }
-
- /**
- * Accessor for the stylesheet we are transforming using
- *
- * @param style
- * returns the resource name given a style
- */
- public static void setResourceName(final String style) {
- ConfigurableHTMLConverter.style = style;
- }
-
- /**
- *
- *
- * @see org.crosswire.common.xml.Converter#convert(org.crosswire.common.xml.
- * SAXEventProvider)
- * @param xmlsep
- * the sax event provider
- * @return the converted SAX event provider
- * @throws TransformerException
- * thrown if something bad happens during the transformation of
- * the xml
- */
- public SAXEventProvider convert(final SAXEventProvider xmlsep) throws TransformerException {
- try {
- final String path = "xsl/cswing/" + ConfigurableHTMLConverter.style; //$NON-NLS-1$
- final URL xslurl = ResourceUtil.getResource(path);
-
- final TransformingSAXEventProvider tsep = new TransformingSAXEventProvider(NetUtil.toURI(xslurl), xmlsep);
- // We used to do:
- // tsep.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
- // however for various reasons, now we don't but nothing seems to be
- // broken ...
- return tsep;
- } catch (final MissingResourceException ex) {
- throw new TransformerException(ex);
- }
- }
-
- /**
- * Get an array of the available style names for a given subject. Different
- * subjects are available for different contexts. For example - for
- * insertion into a web page we might want to use a set that had complex
- * HTML, or IE/NS specific HTML, where as a JFC HTMLDocument needs simpler
- * HTML - and special tags like the starting <HTML> tags.
- * <p>
- * If the protocol of the URL of the current directory is not file then we
- * can't use File.list to get the contents of the directory. This will
- * happen if this is being run as an applet. When we start doing that then
- * we will need to think up something smarter here. Until then we just
- * return a zero length array.
- *
- * @return An array of available style names
- */
- public String[] getStyles() {
- try {
- final String search = "xsl/cswing/" + NetUtil.INDEX_FILE; //$NON-NLS-1$
- final URL index = ResourceUtil.getResource(search);
- return NetUtil.listByIndexFile(NetUtil.toURI(index), new XSLTFilter());
- } catch (final IOException ex) {
- return new String[0];
- }
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/XSLTProperty.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/XSLTProperty.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/XSLTProperty.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,335 +0,0 @@
-/**
- * Distribution License:
- * BibleDesktop is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 2 as published by
- * the Free Software Foundation. This program is distributed in the hope
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * The License is available on the internet at:
- * http://www.gnu.org/copyleft/gpl.html
- * or by writing to:
- * Free Software Foundation, Inc.
- * 59 Temple Place - Suite 330
- * Boston, MA 02111-1307, USA
- *
- * Copyright: 2005
- * The copyright to this program is held by it's authors.
- *
- * ID: $Id: XSLTProperty.java 1583 2007-07-30 17:04:04Z dmsmith $
- */
-package com.tyndalehouse.step.web.server.jsword;
-
-import java.io.File;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-
-import org.crosswire.common.util.NetUtil;
-import org.crosswire.common.util.Reporter;
-import org.crosswire.common.xml.TransformingSAXEventProvider;
-
-/* TODO: redo this class properly to behave as per where it cam from!
- *
- */
-
-/**
- * Defines properties that control the behavior of translating OSIS to HTML.
- *
- * @see gnu.gpl.License for license details. The copyright to this program is
- * held by it's authors.
- * @author DM Smith [ dmsmith555 at yahoo dot com]
- */
- at SuppressWarnings(value = {})
-public final class XSLTProperty implements Serializable {
- /**
- * What is the base of the current document. Note this needs to be set each
- * time the document is shown.
- */
- public static final XSLTProperty BASE_URL = new XSLTProperty("baseURL", "", true); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Show book, chapter and verse numbers.
- */
- public static final XSLTProperty BCV = new XSLTProperty("BCVNum", false); //$NON-NLS-1$
-
- /**
- * What is the base of the current document.
- */
- public static final XSLTProperty CSS = new XSLTProperty("css", "", true); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Show chapter and verse numbers.
- */
- public static final XSLTProperty CV = new XSLTProperty("CVNum", false); //$NON-NLS-1$
-
- /**
- * What is the base of the current document. Note this needs to be set each
- * time the document is shown.
- */
- public static final XSLTProperty DIRECTION = new XSLTProperty("direction", ""); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * What is the base of the current document. Note this needs to be set each
- * time the font changes.
- */
- public static final XSLTProperty FONT = new XSLTProperty("font", "Serif-PLAIN-14"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Should headings be shown
- */
- public static final XSLTProperty HEADINGS = new XSLTProperty("Headings", true); //$NON-NLS-1$
-
- /**
- * Determines whether Word Morphology (e.g. Robinson) should show
- */
- public static final XSLTProperty MORPH = new XSLTProperty("Morph", false); //$NON-NLS-1$
-
- /**
- * Show no verse numbers
- */
- public static final XSLTProperty NO_VERSE_NUMBERS = new XSLTProperty("NoVNum", false); //$NON-NLS-1$
-
- /**
- * Should notes be shown
- */
- public static final XSLTProperty NOTES = new XSLTProperty("Notes", true); //$NON-NLS-1$
-
- /**
- * Determines whether verses should start on a new line.
- */
- public static final XSLTProperty START_VERSE_ON_NEWLINE = new XSLTProperty("VLine", false); //$NON-NLS-1$
-
- /**
- * Determines whether Strong's Numbers should show
- */
- public static final XSLTProperty STRONGS_NUMBERS = new XSLTProperty("Strongs", false); //$NON-NLS-1$
-
- /**
- * Show verse numbers as a superscript.
- */
- public static final XSLTProperty TINY_VERSE_NUMBERS = new XSLTProperty("TinyVNum", true); //$NON-NLS-1$
-
- /**
- * Show verse numbers
- */
- public static final XSLTProperty VERSE_NUMBERS = new XSLTProperty("VNum", true); //$NON-NLS-1$
-
- /**
- * Should cross references be shown
- */
- public static final XSLTProperty XREF = new XSLTProperty("XRef", true); //$NON-NLS-1$
-
- /**
- * Support for serialization
- *
- */
- private static int nextObj;
-
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = 3257567325749326905L;
-
- /**
- * list of xslt properties
- */
- private static final XSLTProperty[] VALUES = { XSLTProperty.STRONGS_NUMBERS, XSLTProperty.MORPH,
- XSLTProperty.START_VERSE_ON_NEWLINE, XSLTProperty.VERSE_NUMBERS, XSLTProperty.CV, XSLTProperty.BCV,
- XSLTProperty.NO_VERSE_NUMBERS, XSLTProperty.TINY_VERSE_NUMBERS, XSLTProperty.HEADINGS, XSLTProperty.NOTES,
- XSLTProperty.XREF, XSLTProperty.BASE_URL, XSLTProperty.DIRECTION, XSLTProperty.FONT, XSLTProperty.CSS, };
-
- /**
- * Whether the string state should be converted to an URL when setting the
- * property.
- */
- private final boolean asURL;
-
- /**
- * The default state of the XSLTProperty
- */
- private final String defaultState;
-
- /**
- * The name of the XSLTProperty
- */
- private final String name;
-
- /**
- * TODO: don't know what this does, this class is a copy from JSword which
- * needs revamping
- */
- private final int obj = XSLTProperty.nextObj++;
-
- /**
- * The current state of the XSLTProperty
- */
- private String state;
-
- /**
- * @param name
- * The name of this property
- * @param defaultState
- * The initial state of the property.
- */
- private XSLTProperty(final String name, final boolean defaultState) {
- this(name, Boolean.toString(defaultState));
- }
-
- /**
- * @param name
- * The name of this property
- * @param defaultState
- * The initial state of the property.
- */
- private XSLTProperty(final String name, final String defaultState) {
- this(name, defaultState, false);
- }
-
- /**
- * @param name
- * The name of this property
- * @param defaultState
- * The initial state of the property.
- * @param asURL
- * whether it is a uRl?
- */
- private XSLTProperty(final String name, final String defaultState, final boolean asURL) {
- this.name = name;
- this.defaultState = defaultState;
- this.state = defaultState;
- this.asURL = asURL;
- }
-
- /**
- * Lookup method to convert from an integer
- *
- * @param i
- * gets a particular xslt property
- * @return the XSLT property matching the index
- */
- public static XSLTProperty fromInteger(final int i) {
- return XSLTProperty.VALUES[i];
- }
-
- /**
- * Lookup method to convert from a String
- *
- * @param name
- * a linear search for a property and returns the XSLT property
- * @return a XSLT property
- */
- public static XSLTProperty fromString(final String name) {
- for (int i = 0; i < XSLTProperty.VALUES.length; i++) {
- final XSLTProperty o = XSLTProperty.VALUES[i];
- if (o.name.equalsIgnoreCase(name)) {
- return o;
- }
- }
- assert false;
- return null;
- }
-
- /**
- *
- * @param provider
- * sets the SAX provider
- */
- public static void setProperties(final TransformingSAXEventProvider provider) {
- for (int i = 0; i < XSLTProperty.VALUES.length; i++) {
- XSLTProperty.VALUES[i].setProperty(provider);
- }
- }
-
- /**
- *
- * @return default state
- */
- public boolean getDefaultState() {
- return Boolean.valueOf(defaultState).booleanValue();
- }
-
- /**
- *
- * @return default state as a string
- */
- public String getDefaultStringState() {
- return defaultState;
- }
-
- /**
- * @return the name of the property
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return the state
- */
- public boolean getState() {
- return Boolean.valueOf(state).booleanValue();
- }
-
- /**
- *
- * @return state as a string
- */
- public String getStringState() {
- return state;
- }
-
- /**
- *
- * @param provider
- * a SAX provider
- */
- public void setProperty(final TransformingSAXEventProvider provider) {
- if (state != null && state.length() > 0) {
- String theState = state;
- if (asURL) {
- try {
- theState = NetUtil.getURI(new File(state)).toURL().toString();
- } catch (final MalformedURLException ex) {
- Reporter.informUser(this, ex);
- }
- }
- provider.setParameter(name, theState);
- }
- }
-
- /**
- * @param newState
- * sets the state to newState
- */
- public void setState(final boolean newState) {
- state = Boolean.toString(newState);
- }
-
- /**
- * @param newState
- * sets the state to newState
- */
- public void setState(final String newState) {
- state = newState;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return name;
- }
-
- /**
- * TODO: redo this whole class
- *
- * @return an object
- */
- Object readResolve() {
- return XSLTProperty.VALUES[obj];
- }
-}
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/BookmarkView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/BookmarkView.ui.xml 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/BookmarkView.ui.xml 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,19 +1,17 @@
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui' >
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <g:SimplePanel>
- <g:HTML>
- Mark 1:1
- <br />
- Matthew 1:1
- <br />
- Genesis 1:1
- <br />
- Exodus 1:1
- <br />
- Deutoronomy 2:1
- <br />
- </g:HTML>
- </g:SimplePanel>
-
+ <g:SimplePanel>
+ <g:HTML>
+ Mark 1:1
+ <br />
+ Matthew 1:1
+ <br />
+ Genesis 1:1
+ <br />
+ Exodus 1:1
+ <br />
+ Deutoronomy 2:1
+ <br />
+ </g:HTML>
+ </g:SimplePanel>
</ui:UiBinder>
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/FilterResultsView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/FilterResultsView.ui.xml 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/FilterResultsView.ui.xml 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,10 +1,7 @@
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui' >
+<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style src="views.css" />
-
- <g:SimplePanel>
- <g:FlowPanel height="100%">
+ <g:FlowPanel>
<g:TextBox ui:field='filterQuery' />
<g:SimplePanel ui:field='filterResults'>
<g:HTML>
@@ -33,5 +30,4 @@
</g:HTML>
</g:SimplePanel>
</g:FlowPanel>
- </g:SimplePanel>
</ui:UiBinder>
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ModuleSideBarView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ModuleSideBarView.ui.xml 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ModuleSideBarView.ui.xml 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,27 +1,29 @@
-<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'>
+<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'>
<ui:with type='com.tyndalehouse.step.web.client.framework.StepResources' field='resources' />
<ui:style src="views.css" />
-
- <g:FlowPanel>
- <g:ToggleButton ui:field='people' >
- <g:upFace image='{resources.peopleModule}' />
- </g:ToggleButton>
- <g:ToggleButton ui:field='geography'>
- <g:upFace image='{resources.geographyModule}' />
- </g:ToggleButton>
- <g:ToggleButton ui:field='history' >
- <g:upFace image='{resources.historyModule}' />
- </g:ToggleButton>
- <g:ToggleButton ui:field='language' >
- <g:upFace image='{resources.languageModule}' />
- </g:ToggleButton>
- <g:ToggleButton ui:field='literature' >
- <g:upFace image='{resources.literatureModule}' />
- </g:ToggleButton>
- <g:ToggleButton ui:field='search' >
- <g:upFace image='{resources.searchModule}' />
- </g:ToggleButton>
- </g:FlowPanel>
+
+ <g:DecoratorPanel>
+ <g:FlowPanel>
+ <g:ToggleButton ui:field='people'>
+ <g:upFace image='{resources.peopleModule}' />
+ </g:ToggleButton>
+ <g:ToggleButton ui:field='geography'>
+ <g:upFace image='{resources.geographyModule}' />
+ </g:ToggleButton>
+ <g:ToggleButton ui:field='history'>
+ <g:upFace image='{resources.historyModule}' />
+ </g:ToggleButton>
+ <g:ToggleButton ui:field='language'>
+ <g:upFace image='{resources.languageModule}' />
+ </g:ToggleButton>
+ <g:ToggleButton ui:field='literature'>
+ <g:upFace image='{resources.literatureModule}' />
+ </g:ToggleButton>
+ <g:ToggleButton ui:field='search'>
+ <g:upFace image='{resources.searchModule}' />
+ </g:ToggleButton>
+ </g:FlowPanel>
+ </g:DecoratorPanel>
</ui:UiBinder>
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.ui.xml 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.ui.xml 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,9 +1,9 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' >
-
+
<g:FlowPanel>
- <g:TextBox ui:field='referenceTextbox' />
- <g:Button ui:field='selectReferenceButton' text='>' />
+ <g:TextBox ui:field='referenceTextbox' width='90%' />
+ <g:Button ui:field='selectReferenceButton' text='>' width="10" />
</g:FlowPanel>
</ui:UiBinder>
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-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml 2010-06-25 20:49:31 UTC (rev 142)
@@ -3,22 +3,25 @@
<ui:with type='com.tyndalehouse.step.web.client.framework.StepResources' field='resources' />
<ui:style src="views.css" />
-
+
+
<g:LayoutPanel ui:field='scriptureLayoutPanel'>
- <g:layer top='0px' height='25px' left='10px' width='90%'>
+ <g:layer top='0px' height='25px'>
<g:FlowPanel ui:field='selectorPanel'>
<g:TextBox ui:field="bibleVersionSuggestion" width='99%'
text='Please enter a bible version name' />
</g:FlowPanel>
</g:layer>
- <g:layer top='25px' height='300px' left='10px' width='90%'>
- <g:FlowPanel ui:field='scriptureHolder'>
- <g:HTML>hello</g:HTML>
- </g:FlowPanel>
+ <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>
</g:layer>
- <g:layer top='20px' height='300px' left='10px' width='90%'>
+ <g:layer top='20px' height='300px'>
<g:SimplePanel ui:field='treePanel'>
<g:Tree ui:field='bibleVersions' addStyleNames="{style.lightPanelBackground}" />
</g:SimplePanel>
Deleted: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java 2010-06-25 20:30:48 UTC (rev 141)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/StepQueryRunnerImplTest.java 2010-06-25 20:49:31 UTC (rev 142)
@@ -1,85 +0,0 @@
-package com.tyndalehouse.step.web.server.db;
-
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.commons.logging.Log;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.tyndalehouse.step.web.server.db.framework.StepQueryRunnerImpl;
-import com.tyndalehouse.step.web.server.db.framework.UnableToRunQueryException;
-import com.tyndalehouse.step.web.server.db.helper.TestProcessor;
-
-/**
- * Tests the StepQueryRunner framework
- *
- * @author CJBurrell
- *
- */
- at RunWith(JMock.class)
-public class StepQueryRunnerImplTest {
-
- /** the mock object */
- private final Mockery context = new Mockery();
-
- /** tests running a query */
- @Test
- public void testRunQuery() throws UnableToRunQueryException {
- // set up the test
- final TestProcessor processor = new TestProcessor();
- final Log log = context.mock(Log.class);
-
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
-
- final StepQueryRunnerImpl impl = new StepQueryRunnerImpl(log);
-
- // Take an example ResultSet
-
- final List<String> events = impl.run(processor);
- Assert.assertNotNull(events);
- // Assert.assertEquals("Bantu expansion from Cameroon to Central Africa",
- // events.get(0));
- // Assert.assertEquals("Events in Africa", events.get(1));
-
- // TODO: Db Date has changed. this needs investigation
- // Assert.assertEquals("First date on the Mayan Long Count calendar",
- // events.get(2));
- }
-
- /**
- * tests and expects a exception to be returned
- *
- * @throws UnableToRunQueryException
- * the query expected to be return on invalid query passed in
- */
- @Test(expected = UnableToRunQueryException.class)
- public void testRunQueryWithNull() throws UnableToRunQueryException {
- // set up the test
- final Log log = context.mock(Log.class);
-
- context.checking(new Expectations() {
- {
- allowing(log).debug(with(any(String.class)));
- allowing(log).trace(with(any(String.class)));
- allowing(log).info(with(any(String.class)));
- allowing(log).isDebugEnabled();
- allowing(log).isTraceEnabled();
- allowing(log).isInfoEnabled();
- allowing(log).isErrorEnabled();
- atLeast(1).of(log).error(with(any(String.class)));
- }
- });
-
- final StepQueryRunnerImpl impl = new StepQueryRunnerImpl(log);
- impl.run(null);
- }
-}
More information about the Tynstep-svn
mailing list