[Tynstep-svn] r136 - in trunk/step-web-app/src: main/java/com/tyndalehouse/step/web/client main/java/com/tyndalehouse/step/web/client/common main/java/com/tyndalehouse/step/web/client/event main/java/com/tyndalehouse/step/web/client/eventhandler main/java/com/tyndalehouse/step/web/client/framework main/java/com/tyndalehouse/step/web/client/presenter main/java/com/tyndalehouse/step/web/client/service/refdata main/java/com/tyndalehouse/step/web/client/toolkit main/java/com/tyndalehouse/step/web/client/toolkit/scripture main/java/com/tyndalehouse/step/web/client/toolkit/timeline main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components main/java/com/tyndalehouse/step/web/client/toolkit/timeline/events main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers main/java/com/tyndalehouse/step/web/client/view main/java/com/tyndalehouse/step/web/client/view/handlers main/java/com/tyndalehouse/step/web/client/view/internal main/java/com/tyndalehouse/step/web/public/css main/java/com/tyndalehouse/step/web/server/common main/java/com/tyndalehouse/step/web/server/db/framework main/java/com/tyndalehouse/step/web/server/db/timeline main/java/com/tyndalehouse/step/web/server/guice main/java/com/tyndalehouse/step/web/server/handler main/java/com/tyndalehouse/step/web/server/handler/util/passage main/java/com/tyndalehouse/step/web/server/jsword main/java/com/tyndalehouse/step/web/shared/command main/java/com/tyndalehouse/step/web/shared/common/maps main/java/com/tyndalehouse/step/web/shared/common/scripturelookup main/java/com/tyndalehouse/step/web/shared/common/timeline main/java/com/tyndalehouse/step/web/shared/result main/java/com/tyndalehouse/step/web/shared/result/beans main/java/com/tyndalehouse/step/web/shared/scripture main/java/com/tyndalehouse/step/web/shared/timeline main/resources/com/tyndalehouse/step/web/client/view test/java/com/tyndalehouse/step/web/client/presenter test/java/com/tyndalehouse/step/web/client/service test/java/com/tyndalehouse/step/web/client/views test/java/com/tyndalehouse/step/web/server/db/helper test/java/com/tyndalehouse/step/web/server/handlers
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Sat Jun 19 10:36:36 MST 2010
Author: ChrisBurrell
Date: 2010-06-19 10:36:35 -0700 (Sat, 19 Jun 2010)
New Revision: 136
Added:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepViewInterface.java
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ScriptureChangeEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/VersionChangeEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/LemmaClickedEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ScriptureChangeEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/VersionChangeEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/VersionSelectorView.java
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/VersionSelectorView.ui.xml
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenterTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/views/VersionSelectorViewTest.java
Modified:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/BookSelectedEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ModuleChangeEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepResources.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleName.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Orientation.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimebandRequestWindow.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimelineConstants.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/events/TimelineMouseHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/CannotDeleteEventException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/IncapableOfCalculatingRequestWindowException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/TimeBandNotFoundException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/CurrentBandStats.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.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/ModuleSideBarView.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/client/view/handlers/HasSelectionHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Area.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Version.java
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/server/common/AbstractStepHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigNotLoadedException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigProvider.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/JSwordConstants.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/MalformedStepQueryException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/Query.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/QueryImpl.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/ResultSetProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQuery.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunner.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunnerImpl.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginDbBean.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java
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/StrongMorphMap.java
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/shared/command/BooksRequiredType.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetLocationsCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocation.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocationType.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/LatLong.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimeBandVisibleDate.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/beans/BibleVersion.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/timeline/Unit.java
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/StepView.ui.xml
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/views.css
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/service/ModuleRefDataServiceTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java
trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java
Log:
latest UI code
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -15,29 +15,27 @@
*/
public class StepEntryPoint implements EntryPoint {
- /**
- * Main step injector
- */
- private final StepInjector injector = GWT.create(StepInjector.class);
-
-
- /**
- * Entry point to the Step application
- */
- public void onModuleLoad() {
- Mvp4gModule module = (Mvp4gModule) GWT.create(Mvp4gModule.class);
- module.createAndStartModule();
- RootLayoutPanel.get().add((Widget) module.getStartView());
-
- // StepPresenter.Display stepView = injector.getStepPresenterDisplay();
-// RootLayoutPanel.get().add(stepView.asWidget());
-//
-
-
-// final AppPresenter appPresenter = injector.getAppPresenter();
-// appPresenter.go(RootPanel.get());
+ /**
+ * Main step injector
+ */
+ private final StepInjector injector = GWT.create(StepInjector.class);
- // injector.getPlaceManager().fireCurrentPlace();
- }
+ /**
+ * Entry point to the Step application
+ */
+ public void onModuleLoad() {
+ final Mvp4gModule module = (Mvp4gModule) GWT.create(Mvp4gModule.class);
+ module.createAndStartModule();
+ RootLayoutPanel.get().add((Widget) module.getStartView());
+ // StepPresenter.Display stepView = injector.getStepPresenterDisplay();
+ // RootLayoutPanel.get().add(stepView.asWidget());
+ //
+
+ // final AppPresenter appPresenter = injector.getAppPresenter();
+ // appPresenter.go(RootPanel.get());
+
+ // injector.getPlaceManager().fireCurrentPlace();
+ }
+
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/common/CachingDispatchAsync.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,77 +16,84 @@
*
*/
public class CachingDispatchAsync implements DispatchAsync {
- /**
+ /**
*
*/
- private final Map<Action<Result>, Result> cache = new HashMap<Action<Result>, Result>();
+ private final Map<Action<Result>, Result> cache = new HashMap<Action<Result>, Result>();
- /**
- * The default dispatcher
- */
- private final DispatchAsync dispatcher;
+ /**
+ * The default dispatcher
+ */
+ private final DispatchAsync dispatcher;
- /**
- * The default constructor
- *
- * @param dispatcher uses the default dispatcher
- */
- @Inject
- public CachingDispatchAsync(final DispatchAsync dispatcher) {
- this.dispatcher = dispatcher;
- }
+ /**
+ * The default constructor
+ *
+ * @param dispatcher
+ * uses the default dispatcher
+ */
+ @Inject
+ public CachingDispatchAsync(final DispatchAsync dispatcher) {
+ this.dispatcher = dispatcher;
+ }
- /**
- * Clear the cache
- */
- public void clear() {
- cache.clear();
- }
+ /**
+ * Clear the cache
+ */
+ public void clear() {
+ cache.clear();
+ }
- /**
- * This method is a simple wrapper around the DispatchAsync class at the
- * moment
- *
- * @param <A> Action implementation
- * @param <R> Result implementation
- * @param action the action
- * @param callback the callback
- * @see net.customware.gwt.dispatch.client.DispatchAsync#execute(A,
- * com.google.gwt.user.client.rpc.AsyncCallback)
- */
- public <A extends Action<R>, R extends Result> void execute(final A action,
- final AsyncCallback<R> callback) {
- dispatcher.execute(action, callback);
- }
+ /**
+ * This method is a simple wrapper around the DispatchAsync class at the
+ * moment
+ *
+ * @param <A>
+ * Action implementation
+ * @param <R>
+ * Result implementation
+ * @param action
+ * the action
+ * @param callback
+ * the callback
+ * @see net.customware.gwt.dispatch.client.DispatchAsync#execute(A,
+ * com.google.gwt.user.client.rpc.AsyncCallback)
+ */
+ public <A extends Action<R>, R extends Result> void execute(final A action, final AsyncCallback<R> callback) {
+ dispatcher.execute(action, callback);
+ }
- /**
- * Execute the given Action. If the Action was executed before it will get
- * fetched from the cache
- *
- * @param <A> Action implementation
- * @param <R> Result implementation
- * @param action the action
- * @param callback the callback
- */
- @SuppressWarnings("unchecked")
- public <A extends Action<R>, R extends Result> void executeWithCache(final A action,
- final AsyncCallback<R> callback) {
- final Result r = cache.get(action);
+ /**
+ * Execute the given Action. If the Action was executed before it will get
+ * fetched from the cache
+ *
+ * @param <A>
+ * Action implementation
+ * @param <R>
+ * Result implementation
+ * @param action
+ * the action
+ * @param callback
+ * the callback
+ */
+ @SuppressWarnings("unchecked")
+ public <A extends Action<R>, R extends Result> void executeWithCache(final A action, final AsyncCallback<R> callback) {
+ final Result r = cache.get(action);
- if (r != null) {
- callback.onSuccess((R) r);
- } else {
- dispatcher.execute(action, new AsyncCallback<R>() {
+ if (r != null) {
+ callback.onSuccess((R) r);
+ } else {
+ dispatcher.execute(action, new AsyncCallback<R>() {
- public void onFailure(final Throwable caught) {
- callback.onFailure(caught);
- }
+ public void onFailure(final Throwable caught) {
+ callback.onFailure(caught);
+ }
- public void onSuccess(final R result) {
- cache.put((Action) action, (Result) result);
- callback.onSuccess(result);
- }
- });
- }
- }
+ public void onSuccess(final R result) {
+ cache.put((Action) action, (Result) result);
+ callback.onSuccess(result);
+ }
+ });
+ }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/BookSelectedEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,21 +12,21 @@
*/
public class BookSelectedEvent extends GwtEvent<BookSelectedEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- private static Type<BookSelectedEventHandler> TYPE = new Type<BookSelectedEventHandler>();
+ /**
+ * The default Type Handler Type is parameterized by the handler type in
+ * order to make the addHandler method type safe.
+ */
+ private static Type<BookSelectedEventHandler> TYPE = new Type<BookSelectedEventHandler>();
- @Override
- public Type<BookSelectedEventHandler> getAssociatedType() {
- return TYPE;
- }
+ @Override
+ public Type<BookSelectedEventHandler> getAssociatedType() {
+ return BookSelectedEvent.TYPE;
+ }
- @Override
- protected void dispatch(final BookSelectedEventHandler handler) {
- handler.onBookSelected(this);
+ @Override
+ protected void dispatch(final BookSelectedEventHandler handler) {
+ handler.onBookSelected(this);
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,48 +12,49 @@
*
*/
public class DictionaryDefinitionFoundEvent extends GwtEvent<DictionaryDefinitionFoundHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- private static Type<DictionaryDefinitionFoundHandler> TYPE = new Type<DictionaryDefinitionFoundHandler>();
+ /**
+ * The default Type Handler Type is parameterized by the handler type in
+ * order to make the addHandler method type safe.
+ */
+ private static Type<DictionaryDefinitionFoundHandler> TYPE = new Type<DictionaryDefinitionFoundHandler>();
- /**
- * the definition that was retrieved
- */
- private String definition;
+ /**
+ * the definition that was retrieved
+ */
+ private String definition;
- /**
- * default constructor
- *
- * @param defintion this is the definition that was retrieved from the
- * server
- */
- public DictionaryDefinitionFoundEvent(final String defintion) {
- this.definition = defintion;
- }
+ /**
+ * default constructor
+ *
+ * @param defintion
+ * this is the definition that was retrieved from the server
+ */
+ public DictionaryDefinitionFoundEvent(final String defintion) {
+ this.definition = defintion;
+ }
- @Override
- public Type<DictionaryDefinitionFoundHandler> getAssociatedType() {
- return TYPE;
- }
+ @Override
+ public Type<DictionaryDefinitionFoundHandler> getAssociatedType() {
+ return DictionaryDefinitionFoundEvent.TYPE;
+ }
- /**
- * @return the definition
- */
- public String getDefinition() {
- return definition;
- }
+ /**
+ * @return the definition
+ */
+ public String getDefinition() {
+ return definition;
+ }
- /**
- * @param definition the definition to set
- */
- public void setDefinition(final String definition) {
- this.definition = definition;
- }
+ /**
+ * @param definition
+ * the definition to set
+ */
+ public void setDefinition(final String definition) {
+ this.definition = definition;
+ }
- @Override
- protected void dispatch(final DictionaryDefinitionFoundHandler handler) {
- handler.onDefinitionFound(this);
- }
+ @Override
+ protected void dispatch(final DictionaryDefinitionFoundHandler handler) {
+ handler.onDefinitionFound(this);
+ }
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/LemmaClickedEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,59 +0,0 @@
-package com.tyndalehouse.step.web.client.event;
-
-import java.util.List;
-
-import com.google.gwt.event.shared.GwtEvent;
-import com.tyndalehouse.step.web.client.eventhandler.LemmaClickedEventHandler;
-
-/**
- * This event is fired when a portion of scripture tagged with 1 or more lemma
- * (strong number for e.g.) has been clicked. The event contains details of the
- * lemmas references.
- *
- * @author cjburrell
- *
- */
-public class LemmaClickedEvent extends GwtEvent<LemmaClickedEventHandler> {
- /**
- * Type of event
- */
- public static Type<LemmaClickedEventHandler> TYPE = new Type<LemmaClickedEventHandler>();
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- private List<String> lemma;
-
- /**
- * constructing the event with a list of lemmas
- *
- * @param lemmas the list of lemmas that were clicked upon
- */
- public LemmaClickedEvent(final List<String> lemmas) {
- this.lemma = lemmas;
- }
-
- @Override
- public Type<LemmaClickedEventHandler> getAssociatedType() {
- return TYPE;
- }
-
- /**
- * @return the lemma
- */
- public List<String> getLemma() {
- return lemma;
- }
-
- /**
- * @param lemma the lemma to set
- */
- public void setLemma(final List<String> lemma) {
- this.lemma = lemma;
- }
-
- @Override
- protected void dispatch(final LemmaClickedEventHandler handler) {
- handler.onLemmaClicked(this);
- }
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ModuleChangeEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,65 +11,67 @@
*
*/
public class ModuleChangeEvent extends GwtEvent<ModuleChangeEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- private static Type<ModuleChangeEventHandler> TYPE = new Type<ModuleChangeEventHandler>();
+ /**
+ * The default Type Handler Type is parameterized by the handler type in
+ * order to make the addHandler method type safe.
+ */
+ private static Type<ModuleChangeEventHandler> TYPE = new Type<ModuleChangeEventHandler>();
- /** newly selected depth of stud */
- private final String newDepth;
- /** newly selected module */
- private final String newModule;
- /** newly selected submodule */
- private final String newSubModule;
+ /** newly selected depth of stud */
+ private final String newDepth;
+ /** newly selected module */
+ private final String newModule;
+ /** newly selected submodule */
+ private final String newSubModule;
- /**
- * creates an event alerting of the new chosen combination of
- * module/sub-module/depth
- *
- * @param newModule new module
- * @param newSubModule new sub module
- * @param newDepth new depth of study
- */
- public ModuleChangeEvent(final String newModule, final String newSubModule,
- final String newDepth) {
- this.newModule = newModule;
- this.newSubModule = newSubModule;
- this.newDepth = newDepth;
- }
+ /**
+ * creates an event alerting of the new chosen combination of
+ * module/sub-module/depth
+ *
+ * @param newModule
+ * new module
+ * @param newSubModule
+ * new sub module
+ * @param newDepth
+ * new depth of study
+ */
+ public ModuleChangeEvent(final String newModule, final String newSubModule, final String newDepth) {
+ this.newModule = newModule;
+ this.newSubModule = newSubModule;
+ this.newDepth = newDepth;
+ }
- @Override
- public Type<ModuleChangeEventHandler> getAssociatedType() {
- return TYPE;
- }
+ @Override
+ public Type<ModuleChangeEventHandler> getAssociatedType() {
+ return ModuleChangeEvent.TYPE;
+ }
- /**
- *
- * @return the depth
- */
- public String getNewDepth() {
- return newDepth;
- }
+ /**
+ *
+ * @return the depth
+ */
+ public String getNewDepth() {
+ return newDepth;
+ }
- /**
- * @return the new module
- */
- public String getNewModule() {
- return newModule;
- }
+ /**
+ * @return the new module
+ */
+ public String getNewModule() {
+ return newModule;
+ }
- /**
- *
- * @return the new sub module
- */
- public String getNewSubModule() {
- return newSubModule;
- }
+ /**
+ *
+ * @return the new sub module
+ */
+ public String getNewSubModule() {
+ return newSubModule;
+ }
- @Override
- protected void dispatch(final ModuleChangeEventHandler handler) {
- handler.onModuleChange(this);
- }
+ @Override
+ protected void dispatch(final ModuleChangeEventHandler handler) {
+ handler.onModuleChange(this);
+ }
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ScriptureChangeEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ScriptureChangeEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/ScriptureChangeEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,53 +0,0 @@
-package com.tyndalehouse.step.web.client.event;
-
-import com.google.gwt.event.shared.GwtEvent;
-import com.tyndalehouse.step.web.client.eventhandler.ScriptureChangeEventHandler;
-
-/**
- * Scripture change is fired when the scripture viewed on the screen is
- * requested to be different
- *
- * @author cjburrell
- *
- */
-public class ScriptureChangeEvent extends GwtEvent<ScriptureChangeEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- // TODO: remove this type into an abstract layer
- public static Type<ScriptureChangeEventHandler> TYPE = new Type<ScriptureChangeEventHandler>();
-
- /**
- * This is the new reference that is being fired.
- */
- private final String newReference;
-
- /**
- * Constructor to create a scripture change even with a biblical reference
- *
- * @param newReference the new reference that has been chosen by the user
- */
- public ScriptureChangeEvent(final String newReference) {
- this.newReference = newReference;
- }
-
- @Override
- public Type<ScriptureChangeEventHandler> getAssociatedType() {
- return TYPE;
- }
-
- /**
- * @return the new biblical reference that has been selected
- */
- public String getNewReference() {
- return newReference;
- }
-
- @Override
- protected void dispatch(final ScriptureChangeEventHandler handler) {
- handler.onScriptureChange(this);
-
- }
-
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,48 +13,48 @@
* @author cjburrell
*
*/
-public class TimebandListUpdateRequiredEvent extends
- GwtEvent<TimebandListUpdateRequiredEventHandler> {
+public class TimebandListUpdateRequiredEvent extends GwtEvent<TimebandListUpdateRequiredEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- public static Type<TimebandListUpdateRequiredEventHandler> TYPE = new Type<TimebandListUpdateRequiredEventHandler>();
+ /**
+ * The default Type Handler Type is parameterized by the handler type in
+ * order to make the addHandler method type safe.
+ */
+ public static Type<TimebandListUpdateRequiredEventHandler> TYPE = new Type<TimebandListUpdateRequiredEventHandler>();
- /**
- * List of new statistics, one for each band
- */
- private final List<CurrentBandStats> stats;
+ /**
+ * List of new statistics, one for each band
+ */
+ private final List<CurrentBandStats> stats;
- /**
- * The timeline is passed in, so that the timeband list can know what the
- * new values are
- *
- * @param stats timeline to be passed in
- */
- public TimebandListUpdateRequiredEvent(final List<CurrentBandStats> stats) {
- this.stats = stats;
+ /**
+ * The timeline is passed in, so that the timeband list can know what the
+ * new values are
+ *
+ * @param stats
+ * timeline to be passed in
+ */
+ public TimebandListUpdateRequiredEvent(final List<CurrentBandStats> stats) {
+ this.stats = stats;
- }
+ }
- @Override
- public Type<TimebandListUpdateRequiredEventHandler> getAssociatedType() {
- // TODO Auto-generated method stub
- return TYPE;
- }
+ @Override
+ public Type<TimebandListUpdateRequiredEventHandler> getAssociatedType() {
+ // TODO Auto-generated method stub
+ return TimebandListUpdateRequiredEvent.TYPE;
+ }
- /**
- * @return the stats
- */
- public List<CurrentBandStats> getTimelineStats() {
- return stats;
- }
+ /**
+ * @return the stats
+ */
+ public List<CurrentBandStats> getTimelineStats() {
+ return stats;
+ }
- @Override
- protected void dispatch(final TimebandListUpdateRequiredEventHandler handler) {
- handler.onTimebandListRequiringUpdate(this);
+ @Override
+ protected void dispatch(final TimebandListUpdateRequiredEventHandler handler) {
+ handler.onTimebandListRequiringUpdate(this);
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -15,71 +15,75 @@
*
*/
public class TimelineScrollEvent extends GwtEvent<TimelineScrollEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- public static Type<TimelineScrollEventHandler> TYPE = new Type<TimelineScrollEventHandler>();
+ /**
+ * The default Type Handler Type is parameterized by the handler type in
+ * order to make the addHandler method type safe.
+ */
+ public static Type<TimelineScrollEventHandler> TYPE = new Type<TimelineScrollEventHandler>();
- /**
- * list of requests to the server on which portions of which bands need to
- * be updated
- */
- private List<TimeBandVisibleDate> timebandVisibleDates;
+ /**
+ * list of requests to the server on which portions of which bands need to
+ * be updated
+ */
+ private List<TimeBandVisibleDate> timebandVisibleDates;
- /**
- * default constructor
- */
- public TimelineScrollEvent() {
- timebandVisibleDates = new ArrayList<TimeBandVisibleDate>();
- }
+ /**
+ * default constructor
+ */
+ public TimelineScrollEvent() {
+ timebandVisibleDates = new ArrayList<TimeBandVisibleDate>();
+ }
- /**
- * adds a timeband and the portion of time that needs updating
- *
- * @param timebandId the timeband id
- * @param minDate the minimum date
- * @param maxDate the maximum date
- */
- public void addTimebandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
- final TimeBandVisibleDate visibleDate = new TimeBandVisibleDate(timebandId, minDate,
- maxDate);
- addTimebandVisibleDate(visibleDate);
- }
+ /**
+ * adds a timeband and the portion of time that needs updating
+ *
+ * @param timebandId
+ * the timeband id
+ * @param minDate
+ * the minimum date
+ * @param maxDate
+ * the maximum date
+ */
+ public void addTimebandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
+ final TimeBandVisibleDate visibleDate = new TimeBandVisibleDate(timebandId, minDate, maxDate);
+ addTimebandVisibleDate(visibleDate);
+ }
- /**
- * adds a @see {@link TimeBandVisibleDate} to the event
- *
- * @param visibleDate the TimeBandVisibleDate object containing details of
- * which parts of the timeband (min, max) need updating.
- */
- public void addTimebandVisibleDate(final TimeBandVisibleDate visibleDate) {
- if (!visibleDate.isNoRequest()) {
- timebandVisibleDates.add(visibleDate);
- }
- }
+ /**
+ * adds a @see {@link TimeBandVisibleDate} to the event
+ *
+ * @param visibleDate
+ * the TimeBandVisibleDate object containing details of which
+ * parts of the timeband (min, max) need updating.
+ */
+ public void addTimebandVisibleDate(final TimeBandVisibleDate visibleDate) {
+ if (!visibleDate.isNoRequest()) {
+ timebandVisibleDates.add(visibleDate);
+ }
+ }
- @Override
- public Type<TimelineScrollEventHandler> getAssociatedType() {
- return TYPE;
- }
+ @Override
+ public Type<TimelineScrollEventHandler> getAssociatedType() {
+ return TimelineScrollEvent.TYPE;
+ }
- /**
- * @return the timebandVisibleDates
- */
- public List<TimeBandVisibleDate> getTimebandVisibleDates() {
- return timebandVisibleDates;
- }
+ /**
+ * @return the timebandVisibleDates
+ */
+ public List<TimeBandVisibleDate> getTimebandVisibleDates() {
+ return timebandVisibleDates;
+ }
- /**
- * @param timebandVisibleDates the timebandVisibleDates to set
- */
- public void setTimebandVisibleDates(final List<TimeBandVisibleDate> timebandVisibleDates) {
- this.timebandVisibleDates = timebandVisibleDates;
- }
+ /**
+ * @param timebandVisibleDates
+ * the timebandVisibleDates to set
+ */
+ public void setTimebandVisibleDates(final List<TimeBandVisibleDate> timebandVisibleDates) {
+ this.timebandVisibleDates = timebandVisibleDates;
+ }
- @Override
- protected void dispatch(final TimelineScrollEventHandler handler) {
- handler.onScroll(this);
- }
+ @Override
+ protected void dispatch(final TimelineScrollEventHandler handler) {
+ handler.onScroll(this);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,55 +10,57 @@
*
*/
public class UserInterestInBandEvent extends GwtEvent<UserInterestInBandEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- public static Type<UserInterestInBandEventHandler> TYPE = new Type<UserInterestInBandEventHandler>();
+ /**
+ * The default Type Handler Type is parameterized by the handler type in
+ * order to make the addHandler method type safe.
+ */
+ public static Type<UserInterestInBandEventHandler> TYPE = new Type<UserInterestInBandEventHandler>();
- /**
- * the band the user has selected to choose or dismiss
- */
- private final int bandId;
+ /**
+ * the band the user has selected to choose or dismiss
+ */
+ private final int bandId;
- /**
- * whether the user wants to see the band or not
- */
- private final Boolean isOfInterest;
+ /**
+ * whether the user wants to see the band or not
+ */
+ private final Boolean isOfInterest;
- /**
- * creates the event
- *
- * @param bandId the band that the user selected
- * @param isOfInterest whether the user is interested in it or not
- */
- public UserInterestInBandEvent(final int bandId, final Boolean isOfInterest) {
- this.bandId = bandId;
- this.isOfInterest = isOfInterest;
- }
+ /**
+ * creates the event
+ *
+ * @param bandId
+ * the band that the user selected
+ * @param isOfInterest
+ * whether the user is interested in it or not
+ */
+ public UserInterestInBandEvent(final int bandId, final Boolean isOfInterest) {
+ this.bandId = bandId;
+ this.isOfInterest = isOfInterest;
+ }
- @Override
- public Type<UserInterestInBandEventHandler> getAssociatedType() {
- return TYPE;
- }
+ @Override
+ public Type<UserInterestInBandEventHandler> getAssociatedType() {
+ return UserInterestInBandEvent.TYPE;
+ }
- /**
- * @return the bandId
- */
- public int getBandId() {
- return bandId;
- }
+ /**
+ * @return the bandId
+ */
+ public int getBandId() {
+ return bandId;
+ }
- /**
- * @return the isOfInterest
- */
- public Boolean isOfInterest() {
- return isOfInterest;
- }
+ /**
+ * @return the isOfInterest
+ */
+ public Boolean isOfInterest() {
+ return isOfInterest;
+ }
- @Override
- protected void dispatch(final UserInterestInBandEventHandler handler) {
- handler.onUserInterestedInBand(this);
- }
+ @Override
+ protected void dispatch(final UserInterestInBandEventHandler handler) {
+ handler.onUserInterestedInBand(this);
+ }
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/VersionChangeEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/VersionChangeEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/VersionChangeEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,28 +0,0 @@
-package com.tyndalehouse.step.web.client.event;
-
-import com.google.gwt.event.shared.GwtEvent;
-import com.tyndalehouse.step.web.client.eventhandler.VersionChangeEventHandler;
-
-/**
- * Event signalling a change of bible version of the UI
- *
- * @author cjburrell
- *
- */
-public class VersionChangeEvent extends GwtEvent<VersionChangeEventHandler> {
- /**
- * The default Type Handler Type is parameterized by the handler type in
- * order to make the addHandler method type safe.
- */
- public static Type<VersionChangeEventHandler> TYPE = new Type<VersionChangeEventHandler>();
-
- @Override
- public Type<VersionChangeEventHandler> getAssociatedType() {
- return TYPE;
- }
-
- @Override
- protected void dispatch(final VersionChangeEventHandler handler) {
- handler.onVersionChange(this);
- }
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/BookSelectedEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/BookSelectedEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/BookSelectedEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,10 +13,11 @@
*/
public interface BookSelectedEventHandler extends EventHandler {
- /**
- * This method is called when a @see {@link BookSelectedEvent} is triggered
- *
- * @param event that is provided to the handler
- */
- void onBookSelected(BookSelectedEvent event);
+ /**
+ * This method is called when a @see {@link BookSelectedEvent} is triggered
+ *
+ * @param event
+ * that is provided to the handler
+ */
+ void onBookSelected(BookSelectedEvent event);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,12 +11,13 @@
*
*/
public interface DictionaryDefinitionFoundHandler extends EventHandler {
- /**
- * This method is fired when a dictionary definition has been looked up from
- * the server
- *
- * @param dictionaryDefintionFoundEvent the dictionary definition found
- * event, containing the results from the server
- */
- void onDefinitionFound(DictionaryDefinitionFoundEvent dictionaryDefintionFoundEvent);
+ /**
+ * This method is fired when a dictionary definition has been looked up from
+ * the server
+ *
+ * @param dictionaryDefintionFoundEvent
+ * the dictionary definition found event, containing the results
+ * from the server
+ */
+ void onDefinitionFound(DictionaryDefinitionFoundEvent dictionaryDefintionFoundEvent);
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/LemmaClickedEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/LemmaClickedEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/LemmaClickedEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,21 +0,0 @@
-package com.tyndalehouse.step.web.client.eventhandler;
-
-import com.google.gwt.event.shared.EventHandler;
-import com.tyndalehouse.step.web.client.event.LemmaClickedEvent;
-
-/**
- * Contract for handlers who are interested in the user clicking on a portion of
- * scripture which was tagged with a lemma
- *
- * @author cjburrell
- *
- */
-public interface LemmaClickedEventHandler extends EventHandler {
- /**
- * This is fired when a click on a portion of scripture tagged with a lemma
- * has occured
- *
- * @param lemmaClickedEvent the event that is provided to the handler
- */
- void onLemmaClicked(LemmaClickedEvent lemmaClickedEvent);
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ModuleChangeEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ModuleChangeEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ModuleChangeEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,11 +10,11 @@
*
*/
public interface ModuleChangeEventHandler extends EventHandler {
- /**
- * Called when the user has selected a different module
- *
- * @param event provided to the handler containing the new module
- * combination
- */
- void onModuleChange(ModuleChangeEvent event);
+ /**
+ * Called when the user has selected a different module
+ *
+ * @param event
+ * provided to the handler containing the new module combination
+ */
+ void onModuleChange(ModuleChangeEvent event);
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ScriptureChangeEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ScriptureChangeEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ScriptureChangeEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,20 +0,0 @@
-package com.tyndalehouse.step.web.client.eventhandler;
-
-import com.google.gwt.event.shared.EventHandler;
-import com.tyndalehouse.step.web.client.event.ScriptureChangeEvent;
-
-/**
- * Handler contract for when the user changes the portion of scripture he is
- * viewing
- *
- * @author cjburrell
- *
- */
-public interface ScriptureChangeEventHandler extends EventHandler {
- /**
- * Fired when the user changes the portion of scripture currently viewed
- *
- * @param event event containing the details of the new scripture requested
- */
- void onScriptureChange(ScriptureChangeEvent event);
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,12 +11,12 @@
*
*/
public interface TimebandListUpdateRequiredEventHandler extends EventHandler {
- /**
- * This is fired when new events are added to the timeband, or when events
- * are no longer in the visible section
- *
- * @param timebandListUpdateRequiredEvent the event containing the new
- * statistics to be displayed
- */
- void onTimebandListRequiringUpdate(TimebandListUpdateRequiredEvent timebandListUpdateRequiredEvent);
+ /**
+ * This is fired when new events are added to the timeband, or when events
+ * are no longer in the visible section
+ *
+ * @param timebandListUpdateRequiredEvent
+ * the event containing the new statistics to be displayed
+ */
+ void onTimebandListRequiringUpdate(TimebandListUpdateRequiredEvent timebandListUpdateRequiredEvent);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,12 +12,13 @@
*/
public interface TimelineScrollEventHandler extends EventHandler {
- /**
- * Fired when the timeline is being scrolled, before new events are
- * requested from the server
- *
- * @param event event containing the new portions of time to be requested
- * from the server
- */
- void onScroll(TimelineScrollEvent event);
+ /**
+ * Fired when the timeline is being scrolled, before new events are
+ * requested from the server
+ *
+ * @param event
+ * event containing the new portions of time to be requested from
+ * the server
+ */
+ void onScroll(TimelineScrollEvent event);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,12 +12,13 @@
*/
public interface UserInterestInBandEventHandler extends EventHandler {
- /**
- * fired when a timeband has been selected/nselected
- *
- * @param userInterestInBandEvent contains information about the timeband
- * that was selected/nselected
- */
- void onUserInterestedInBand(UserInterestInBandEvent userInterestInBandEvent);
+ /**
+ * fired when a timeband has been selected/nselected
+ *
+ * @param userInterestInBandEvent
+ * contains information about the timeband that was
+ * selected/nselected
+ */
+ void onUserInterestedInBand(UserInterestInBandEvent userInterestInBandEvent);
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/VersionChangeEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/VersionChangeEventHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/VersionChangeEventHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,21 +0,0 @@
-package com.tyndalehouse.step.web.client.eventhandler;
-
-import com.google.gwt.event.shared.EventHandler;
-import com.tyndalehouse.step.web.client.event.VersionChangeEvent;
-
-/**
- * Contract for handlers requiring updates when the user changes the version of
- * the bible he is currently accessing
- *
- * @author cjburrell
- *
- */
-public interface VersionChangeEventHandler extends EventHandler {
-
- /**
- * fired when the user selects a different bible version
- *
- * @param event the event containing the new version information
- */
- void onVersionChange(VersionChangeEvent event);
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -2,40 +2,45 @@
import java.util.List;
-import com.google.gwt.user.client.ui.Widget;
import com.mvp4g.client.annotation.Event;
import com.mvp4g.client.annotation.Events;
import com.mvp4g.client.annotation.Start;
import com.mvp4g.client.event.EventBus;
import com.tyndalehouse.step.web.client.gin.StepClientModule;
+import com.tyndalehouse.step.web.client.presenter.BookmarkPresenter;
import com.tyndalehouse.step.web.client.presenter.FilterResultsPresenter;
import com.tyndalehouse.step.web.client.presenter.ModuleSideBarPresenter;
+import com.tyndalehouse.step.web.client.presenter.ScripturePresenter;
import com.tyndalehouse.step.web.client.presenter.StepPresenter;
-import com.tyndalehouse.step.web.client.presenter.VersionSelectorPresenter;
import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
import com.tyndalehouse.step.web.client.view.StepView;
@Events(startView = StepView.class, ginModule = StepClientModule.class)
public interface StepEventBus extends EventBus {
+
+ @Start
+ @Event(handlers = { ModuleSideBarPresenter.class, FilterResultsPresenter.class, BookmarkPresenter.class,
+ StepPresenter.class })
+ void start();
+
@Event(handlers = StepPresenter.class)
- void setLeftColumn(Widget w);
+ void setLeftColumn(StepViewInterface w);
@Event(handlers = StepPresenter.class)
- void setRightColumn(Widget w);
+ void setRightColumn(StepViewInterface w);
@Event(handlers = StepPresenter.class)
- void setSidebar(Widget w);
+ void setSidebar(StepViewInterface w);
@Event(handlers = StepPresenter.class)
- void setTop(Widget w);
+ void setTop(StepViewInterface w);
@Event(handlers = StepPresenter.class)
- void setFilterPanel(Widget w);
+ void setFilterPanel(StepViewInterface w);
- @Start
- @Event(handlers = { VersionSelectorPresenter.class, ModuleSideBarPresenter.class, FilterResultsPresenter.class })
- void start();
+ @Event(handlers = StepPresenter.class)
+ void setCenterPanel(StepViewInterface w);
/**
* sets the new module to be looked up
@@ -56,4 +61,22 @@
@Event()
void timebandUpdated(List<CurrentBandStats> currentBandStats);
+ /**
+ * alerts of an update to the reference that the user is wanting to study
+ *
+ * @param newReference
+ * a new reference
+ */
+ @Event(handlers = ScripturePresenter.class)
+ void scriptureChanged(String newReference);
+
+ /**
+ * a change of version has occured
+ *
+ * @param newVersion
+ * the new version initials
+ */
+ @Event(handlers = ScripturePresenter.class)
+ void versionChanged(String newVersion);
+
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepResources.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepResources.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepResources.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -5,22 +5,22 @@
public interface StepResources extends ClientBundle {
- @Source("com/tyndalehouse/step/web/client/sidebar/people.png")
- ImageResource peopleModule();
+ @Source("com/tyndalehouse/step/web/client/sidebar/people.png")
+ ImageResource peopleModule();
- @Source("com/tyndalehouse/step/web/client/sidebar/globe.png")
- ImageResource geographyModule();
+ @Source("com/tyndalehouse/step/web/client/sidebar/globe.png")
+ ImageResource geographyModule();
- @Source("com/tyndalehouse/step/web/client/sidebar/search.png")
- ImageResource searchModule();
+ @Source("com/tyndalehouse/step/web/client/sidebar/search.png")
+ ImageResource searchModule();
- @Source("com/tyndalehouse/step/web/client/sidebar/language.png")
- ImageResource languageModule();
+ @Source("com/tyndalehouse/step/web/client/sidebar/language.png")
+ ImageResource languageModule();
- @Source("com/tyndalehouse/step/web/client/sidebar/books.png")
- ImageResource literatureModule();
+ @Source("com/tyndalehouse/step/web/client/sidebar/books.png")
+ ImageResource literatureModule();
- @Source("com/tyndalehouse/step/web/client/sidebar/history.png")
- ImageResource historyModule();
+ @Source("com/tyndalehouse/step/web/client/sidebar/history.png")
+ ImageResource historyModule();
}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepViewInterface.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepViewInterface.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepViewInterface.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -0,0 +1,14 @@
+package com.tyndalehouse.step.web.client.framework;
+
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * All views should implement this interface, so that the presenters do not need
+ * a reference to Widget and can be tested independently from the browser.
+ *
+ * @author cjburrell
+ *
+ */
+public interface StepViewInterface {
+ Widget getContainerWidget();
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -6,6 +6,7 @@
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.view.BookmarkView;
@Presenter(view = BookmarkView.class)
@@ -13,7 +14,7 @@
private final DispatchAsync dispatcher;
/** contact with the sidebar view */
- public interface Display {
+ public interface Display extends StepViewInterface {
}
@Inject
@@ -22,5 +23,6 @@
}
public void onStart() {
+ eventBus.setCenterPanel(view);
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -2,11 +2,11 @@
import net.customware.gwt.dispatch.client.DispatchAsync;
-import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
import com.tyndalehouse.step.web.client.view.FilterResultsView;
@@ -17,8 +17,8 @@
/**
* Interface for the Version Selector Module View
*/
- public interface Display {
- Widget getWidget();
+ public interface Display extends StepViewInterface {
+
}
@Inject
@@ -30,6 +30,6 @@
}
public void onStart() {
- super.eventBus.setFilterPanel(super.view.getWidget());
+ super.eventBus.setFilterPanel(super.view);
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -5,49 +5,54 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
import com.tyndalehouse.step.web.client.view.ModuleSideBarView;
@Presenter(view = ModuleSideBarView.class)
public class ModuleSideBarPresenter extends BasePresenter<ModuleSideBarPresenter.Display, StepEventBus> {
- private DispatchAsync dispatcher;
+ private final DispatchAsync dispatcher;
- /** contact with the sidebar view */
- public interface Display {
- HasClickHandlers getGeography();
- HasClickHandlers getHistory();
- HasClickHandlers getLanguage();
- HasClickHandlers getPeople();
- HasClickHandlers getSearch();
- HasClickHandlers getLiterature();
- SideBarModule getSelectedModule();
- Widget getWidget();
-
- }
+ /** contact with the sidebar view */
+ public interface Display extends StepViewInterface {
+ HasClickHandlers getGeography();
- @Inject
- ModuleSideBarPresenter(final DispatchAsync dispatcher) {
- this.dispatcher = dispatcher;
- }
+ HasClickHandlers getHistory();
- public void onStart() {
- super.eventBus.setSidebar(super.view.getWidget());
- ClickHandler clickedModuleButtonHandler = new ClickHandler() {
- public void onClick(final ClickEvent arg0) {
- eventBus.moduleChanged(view.getSelectedModule());
- }
- };
-
- super.view.getGeography().addClickHandler(clickedModuleButtonHandler);
- super.view.getHistory().addClickHandler(clickedModuleButtonHandler);
- super.view.getLanguage().addClickHandler(clickedModuleButtonHandler);
- super.view.getPeople().addClickHandler(clickedModuleButtonHandler);
- super.view.getSearch().addClickHandler(clickedModuleButtonHandler);
- super.view.getLiterature().addClickHandler(clickedModuleButtonHandler);
- }
+ HasClickHandlers getLanguage();
+
+ HasClickHandlers getPeople();
+
+ HasClickHandlers getSearch();
+
+ HasClickHandlers getLiterature();
+
+ SideBarModule getSelectedModule();
+
+ }
+
+ @Inject
+ ModuleSideBarPresenter(final DispatchAsync dispatcher) {
+ this.dispatcher = dispatcher;
+ }
+
+ public void onStart() {
+ super.eventBus.setSidebar(super.view);
+ final ClickHandler clickedModuleButtonHandler = new ClickHandler() {
+ public void onClick(final ClickEvent arg0) {
+ eventBus.moduleChanged(view.getSelectedModule());
+ }
+ };
+
+ super.view.getGeography().addClickHandler(clickedModuleButtonHandler);
+ super.view.getHistory().addClickHandler(clickedModuleButtonHandler);
+ super.view.getLanguage().addClickHandler(clickedModuleButtonHandler);
+ super.view.getPeople().addClickHandler(clickedModuleButtonHandler);
+ super.view.getSearch().addClickHandler(clickedModuleButtonHandler);
+ super.view.getLiterature().addClickHandler(clickedModuleButtonHandler);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -5,8 +5,26 @@
import net.customware.gwt.dispatch.client.DispatchAsync;
+import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.HasChangeHandlers;
+import com.google.gwt.event.dom.client.HasKeyPressHandlers;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+import com.mvp4g.client.annotation.Presenter;
+import com.mvp4g.client.presenter.BasePresenter;
+import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.toolkit.HasSource;
+import com.tyndalehouse.step.web.client.view.ScriptureView;
+import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
+import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
+import com.tyndalehouse.step.web.shared.common.scripturelookup.BibleTextLookupType;
+import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
+import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
+import com.tyndalehouse.step.web.shared.result.beans.BibleVersion;
import com.tyndalehouse.step.web.shared.scripture.Passage;
/**
@@ -17,10 +35,8 @@
* @author cjburrell
*
*/
-public class ScripturePresenter /*
- * extends
- * WidgetPresenter<ScripturePresenter.Display>
- */{
+ at Presenter(view = ScriptureView.class, multiple = true)
+public class ScripturePresenter extends BasePresenter<ScripturePresenter.Display, StepEventBus> {
/**
* Description of the view for presenting scripture to the user
@@ -28,7 +44,7 @@
* @author cjburrell
*
*/
- public interface Display /* extends WidgetDisplay */{
+ public interface Display extends StepViewInterface {
/**
* TODO: change the name, it's a bit meaningless change handlers to the
* bible versions dropdown
@@ -39,12 +55,6 @@
/**
*
- * @return the currently selected bible version on the UI
- */
- String getSelectedBibleVersion();
-
- /**
- *
* @return a map (intials -> bible Name) used as the source of the bible
* versions dropdown
*/
@@ -65,17 +75,23 @@
*/
void setPassage(Passage passage);
- /**
- * @param text
- * the text form of the passage
- */
- void setPassage(String text);
+ String getCurrentPassage();
+
+ void setCurrentPassage(String currentPassage);
+
+ void addVersion(String continent, String language, String versionInitials, String versionName);
+
+ // HasClickHandlers getVersionSelectionButton();
+
+ HasKeyPressHandlers getVersionSelectionEntered();
+
+ String getCurrentlySelectedVersion();
}
/**
* default asynchronous dispatcher
*/
- private DispatchAsync dispatcher;
+ private final DispatchAsync dispatcher;
/**
*
@@ -89,112 +105,92 @@
* the scripture selector view (i.e. the bit with the reference
* in it), provided by Gin
*/
- // @Inject
- public ScripturePresenter(/*
- * final Display display, final EventBus eventBus,
- * final DispatchAsync dispatcher
- */) {
- // super(display, eventBus);
- // TODO: remove dependency on scripture selector view
- // this.dispatcher = dispatcher;
- // Log.debug("Initialising Scripture Presenter");
- // bind();
+ @Inject
+ public ScripturePresenter(final DispatchAsync dispatcher) {
+ this.dispatcher = dispatcher;
+ Log.debug("Initialising Scripture Presenter");
}
- public void refreshDisplay() {
- // TODO Auto-generated method stub
+ @Override
+ public void bind() {
+ // super.eventBus.setLeftColumn(super.view);
+ dispatcher.execute(new GetAvailableBibleVersionsCommand(),
+ new AsyncCallback<GetAvailableBibleVersionsResult>() {
+
+ public void onFailure(final Throwable e) {
+ // TODO Auto-generated method stub
+ Log.debug("Error getting available versions: ", e);
+ }
+
+ public void onSuccess(final GetAvailableBibleVersionsResult versions) {
+ final List<BibleVersion> bibleVersions = versions.getBibleVersions();
+ for (final BibleVersion bv : bibleVersions) {
+ view.addVersion("Bibles", bv.getLanguage(), bv.getInitials(), bv.getName());
+ }
+ }
+ });
+
+ addHandlersForVersionSelection();
}
+ public void onStart() {
+ // eventBus.setLeftColumn(view);
+ }
+
/**
- * Sends a request to the server to get the new text to be displayed. TODO:
- * this should be parameterized since the cmd options are set to defaults
- * here for testing
+ * adds the click and key handlers that would trigger a version change
*/
- private void doRefreshScripture() {
- // final GetCurrentBibleTextCommand cmd = new
- // GetCurrentBibleTextCommand(display.getSelectedBibleVersion(),
- // scriptureSelectorView.getReference().getValue());
+ private void addHandlersForVersionSelection() {
+
+ super.view.getVersionSelectionEntered().addKeyPressHandler(new KeyPressHandler() {
+ public void onKeyPress(final KeyPressEvent keyPressEvent) {
+ if (keyPressEvent.getCharCode() == KeyCodes.KEY_ENTER) {
+ fireVersionChange();
+ }
+ }
+ });
+ }
+
+ protected void fireVersionChange() {
+ final String currentlySelectedVersion = view.getCurrentlySelectedVersion();
+ if (currentlySelectedVersion != null) {
+ eventBus.versionChanged(currentlySelectedVersion);
+ }
+ }
+
+ /**
+ * updates the state of the view with the new scripture change, and
+ * refreshes the view
+ */
+ public void onScriptureChanged(final String newReference) {
+ view.setCurrentPassage(newReference);
+ refreshView();
+ }
+
+ public void onVersionChanged(final String newVersionInitials) {
+ refreshView();
+ }
+
+ private void refreshView() {
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(view.getCurrentlySelectedVersion(), view
+ .getCurrentPassage());
+
// TODO: decide if this should be made static or UI driven
- // cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
- //
- // dispatcher.execute(cmd, new
- // DisplayCallback<GetCurrentBibleTextResult>(display) {
- //
- // @Override
- // protected void handleFailure(final Throwable e) {
- // Log.error("An error has occurred", e);
- // }
- //
- // @Override
- // protected void handleSuccess(final GetCurrentBibleTextResult result)
- // {
- // // String text = result.getPassageText();
- // display.setPassage(result.getPassage());
- // }
- //
- // });
+ cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+
+ dispatcher.execute(cmd, new AsyncCallback<GetCurrentBibleTextResult>() {
+ public void onFailure(final Throwable e) {
+ Log.error("An error has occurred", e);
+ }
+
+ public void onSuccess(final GetCurrentBibleTextResult result) {
+ view.setPassage(result.getPassage());
+ }
+ });
}
- // @Override
- protected void onBind() {
- // Log.debug("Binding Scripture Presenter");
- // // get list of versions now...
- // dispatcher.execute(new GetAvailableBibleVersionsCommand(),
- // new DisplayCallback<GetAvailableBibleVersionsResult>(display) {
- // @Override
- // protected void handleFailure(final Throwable e) {
- // Log.error("An error occurred while retrieving bible versions: ", e);
- // }
- //
- // @Override
- // protected void handleSuccess(final GetAvailableBibleVersionsResult
- // result) {
- // // display.getSource().setSource(result.getBooks());
- // }
- // });
- //
- // display.getChangeHandlers().addChangeHandler(new ChangeHandler() {
- // public void onChange(final ChangeEvent event) {
- // eventBus.fireEvent(new VersionChangeEvent());
- // doRefreshScripture();
- // }
- // });
- //
- // eventBus.addHandler(ScriptureChangeEvent.TYPE, new
- // ScriptureChangeEventHandler() {
- //
- // public void onScriptureChange(final ScriptureChangeEvent event) {
- // Log.debug("Scripture Change event captured");
- // doRefreshScripture();
- // }
- // });
- //
- // // TODO: this handler needs to be moved somewhere else, and fire off
- // // definition found
- // // TODO: given the handler name, our event bus, should be able to
- // derive
- // // the type of it,
- // // since the type = Type<HandlerName>, at which point we can probably
- // // get rid of
- // // the type variable in the event.
- // // we would have to change the event to return the static type
- // declared
- // // in the
- // // event handler
- //
- // final LemmaClickedEventHandler lceh = new LemmaClickedEventHandler()
- // {
- // public void onLemmaClicked(final LemmaClickedEvent lemmaClickedEvent)
- // {
- // Log.error("Lemma Clicked event handler invoked");
- // highlightAllLemmas(lemmaClickedEvent.getLemma());
- // }
- //
- // private void highlightAllLemmas(final List<String> lemmas) {
- // display.highlight(lemmas);
- // }
- // };
- // eventBus.addHandler(LemmaClickedEvent.TYPE, lceh);
+ public void onLemmaClicked(final List<String> lemmas) {
+ view.highlight(lemmas);
}
}
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,9 +1,11 @@
package com.tyndalehouse.step.web.client.presenter;
-import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
import com.tyndalehouse.step.web.client.view.StepView;
@@ -24,40 +26,63 @@
* @author cjburrell
*
*/
- public interface Display {
- void setSideBar(Widget w);
+ public interface Display extends StepViewInterface {
+ void setSideBar(StepViewInterface w);
- void setTop(Widget w);
+ void setTop(StepViewInterface w);
- void setLeftColumn(Widget w);
+ void setLeftColumn(StepViewInterface w);
- void setRightColumn(Widget w);
+ void setRightColumn(StepViewInterface w);
- void setFilterPanel(Widget w);
+ void setFilterPanel(StepViewInterface w);
+ void setCenterPanel(StepViewInterface w);
+
void setFilterPanelVisible(boolean visible);
+
+ void reLay();
}
- public void onSetLeftColumn(final Widget w) {
- super.view.setLeftColumn(w);
+ public void onStart() {
+ view.setLeftColumn(eventBus.addHandler(ScripturePresenter.class).getView());
+ view.setRightColumn(eventBus.addHandler(ScripturePresenter.class).getView());
}
- public void onSetRightColumn(final Widget w) {
- super.view.setRightColumn(w);
+ @Override
+ public void bind() {
+ super.bind();
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ view.reLay();
+ }
+ });
}
- public void onSetSidebar(final Widget w) {
- super.view.setSideBar(w);
+ public void onSetLeftColumn(final StepViewInterface v) {
+ super.view.setLeftColumn(v);
}
- public void onSetTop(final Widget w) {
- super.view.setTop(w);
+ public void onSetRightColumn(final StepViewInterface v) {
+ super.view.setRightColumn(v);
}
- public void onSetFilterPanel(final Widget w) {
- super.view.setFilterPanel(w);
+ public void onSetSidebar(final StepViewInterface v) {
+ super.view.setSideBar(v);
}
+ public void onSetTop(final StepViewInterface v) {
+ super.view.setTop(v);
+ }
+
+ public void onSetFilterPanel(final StepViewInterface v) {
+ super.view.setFilterPanel(v);
+ }
+
+ public void onSetCenterPanel(final StepViewInterface v) {
+ super.view.setCenterPanel(v);
+ }
+
public void onModuleChanged(final SideBarModule newModule) {
super.view.setFilterPanelVisible(!SideBarModule.NONE.equals(newModule));
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,7 +10,6 @@
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
-import com.tyndalehouse.step.web.client.event.ScriptureChangeEvent;
import com.tyndalehouse.step.web.client.event.TimelineScrollEvent;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
import com.tyndalehouse.step.web.client.toolkit.timeline.TimeEvent;
@@ -140,9 +139,9 @@
}
}
- public void onScriptureChange(final ScriptureChangeEvent sce) {
+ public void onScriptureChange(final String newReference) {
Log.debug("Scripture Change event captured");
- dispatcher.execute(new GetTimelineOriginForScriptureCommand(sce.getNewReference()),
+ dispatcher.execute(new GetTimelineOriginForScriptureCommand(newReference),
new AsyncCallback<GetTimelineOriginForScriptureResult>() {
public void onFailure(final Throwable e) {
Log.error("Failed to get timeline origin", e);
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,71 +0,0 @@
-package com.tyndalehouse.step.web.client.presenter;
-
-import java.util.List;
-
-import net.customware.gwt.dispatch.client.DispatchAsync;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Inject;
-import com.mvp4g.client.annotation.Presenter;
-import com.mvp4g.client.presenter.BasePresenter;
-import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.view.VersionSelectorView;
-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;
-
- at Presenter(view = VersionSelectorView.class)
-public class VersionSelectorPresenter extends BasePresenter<VersionSelectorPresenter.Display, StepEventBus> {
- private final DispatchAsync dispatcher;
-
- /**
- * Interface for the Version Selector Module View
- */
- public interface Display {
- void addVersion(String continent, String language, String versionInitials, String versionName);
-
- // void addVersionChangeHandler(final
- // SelectionHandler<VersionChangeEvent> handler);
-
- Widget getWidget();
- }
-
- @Inject
- VersionSelectorPresenter(final DispatchAsync dispatcher) {
- this.dispatcher = dispatcher;
- }
-
- public void onStart() {
- super.eventBus.setLeftColumn(super.view.getWidget());
-
- dispatcher.execute(new GetAvailableBibleVersionsCommand(),
- new AsyncCallback<GetAvailableBibleVersionsResult>() {
-
- public void onFailure(final Throwable e) {
- // TODO Auto-generated method stub
- Log.debug("Error getting available versions: ", e);
- }
-
- public void onSuccess(final GetAvailableBibleVersionsResult versions) {
- final List<BibleVersion> bibleVersions = versions.getBibleVersions();
- for (final BibleVersion bv : bibleVersions) {
- view.addVersion("Bibles", bv.getLanguage(), bv.getInitials(), bv.getName());
- }
- }
- });
- }
-
- @Override
- public void bind() {
- // TODO: try with HasSelectionHandlers<TreeItem>
- // view.addVersionChangeHandler(new
- // SelectionHandler<VersionSelectionEvent>() {
- // public void onSelection(SelectionEvent<VersionSelectionEvent> event)
- // {
- // Log.debug("selection was changed");
- // }
- // });
- }
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleName.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleName.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleName.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,57 +7,61 @@
*
*/
public class ModuleName {
- /**
- * Module name
- */
- private String moduleName;
+ /**
+ * Module name
+ */
+ private String moduleName;
- /**
- * Parent if applicable of the module
- */
- private String parent;
+ /**
+ * Parent if applicable of the module
+ */
+ private String parent;
- /**
- * Cosntructs a module with a given name and parent
- *
- * @param moduleName module name
- * @param parent parent may be null
- */
- public ModuleName(final String moduleName, final String parent) {
- this.moduleName = moduleName;
+ /**
+ * Cosntructs a module with a given name and parent
+ *
+ * @param moduleName
+ * module name
+ * @param parent
+ * parent may be null
+ */
+ public ModuleName(final String moduleName, final String parent) {
+ this.moduleName = moduleName;
- if (parent == null) {
- this.parent = "Module";
- } else {
- this.parent = parent;
- }
- }
+ if (parent == null) {
+ this.parent = "Module";
+ } else {
+ this.parent = parent;
+ }
+ }
- /**
- * @return the moduleName
- */
- public String getModuleName() {
- return moduleName;
- }
+ /**
+ * @return the moduleName
+ */
+ public String getModuleName() {
+ return moduleName;
+ }
- /**
- * @return the parent
- */
- public String getParent() {
- return parent;
- }
+ /**
+ * @return the parent
+ */
+ public String getParent() {
+ return parent;
+ }
- /**
- * @param moduleName the moduleName to set
- */
- public void setModuleName(final String moduleName) {
- this.moduleName = moduleName;
- }
+ /**
+ * @param moduleName
+ * the moduleName to set
+ */
+ public void setModuleName(final String moduleName) {
+ this.moduleName = moduleName;
+ }
- /**
- * @param parent the parent to set
- */
- public void setParent(final String parent) {
- this.parent = parent;
- }
+ /**
+ * @param parent
+ * the parent to set
+ */
+ public void setParent(final String parent) {
+ this.parent = parent;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/ModuleRefData.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,92 +9,93 @@
*/
// TODO: Ginify the singleton pattern
public final class ModuleRefData {
- /**
- * This class is a singleton, so this is the unique private instance
- */
- private static ModuleRefData instance;
+ /**
+ * This class is a singleton, so this is the unique private instance
+ */
+ private static ModuleRefData instance;
- /**
- * List of depths populating the Depth dropdown (level at which the user
- * wants to see articles)
- */
- private final List<String> depths;
+ /**
+ * List of depths populating the Depth dropdown (level at which the user
+ * wants to see articles)
+ */
+ private final List<String> depths;
- /**
- * List of module names to be displayed in the drop downs
- */
- private final List<ModuleName> moduleNames;
+ /**
+ * List of module names to be displayed in the drop downs
+ */
+ private final List<ModuleName> moduleNames;
- /**
- * Private constructor setting up all modules, and their hierarchies For
- * e.g. People, Events and Eras come under History TODO: This needs
- * internationalising
- */
- private ModuleRefData() {
- moduleNames = new ArrayList<ModuleName>();
+ /**
+ * Private constructor setting up all modules, and their hierarchies For
+ * e.g. People, Events and Eras come under History TODO: This needs
+ * internationalising
+ */
+ private ModuleRefData() {
+ moduleNames = new ArrayList<ModuleName>();
- // no hashtable on client side...
+ // no hashtable on client side...
- // History Modules
- moduleNames.add(new ModuleName("People", "History"));
- moduleNames.add(new ModuleName("Events", "History"));
- moduleNames.add(new ModuleName("Eras", "History"));
+ // History Modules
+ moduleNames.add(new ModuleName("People", "History"));
+ moduleNames.add(new ModuleName("Events", "History"));
+ moduleNames.add(new ModuleName("Eras", "History"));
- // Geography Modules
- moduleNames.add(new ModuleName("Places", "Geography"));
- moduleNames.add(new ModuleName("Maps", "Geography"));
- moduleNames.add(new ModuleName("Google Maps", "Geography"));
+ // Geography Modules
+ moduleNames.add(new ModuleName("Places", "Geography"));
+ moduleNames.add(new ModuleName("Maps", "Geography"));
+ moduleNames.add(new ModuleName("Google Maps", "Geography"));
- // Main modules
- // TODO: tidy up and send to paremeter files
- moduleNames.add(new ModuleName("History", "Module"));
- moduleNames.add(new ModuleName("Geography", "Module"));
- moduleNames.add(new ModuleName("Language", "Module"));
- moduleNames.add(new ModuleName("Parallels", "Module"));
- moduleNames.add(new ModuleName("Translations", "Module"));
- moduleNames.add(new ModuleName("Commentaries", "Module"));
- moduleNames.add(new ModuleName("Publications", "Module"));
- moduleNames.add(new ModuleName("Presentations", "Module"));
+ // Main modules
+ // TODO: tidy up and send to paremeter files
+ moduleNames.add(new ModuleName("History", "Module"));
+ moduleNames.add(new ModuleName("Geography", "Module"));
+ moduleNames.add(new ModuleName("Language", "Module"));
+ moduleNames.add(new ModuleName("Parallels", "Module"));
+ moduleNames.add(new ModuleName("Translations", "Module"));
+ moduleNames.add(new ModuleName("Commentaries", "Module"));
+ moduleNames.add(new ModuleName("Publications", "Module"));
+ moduleNames.add(new ModuleName("Presentations", "Module"));
- // DEPTHS
- depths = new ArrayList<String>();
- depths.add("Quick Look");
- depths.add("Deep Study");
- depths.add("Scholarly Details");
- }
+ // DEPTHS
+ depths = new ArrayList<String>();
+ depths.add("Quick Look");
+ depths.add("Deep Study");
+ depths.add("Scholarly Details");
+ }
- /**
- * @return the instance
- */
- public static synchronized ModuleRefData getInstance() {
- if (instance == null) {
- instance = new ModuleRefData();
- }
+ /**
+ * @return the instance
+ */
+ public static synchronized ModuleRefData getInstance() {
+ if (ModuleRefData.instance == null) {
+ ModuleRefData.instance = new ModuleRefData();
+ }
- return instance;
- }
+ return ModuleRefData.instance;
+ }
- /**
- * @return the depths
- */
- public List<String> getDepths() {
- return depths;
- }
+ /**
+ * @return the depths
+ */
+ public List<String> getDepths() {
+ return depths;
+ }
- /**
- * Returns a list of modules given a parent module
- *
- * @param parentModule parent module, or "Module" if none
- * @return the list of available modules
- */
- public List<String> getListOfModules(final String parentModule) {
- final List<String> subset = new ArrayList<String>();
+ /**
+ * Returns a list of modules given a parent module
+ *
+ * @param parentModule
+ * parent module, or "Module" if none
+ * @return the list of available modules
+ */
+ public List<String> getListOfModules(final String parentModule) {
+ final List<String> subset = new ArrayList<String>();
- for (final ModuleName mn : moduleNames) {
- if (mn.getParent().equals(parentModule)) {
- subset.add(mn.getModuleName());
- }
- }
- return subset;
- }
+ for (final ModuleName mn : moduleNames) {
+ if (mn.getParent().equals(parentModule)) {
+ subset.add(mn.getModuleName());
+ }
+ }
+ return subset;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -6,19 +6,21 @@
*
* @author cjburrell
*
- * @param <T> The type of data it is expecting
+ * @param <T>
+ * The type of data it is expecting
*/
public interface HasSource<T> {
- /**
- * Clears the source, i.e. resets to an empty list
- */
- void clearSource();
+ /**
+ * Clears the source, i.e. resets to an empty list
+ */
+ void clearSource();
- /**
- * Settings the data
- *
- * @param source source of the data
- */
- void setSource(T source);
+ /**
+ * Settings the data
+ *
+ * @param source
+ * source of the data
+ */
+ void setSource(T source);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,99 +16,102 @@
* @author cjburrell
*/
public class HtmlList extends Widget {
- /**
- * Two types of list, ordered or undered
- *
- * @author cjburrell
- *
- */
- public static enum ListType {
- /**
- * An ordered list
- */
- ORDERED {
- /**
- * Creates an UL element on the DOM
- *
- * @return the element created
- */
- @Override
- public Element createElement() {
- return Document.get().createOLElement();
- }
- },
- /**
- * An unordered list
- */
- UNORDERED {
- /**
- * Creates an UL element on the DOM
- *
- * @return the element created
- */
- @Override
- public Element createElement() {
- return Document.get().createULElement();
- }
- };
+ /**
+ * Two types of list, ordered or undered
+ *
+ * @author cjburrell
+ *
+ */
+ public static enum ListType {
+ /**
+ * An ordered list
+ */
+ ORDERED {
+ /**
+ * Creates an UL element on the DOM
+ *
+ * @return the element created
+ */
+ @Override
+ public Element createElement() {
+ return Document.get().createOLElement();
+ }
+ },
+ /**
+ * An unordered list
+ */
+ UNORDERED {
+ /**
+ * Creates an UL element on the DOM
+ *
+ * @return the element created
+ */
+ @Override
+ public Element createElement() {
+ return Document.get().createULElement();
+ }
+ };
- /**
- * Creates an UL element on the DOM
- *
- * @return the element created
- */
- public abstract Element createElement();
- }
+ /**
+ * Creates an UL element on the DOM
+ *
+ * @return the element created
+ */
+ public abstract Element createElement();
+ }
- /**
- * list of items to be mapped in the list. And whether they should launch
- * Commands on selected
- */
- private final Map<Element, Command> listItems = new HashMap<Element, Command>();
+ /**
+ * list of items to be mapped in the list. And whether they should launch
+ * Commands on selected
+ */
+ private final Map<Element, Command> listItems = new HashMap<Element, Command>();
- /**
- * Constructor to create a HTML unordered or ordered list
- *
- * @param listType whether an ordered or unordered list should be created
- */
- public HtmlList(final ListType listType) {
- setElement(listType.createElement());
- setStylePrimaryName("html-list");
- }
+ /**
+ * Constructor to create a HTML unordered or ordered list
+ *
+ * @param listType
+ * whether an ordered or unordered list should be created
+ */
+ public HtmlList(final ListType listType) {
+ setElement(listType.createElement());
+ setStylePrimaryName("html-list");
+ }
- /**
- * Adds an item to the HtmlList
- *
- * @param text the text next to the bullet/numbered point
- * @param command the command to be executed if a user clicks on it
- */
- public void addItem(final String text, final Command command) {
- final LIElement liElement = Document.get().createLIElement();
- liElement.setInnerText(text);
- getElement().appendChild(liElement);
+ /**
+ * Adds an item to the HtmlList
+ *
+ * @param text
+ * the text next to the bullet/numbered point
+ * @param command
+ * the command to be executed if a user clicks on it
+ */
+ public void addItem(final String text, final Command command) {
+ final LIElement liElement = Document.get().createLIElement();
+ liElement.setInnerText(text);
+ getElement().appendChild(liElement);
- listItems.put(liElement, command);
+ listItems.put(liElement, command);
- // All the events we're interested in
- sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONCLICK);
- }
- //
- // @Override
- // public void onBrowserEvent(Event event) {
- // switch(event.getTypeInt()) {
- // case Event.ONCLICK:
- // Element target = event.getTarget();
- // if (listItems.containsKey(target))
- // DeferredCommand.addCommand(listItems.get(target));
- //
- // break;
- // case Event.ONMOUSEOUT:
- // event.getTarget().setClassName(null);
- // break;
- //
- // case Event.ONMOUSEOVER:
- // event.getTarget().setClassName("highlightOn");
- // break;
- // }
- // }
+ // All the events we're interested in
+ sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONCLICK);
+ }
+ //
+ // @Override
+ // public void onBrowserEvent(Event event) {
+ // switch(event.getTypeInt()) {
+ // case Event.ONCLICK:
+ // Element target = event.getTarget();
+ // if (listItems.containsKey(target))
+ // DeferredCommand.addCommand(listItems.get(target));
+ //
+ // break;
+ // case Event.ONMOUSEOUT:
+ // event.getTarget().setClassName(null);
+ // break;
+ //
+ // case Event.ONMOUSEOVER:
+ // event.getTarget().setClassName("highlightOn");
+ // break;
+ // }
+ // }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,18 +1,18 @@
package com.tyndalehouse.step.web.client.toolkit;
public enum SideBarModule {
- /** the geography module */
- GEOGRAPHY,
- /** the history module */
- HISTORY,
- /** the language module */
- LANGUAGE,
- /** the people module */
- PEOPLE,
- /** the search module */
- SEARCH,
- /** the literature module */
- LITERATURE,
- /** no module selected */
- NONE,
+ /** the geography module */
+ GEOGRAPHY,
+ /** the history module */
+ HISTORY,
+ /** the language module */
+ LANGUAGE,
+ /** the people module */
+ PEOPLE,
+ /** the search module */
+ SEARCH,
+ /** the literature module */
+ LITERATURE,
+ /** no module selected */
+ NONE,
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,15 +13,15 @@
*/
public class SimpleListBox extends ListBox implements HasSource<List<String>> {
- public void clearSource() {
- this.clear();
+ public void clearSource() {
+ this.clear();
- }
+ }
- public void setSource(final List<String> source) {
- clearSource();
- for (final String key : source) {
- addItem(key);
- }
- }
+ public void setSource(final List<String> source) {
+ clearSource();
+ for (final String key : source) {
+ addItem(key);
+ }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,16 +13,16 @@
*/
public class SourceListBox extends ListBox implements HasSource<SortedMap<String, String>> {
- public void clearSource() {
- this.clear();
+ public void clearSource() {
+ this.clear();
- }
+ }
- public void setSource(final SortedMap<String, String> source) {
- clearSource();
- for (final Entry<String, String> entry : source.entrySet()) {
- addItem(entry.getValue(), entry.getKey());
- }
+ public void setSource(final SortedMap<String, String> source) {
+ clearSource();
+ for (final Entry<String, String> entry : source.entrySet()) {
+ addItem(entry.getValue(), entry.getKey());
+ }
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,15 +8,15 @@
*/
public final class ScriptureDisplayConstants {
- /**
- * To emphasis text in the module, for e.g. when a user clicks on a word
- */
- public static final String EMPHASISE = "scripture-emphasise";
+ /**
+ * To emphasis text in the module, for e.g. when a user clicks on a word
+ */
+ public static final String EMPHASISE = "scripture-emphasise";
- /**
- * making constructor private
- */
- private ScriptureDisplayConstants() {
+ /**
+ * making constructor private
+ */
+ private ScriptureDisplayConstants() {
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,99 +13,103 @@
*
*/
public class TapeTrack extends Widget {
- /**
- * The following variable defines the earliest spot at which an event can be
- * painted
- */
- private int earliestPaintOpportunity;
+ /**
+ * The following variable defines the earliest spot at which an event can be
+ * painted
+ */
+ private int earliestPaintOpportunity;
- /**
- * Determines whether the Tape Track is part of the DOM yet
- */
- private boolean isRendered;
+ /**
+ * Determines whether the Tape Track is part of the DOM yet
+ */
+ private boolean isRendered;
- /**
- * The following spot defines the latest spot at which an event needs to be
- * finished if it is to be painted on this track
- */
- private int latestPaintOpportunity;
+ /**
+ * The following spot defines the latest spot at which an event needs to be
+ * finished if it is to be painted on this track
+ */
+ private int latestPaintOpportunity;
- /**
- * Element on the DOM that is the track
- */
- private final Element track;
+ /**
+ * Element on the DOM that is the track
+ */
+ private final Element track;
- /**
- * The default constructor initialises in memory a tape track. This includes
- * setting up the div outside of the DOM, and setting the default earliest
- * and latest opportunities for painting as Max and Min Integers hence
- * allowing everything to be painted
- */
- public TapeTrack() {
- isRendered = false;
- track = DOM.createDiv();
- track.setClassName("step-tape-track");
- earliestPaintOpportunity = Integer.MAX_VALUE;
- latestPaintOpportunity = Integer.MIN_VALUE;
+ /**
+ * The default constructor initialises in memory a tape track. This includes
+ * setting up the div outside of the DOM, and setting the default earliest
+ * and latest opportunities for painting as Max and Min Integers hence
+ * allowing everything to be painted
+ */
+ public TapeTrack() {
+ isRendered = false;
+ track = DOM.createDiv();
+ track.setClassName("step-tape-track");
+ earliestPaintOpportunity = Integer.MAX_VALUE;
+ latestPaintOpportunity = Integer.MIN_VALUE;
- setElement(track);
- }
+ setElement(track);
+ }
- /**
- * Checks and then adds an event to the timetrack Logically it is still
- * added to the band, but it is painted on the timetrack
- *
- * @param event even to be painted
- * @return whether the event has been painted
- */
- public boolean addEvent(final TimeEvent event) {
- if (canPaintAt(event.getLeftPixelPosition(), event.getTotalWidth())) {
- // Log.debug(event.getDescription() +
- // " can be painted on timetrack");
- event.paint(this);
+ /**
+ * Checks and then adds an event to the timetrack Logically it is still
+ * added to the band, but it is painted on the timetrack
+ *
+ * @param event
+ * even to be painted
+ * @return whether the event has been painted
+ */
+ public boolean addEvent(final TimeEvent event) {
+ if (canPaintAt(event.getLeftPixelPosition(), event.getTotalWidth())) {
+ // Log.debug(event.getDescription() +
+ // " can be painted on timetrack");
+ event.paint(this);
- // now update the available bands
- // Log.debug("Old latest and earliest times were: " +
- // latestPaintOpportunity + "," + earliestPaintOpportunity);
- latestPaintOpportunity = Math.max(latestPaintOpportunity, event.getLeftPixelPosition()
- + event.getTotalWidth());
- earliestPaintOpportunity = Math.min(earliestPaintOpportunity, event.getLeftPixelPosition());
- // Log.debug("New latest and earliest times were: " +
- // latestPaintOpportunity + "," + earliestPaintOpportunity);
- return true;
- }
- return false;
- }
+ // now update the available bands
+ // Log.debug("Old latest and earliest times were: " +
+ // latestPaintOpportunity + "," + earliestPaintOpportunity);
+ latestPaintOpportunity = Math.max(latestPaintOpportunity, event.getLeftPixelPosition()
+ + event.getTotalWidth());
+ earliestPaintOpportunity = Math.min(earliestPaintOpportunity, event.getLeftPixelPosition());
+ // Log.debug("New latest and earliest times were: " +
+ // latestPaintOpportunity + "," + earliestPaintOpportunity);
+ return true;
+ }
+ return false;
+ }
- /**
- * The events need to be added in order, otherwise the time taping will not
- * be efficient Returns whether an event of width width can be painted at
- * position pixel
- *
- * @param pixel pixel position at which to be painted
- * @param width width of the event
- * @return true if the event can be painted
- */
- public boolean canPaintAt(final int pixel, final int width) {
- return pixel > latestPaintOpportunity || (pixel + width + 1) < earliestPaintOpportunity;
- }
+ /**
+ * The events need to be added in order, otherwise the time taping will not
+ * be efficient Returns whether an event of width width can be painted at
+ * position pixel
+ *
+ * @param pixel
+ * pixel position at which to be painted
+ * @param width
+ * width of the event
+ * @return true if the event can be painted
+ */
+ public boolean canPaintAt(final int pixel, final int width) {
+ return pixel > latestPaintOpportunity || (pixel + width + 1) < earliestPaintOpportunity;
+ }
- /**
- * @return the track
- */
- public Element getTrack() {
- return track;
- }
+ /**
+ * @return the track
+ */
+ public Element getTrack() {
+ return track;
+ }
- /**
- * paints the timetrack on to the timeband
- *
- * @param band the band to be painteds
- */
- public void paint(final Timeband band) {
- if (!isRendered) {
- band.getBandDiv().appendChild(track);
- isRendered = true;
- }
- }
+ /**
+ * paints the timetrack on to the timeband
+ *
+ * @param band
+ * the band to be painteds
+ */
+ public void paint(final Timeband band) {
+ if (!isRendered) {
+ band.getBandDiv().appendChild(track);
+ isRendered = true;
+ }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -15,382 +15,396 @@
*/
public class TimeEvent {
- /**
- * events can move from one timeband to another
- */
- private final Timeband currentTimeband;
+ /**
+ * events can move from one timeband to another
+ */
+ private final Timeband currentTimeband;
- /**
- * description of the event
- */
- private String description;
+ /**
+ * description of the event
+ */
+ private String description;
- /**
- * If this event is a duration, this captures the width to be displayed
- */
- private int durationWidth;
+ /**
+ * If this event is a duration, this captures the width to be displayed
+ */
+ private int durationWidth;
- /**
- * The master div containing all the relevant DOM elements representing it
- */
- private Element eventDiv;
+ /**
+ * The master div containing all the relevant DOM elements representing it
+ */
+ private Element eventDiv;
- /**
- * default to a standard event or duration we will drive this from the
- * database
- */
- private String eventType;
+ /**
+ * default to a standard event or duration we will drive this from the
+ * database
+ */
+ private String eventType;
- /**
- * The picture if appropriate, displaying the type of event
- */
- private Element icon;
- /**
- * id of the event
- */
- private int id;
+ /**
+ * The picture if appropriate, displaying the type of event
+ */
+ private Element icon;
+ /**
+ * id of the event
+ */
+ private int id;
- /**
- * whether the time event has been rendered on to the DOM yet
- */
- private boolean isRendered = false;
+ /**
+ * whether the time event has been rendered on to the DOM yet
+ */
+ private boolean isRendered = false;
- /**
- * The label containing the text going with the event
- */
- private Element label;
+ /**
+ * The label containing the text going with the event
+ */
+ private Element label;
- /**
- * The left-most position at which the event is located, in relation to the
- * timeband
- */
- private int leftPixelPosition;
- /**
- * the end date of a duration event
- */
- private Long maxDate;
+ /**
+ * The left-most position at which the event is located, in relation to the
+ * timeband
+ */
+ private int leftPixelPosition;
+ /**
+ * the end date of a duration event
+ */
+ private Long maxDate;
- /**
- * the date of the event, and if a duration, the start date
- *
- */
- private Long minDate;
+ /**
+ * the date of the event, and if a duration, the start date
+ *
+ */
+ private Long minDate;
- /**
- * Show event text
- */
- private boolean showText;
+ /**
+ * Show event text
+ */
+ private boolean showText;
- /**
- * A representation of the total width occupied by the event, including the
- * text next to it. This is particularly important for events that are
- * single point in time, where the text will be much wider than the icon
- *
- */
- private int totalWidth;
+ /**
+ * A representation of the total width occupied by the event, including the
+ * text next to it. This is particularly important for events that are
+ * single point in time, where the text will be much wider than the icon
+ *
+ */
+ private int totalWidth;
- /**
- * The
- *
- * @param id id of the event
- * @param description a description to be displayed
- * @param minDate a minimum date
- * @param maxDate a maximum date, optional, in case of single point in time
- * events
- * @param tb the timeband
- */
- public TimeEvent(final int id, final String description, final Long minDate, final Long maxDate,
- final Timeband tb) {
- this.id = id;
- this.description = description;
- this.minDate = minDate;
- this.maxDate = maxDate;
- this.currentTimeband = tb;
+ /**
+ * The
+ *
+ * @param id
+ * id of the event
+ * @param description
+ * a description to be displayed
+ * @param minDate
+ * a minimum date
+ * @param maxDate
+ * a maximum date, optional, in case of single point in time
+ * events
+ * @param tb
+ * the timeband
+ */
+ public TimeEvent(final int id, final String description, final Long minDate, final Long maxDate, final Timeband tb) {
+ this.id = id;
+ this.description = description;
+ this.minDate = minDate;
+ this.maxDate = maxDate;
+ this.currentTimeband = tb;
- setupEventSpecificOptions();
- }
+ setupEventSpecificOptions();
+ }
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final TimeEvent other = (TimeEvent) obj;
- if (id != other.getId()) {
- return false;
- }
- return true;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final TimeEvent other = (TimeEvent) obj;
+ if (id != other.getId()) {
+ return false;
+ }
+ return true;
+ }
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * returns the event div that is shown on the screen
- *
- * @return the eventDiv
- */
- public Element getEventDiv() {
- return eventDiv;
- }
+ /**
+ * returns the event div that is shown on the screen
+ *
+ * @return the eventDiv
+ */
+ public Element getEventDiv() {
+ return eventDiv;
+ }
- /**
- * @return the eventType
- */
- public String getEventType() {
- return eventType;
- }
+ /**
+ * @return the eventType
+ */
+ public String getEventType() {
+ return eventType;
+ }
- /**
- * @return the id
- */
- public int getId() {
- return id;
- }
+ /**
+ * @return the id
+ */
+ public int getId() {
+ return id;
+ }
- /**
- * @return the leftPixelPosition
- */
- public int getLeftPixelPosition() {
- return leftPixelPosition;
- }
+ /**
+ * @return the leftPixelPosition
+ */
+ public int getLeftPixelPosition() {
+ return leftPixelPosition;
+ }
- /**
- * @return the maxDate
- */
- public Long getMaxDate() {
- return maxDate;
- }
+ /**
+ * @return the maxDate
+ */
+ public Long getMaxDate() {
+ return maxDate;
+ }
- /**
- * @return the minDate
- */
- public long getMinDate() {
- return minDate;
- }
+ /**
+ * @return the minDate
+ */
+ public long getMinDate() {
+ return minDate;
+ }
- /**
- * @return the totalWidth
- */
- public int getTotalWidth() {
- return totalWidth;
- }
+ /**
+ * @return the totalWidth
+ */
+ public int getTotalWidth() {
+ return totalWidth;
+ }
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + id;
- return result;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + id;
+ return result;
+ }
- /**
- * returns whether this event is a duration or point in time event
- *
- * @return true if this is a duration event
- */
- public boolean isDuration() {
- return maxDate == null;
- }
+ /**
+ * returns whether this event is a duration or point in time event
+ *
+ * @return true if this is a duration event
+ */
+ public boolean isDuration() {
+ return maxDate == null;
+ }
- /**
- * @return the isRendered
- */
- public boolean isRendered() {
- return isRendered;
- }
+ /**
+ * @return the isRendered
+ */
+ public boolean isRendered() {
+ return isRendered;
+ }
- /**
- * @return the showText
- */
- public boolean isShowText() {
- return showText;
- }
+ /**
+ * @return the showText
+ */
+ public boolean isShowText() {
+ return showText;
+ }
- /**
- * the main responsible culprit for painting events on the timeband
- *
- * @param track the track on which the event will be painted
- */
- public void paint(final TapeTrack track) {
- // all we do is attach it to the parent if need be.
- if (!isRendered) {
- setupDivProperties();
- track.getTrack().appendChild(eventDiv);
- isRendered = true;
- }
- }
+ /**
+ * the main responsible culprit for painting events on the timeband
+ *
+ * @param track
+ * the track on which the event will be painted
+ */
+ public void paint(final TapeTrack track) {
+ // all we do is attach it to the parent if need be.
+ if (!isRendered) {
+ setupDivProperties();
+ track.getTrack().appendChild(eventDiv);
+ isRendered = true;
+ }
+ }
- /**
- * ensures the event gets rendered next time paint() is called
- */
- public void reset() {
- isRendered = false;
+ /**
+ * ensures the event gets rendered next time paint() is called
+ */
+ public void reset() {
+ isRendered = false;
- // also recalculate the times and dates of the events (perhaps this is
- // not always necessary)
- setupEventSpecificOptions(); // a few extra bits in there, but nothing
- // that takes time
- }
+ // also recalculate the times and dates of the events (perhaps this is
+ // not always necessary)
+ setupEventSpecificOptions(); // a few extra bits in there, but nothing
+ // that takes time
+ }
- /**
- * @param description the description to set
- */
- public void setDescription(final String description) {
- this.description = description;
- }
+ /**
+ * @param description
+ * the description to set
+ */
+ public void setDescription(final String description) {
+ this.description = description;
+ }
- /**
- * @param eventType the eventType to set
- */
- public void setEventType(final String eventType) {
- this.eventType = eventType;
- }
+ /**
+ * @param eventType
+ * the eventType to set
+ */
+ public void setEventType(final String eventType) {
+ this.eventType = eventType;
+ }
- /**
- * @param id the id to set
- */
- public void setId(final int id) {
- this.id = id;
- }
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(final int id) {
+ this.id = id;
+ }
- /**
- * @param leftPixelPosition the leftPixelPosition to set
- */
- public void setLeftPixelPosition(final int leftPixelPosition) {
- this.leftPixelPosition = leftPixelPosition;
- }
+ /**
+ * @param leftPixelPosition
+ * the leftPixelPosition to set
+ */
+ public void setLeftPixelPosition(final int leftPixelPosition) {
+ this.leftPixelPosition = leftPixelPosition;
+ }
- /**
- * @param maxDate the maxDate to set
- */
- public void setMaxDate(final long maxDate) {
- this.maxDate = maxDate;
- }
+ /**
+ * @param maxDate
+ * the maxDate to set
+ */
+ public void setMaxDate(final long maxDate) {
+ this.maxDate = maxDate;
+ }
- /**
- * @param maxDate the maxDate to set
- */
- public void setMaxDate(final Long maxDate) {
- this.maxDate = maxDate;
- }
+ /**
+ * @param maxDate
+ * the maxDate to set
+ */
+ public void setMaxDate(final Long maxDate) {
+ this.maxDate = maxDate;
+ }
- /**
- * @param minDate the minDate to set
- */
- public void setMinDate(final long minDate) {
- this.minDate = minDate;
- }
+ /**
+ * @param minDate
+ * the minDate to set
+ */
+ public void setMinDate(final long minDate) {
+ this.minDate = minDate;
+ }
- /**
- * @param minDate the minDate to set
- */
- public void setMinDate(final Long minDate) {
- this.minDate = minDate;
- }
+ /**
+ * @param minDate
+ * the minDate to set
+ */
+ public void setMinDate(final Long minDate) {
+ this.minDate = minDate;
+ }
- /**
- * @param showText the showText to set
- */
- public void setShowText(final boolean showText) {
- this.showText = showText;
- }
+ /**
+ * @param showText
+ * the showText to set
+ */
+ public void setShowText(final boolean showText) {
+ this.showText = showText;
+ }
- /**
- * Creates all the elements/styles/etc.
- */
- private void setupDivProperties() {
- eventDiv = DOM.createDiv();
- icon = DOM.createDiv();
- label = DOM.createDiv();
- final El gxtEvent = new El(eventDiv);
- final El gxtLabel = new El(label);
+ /**
+ * Creates all the elements/styles/etc.
+ */
+ private void setupDivProperties() {
+ eventDiv = DOM.createDiv();
+ icon = DOM.createDiv();
+ label = DOM.createDiv();
+ final El gxtEvent = new El(eventDiv);
+ final El gxtLabel = new El(label);
- // setup div hierarchy
- eventDiv.appendChild(icon);
- eventDiv.appendChild(label);
+ // setup div hierarchy
+ eventDiv.appendChild(icon);
+ eventDiv.appendChild(label);
- // setup CSS properties
- eventDiv.setClassName(TimelineConstants.EVENT);
+ // setup CSS properties
+ eventDiv.setClassName(TimelineConstants.EVENT);
- // setup positioning
- gxtEvent.setLeft(leftPixelPosition);
+ // setup positioning
+ gxtEvent.setLeft(leftPixelPosition);
- // setup values
- label.setInnerText(description);
+ // setup values
+ label.setInnerText(description);
- // specific properties
- if (maxDate != null) {
- setupDurationProperties();
- } else {
- setupPointInTimeProperties();
- }
+ // specific properties
+ if (maxDate != null) {
+ setupDurationProperties();
+ } else {
+ setupPointInTimeProperties();
+ }
- // all css is setup, take measurement of label element:
+ // all css is setup, take measurement of label element:
- final TextMetrics ruler = TextMetrics.get();
- ruler.bind(new El(label));
- final int labelWidth = ruler.getWidth(description);
- gxtLabel.setWidth(labelWidth);
+ final TextMetrics ruler = TextMetrics.get();
+ ruler.bind(new El(label));
+ final int labelWidth = ruler.getWidth(description);
+ gxtLabel.setWidth(labelWidth);
- // set up width: if event, then labelWidth, otherwise
- // max(duration,label)
- totalWidth = maxDate == null ? labelWidth : Math.max(durationWidth, labelWidth);
- gxtEvent.setWidth(totalWidth);
- }
+ // set up width: if event, then labelWidth, otherwise
+ // max(duration,label)
+ totalWidth = maxDate == null ? labelWidth : Math.max(durationWidth, labelWidth);
+ gxtEvent.setWidth(totalWidth);
+ }
- /**
- * Sets up duration properties
- */
- private void setupDurationProperties() {
- final El gxtIcon = new El(icon);
- final El gxtLabel = new El(label);
- gxtIcon.setWidth(durationWidth);
- gxtIcon.setStyleName(eventType, true);
- gxtLabel.setStyleName(TimelineConstants.DURATION_LABEL, true);
- }
+ /**
+ * Sets up duration properties
+ */
+ private void setupDurationProperties() {
+ final El gxtIcon = new El(icon);
+ final El gxtLabel = new El(label);
+ gxtIcon.setWidth(durationWidth);
+ gxtIcon.setStyleName(eventType, true);
+ gxtLabel.setStyleName(TimelineConstants.DURATION_LABEL, true);
+ }
- /**
- * Sets up properties and fields that depend on the type of event
- */
- private void setupEventSpecificOptions() {
- this.leftPixelPosition = TimeConversionUtil.timeToPixel(minDate.longValue(), currentTimeband);
- if (maxDate == null) {
- // then it's a point in time
- eventType = TimelineConstants.POINT_IN_TIME_EVENT;
- } else {
- eventType = TimelineConstants.DURATION;
- durationWidth = Math.max(TimelineConstants.EVENT_MIN_WIDTH, TimeConversionUtil.timeToPixel(
- maxDate.longValue(), currentTimeband)
- - leftPixelPosition);
- }
- }
+ /**
+ * Sets up properties and fields that depend on the type of event
+ */
+ private void setupEventSpecificOptions() {
+ this.leftPixelPosition = TimeConversionUtil.timeToPixel(minDate.longValue(), currentTimeband);
+ if (maxDate == null) {
+ // then it's a point in time
+ eventType = TimelineConstants.POINT_IN_TIME_EVENT;
+ } else {
+ eventType = TimelineConstants.DURATION;
+ durationWidth = Math.max(TimelineConstants.EVENT_MIN_WIDTH, TimeConversionUtil.timeToPixel(maxDate
+ .longValue(), currentTimeband)
+ - leftPixelPosition);
+ }
+ }
- /**
- * Sets up point in time properties
- */
- private void setupPointInTimeProperties() {
- final El gxtLabel = new El(label);
- gxtLabel.setStyleName(TimelineConstants.POINT_IN_TIME_LABEL, true);
- }
+ /**
+ * Sets up point in time properties
+ */
+ private void setupPointInTimeProperties() {
+ final El gxtLabel = new El(label);
+ gxtLabel.setStyleName(TimelineConstants.POINT_IN_TIME_LABEL, true);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,67 +16,70 @@
*/
public class TimeEventDescriptor {
- /**
- * DOM Element containing the time event description
- */
- private final Element div;
+ /**
+ * DOM Element containing the time event description
+ */
+ private final Element div;
- /**
- * a wrapper (div) around the main element
- */
- private final El divWrapper;
+ /**
+ * a wrapper (div) around the main element
+ */
+ private final El divWrapper;
- /**
- * The timeline component on which to draw the popup
- */
- private final Timeline timeline;
+ /**
+ * The timeline component on which to draw the popup
+ */
+ private final Timeline timeline;
- /**
- * public constructor initialising the descriptor
- *
- * @param timeline the timeline on which the popup is to be displayed
- */
- public TimeEventDescriptor(final Timeline timeline) {
- this.timeline = timeline;
- div = DOM.createDiv();
- divWrapper = new El(div);
+ /**
+ * public constructor initialising the descriptor
+ *
+ * @param timeline
+ * the timeline on which the popup is to be displayed
+ */
+ public TimeEventDescriptor(final Timeline timeline) {
+ this.timeline = timeline;
+ div = DOM.createDiv();
+ divWrapper = new El(div);
- divWrapper.setStyleName("step-timeline-time-event-descriptor");
- divWrapper.setDisplayed(false);
+ divWrapper.setStyleName("step-timeline-time-event-descriptor");
+ divWrapper.setDisplayed(false);
- // append to timeline component
- timeline.getElement().appendChild(div);
- }
+ // append to timeline component
+ timeline.getElement().appendChild(div);
+ }
- /**
- * @return the divWrapper
- */
- public El getDivWrapper() {
- return divWrapper;
- }
+ /**
+ * @return the divWrapper
+ */
+ public El getDivWrapper() {
+ return divWrapper;
+ }
- /**
- * Hides the timeline
- */
- public void hide() {
- getDivWrapper().setDisplayed(false);
- }
+ /**
+ * Hides the timeline
+ */
+ public void hide() {
+ getDivWrapper().setDisplayed(false);
+ }
- /**
- * Given a timed event, this shows the description in a div
- *
- * @param te the TimeEvent to be displayed
- * @param me the mouse event that was triggered, contains details of pixel
- * positions
- */
- public void show(final TimeEvent te, final MouseEvent<?> me) {
- final El divWrapper = getDivWrapper();
- divWrapper.setInnerHtml(te.getId() + " - " + te.getDescription());
- divWrapper.setDisplayed(true);
- // Log.debug("x: " + me.getX());
- // Log.debug("y: " + me.getY());
+ /**
+ * Given a timed event, this shows the description in a div
+ *
+ * @param te
+ * the TimeEvent to be displayed
+ * @param me
+ * the mouse event that was triggered, contains details of pixel
+ * positions
+ */
+ public void show(final TimeEvent te, final MouseEvent<?> me) {
+ final El divWrapper = getDivWrapper();
+ divWrapper.setInnerHtml(te.getId() + " - " + te.getDescription());
+ divWrapper.setDisplayed(true);
+ // Log.debug("x: " + me.getX());
+ // Log.debug("y: " + me.getY());
- divWrapper.setLeft(timeline.getAbsoluteLeft() + me.getX());
- divWrapper.setTop(timeline.getAbsoluteTop() + me.getY() - TimelineConstants.SPACE_BELOW_POPUP);
- }
+ divWrapper.setLeft(timeline.getAbsoluteLeft() + me.getX());
+ divWrapper.setTop(timeline.getAbsoluteTop() + me.getY() - TimelineConstants.SPACE_BELOW_POPUP);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,149 +16,150 @@
*
*/
public class TimeScale {
- /**
- * timeband on which the TimeScale resides
- */
- private final Timeband band;
+ /**
+ * timeband on which the TimeScale resides
+ */
+ private final Timeband band;
- /**
- * true if time scale rendered
- */
- private boolean isRendered = false;
+ /**
+ * true if time scale rendered
+ */
+ private boolean isRendered = false;
- /**
- * Maps of all timescales that have been drawn on the timeband
- */
- private final HashMap<Integer, Element> paintedTimescaleBands;
+ /**
+ * Maps of all timescales that have been drawn on the timeband
+ */
+ private final HashMap<Integer, Element> paintedTimescaleBands;
- /**
- * DOM element containing the scale columns
- */
- private Element scaleBand;
+ /**
+ * DOM element containing the scale columns
+ */
+ private Element scaleBand;
- /**
- * A timescale is attached to a timeband
- *
- * @param band timeband to attach the scale on
- */
- public TimeScale(final Timeband band) {
- this.band = band;
- paintedTimescaleBands = new HashMap<Integer, Element>();
- }
+ /**
+ * A timescale is attached to a timeband
+ *
+ * @param band
+ * timeband to attach the scale on
+ */
+ public TimeScale(final Timeband band) {
+ this.band = band;
+ paintedTimescaleBands = new HashMap<Integer, Element>();
+ }
- /**
- * this paints the timescale band on those bits that need painting...
- */
- public void paint() {
- // check band is rendered, otherwise this is a waste of time
- if (!band.isRendered()) {
- return;
- }
+ /**
+ * this paints the timescale band on those bits that need painting...
+ */
+ public void paint() {
+ // check band is rendered, otherwise this is a waste of time
+ if (!band.isRendered()) {
+ return;
+ }
- // if rendered already? skip!
- if (!isRendered) {
- scaleBand = DOM.createDiv();
- paintedTimescaleBands.clear(); // reset in case we're in a zoom
+ // if rendered already? skip!
+ if (!isRendered) {
+ scaleBand = DOM.createDiv();
+ paintedTimescaleBands.clear(); // reset in case we're in a zoom
- final El gxtScaleBand = new El(scaleBand);
- band.getBandDiv().appendChild(scaleBand);
- gxtScaleBand.setStyleName("step-scale-band", true);
- isRendered = true;
- }
+ final El gxtScaleBand = new El(scaleBand);
+ band.getBandDiv().appendChild(scaleBand);
+ gxtScaleBand.setStyleName("step-scale-band", true);
+ isRendered = true;
+ }
- // finally render those bits that are visible only
- paintVisibleScale();
- }
+ // finally render those bits that are visible only
+ paintVisibleScale();
+ }
- /**
- * The easy way is to get rid of everything and repaint The slightly more
- * clever way is to actually repaint the existing dom elements. It uses more
- * memory though, however, we can try both eventually if need be.
- */
- public void repaint() {
- // remove oneself first
- reset();
- paint();
- }
+ /**
+ * The easy way is to get rid of everything and repaint The slightly more
+ * clever way is to actually repaint the existing dom elements. It uses more
+ * memory though, however, we can try both eventually if need be.
+ */
+ public void repaint() {
+ // remove oneself first
+ reset();
+ paint();
+ }
- /**
- * resets to redraw
- */
- public void reset() {
- isRendered = false;
- }
+ /**
+ * resets to redraw
+ */
+ public void reset() {
+ isRendered = false;
+ }
- /**
- * draws the segments on the TimeScale DOM element
- *
- * @param firstVisibleSegmentPixel first visible pixel, left most, of the
- * band
- * @param numberOfVisibleSegments number of segments to draw
- */
- private synchronized void drawSegments(final long firstVisibleSegmentPixel,
- final long numberOfVisibleSegments) {
- final El gxtScaleBand = new El(scaleBand);
- final int pixelsPerUnit = band.getPixelsPerUnit();
- int relativeLeft = (int) firstVisibleSegmentPixel;
- // Log.debug("Drawing segments");
- for (long ii = 0; ii < numberOfVisibleSegments + 1; ii++) {
- // check segment not already drawn...
- final Integer key = Integer.valueOf(relativeLeft);
- final Integer keyMinus1 = Integer.valueOf(relativeLeft - 1);
- final Integer keyPlus1 = Integer.valueOf(relativeLeft + 1);
+ /**
+ * draws the segments on the TimeScale DOM element
+ *
+ * @param firstVisibleSegmentPixel
+ * first visible pixel, left most, of the band
+ * @param numberOfVisibleSegments
+ * number of segments to draw
+ */
+ private synchronized void drawSegments(final long firstVisibleSegmentPixel, final long numberOfVisibleSegments) {
+ final El gxtScaleBand = new El(scaleBand);
+ final int pixelsPerUnit = band.getPixelsPerUnit();
+ int relativeLeft = (int) firstVisibleSegmentPixel;
+ // Log.debug("Drawing segments");
+ for (long ii = 0; ii < numberOfVisibleSegments + 1; ii++) {
+ // check segment not already drawn...
+ final Integer key = Integer.valueOf(relativeLeft);
+ final Integer keyMinus1 = Integer.valueOf(relativeLeft - 1);
+ final Integer keyPlus1 = Integer.valueOf(relativeLeft + 1);
- // due to rounding errors, we need to check 1 below key and 1 above
- // too
- // TODO: instead of relying on time for drawing these, draw the
- // first one,
- // then rely on intervals. Saves computations for storage.
- if (!paintedTimescaleBands.containsKey(key) && !paintedTimescaleBands.containsKey(keyPlus1)
- && !paintedTimescaleBands.containsKey(keyMinus1)) {
- final Element un = DOM.createDiv();
- final El gxtUn = new El(un);
- gxtUn.setWidth(pixelsPerUnit);
+ // due to rounding errors, we need to check 1 below key and 1 above
+ // too
+ // TODO: instead of relying on time for drawing these, draw the
+ // first one,
+ // then rely on intervals. Saves computations for storage.
+ if (!paintedTimescaleBands.containsKey(key) && !paintedTimescaleBands.containsKey(keyPlus1)
+ && !paintedTimescaleBands.containsKey(keyMinus1)) {
+ final Element un = DOM.createDiv();
+ final El gxtUn = new El(un);
+ gxtUn.setWidth(pixelsPerUnit);
- un.setInnerText(TimeConversionUtil.formatPixelToTime(relativeLeft, band));
- gxtScaleBand.appendChild(un);
+ un.setInnerText(TimeConversionUtil.formatPixelToTime(relativeLeft, band));
+ gxtScaleBand.appendChild(un);
- // set left position:
- gxtUn.setLeft(relativeLeft);
- gxtUn.setTop(0); // if this is laid out after events, then 0
- // makes sure it lines up to the top
- gxtUn.setHeight("100%");
+ // set left position:
+ gxtUn.setLeft(relativeLeft);
+ gxtUn.setTop(0); // if this is laid out after events, then 0
+ // makes sure it lines up to the top
+ gxtUn.setHeight("100%");
- paintedTimescaleBands.put(key, un);
- }
- // else {
- // TODO: log should come in next
- // Log.debug("Segment not drawn as already painted");
- // }
- relativeLeft += pixelsPerUnit;
- }
- }
+ paintedTimescaleBands.put(key, un);
+ }
+ // else {
+ // TODO: log should come in next
+ // Log.debug("Segment not drawn as already painted");
+ // }
+ relativeLeft += pixelsPerUnit;
+ }
+ }
- /**
- * paints the visible segments (columns) on to the band This method mainly
- * sets up all the relevant mathematics, and passes down
- */
- private void paintVisibleScale() {
- final long visibleLeft = band.getMinVisibleDate();
- final long visibleRight = band.getMaxVisibleDate();
+ /**
+ * paints the visible segments (columns) on to the band This method mainly
+ * sets up all the relevant mathematics, and passes down
+ */
+ private void paintVisibleScale() {
+ final long visibleLeft = band.getMinVisibleDate();
+ final long visibleRight = band.getMaxVisibleDate();
- final Unit unit = band.getUnit();
+ final Unit unit = band.getUnit();
- // We do not want to generate all the time scale segments,
- // the number of visible segments is number of time 'unit' is in the
- // visible section
- final long numberOfVisibleSegments = (visibleRight - visibleLeft) / unit.getMilliseconds();
+ // We do not want to generate all the time scale segments,
+ // the number of visible segments is number of time 'unit' is in the
+ // visible section
+ final long numberOfVisibleSegments = (visibleRight - visibleLeft) / unit.getMilliseconds();
- // first visible segment is going to be located at
- final long firstVisibleSegmentPixel = TimeConversionUtil.timeToPixel(visibleLeft
- - (visibleLeft % unit.getMilliseconds()), band);
+ // first visible segment is going to be located at
+ final long firstVisibleSegmentPixel = TimeConversionUtil.timeToPixel(visibleLeft
+ - (visibleLeft % unit.getMilliseconds()), band);
- // TODO: uncomment all the debug statements and change global logging
- // level to info
- // Log.debug("Drawing segments for timeband" + band.getId());
- drawSegments(firstVisibleSegmentPixel, numberOfVisibleSegments);
- }
+ // TODO: uncomment all the debug statements and change global logging
+ // level to info
+ // Log.debug("Drawing segments for timeband" + band.getId());
+ drawSegments(firstVisibleSegmentPixel, numberOfVisibleSegments);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -28,925 +28,954 @@
* @author CJBurrell
*/
public class Timeband extends Widget {
- /**
- * The DOM element containing all timeband elements
- */
- private Element bandDiv;
+ /**
+ * The DOM element containing all timeband elements
+ */
+ private Element bandDiv;
- /**
- * The current date that is shown
- */
- private long currentDate;
+ /**
+ * The current date that is shown
+ */
+ private long currentDate;
- /**
- * The current pixel on the timeband representing the current date (above)
- */
- private long currentDateX = 0;
+ /**
+ * The current pixel on the timeband representing the current date (above)
+ */
+ private long currentDateX = 0;
- /**
- * when this is set to true, then we can use the request window object to
- * determine whether or not we are showing all the events we are able to If
- * events can be deleted or moved to other timebands, it becomes difficult
- * to work out what the request window should be.
- */
- private boolean deletionsDisabled = true;
+ /**
+ * when this is set to true, then we can use the request window object to
+ * determine whether or not we are showing all the events we are able to If
+ * events can be deleted or moved to other timebands, it becomes difficult
+ * to work out what the request window should be.
+ */
+ private boolean deletionsDisabled = true;
- /**
- * The timeband description
- */
- private String description;
+ /**
+ * The timeband description
+ */
+ private String description;
- /**
- * this contains all the events on the time band
- */
- private final TreeMap<Integer, TimeEvent> events;
+ /**
+ * this contains all the events on the time band
+ */
+ private final TreeMap<Integer, TimeEvent> events;
- /**
- * Id of the timeband
- */
- private int id;
+ /**
+ * Id of the timeband
+ */
+ private int id;
- /**
- * This indicates whether the band has been painted and is showing
- */
- private boolean isRendered = false;
+ /**
+ * This indicates whether the band has been painted and is showing
+ */
+ private boolean isRendered = false;
- /**
- * whether the user is interested in this timeband or not
- */
- private boolean isUserInterested;
+ /**
+ * whether the user is interested in this timeband or not
+ */
+ private boolean isUserInterested;
- /**
- * Max date that the timeband is expected to paint
- */
- private long maxDate;
+ /**
+ * Max date that the timeband is expected to paint
+ */
+ private long maxDate;
- /**
- * Min date that the timeband is expected to paint
- */
- private long minDate;
+ /**
+ * Min date that the timeband is expected to paint
+ */
+ private long minDate;
- /**
- * The last recorded mouse position on the mouse down event
- */
- private int mouseDownScrollLeft;
+ /**
+ * The last recorded mouse position on the mouse down event
+ */
+ private int mouseDownScrollLeft;
- /**
- * original unit as set up before it was rendered for the first time This is
- * used so that we can revert back to the original, recommended unit at
- * point in time
- */
- private Unit originalUnit = null;
+ /**
+ * original unit as set up before it was rendered for the first time This is
+ * used so that we can revert back to the original, recommended unit at
+ * point in time
+ */
+ private Unit originalUnit = null;
- // TODO:Derive this from a properties file? somehow? or database?
- /**
- * this describes how much of a unit needs to be visible before calling back
- * to the server
- */
- private double outstandingUnitFactor = TimelineConstants.MINIMUM_UNIT_PORTION_BEFORE_SERVER_CALL;
+ // TODO:Derive this from a properties file? somehow? or database?
+ /**
+ * this describes how much of a unit needs to be visible before calling back
+ * to the server
+ */
+ private double outstandingUnitFactor = TimelineConstants.MINIMUM_UNIT_PORTION_BEFORE_SERVER_CALL;
- /**
- * this is the parent widget Timeline object
- */
- private final Timeline parent;
+ /**
+ * this is the parent widget Timeline object
+ */
+ private final Timeline parent;
- /**
- * Number of pixels to be shown per unit
- */
- private int pixelsPerUnit;
+ /**
+ * Number of pixels to be shown per unit
+ */
+ private int pixelsPerUnit;
- /**
- * Each timeband is given a request window. This object is responsible of
- * working out how much to request from the server, so as not to flood it
- * with requests of stuff it already has
- */
- private TimebandRequestWindow requestWindow = null;
+ /**
+ * Each timeband is given a request window. This object is responsible of
+ * working out how much to request from the server, so as not to flood it
+ * with requests of stuff it already has
+ */
+ private TimebandRequestWindow requestWindow = null;
- /**
- * Whether or not to show the scale band
- */
- private boolean showScale = true;
+ /**
+ * Whether or not to show the scale band
+ */
+ private boolean showScale = true;
- /**
- * The list of tape tracks on this timeband.
- */
- private final List<TapeTrack> tapeTracks;
+ /**
+ * The list of tape tracks on this timeband.
+ */
+ private final List<TapeTrack> tapeTracks;
- /**
- * The timeband container which contains the bandDiv
- */
- private final Element timebandContainer;
+ /**
+ * The timeband container which contains the bandDiv
+ */
+ private final Element timebandContainer;
- /**
- * label of the timeband
- */
- private Element timebandLabel;
+ /**
+ * label of the timeband
+ */
+ private Element timebandLabel;
- /**
- * This is the timescale visible on the timeband drawing lines across the
- * timebands for each unit
- */
- private TimeScale timescale;
+ /**
+ * This is the timescale visible on the timeband drawing lines across the
+ * timebands for each unit
+ */
+ private TimeScale timescale;
- /**
- * Determines the unit of the timeband and how to convert from/to
- * time/pixels
- */
- private Unit unit;
+ /**
+ * Determines the unit of the timeband and how to convert from/to
+ * time/pixels
+ */
+ private Unit unit;
- /**
- * This determines how much of a zoom is applied. For example a factor of
- * 0.25 changes the scale of 50 pixels per decade to (1 + 0.25) * 50 = 75
- * pixels
- */
- private double zoomFactor = TimelineConstants.ZOOM_FACTOR;
+ /**
+ * This determines how much of a zoom is applied. For example a factor of
+ * 0.25 changes the scale of 50 pixels per decade to (1 + 0.25) * 50 = 75
+ * pixels
+ */
+ private double zoomFactor = TimelineConstants.ZOOM_FACTOR;
- /**
- * To create a new timeband on the timeline
- *
- * @param parent the timeline on which it is to be created
- * @param id the id of the timeband
- * @param description its description
- */
- public Timeband(final Timeline parent, final int id, final String description) {
- this.parent = parent;
- this.id = id;
- this.description = description;
+ /**
+ * To create a new timeband on the timeline
+ *
+ * @param parent
+ * the timeline on which it is to be created
+ * @param id
+ * the id of the timeband
+ * @param description
+ * its description
+ */
+ public Timeband(final Timeline parent, final int id, final String description) {
+ this.parent = parent;
+ this.id = id;
+ this.description = description;
- // set up collections
- events = new TreeMap<Integer, TimeEvent>();
- tapeTracks = new ArrayList<TapeTrack>();
+ // set up collections
+ events = new TreeMap<Integer, TimeEvent>();
+ tapeTracks = new ArrayList<TapeTrack>();
- // set up page properties
- bandDiv = DOM.createDiv();
- timebandContainer = DOM.createDiv();
- bandDiv.setClassName("step-timeband");
- setElement(timebandContainer);
- }
+ // set up page properties
+ bandDiv = DOM.createDiv();
+ timebandContainer = DOM.createDiv();
+ bandDiv.setClassName("step-timeband");
+ setElement(timebandContainer);
+ }
- /**
- * Adds an event to the timeband, and therefore on to a random timetack. The
- * first available spot to minimize the space required. In particular this
- * delegates to addEventToTapeTrack after checking the event is not already
- * in our list of events
- *
- * @param event event to be added
- */
- public void addEvent(final TimeEvent event) {
- // need to check the event isn't already in our list:
- if (!events.containsKey(event.getId())) {
- events.put(event.getId(), event);
- addEventToTapeTrack(event);
+ /**
+ * Adds an event to the timeband, and therefore on to a random timetack. The
+ * first available spot to minimize the space required. In particular this
+ * delegates to addEventToTapeTrack after checking the event is not already
+ * in our list of events
+ *
+ * @param event
+ * event to be added
+ */
+ public void addEvent(final TimeEvent event) {
+ // need to check the event isn't already in our list:
+ if (!events.containsKey(event.getId())) {
+ events.put(event.getId(), event);
+ addEventToTapeTrack(event);
- // TODO: analyse this, but it is likely that it is not possible
- // that the bit in the middle is redundant
- if (isEventInVisibleSection(event)) {
- Log.debug("Adding event to hidden band: " + event.getDescription());
- addEventToTapeTrack(event);
- }
- // otherwise, autoHide is set to false, so leave hidden
- }
- }
+ // TODO: analyse this, but it is likely that it is not possible
+ // that the bit in the middle is redundant
+ if (isEventInVisibleSection(event)) {
+ Log.debug("Adding event to hidden band: " + event.getDescription());
+ addEventToTapeTrack(event);
+ }
+ // otherwise, autoHide is set to false, so leave hidden
+ }
+ }
- /**
- * This method is used to tell the Timeband that it now has all events
- * within the section: (x1,x2). We can then use this to ensure subsequent
- * requests don't request the same thing from the server, hence reducing
- * load between the server and the client and also reducing the load on the
- * server
- *
- * @param minDateRequested the minimum date that was requested and retrieved
- * from the back-end
- * @param maxDateRequested the maximum date that was requested and retrieved
- * from the back-end
- */
- public void adjustRequestedView(final long minDateRequested, final long maxDateRequested) {
- if (requestWindow == null) {
- requestWindow = new TimebandRequestWindow(minDateRequested, maxDateRequested);
- } else {
- requestWindow.adjustRange(minDateRequested, maxDateRequested);
- }
- }
+ /**
+ * This method is used to tell the Timeband that it now has all events
+ * within the section: (x1,x2). We can then use this to ensure subsequent
+ * requests don't request the same thing from the server, hence reducing
+ * load between the server and the client and also reducing the load on the
+ * server
+ *
+ * @param minDateRequested
+ * the minimum date that was requested and retrieved from the
+ * back-end
+ * @param maxDateRequested
+ * the maximum date that was requested and retrieved from the
+ * back-end
+ */
+ public void adjustRequestedView(final long minDateRequested, final long maxDateRequested) {
+ if (requestWindow == null) {
+ requestWindow = new TimebandRequestWindow(minDateRequested, maxDateRequested);
+ } else {
+ requestWindow.adjustRange(minDateRequested, maxDateRequested);
+ }
+ }
- /**
- * when a mousedown event has been captured, update the position at which
- * the mouse was
- *
- * @param e the mousedown event
- */
- public void captureScrollLeft(final MouseDownEvent e) {
- this.mouseDownScrollLeft = timebandContainer.getScrollLeft();
- }
+ /**
+ * when a mousedown event has been captured, update the position at which
+ * the mouse was
+ *
+ * @param e
+ * the mousedown event
+ */
+ public void captureScrollLeft(final MouseDownEvent e) {
+ this.mouseDownScrollLeft = timebandContainer.getScrollLeft();
+ }
- /**
- * @return the bandDiv
- */
- public Element getBandDiv() {
- return bandDiv;
- }
+ /**
+ * @return the bandDiv
+ */
+ public Element getBandDiv() {
+ return bandDiv;
+ }
- /**
- * @return the currentDate
- */
- public long getCurrentDate() {
- return currentDate;
- }
+ /**
+ * @return the currentDate
+ */
+ public long getCurrentDate() {
+ return currentDate;
+ }
- /**
- * @return the currentDateX
- */
- public long getCurrentDateX() {
- return currentDateX;
- }
+ /**
+ * @return the currentDateX
+ */
+ public long getCurrentDateX() {
+ return currentDateX;
+ }
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * @return the events
- */
- public TreeMap<Integer, TimeEvent> getEvents() {
- return events;
- }
+ /**
+ * @return the events
+ */
+ public TreeMap<Integer, TimeEvent> getEvents() {
+ return events;
+ }
- /**
- * @return the id
- */
- public int getId() {
- return id;
- }
+ /**
+ * @return the id
+ */
+ public int getId() {
+ return id;
+ }
- /**
- * @return the maxDate
- */
- public long getMaxDate() {
- return maxDate;
- }
+ /**
+ * @return the maxDate
+ */
+ public long getMaxDate() {
+ return maxDate;
+ }
- /**
- * returns the current maximum visible date on the band
- *
- * @return the maximum date visible on the band
- */
- public long getMaxVisibleDate() {
- int realClientWidth = timebandContainer.getClientWidth();
- // if this is not rendered properly yet, then we have no width:
- if (realClientWidth == 0) {
- // use the timeline width, perhaps we can take the parent width
- // instead...
- // this is important as it it could that the timline doesn't take
- // the full width
- realClientWidth = Window.getClientWidth();
- }
+ /**
+ * returns the current maximum visible date on the band
+ *
+ * @return the maximum date visible on the band
+ */
+ public long getMaxVisibleDate() {
+ int realClientWidth = timebandContainer.getClientWidth();
+ // if this is not rendered properly yet, then we have no width:
+ if (realClientWidth == 0) {
+ // use the timeline width, perhaps we can take the parent width
+ // instead...
+ // this is important as it it could that the timline doesn't take
+ // the full width
+ realClientWidth = Window.getClientWidth();
+ }
- return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft() + realClientWidth, this);
- }
+ return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft() + realClientWidth, this);
+ }
- /**
- * @return the minDate, in pixels
- */
- public long getMinDate() {
- return minDate;
- }
+ /**
+ * @return the minDate, in pixels
+ */
+ public long getMinDate() {
+ return minDate;
+ }
- /**
- * returns the current minimum visible date on the band
- *
- * @return the minimum date visible on the band
- */
- public long getMinVisibleDate() {
- return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft(), this);
- }
+ /**
+ * returns the current minimum visible date on the band
+ *
+ * @return the minimum date visible on the band
+ */
+ public long getMinVisibleDate() {
+ return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft(), this);
+ }
- /**
- * Could this be optimized by organising the events in time order, and on
- * scroll recording which events have popped off?
- *
- * @return the number of visible events in the band
- */
- public int getNumberOfVisibleEvents() {
- int count = 0;
- for (final TimeEvent te : events.values()) {
- if (isEventInVisibleSection(te)) {
- count++;
- }
- }
- return count;
- }
+ /**
+ * Could this be optimized by organising the events in time order, and on
+ * scroll recording which events have popped off?
+ *
+ * @return the number of visible events in the band
+ */
+ public int getNumberOfVisibleEvents() {
+ int count = 0;
+ for (final TimeEvent te : events.values()) {
+ if (isEventInVisibleSection(te)) {
+ count++;
+ }
+ }
+ return count;
+ }
- /**
- * Works out how much of the timeband is to be requested Ideally we should
- * TODO: this somewhere else.
- *
- * @return the visible section of the timeband
- * @throws IncapableOfCalculatingRequestWindowException thrown if we are not
- * in a position to calculate what the remaining section is.
- */
- public TimeBandVisibleDate getOustandingTimebandPeriod()
- throws IncapableOfCalculatingRequestWindowException {
- final long minVisibleDate = getMinVisibleDate();
- final long maxVisibleDate = getMaxVisibleDate();
- final long minimumDifference = (long) (unit.getMilliseconds() * outstandingUnitFactor);
+ /**
+ * Works out how much of the timeband is to be requested Ideally we should
+ * TODO: this somewhere else.
+ *
+ * @return the visible section of the timeband
+ * @throws IncapableOfCalculatingRequestWindowException
+ * thrown if we are not in a position to calculate what the
+ * remaining section is.
+ */
+ public TimeBandVisibleDate getOustandingTimebandPeriod() throws IncapableOfCalculatingRequestWindowException {
+ final long minVisibleDate = getMinVisibleDate();
+ final long maxVisibleDate = getMaxVisibleDate();
+ final long minimumDifference = (long) (unit.getMilliseconds() * outstandingUnitFactor);
- // the new requested bit depends on our request window
- if (requestWindow == null) {
- return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
- } else {
- // return only the portion that has changed (probably only one pixel
- // worth)!
- // -------|--------$------|-----$--------------------
- // mvd mrd Mvd Mrd
- final long minReceivedDate = requestWindow.getMinDate();
- final long maxReceivedDate = requestWindow.getMaxDate();
- final boolean shiftedLeft = minVisibleDate < minReceivedDate;
- final boolean shiftedRight = maxVisibleDate > maxReceivedDate;
+ // the new requested bit depends on our request window
+ if (requestWindow == null) {
+ return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
+ } else {
+ // return only the portion that has changed (probably only one pixel
+ // worth)!
+ // -------|--------$------|-----$--------------------
+ // mvd mrd Mvd Mrd
+ final long minReceivedDate = requestWindow.getMinDate();
+ final long maxReceivedDate = requestWindow.getMaxDate();
+ final boolean shiftedLeft = minVisibleDate < minReceivedDate;
+ final boolean shiftedRight = maxVisibleDate > maxReceivedDate;
- if (!shiftedLeft && !shiftedRight) {
- return TimeBandVisibleDate.getNoRequest();
- } else if (shiftedLeft && shiftedRight) {
- // in this case, it was probably a zoom, and so we need to
- // request both parts
- return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
- } else if (shiftedLeft) {
- // window could potentially have jumped, so there may be a gap
- // between maxVisibleDate and min, so take so check that first:
- if (maxVisibleDate < minReceivedDate) {
- // we have issues here, as we're either going to have to
- // remember about all the already painted stuff. this would
- // potentially be troublesome
- // as with units and zooming, we're going to have to
- // eventually repaint huge amounts of stuff
- // so reset to 0
- requestWindow = null;
+ if (!shiftedLeft && !shiftedRight) {
+ return TimeBandVisibleDate.getNoRequest();
+ } else if (shiftedLeft && shiftedRight) {
+ // in this case, it was probably a zoom, and so we need to
+ // request both parts
+ return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
+ } else if (shiftedLeft) {
+ // window could potentially have jumped, so there may be a gap
+ // between maxVisibleDate and min, so take so check that first:
+ if (maxVisibleDate < minReceivedDate) {
+ // we have issues here, as we're either going to have to
+ // remember about all the already painted stuff. this would
+ // potentially be troublesome
+ // as with units and zooming, we're going to have to
+ // eventually repaint huge amounts of stuff
+ // so reset to 0
+ requestWindow = null;
- // TODO: investigate whether we want to clear the band down!
- return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
- } else {
- // the max is greater than the minimum so we return
- if (minReceivedDate - minVisibleDate > minimumDifference) {
- return new TimeBandVisibleDate(id, minVisibleDate, minReceivedDate);
- } else {
- return TimeBandVisibleDate.getNoRequest();
- }
- }
- } else if (shiftedRight) {
- // same problem as above if
- if (minVisibleDate > maxReceivedDate) {
- requestWindow = null;
- return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
- } else {
- // in particular check that the gap between maxReceivedDate
- // and maxVisibleDate is enough
- if (maxVisibleDate - maxReceivedDate > minimumDifference) {
- return new TimeBandVisibleDate(id, maxReceivedDate, maxVisibleDate);
- } else {
- return TimeBandVisibleDate.getNoRequest();
- }
- }
- } else {
- throw new IncapableOfCalculatingRequestWindowException(minVisibleDate, maxVisibleDate,
- minReceivedDate, maxReceivedDate);
- }
- }
- }
+ // TODO: investigate whether we want to clear the band down!
+ return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
+ } else {
+ // the max is greater than the minimum so we return
+ if (minReceivedDate - minVisibleDate > minimumDifference) {
+ return new TimeBandVisibleDate(id, minVisibleDate, minReceivedDate);
+ } else {
+ return TimeBandVisibleDate.getNoRequest();
+ }
+ }
+ } else if (shiftedRight) {
+ // same problem as above if
+ if (minVisibleDate > maxReceivedDate) {
+ requestWindow = null;
+ return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
+ } else {
+ // in particular check that the gap between maxReceivedDate
+ // and maxVisibleDate is enough
+ if (maxVisibleDate - maxReceivedDate > minimumDifference) {
+ return new TimeBandVisibleDate(id, maxReceivedDate, maxVisibleDate);
+ } else {
+ return TimeBandVisibleDate.getNoRequest();
+ }
+ }
+ } else {
+ throw new IncapableOfCalculatingRequestWindowException(minVisibleDate, maxVisibleDate, minReceivedDate,
+ maxReceivedDate);
+ }
+ }
+ }
- /**
- * @return the outstandingUnitFactor
- */
- public double getOutstandingUnitFactor() {
- return outstandingUnitFactor;
- }
+ /**
+ * @return the outstandingUnitFactor
+ */
+ public double getOutstandingUnitFactor() {
+ return outstandingUnitFactor;
+ }
- /**
- * @return the pixelsPerUnit
- */
- public int getPixelsPerUnit() {
- return pixelsPerUnit;
- }
+ /**
+ * @return the pixelsPerUnit
+ */
+ public int getPixelsPerUnit() {
+ return pixelsPerUnit;
+ }
- /**
- * returns a single event contained on the timeband
- *
- * @param eventId event id of the event
- * @return the TimeEvent
- */
- public TimeEvent getSingleEvent(final String eventId) {
- final Integer key = Integer.parseInt(eventId);
- return events.get(key);
- }
+ /**
+ * returns a single event contained on the timeband
+ *
+ * @param eventId
+ * event id of the event
+ * @return the TimeEvent
+ */
+ public TimeEvent getSingleEvent(final String eventId) {
+ final Integer key = Integer.parseInt(eventId);
+ return events.get(key);
+ }
- /**
- * current number of tape tracks on the band. Also remember that one tape
- * track is allocated at the top of the timeband to allow for dates to be
- * displayed
- *
- * @return the numbers of tracks on the band
- */
- public int getSizeTapeTracks() {
- return tapeTracks.size();
- }
+ /**
+ * current number of tape tracks on the band. Also remember that one tape
+ * track is allocated at the top of the timeband to allow for dates to be
+ * displayed
+ *
+ * @return the numbers of tracks on the band
+ */
+ public int getSizeTapeTracks() {
+ return tapeTracks.size();
+ }
- /**
- * @return the unit
- */
- public Unit getUnit() {
- return unit;
- }
+ /**
+ * @return the unit
+ */
+ public Unit getUnit() {
+ return unit;
+ }
- /**
- * @return the zoomFactor
- */
- public double getZoomFactor() {
- return zoomFactor;
- }
+ /**
+ * @return the zoomFactor
+ */
+ public double getZoomFactor() {
+ return zoomFactor;
+ }
- /**
- * Hides by setting the height of the band to 0
- */
- public void hideFromUser() {
- // set height to 0 by default, and we'll add something later TODO: to
- // see which bands have got events...
- new El(timebandContainer).setHeight(0);
- }
+ /**
+ * Hides by setting the height of the band to 0
+ */
+ public void hideFromUser() {
+ // set height to 0 by default, and we'll add something later TODO: to
+ // see which bands have got events...
+ new El(timebandContainer).setHeight(0);
+ }
- /**
- * @return the deletionsDisabled
- */
- public boolean isDeletionsDisabled() {
- return deletionsDisabled;
- }
+ /**
+ * @return the deletionsDisabled
+ */
+ public boolean isDeletionsDisabled() {
+ return deletionsDisabled;
+ }
- /**
- * indicates whether the band has been rendered or not
- *
- * @return true if the band has been rendered
- */
- public boolean isRendered() {
- return isRendered;
- }
+ /**
+ * indicates whether the band has been rendered or not
+ *
+ * @return true if the band has been rendered
+ */
+ public boolean isRendered() {
+ return isRendered;
+ }
- /**
- * @return the showScale
- */
- public boolean isShowScale() {
- return showScale;
- }
+ /**
+ * @return the showScale
+ */
+ public boolean isShowScale() {
+ return showScale;
+ }
- /**
- * @return the isUserInterested
- */
- public boolean isUserInterested() {
- return isUserInterested;
- }
+ /**
+ * @return the isUserInterested
+ */
+ public boolean isUserInterested() {
+ return isUserInterested;
+ }
- /**
- * Does not delete the events but redraws everything else.
- */
- public void redrawBand() {
- tapeTracks.clear();
+ /**
+ * Does not delete the events but redraws everything else.
+ */
+ public void redrawBand() {
+ tapeTracks.clear();
- // use El to remove all children
- new El(bandDiv).removeChildren();
- resetAllEvents();
+ // use El to remove all children
+ new El(bandDiv).removeChildren();
+ resetAllEvents();
- timescale.repaint();
+ timescale.repaint();
- requestWindow = null;
+ requestWindow = null;
- drawEvents();
- }
+ drawEvents();
+ }
- /**
- * Resets the timeband and redraws it
- */
- public void redrawEmptyBand() {
- events.clear();
- redrawBand();
- }
+ /**
+ * Resets the timeband and redraws it
+ */
+ public void redrawEmptyBand() {
+ events.clear();
+ redrawBand();
+ }
- /**
- * true if the band is targetted from user input
- *
- * @param isUserInterested identifies whether a user is interested in the
- * band
- */
- public void registerUserInterest(final boolean isUserInterested) {
- this.isUserInterested = isUserInterested;
- }
+ /**
+ * true if the band is targetted from user input
+ *
+ * @param isUserInterested
+ * identifies whether a user is interested in the band
+ */
+ public void registerUserInterest(final boolean isUserInterested) {
+ this.isUserInterested = isUserInterested;
+ }
- /**
- * Removes an event from the band
- *
- * @param id the id of the event to be removed.
- * @throws CannotDeleteEventException An event cannot be removed from a
- * timeband.
- */
- public void removeEvent(final int id) throws CannotDeleteEventException {
- if (deletionsDisabled) {
- throw new CannotDeleteEventException("The event you are trying to delete (" + id
- + ") is on band set on" + "deletionsDisabled = true");
- }
+ /**
+ * Removes an event from the band
+ *
+ * @param id
+ * the id of the event to be removed.
+ * @throws CannotDeleteEventException
+ * An event cannot be removed from a timeband.
+ */
+ public void removeEvent(final int id) throws CannotDeleteEventException {
+ if (deletionsDisabled) {
+ throw new CannotDeleteEventException("The event you are trying to delete (" + id + ") is on band set on"
+ + "deletionsDisabled = true");
+ }
- events.remove(id);
- // TODO: refresh the timeline dom
- }
+ events.remove(id);
+ // TODO: refresh the timeline dom
+ }
- /**
- * resets the band to use the original unit
- */
- public void resetOriginalUnit() {
- setUnit(originalUnit);
- }
+ /**
+ * resets the band to use the original unit
+ */
+ public void resetOriginalUnit() {
+ setUnit(originalUnit);
+ }
- /**
- * Resizes bands dependant on how many bands are present.
- */
- public void resizeBand() {
- if (isUserInterested) {
- // resize the timeband to take account of the number of timetracks
- new El(timebandContainer).setHeight(tapeTracks.size() * TimelineConstants.TAPE_TRACK_HEIGHT);
- }
- }
+ /**
+ * Resizes bands dependant on how many bands are present.
+ */
+ public void resizeBand() {
+ if (isUserInterested) {
+ // resize the timeband to take account of the number of timetracks
+ new El(timebandContainer).setHeight(tapeTracks.size() * TimelineConstants.TAPE_TRACK_HEIGHT);
+ }
+ }
- /**
- * Gets the band to scroll to the current date
- */
- public void scrollToCurrentDate() {
- Log.debug("Client width /2 : " + (timebandContainer.getClientWidth() / 2));
- new El(timebandContainer)
- .setScrollLeft((int) currentDateX - (timebandContainer.getClientWidth() / 2));
- displayTimebandLabel();
- }
+ /**
+ * Gets the band to scroll to the current date
+ */
+ public void scrollToCurrentDate() {
+ Log.debug("Client width /2 : " + (timebandContainer.getClientWidth() / 2));
+ new El(timebandContainer).setScrollLeft((int) currentDateX - (timebandContainer.getClientWidth() / 2));
+ displayTimebandLabel();
+ }
- /**
- * @param bandDiv the bandDiv to set
- */
- public final void setBandDiv(final Element bandDiv) {
- this.bandDiv = bandDiv;
- }
+ /**
+ * @param bandDiv
+ * the bandDiv to set
+ */
+ public final void setBandDiv(final Element bandDiv) {
+ this.bandDiv = bandDiv;
+ }
- /**
- * resetting the current date...
- *
- * @param currentDate the date on which the timeband is rooted
- */
- public void setCurrentDate(final long currentDate) {
- this.currentDate = currentDate;
+ /**
+ * resetting the current date...
+ *
+ * @param currentDate
+ * the date on which the timeband is rooted
+ */
+ public void setCurrentDate(final long currentDate) {
+ this.currentDate = currentDate;
- // if we're changing the date, then everything on the band is going to
- // be wrong, so
- // get rid of it...
+ // if we're changing the date, then everything on the band is going to
+ // be wrong, so
+ // get rid of it...
- }
+ }
- /**
- * @param currentDateX the currentDateX to set
- */
- public void setCurrentDateX(final long currentDateX) {
- this.currentDateX = currentDateX;
- }
+ /**
+ * @param currentDateX
+ * the currentDateX to set
+ */
+ public void setCurrentDateX(final long currentDateX) {
+ this.currentDateX = currentDateX;
+ }
- /**
- * @param deletionsDisabled the deletionsDisabled to set
- */
- public void setDeletionsDisabled(final boolean deletionsDisabled) {
- this.deletionsDisabled = deletionsDisabled;
- }
+ /**
+ * @param deletionsDisabled
+ * the deletionsDisabled to set
+ */
+ public void setDeletionsDisabled(final boolean deletionsDisabled) {
+ this.deletionsDisabled = deletionsDisabled;
+ }
- /**
- * @param description the description to set
- */
- public void setDescription(final String description) {
- this.description = description;
- }
+ /**
+ * @param description
+ * the description to set
+ */
+ public void setDescription(final String description) {
+ this.description = description;
+ }
- /**
- * @param id the id to set
- */
- public void setId(final int id) {
- this.id = id;
- }
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(final int id) {
+ this.id = id;
+ }
- /**
- * @param maxDate the maxDate to set
- */
- public void setMaxDate(final long maxDate) {
- this.maxDate = maxDate;
- }
+ /**
+ * @param maxDate
+ * the maxDate to set
+ */
+ public void setMaxDate(final long maxDate) {
+ this.maxDate = maxDate;
+ }
- /**
- * @param minDate the minDate to set
- */
- public void setMinDate(final long minDate) {
- this.minDate = minDate;
- }
+ /**
+ * @param minDate
+ * the minDate to set
+ */
+ public void setMinDate(final long minDate) {
+ this.minDate = minDate;
+ }
- /**
- * Usuall, the first call ever to set the unit of the timeband. The original
- * unit gets cached in the originalUnit field For other uses, use @see
- * {@link Timeband.setUnit} If not set, then it gets set. Otherwise a
- * warning if produced
- *
- * @param unit unit to be associated with the timeband
- */
- public void setOriginalUnit(final Unit unit) {
- if (originalUnit == null) {
- originalUnit = unit;
- } else {
- Log.warn("Original unit is already set. Please use resetOriginalUnit instead");
- }
- resetOriginalUnit();
- }
+ /**
+ * Usuall, the first call ever to set the unit of the timeband. The original
+ * unit gets cached in the originalUnit field For other uses, use @see
+ * {@link Timeband.setUnit} If not set, then it gets set. Otherwise a
+ * warning if produced
+ *
+ * @param unit
+ * unit to be associated with the timeband
+ */
+ public void setOriginalUnit(final Unit unit) {
+ if (originalUnit == null) {
+ originalUnit = unit;
+ } else {
+ Log.warn("Original unit is already set. Please use resetOriginalUnit instead");
+ }
+ resetOriginalUnit();
+ }
- /**
- * @param outstandingUnitFactor the outstandingUnitFactor to set
- */
- public void setOutstandingUnitFactor(final double outstandingUnitFactor) {
- this.outstandingUnitFactor = outstandingUnitFactor;
- }
+ /**
+ * @param outstandingUnitFactor
+ * the outstandingUnitFactor to set
+ */
+ public void setOutstandingUnitFactor(final double outstandingUnitFactor) {
+ this.outstandingUnitFactor = outstandingUnitFactor;
+ }
- /**
- * @param pixelsPerUnit the pixelsPerUnit to set
- */
- public void setPixelsPerUnit(final int pixelsPerUnit) {
- this.pixelsPerUnit = pixelsPerUnit;
- }
+ /**
+ * @param pixelsPerUnit
+ * the pixelsPerUnit to set
+ */
+ public void setPixelsPerUnit(final int pixelsPerUnit) {
+ this.pixelsPerUnit = pixelsPerUnit;
+ }
- /**
- * sets the new position of the window, when the user is moving it
- *
- * @param previousClientX the previousPosition on the x axis
- * @param newClientX the new position where it should be moved
- * @param defaultUnit the default unit which should be used to calculate the
- * time difference
- * @param defaultPixelsPerUnit the default number of pixels per unit
- */
- public void setScrollLeft(final int previousClientX, final int newClientX, final Unit defaultUnit,
- final int defaultPixelsPerUnit) {
- // we scroll, but we calculate the unit/scale factor first
- // say default is 1 Year
- // this one is 10 years
- // unit Factor = 0.1 so we scroll 10 times less pixels
- final double unitFactor = (double) defaultUnit.getMilliseconds() / (double) unit.getMilliseconds();
+ /**
+ * sets the new position of the window, when the user is moving it
+ *
+ * @param previousClientX
+ * the previousPosition on the x axis
+ * @param newClientX
+ * the new position where it should be moved
+ * @param defaultUnit
+ * the default unit which should be used to calculate the time
+ * difference
+ * @param defaultPixelsPerUnit
+ * the default number of pixels per unit
+ */
+ public void setScrollLeft(final int previousClientX, final int newClientX, final Unit defaultUnit,
+ final int defaultPixelsPerUnit) {
+ // we scroll, but we calculate the unit/scale factor first
+ // say default is 1 Year
+ // this one is 10 years
+ // unit Factor = 0.1 so we scroll 10 times less pixels
+ final double unitFactor = (double) defaultUnit.getMilliseconds() / (double) unit.getMilliseconds();
- // now say instead unit factor is 1, ie. the same unit, but different
- // number of pixels
- // default is 50 pixels per year, this one is 25 pixels a year
- // so we want to scroll half
- final double pixelFactor = (double) pixelsPerUnit / (double) defaultPixelsPerUnit;
- final double xAxisDiff = (previousClientX - newClientX) * (unitFactor * pixelFactor);
- final int newScrollLeft = (int) (mouseDownScrollLeft + xAxisDiff);
- this.timebandContainer.setScrollLeft(newScrollLeft);
- displayTimebandLabel();
- }
+ // now say instead unit factor is 1, ie. the same unit, but different
+ // number of pixels
+ // default is 50 pixels per year, this one is 25 pixels a year
+ // so we want to scroll half
+ final double pixelFactor = (double) pixelsPerUnit / (double) defaultPixelsPerUnit;
+ final double xAxisDiff = (previousClientX - newClientX) * (unitFactor * pixelFactor);
+ final int newScrollLeft = (int) (mouseDownScrollLeft + xAxisDiff);
+ this.timebandContainer.setScrollLeft(newScrollLeft);
+ displayTimebandLabel();
+ }
- /**
- * @param showScale the showScale to set
- */
- public void setShowScale(final boolean showScale) {
- this.showScale = showScale;
- }
+ /**
+ * @param showScale
+ * the showScale to set
+ */
+ public void setShowScale(final boolean showScale) {
+ this.showScale = showScale;
+ }
- /**
- * @param unit the unit to set
- */
- public void setUnit(final Unit unit) {
- this.unit = unit;
- }
+ /**
+ * @param unit
+ * the unit to set
+ */
+ public void setUnit(final Unit unit) {
+ this.unit = unit;
+ }
- /**
- * @param zoomFactor the zoomFactor to set
- */
- public void setZoomFactor(final double zoomFactor) {
- this.zoomFactor = zoomFactor;
- }
+ /**
+ * @param zoomFactor
+ * the zoomFactor to set
+ */
+ public void setZoomFactor(final double zoomFactor) {
+ this.zoomFactor = zoomFactor;
+ }
- /**
- * Zooms in
- */
- public void zoomIn() {
- zoom(1 + zoomFactor);
- }
+ /**
+ * Zooms in
+ */
+ public void zoomIn() {
+ zoom(1 + zoomFactor);
+ }
- /**
- * The way zooming works is that we recalculate the positions of all events
- * on the timeline
- */
- public void zoomOut() {
- // first change the zoom factor, then repaint events, and the timescale
- // lets just assume a default zoom factor for now
- // TODO: zoom in factor to be parameterised
- zoom(1 - zoomFactor);
+ /**
+ * The way zooming works is that we recalculate the positions of all events
+ * on the timeline
+ */
+ public void zoomOut() {
+ // first change the zoom factor, then repaint events, and the timescale
+ // lets just assume a default zoom factor for now
+ // TODO: zoom in factor to be parameterised
+ zoom(1 - zoomFactor);
- }
+ }
- /**
- * Adds an event to the tape track. This ensures that the event has not
- * already been rendered If so, then it is present somewhere, perhaps not on
- * this band though. Then, iterates through the tape tracks trying to add
- * the event (i.e. asking each track whether there is space for the icon and
- * the text to be added)
- *
- * @param event event to be added to the tape track
- */
- private void addEventToTapeTrack(final TimeEvent event) {
- int startIndex = showScale ? 1 : 0; // leaving room for the scale band
+ /**
+ * Adds an event to the tape track. This ensures that the event has not
+ * already been rendered If so, then it is present somewhere, perhaps not on
+ * this band though. Then, iterates through the tape tracks trying to add
+ * the event (i.e. asking each track whether there is space for the icon and
+ * the text to be added)
+ *
+ * @param event
+ * event to be added to the tape track
+ */
+ private void addEventToTapeTrack(final TimeEvent event) {
+ int startIndex = showScale ? 1 : 0; // leaving room for the scale band
- // if event is added already, then exit
- if (event.isRendered()) {
- return;
- }
+ // if event is added already, then exit
+ if (event.isRendered()) {
+ return;
+ }
- while (startIndex < tapeTracks.size()) {
- // Log.debug("Trying to add " + event.getDescription() +
- // " to track " + startIndex);
- // try and add event to track
- if (tapeTracks.get(startIndex).addEvent(event)) {
- return;
- }
- startIndex++;
- }
+ while (startIndex < tapeTracks.size()) {
+ // Log.debug("Trying to add " + event.getDescription() +
+ // " to track " + startIndex);
+ // try and add event to track
+ if (tapeTracks.get(startIndex).addEvent(event)) {
+ return;
+ }
+ startIndex++;
+ }
- // Log.debug("Going to create a new tape track");
+ // Log.debug("Going to create a new tape track");
- // check that the event was added, otherwise add timetrack
- if (startIndex >= tapeTracks.size()) {
- // did not manage to add it to tracks. therefore, let's add another
- // one:
- final TapeTrack t = addNewTapeTrack();
- t.addEvent(event);
- }
- }
+ // check that the event was added, otherwise add timetrack
+ if (startIndex >= tapeTracks.size()) {
+ // did not manage to add it to tracks. therefore, let's add another
+ // one:
+ final TapeTrack t = addNewTapeTrack();
+ t.addEvent(event);
+ }
+ }
- /**
- * Adds the timeband label to the band
- */
- private void addLabelToBand() {
- timebandLabel = DOM.createDiv();
- final El gxtTimebandLabel = new El(timebandLabel);
- gxtTimebandLabel.setStyleName("step-timeband-label", true);
- gxtTimebandLabel.setLeft(getElement().getScrollLeft());
- timebandLabel.setInnerText(description + "(" + id + ")");
- timebandContainer.appendChild(timebandLabel);
+ /**
+ * Adds the timeband label to the band
+ */
+ private void addLabelToBand() {
+ timebandLabel = DOM.createDiv();
+ final El gxtTimebandLabel = new El(timebandLabel);
+ gxtTimebandLabel.setStyleName("step-timeband-label", true);
+ gxtTimebandLabel.setLeft(getElement().getScrollLeft());
+ timebandLabel.setInnerText(description + "(" + id + ")");
+ timebandContainer.appendChild(timebandLabel);
- }
+ }
- /**
- * adds a new tape track to the timeband. The TapeTrack gets rendered at the
- * same time
- *
- * @return the TapeTrack that was added
- */
- private TapeTrack addNewTapeTrack() {
- final TapeTrack t = new TapeTrack();
- tapeTracks.add(t);
- t.paint(this);
- return t;
- }
+ /**
+ * adds a new tape track to the timeband. The TapeTrack gets rendered at the
+ * same time
+ *
+ * @return the TapeTrack that was added
+ */
+ private TapeTrack addNewTapeTrack() {
+ final TapeTrack t = new TapeTrack();
+ tapeTracks.add(t);
+ t.paint(this);
+ return t;
+ }
- /**
- * TODO: The idea is to adjust depending on how many pixels constitutes a
- * unit so that we can easily zoom in and out and have the units repainted
- * properly
- */
- private void adjustUnit() {
+ /**
+ * TODO: The idea is to adjust depending on how many pixels constitutes a
+ * unit so that we can easily zoom in and out and have the units repainted
+ * properly
+ */
+ private void adjustUnit() {
- }
+ }
- /**
- * Displays the timeband label on the timeband, with the description of it
- */
- private void displayTimebandLabel() {
- new El(timebandLabel).setLeft(getElement().getScrollLeft());
- }
+ /**
+ * Displays the timeband label on the timeband, with the description of it
+ */
+ private void displayTimebandLabel() {
+ new El(timebandLabel).setLeft(getElement().getScrollLeft());
+ }
- /**
- * Draws event onto the band
- */
- private void drawEvents() {
- // get the events to paint themselves (they will decide whether or not
- // to
- // paint if they are already showing...
- for (final TimeEvent te : events.values()) {
- addEventToTapeTrack(te);
- }
- }
+ /**
+ * Draws event onto the band
+ */
+ private void drawEvents() {
+ // get the events to paint themselves (they will decide whether or not
+ // to
+ // paint if they are already showing...
+ for (final TimeEvent te : events.values()) {
+ addEventToTapeTrack(te);
+ }
+ }
- /**
- * Tells the caller whether the event is in the visible section of the div
- * on the browser.
- *
- * @param event the event to be tested
- * @return true if the event is in the visible section
- */
- private boolean isEventInVisibleSection(final TimeEvent event) {
- final Long eventMinDate = event.getMinDate();
- final Long eventMaxDate = event.getMaxDate(); // eventMaxDate can be
- // null
- final long minVisibleDate = getMinVisibleDate();
- final long maxVisibleDate = getMaxVisibleDate();
+ /**
+ * Tells the caller whether the event is in the visible section of the div
+ * on the browser.
+ *
+ * @param event
+ * the event to be tested
+ * @return true if the event is in the visible section
+ */
+ private boolean isEventInVisibleSection(final TimeEvent event) {
+ final Long eventMinDate = event.getMinDate();
+ final Long eventMaxDate = event.getMaxDate(); // eventMaxDate can be
+ // null
+ final long minVisibleDate = getMinVisibleDate();
+ final long maxVisibleDate = getMaxVisibleDate();
- // output compare option:
- // DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy G");
+ // output compare option:
+ // DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy G");
- // Log.debug("Comparing ev(" +
- // dtf.format(new Date(eventMinDate)) + "," +
- // dtf.format(new Date(eventMaxDate)) + ") " +
- // "to band(" +
- // dtf.format(new Date(minVisibleDate)) + "," +
- // dtf.format(new Date(maxVisibleDate)) + ")");
+ // Log.debug("Comparing ev(" +
+ // dtf.format(new Date(eventMinDate)) + "," +
+ // dtf.format(new Date(eventMaxDate)) + ") " +
+ // "to band(" +
+ // dtf.format(new Date(minVisibleDate)) + "," +
+ // dtf.format(new Date(maxVisibleDate)) + ")");
- if ((eventMinDate >= minVisibleDate && eventMinDate <= maxVisibleDate)
- || (eventMaxDate != null && eventMaxDate >= minVisibleDate && eventMaxDate <= maxVisibleDate)
- || (eventMaxDate != null && eventMinDate <= minVisibleDate && eventMaxDate >= maxVisibleDate)) {
- return true;
- }
+ if ((eventMinDate >= minVisibleDate && eventMinDate <= maxVisibleDate)
+ || (eventMaxDate != null && eventMaxDate >= minVisibleDate && eventMaxDate <= maxVisibleDate)
+ || (eventMaxDate != null && eventMinDate <= minVisibleDate && eventMaxDate >= maxVisibleDate)) {
+ return true;
+ }
- return false;
- }
+ return false;
+ }
- /**
- * Resets the rendered status on all events
- */
- private void resetAllEvents() {
- for (final TimeEvent te : events.values()) {
- te.reset();
- }
- }
+ /**
+ * Resets the rendered status on all events
+ */
+ private void resetAllEvents() {
+ for (final TimeEvent te : events.values()) {
+ te.reset();
+ }
+ }
- /**
- * Zooms out given a ratio
- *
- * @param zoomRatio the given ratio to zoom in and out
- */
- private void zoom(final double zoomRatio) {
- // TODO: somehow start with those events in the window (although for
- // zoomout, won't make a different
- // first change the scale
- pixelsPerUnit *= zoomRatio;
- adjustUnit();
- redrawBand();
- }
+ /**
+ * Zooms out given a ratio
+ *
+ * @param zoomRatio
+ * the given ratio to zoom in and out
+ */
+ private void zoom(final double zoomRatio) {
+ // TODO: somehow start with those events in the window (although for
+ // zoomout, won't make a different
+ // first change the scale
+ pixelsPerUnit *= zoomRatio;
+ adjustUnit();
+ redrawBand();
+ }
- /**
- * adds the band to the DOM
- */
- protected void addBandToUI() {
- final El el = new El(timebandContainer);
- final El gxtBandDiv = new El(bandDiv);
+ /**
+ * adds the band to the DOM
+ */
+ protected void addBandToUI() {
+ final El el = new El(timebandContainer);
+ final El gxtBandDiv = new El(bandDiv);
- // set display options, ie. auto hide
- // if (autoHide && !hasVisibleEvents()) {
- // el.setDisplayed(false);
- // }
+ // set display options, ie. auto hide
+ // if (autoHide && !hasVisibleEvents()) {
+ // el.setDisplayed(false);
+ // }
- parent.getTimelineContainer().appendChild(timebandContainer);
- timebandContainer.appendChild(bandDiv);
- addLabelToBand();
+ parent.getTimelineContainer().appendChild(timebandContainer);
+ timebandContainer.appendChild(bandDiv);
+ addLabelToBand();
- el.setStyleName("step-timeband-container");
- gxtBandDiv.setHeight("100%");
- gxtBandDiv.setTop(0);
- }
+ el.setStyleName("step-timeband-container");
+ gxtBandDiv.setHeight("100%");
+ gxtBandDiv.setTop(0);
+ }
- /**
- * Repaints the timeband
- *
- * @param top
- */
- protected void paint() {
- // Log.debug("Request to paint band id:" + getId() + " Current date: " +
- // getCurrentDate() + " Desc:" + getDescription());
- if (!isRendered) {
- addBandToUI();
- isRendered = true;
- }
+ /**
+ * Repaints the timeband
+ *
+ * @param top
+ */
+ protected void paint() {
+ // Log.debug("Request to paint band id:" + getId() + " Current date: " +
+ // getCurrentDate() + " Desc:" + getDescription());
+ if (!isRendered) {
+ addBandToUI();
+ isRendered = true;
+ }
- // show scale band?
- if (showScale) {
- // check if default time track has been added and add if not
- if (tapeTracks.size() == 0) {
- addNewTapeTrack();
- }
+ // show scale band?
+ if (showScale) {
+ // check if default time track has been added and add if not
+ if (tapeTracks.size() == 0) {
+ addNewTapeTrack();
+ }
- if (timescale == null) {
- timescale = new TimeScale(this);
- }
- timescale.paint();
- }
+ if (timescale == null) {
+ timescale = new TimeScale(this);
+ }
+ timescale.paint();
+ }
- drawEvents();
+ drawEvents();
- if (isUserInterested) {
- // after adding events, call the resizing function.
- // It decides whether or not the band needs resizing, so no overhead
- resizeBand();
- } else {
- hideFromUser();
- }
- }
+ if (isUserInterested) {
+ // after adding events, call the resizing function.
+ // It decides whether or not the band needs resizing, so no overhead
+ resizeBand();
+ } else {
+ hideFromUser();
+ }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Orientation.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Orientation.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Orientation.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,14 +8,14 @@
*
*/
public enum Orientation {
- /**
- * Render the timeband horizontally
- */
- HORIZONTAL,
+ /**
+ * Render the timeband horizontally
+ */
+ HORIZONTAL,
- /**
- * Render the timeband vertically
- */
- VERTICAL,
+ /**
+ * Render the timeband vertically
+ */
+ VERTICAL,
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimebandRequestWindow.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimebandRequestWindow.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimebandRequestWindow.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,73 +10,79 @@
*
*/
public class TimebandRequestWindow {
- /** max date requested so far */
- private long maxDate;
+ /** max date requested so far */
+ private long maxDate;
- /** min date requested so far */
- private long minDate;
+ /** min date requested so far */
+ private long minDate;
- /**
- * timeband request window, when created takes the intial window (min, max)
- *
- * @param initialMin initial minimum, usually the left most visible pixel of
- * the timeband
- * @param initialMax initial maximum, usually the right most visible pixel
- * of the timeband
- */
- public TimebandRequestWindow(final long initialMin, final long initialMax) {
- minDate = initialMin;
- maxDate = initialMax;
- }
+ /**
+ * timeband request window, when created takes the intial window (min, max)
+ *
+ * @param initialMin
+ * initial minimum, usually the left most visible pixel of the
+ * timeband
+ * @param initialMax
+ * initial maximum, usually the right most visible pixel of the
+ * timeband
+ */
+ public TimebandRequestWindow(final long initialMin, final long initialMax) {
+ minDate = initialMin;
+ maxDate = initialMax;
+ }
- /**
- * Enlarges the minimum window on the left hand-side
- *
- * @param minDateRequested the new minDate that the band has received
- * @param maxDateRequested the new maxDate that the band has received
- */
- public void adjustRange(final long minDateRequested, final long maxDateRequested) {
- // Log.debug("Adjusting minimum of received/requested window");
+ /**
+ * Enlarges the minimum window on the left hand-side
+ *
+ * @param minDateRequested
+ * the new minDate that the band has received
+ * @param maxDateRequested
+ * the new maxDate that the band has received
+ */
+ public void adjustRange(final long minDateRequested, final long maxDateRequested) {
+ // Log.debug("Adjusting minimum of received/requested window");
- // adjust minimum: as long as the minimum is before, but the max within
- // range, we're fine to adjust
- // --------------------<-------$-----<-------$------------------
- // mdr md Mdr MD
- if (minDateRequested < minDate && maxDateRequested >= minDate) {
- minDate = minDateRequested;
- }
+ // adjust minimum: as long as the minimum is before, but the max within
+ // range, we're fine to adjust
+ // --------------------<-------$-----<-------$------------------
+ // mdr md Mdr MD
+ if (minDateRequested < minDate && maxDateRequested >= minDate) {
+ minDate = minDateRequested;
+ }
- // do the same for the maximum:
- if (maxDateRequested > maxDate && minDateRequested <= maxDate) {
- maxDate = maxDateRequested;
- }
- }
+ // do the same for the maximum:
+ if (maxDateRequested > maxDate && minDateRequested <= maxDate) {
+ maxDate = maxDateRequested;
+ }
+ }
- /**
- * @return the maxDate
- */
- public long getMaxDate() {
- return maxDate;
- }
+ /**
+ * @return the maxDate
+ */
+ public long getMaxDate() {
+ return maxDate;
+ }
- /**
- * @return the minDate
- */
- public long getMinDate() {
- return minDate;
- }
+ /**
+ * @return the minDate
+ */
+ public long getMinDate() {
+ return minDate;
+ }
- /**
- * @param maxDate the maxDate to set
- */
- public void setMaxDate(final long maxDate) {
- this.maxDate = maxDate;
- }
+ /**
+ * @param maxDate
+ * the maxDate to set
+ */
+ public void setMaxDate(final long maxDate) {
+ this.maxDate = maxDate;
+ }
- /**
- * @param minDate the minDate to set
- */
- public void setMinDate(final long minDate) {
- this.minDate = minDate;
- }
+ /**
+ * @param minDate
+ * the minDate to set
+ */
+ public void setMinDate(final long minDate) {
+ this.minDate = minDate;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimelineConstants.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimelineConstants.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimelineConstants.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,78 +8,78 @@
*/
public final class TimelineConstants {
- /**
- * This is the setting defining how many pixels represent 1 unit
- */
- public static final int DEFAULT_PIXELS_PER_UNIT = 100;
- /**
- * for a duration event, the css class
- */
- public static final String DURATION = "step-timeline-duration";
- /**
- * css class for a label of a duration event
- */
- public static final String DURATION_LABEL = "step-time-duration-label";
- /**
- * step time event css
- */
- public static final String EVENT = "step-time-event";
- /**
- * the minimum width of an event
- */
- public static final int EVENT_MIN_WIDTH = 2;
+ /**
+ * This is the setting defining how many pixels represent 1 unit
+ */
+ public static final int DEFAULT_PIXELS_PER_UNIT = 100;
+ /**
+ * for a duration event, the css class
+ */
+ public static final String DURATION = "step-timeline-duration";
+ /**
+ * css class for a label of a duration event
+ */
+ public static final String DURATION_LABEL = "step-time-duration-label";
+ /**
+ * step time event css
+ */
+ public static final String EVENT = "step-time-event";
+ /**
+ * the minimum width of an event
+ */
+ public static final int EVENT_MIN_WIDTH = 2;
- /**
- * The initial date for the timeline, the date of birth of Jesus
- */
- public static final long INITIAL_DATE = -61183987174853L;
- /**
- * this describes how much of a unit needs to be visible before calling back
- * to the server
- */
- public static final double MINIMUM_UNIT_PORTION_BEFORE_SERVER_CALL = 0.5;
- /**
- * css of a point in time event
- */
- public static final String POINT_IN_TIME_EVENT = "step-timeline-pointInTime";
+ /**
+ * The initial date for the timeline, the date of birth of Jesus
+ */
+ public static final long INITIAL_DATE = -61183987174853L;
+ /**
+ * this describes how much of a unit needs to be visible before calling back
+ * to the server
+ */
+ public static final double MINIMUM_UNIT_PORTION_BEFORE_SERVER_CALL = 0.5;
+ /**
+ * css of a point in time event
+ */
+ public static final String POINT_IN_TIME_EVENT = "step-timeline-pointInTime";
- /**
- * css for the label of a point in time event label
- */
- public static final String POINT_IN_TIME_LABEL = "step-time-point-in-time-label";
+ /**
+ * css for the label of a point in time event label
+ */
+ public static final String POINT_IN_TIME_LABEL = "step-time-point-in-time-label";
- /**
- * space between the icon and the text
- */
- public static final int POINT_IN_TIME_WIDTH_SPACE = 15;
+ /**
+ * space between the icon and the text
+ */
+ public static final int POINT_IN_TIME_WIDTH_SPACE = 15;
- /**
- * space between the popup and the mouse
- */
- public static final int SPACE_BELOW_POPUP = 20;
+ /**
+ * space between the popup and the mouse
+ */
+ public static final int SPACE_BELOW_POPUP = 20;
- /**
- * height of each tape track
- *
- */
- public static final int TAPE_TRACK_HEIGHT = 21;
+ /**
+ * height of each tape track
+ *
+ */
+ public static final int TAPE_TRACK_HEIGHT = 21;
- /**
- * total width of timeline width, hardcoded at the moment
- */
- // TODO: parameterize this depending on the length of the band
- public static final int TIMELINE_WIDTH = 32000;
+ /**
+ * total width of timeline width, hardcoded at the moment
+ */
+ // TODO: parameterize this depending on the length of the band
+ public static final int TIMELINE_WIDTH = 32000;
- /**
- * The initial zoom factor. This determines how much of a zoom is applied.
- * For example a factor of 0.25 changes the scale of 50 pixels per decade to
- * (1 + 0.25) * 50 = 75 pixels
- */
- public static final double ZOOM_FACTOR = 0.25;
+ /**
+ * The initial zoom factor. This determines how much of a zoom is applied.
+ * For example a factor of 0.25 changes the scale of 50 pixels per decade to
+ * (1 + 0.25) * 50 = 75 pixels
+ */
+ public static final double ZOOM_FACTOR = 0.25;
- /**
- * prevent intialisation
- */
- private TimelineConstants() {
- }
+ /**
+ * prevent intialisation
+ */
+ private TimelineConstants() {
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/events/TimelineMouseHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/events/TimelineMouseHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/events/TimelineMouseHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -19,40 +19,41 @@
* @author CJBurrell
*
*/
-public class TimelineMouseHandler implements MouseMoveHandler, MouseUpHandler, MouseDownHandler,
- MouseOutHandler, MouseOverHandler {
- /**
- * The timeline component
- */
- private final Timeline timeline;
+public class TimelineMouseHandler implements MouseMoveHandler, MouseUpHandler, MouseDownHandler, MouseOutHandler,
+ MouseOverHandler {
+ /**
+ * The timeline component
+ */
+ private final Timeline timeline;
- /**
- * constructor takes the timeline component
- *
- * @param timeline the timeline component.
- */
- public TimelineMouseHandler(final Timeline timeline) {
- this.timeline = timeline;
- }
+ /**
+ * constructor takes the timeline component
+ *
+ * @param timeline
+ * the timeline component.
+ */
+ public TimelineMouseHandler(final Timeline timeline) {
+ this.timeline = timeline;
+ }
- public void onMouseDown(final MouseDownEvent event) {
- timeline.handle(event);
- }
+ public void onMouseDown(final MouseDownEvent event) {
+ timeline.handle(event);
+ }
- public void onMouseMove(final MouseMoveEvent event) {
- timeline.handle(event);
- }
+ public void onMouseMove(final MouseMoveEvent event) {
+ timeline.handle(event);
+ }
- public void onMouseOut(final MouseOutEvent event) {
- timeline.handle(event);
- }
+ public void onMouseOut(final MouseOutEvent event) {
+ timeline.handle(event);
+ }
- public void onMouseOver(final MouseOverEvent event) {
- timeline.handle(event);
+ public void onMouseOver(final MouseOverEvent event) {
+ timeline.handle(event);
- }
+ }
- public void onMouseUp(final MouseUpEvent event) {
- timeline.handle(event);
- }
+ public void onMouseUp(final MouseUpEvent event) {
+ timeline.handle(event);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/CannotDeleteEventException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/CannotDeleteEventException.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/CannotDeleteEventException.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,19 +9,19 @@
*/
public class CannotDeleteEventException extends Exception {
- /**
- * The default constructor with the explanatory message
- *
- * @param message
- * The message for the exception
- */
- public CannotDeleteEventException(final String message) {
- super(message);
- }
+ /**
+ * The default constructor with the explanatory message
+ *
+ * @param message
+ * The message for the exception
+ */
+ public CannotDeleteEventException(final String message) {
+ super(message);
+ }
- /**
- * Serialisation id
- */
- private static final long serialVersionUID = -9221252482310063155L;
+ /**
+ * Serialisation id
+ */
+ private static final long serialVersionUID = -9221252482310063155L;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/IncapableOfCalculatingRequestWindowException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/IncapableOfCalculatingRequestWindowException.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/IncapableOfCalculatingRequestWindowException.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,22 +11,26 @@
*/
public class IncapableOfCalculatingRequestWindowException extends Exception {
- /**
- * serial id
- */
- private static final long serialVersionUID = 1866493907904681758L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 1866493907904681758L;
- /**
- * The client is unable to calculate which bit to request from the server
- *
- * @param minVisibleDate the minimum visible date from the client
- * @param maxVisibleDate the maximum visible date from the client
- * @param minReceivedDate the minimum date the client has ever seen
- * @param maxReceivedDate the maximum date the client has ever seen
- */
- public IncapableOfCalculatingRequestWindowException(final long minVisibleDate, final long maxVisibleDate,
- final long minReceivedDate, final long maxReceivedDate) {
- super("Unable to calculate request window for: " + minReceivedDate + " / " + maxReceivedDate
- + ". Visible section is: " + minVisibleDate + " / " + maxVisibleDate);
- }
+ /**
+ * The client is unable to calculate which bit to request from the server
+ *
+ * @param minVisibleDate
+ * the minimum visible date from the client
+ * @param maxVisibleDate
+ * the maximum visible date from the client
+ * @param minReceivedDate
+ * the minimum date the client has ever seen
+ * @param maxReceivedDate
+ * the maximum date the client has ever seen
+ */
+ public IncapableOfCalculatingRequestWindowException(final long minVisibleDate, final long maxVisibleDate,
+ final long minReceivedDate, final long maxReceivedDate) {
+ super("Unable to calculate request window for: " + minReceivedDate + " / " + maxReceivedDate
+ + ". Visible section is: " + minVisibleDate + " / " + maxVisibleDate);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/TimeBandNotFoundException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/TimeBandNotFoundException.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/TimeBandNotFoundException.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,18 +8,19 @@
*/
public class TimeBandNotFoundException extends Exception {
- /**
- * serial id
- */
- private static final long serialVersionUID = 6234571991235670035L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 6234571991235670035L;
- /**
- * Constructor specifying the error message
- *
- * @param message message indicating which band was not found
- */
- public TimeBandNotFoundException(final String message) {
- super(message);
- }
+ /**
+ * Constructor specifying the error message
+ *
+ * @param message
+ * message indicating which band was not found
+ */
+ public TimeBandNotFoundException(final String message) {
+ super(message);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,9 +9,9 @@
*/
public class UnknownFiredElement extends Exception {
- /**
- * serial id
- */
- private static final long serialVersionUID = -726869406002130223L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -726869406002130223L;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/CurrentBandStats.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/CurrentBandStats.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/CurrentBandStats.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,80 +8,85 @@
*
*/
public class CurrentBandStats {
- /**
- * description of the band to be displayed on the screen
- */
- private final String bandDescription;
+ /**
+ * description of the band to be displayed on the screen
+ */
+ private final String bandDescription;
- /**
- * timeband id
- */
- private final int bandId;
+ /**
+ * timeband id
+ */
+ private final int bandId;
- /**
- * ticked or not, whether the user is interested in this
- */
- private final boolean isUserInterested;
+ /**
+ * ticked or not, whether the user is interested in this
+ */
+ private final boolean isUserInterested;
- /**
- * number of elements on the timeband
- */
- private final int numElements;
+ /**
+ * number of elements on the timeband
+ */
+ private final int numElements;
- /**
- * number of elements currently visible
- */
- private final int numVisibleElements;
+ /**
+ * number of elements currently visible
+ */
+ private final int numVisibleElements;
- /**
- *
- * @param bandId the id of the band
- * @param numElements the number of events on the band
- * @param numVisibleElements the number of visible events in the frame
- * @param bandDescription description to be displayed on the view
- * @param isUserInterested whether the user is interested in the band
- */
- public CurrentBandStats(final int bandId, final String bandDescription, final int numElements,
- final int numVisibleElements, final boolean isUserInterested) {
- this.bandId = bandId;
- this.bandDescription = bandDescription;
- this.numElements = numElements;
- this.numVisibleElements = numVisibleElements;
- this.isUserInterested = isUserInterested;
- }
+ /**
+ *
+ * @param bandId
+ * the id of the band
+ * @param numElements
+ * the number of events on the band
+ * @param numVisibleElements
+ * the number of visible events in the frame
+ * @param bandDescription
+ * description to be displayed on the view
+ * @param isUserInterested
+ * whether the user is interested in the band
+ */
+ public CurrentBandStats(final int bandId, final String bandDescription, final int numElements,
+ final int numVisibleElements, final boolean isUserInterested) {
+ this.bandId = bandId;
+ this.bandDescription = bandDescription;
+ this.numElements = numElements;
+ this.numVisibleElements = numVisibleElements;
+ this.isUserInterested = isUserInterested;
+ }
- /**
- * @return the bandDescription
- */
- public String getBandDescription() {
- return bandDescription;
- }
+ /**
+ * @return the bandDescription
+ */
+ public String getBandDescription() {
+ return bandDescription;
+ }
- /**
- * @return the bandId
- */
- public int getBandId() {
- return bandId;
- }
+ /**
+ * @return the bandId
+ */
+ public int getBandId() {
+ return bandId;
+ }
- /**
- * @return the numElements
- */
- public int getNumElements() {
- return numElements;
- }
+ /**
+ * @return the numElements
+ */
+ public int getNumElements() {
+ return numElements;
+ }
- /**
- * @return the numVisibleElements
- */
- public int getNumVisibleElements() {
- return numVisibleElements;
- }
+ /**
+ * @return the numVisibleElements
+ */
+ public int getNumVisibleElements() {
+ return numVisibleElements;
+ }
- /**
- * @return the isUserInterested
- */
- public boolean isUserInterested() {
- return isUserInterested;
- }
+ /**
+ * @return the isUserInterested
+ */
+ public boolean isUserInterested() {
+ return isUserInterested;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,80 +13,86 @@
*
*/
public final class TimeConversionUtil {
- /**
- * converts a pixel position to its date using the format associated to the
- * unit of the timeband
- *
- * @param pixelPosition pixel position to be converted
- * @param timeband current timeband (this contains the current viewing
- * location, and unit
- * @return the date as a formatted string
- */
- public static String formatPixelToTime(final long pixelPosition, final Timeband timeband) {
- return formatTime(pixelToTime(pixelPosition, timeband), timeband);
- }
+ /**
+ * converts a pixel position to its date using the format associated to the
+ * unit of the timeband
+ *
+ * @param pixelPosition
+ * pixel position to be converted
+ * @param timeband
+ * current timeband (this contains the current viewing location,
+ * and unit
+ * @return the date as a formatted string
+ */
+ public static String formatPixelToTime(final long pixelPosition, final Timeband timeband) {
+ return formatTime(pixelToTime(pixelPosition, timeband), timeband);
+ }
- /**
- * formats the given time using the unit described in the timeband
- *
- * @param timeband the timeband containing the current view, unit, etc.
- * @param eventDate date to be formatted
- * @return the string representation of the date
- */
- public static String formatTime(final long eventDate, final Timeband timeband) {
- final Date date = new Date(eventDate);
- final String formatForBand = timeband.getUnit().getFormat();
- final DateTimeFormat format = DateTimeFormat.getFormat(formatForBand);
- return format.format(date);
- }
+ /**
+ * formats the given time using the unit described in the timeband
+ *
+ * @param timeband
+ * the timeband containing the current view, unit, etc.
+ * @param eventDate
+ * date to be formatted
+ * @return the string representation of the date
+ */
+ public static String formatTime(final long eventDate, final Timeband timeband) {
+ final Date date = new Date(eventDate);
+ final String formatForBand = timeband.getUnit().getFormat();
+ final DateTimeFormat format = DateTimeFormat.getFormat(formatForBand);
+ return format.format(date);
+ }
- /**
- * This takes a pixel position and returns the equivalent time
- *
- * @param pixelPosition the pixel position that we are trying to convert
- * @param timeband the timeband which contains the relevant information
- * (current view, unit) to calculate the time from the pixel
- * position
- * @return the time of pixelPosition
- */
- public static long pixelToTime(final long pixelPosition, final Timeband timeband) {
- final long currentDateX = timeband.getCurrentDateX();
- final long currentDate = timeband.getCurrentDate();
- final Unit unit = timeband.getUnit();
- final long pixelsPerUnit = timeband.getPixelsPerUnit();
+ /**
+ * This takes a pixel position and returns the equivalent time
+ *
+ * @param pixelPosition
+ * the pixel position that we are trying to convert
+ * @param timeband
+ * the timeband which contains the relevant information (current
+ * view, unit) to calculate the time from the pixel position
+ * @return the time of pixelPosition
+ */
+ public static long pixelToTime(final long pixelPosition, final Timeband timeband) {
+ final long currentDateX = timeband.getCurrentDateX();
+ final long currentDate = timeband.getCurrentDate();
+ final Unit unit = timeband.getUnit();
+ final long pixelsPerUnit = timeband.getPixelsPerUnit();
- final long differenceWithOrigin = pixelPosition - currentDateX;
- final long date = currentDate + (differenceWithOrigin * unit.getMilliseconds() / pixelsPerUnit);
- return date;
- }
+ final long differenceWithOrigin = pixelPosition - currentDateX;
+ final long date = currentDate + (differenceWithOrigin * unit.getMilliseconds() / pixelsPerUnit);
+ return date;
+ }
- /**
- * A date is always calculated within a time band.
- *
- * @param eventDate the date to be converted
- * @param currentTimeband reference timeband (including current view, unit,
- * etc).
- * @return the pixel position on the timeband for the passed in time
- */
- public static int timeToPixel(final long eventDate, final Timeband currentTimeband) {
- // here's what we start from
- final long millisecondPerUnit = currentTimeband.getUnit().getMilliseconds();
- final long pixelsPerUnit = currentTimeband.getPixelsPerUnit();
- final long currentOriginDate = currentTimeband.getCurrentDate();
- final long currentOriginXPixel = currentTimeband.getCurrentDateX();
+ /**
+ * A date is always calculated within a time band.
+ *
+ * @param eventDate
+ * the date to be converted
+ * @param currentTimeband
+ * reference timeband (including current view, unit, etc).
+ * @return the pixel position on the timeband for the passed in time
+ */
+ public static int timeToPixel(final long eventDate, final Timeband currentTimeband) {
+ // here's what we start from
+ final long millisecondPerUnit = currentTimeband.getUnit().getMilliseconds();
+ final long pixelsPerUnit = currentTimeband.getPixelsPerUnit();
+ final long currentOriginDate = currentTimeband.getCurrentDate();
+ final long currentOriginXPixel = currentTimeband.getCurrentDateX();
- // what's one pixel in milliseconds?
- final double onePixelInMs = (double) millisecondPerUnit / pixelsPerUnit;
+ // what's one pixel in milliseconds?
+ final double onePixelInMs = (double) millisecondPerUnit / pixelsPerUnit;
- // calculate difference with current position on timeband
- final long differenceWithEvent = eventDate - currentOriginDate;
- final long pixelValueOnBand = currentOriginXPixel + (long) (differenceWithEvent / onePixelInMs);
- return (int) pixelValueOnBand;
- }
+ // calculate difference with current position on timeband
+ final long differenceWithEvent = eventDate - currentOriginDate;
+ final long pixelValueOnBand = currentOriginXPixel + (long) (differenceWithEvent / onePixelInMs);
+ return (int) pixelValueOnBand;
+ }
- /**
- * making the constructor invisible to outsiders
- */
- private TimeConversionUtil() {
- }
+ /**
+ * making the constructor invisible to outsiders
+ */
+ private TimeConversionUtil() {
+ }
}
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -4,9 +4,9 @@
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.FilterResultsPresenter.Display;
+import com.tyndalehouse.step.web.client.presenter.BookmarkPresenter;
-public class BookmarkView extends Composite implements Display {
+public class BookmarkView extends Composite implements BookmarkPresenter.Display {
interface MyUiBinder extends UiBinder<Widget, BookmarkView> {
}
@@ -14,11 +14,10 @@
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
public BookmarkView() {
- initWidget(uiBinder.createAndBindUi(this));
+ initWidget(BookmarkView.uiBinder.createAndBindUi(this));
}
- @Override
- public Widget getWidget() {
+ public Widget getContainerWidget() {
return this;
}
}
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -22,11 +22,10 @@
SimplePanel filterResults;
public FilterResultsView() {
- initWidget(uiBinder.createAndBindUi(this));
+ initWidget(FilterResultsView.uiBinder.createAndBindUi(this));
}
- @Override
- public Widget getWidget() {
+ public Widget getContainerWidget() {
return this;
}
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,9 +9,7 @@
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.presenter.ModuleSideBarPresenter.Display;
@@ -19,119 +17,121 @@
public class ModuleSideBarView extends Composite implements Display {
- interface ModuleSideBarUiBinder extends UiBinder<Widget, ModuleSideBarView> {
- }
+ interface ModuleSideBarUiBinder extends UiBinder<Widget, ModuleSideBarView> {
+ }
- private static ModuleSideBarUiBinder uiBinder = GWT
- .create(ModuleSideBarUiBinder.class);
+ private static ModuleSideBarUiBinder uiBinder = GWT.create(ModuleSideBarUiBinder.class);
- @UiField
- ToggleButton geography;
- @UiField
- ToggleButton history;
- @UiField
- ToggleButton language;
- @UiField
- ToggleButton people;
- @UiField
- ToggleButton search;
- @UiField
- ToggleButton literature;
+ @UiField
+ ToggleButton geography;
+ @UiField
+ ToggleButton history;
+ @UiField
+ ToggleButton language;
+ @UiField
+ ToggleButton people;
+ @UiField
+ ToggleButton search;
+ @UiField
+ ToggleButton literature;
- //for convenience
- private List<ToggleButton> options = null;
-
- public ModuleSideBarView() {
- initWidget(uiBinder.createAndBindUi(this));
- addInternalHandlers();
-
- }
+ // for convenience
+ private List<ToggleButton> options = null;
- private void addInternalHandlers() {
- ClickHandler ch = new ClickHandler() {
- public void onClick(ClickEvent event) {
- unselectAll(event.getSource());
- }
- };
+ public ModuleSideBarView() {
+ initWidget(ModuleSideBarView.uiBinder.createAndBindUi(this));
+ addInternalHandlers();
- for(ToggleButton option : getOptions()) {
- option.addClickHandler(ch);
- }
- }
+ }
- protected void unselectAll(Object source) {
- for(ToggleButton tb : getOptions()) {
- if(!source.equals(tb)) {
- tb.setDown(false);
- }
- }
- }
+ private void addInternalHandlers() {
+ final ClickHandler ch = new ClickHandler() {
+ public void onClick(final ClickEvent event) {
+ unselectAll(event.getSource());
+ }
+ };
- public HasClickHandlers getGeography() {
- return geography;
- }
+ for (final ToggleButton option : getOptions()) {
+ option.addClickHandler(ch);
+ }
+ }
- public HasClickHandlers getHistory() {
- return history;
- }
+ protected void unselectAll(final Object source) {
+ for (final ToggleButton tb : getOptions()) {
+ if (!source.equals(tb)) {
+ tb.setDown(false);
+ }
+ }
+ }
- public HasClickHandlers getLanguage() {
- return language;
- }
+ public HasClickHandlers getGeography() {
+ return geography;
+ }
- public HasClickHandlers getPeople() {
- return people;
- }
+ public HasClickHandlers getHistory() {
+ return history;
+ }
- public HasClickHandlers getSearch() {
- return search;
- }
+ public HasClickHandlers getLanguage() {
+ return language;
+ }
- public HasClickHandlers getLiterature() {
- return literature;
- }
+ public HasClickHandlers getPeople() {
+ return people;
+ }
- private List<ToggleButton> getOptions() {
- if(options == null) {
- options = new ArrayList<ToggleButton>();
- options.add(geography);
- options.add(history);
- options.add(language);
- options.add(people);
- options.add(search);
- options.add(literature);
- }
- return options;
- }
+ public HasClickHandlers getSearch() {
+ return search;
+ }
-
- public Widget getWidget() {
- return this;
- }
+ public HasClickHandlers getLiterature() {
+ return literature;
+ }
- public SideBarModule getSelectedModule() {
- for(ToggleButton option : getOptions()) {
- if(option.isDown()) {
- return getModuleName(option);
- }
- }
- return SideBarModule.NONE;
- }
+ private List<ToggleButton> getOptions() {
+ if (options == null) {
+ options = new ArrayList<ToggleButton>();
+ options.add(geography);
+ options.add(history);
+ options.add(language);
+ options.add(people);
+ options.add(search);
+ options.add(literature);
+ }
+ return options;
+ }
- private SideBarModule getModuleName(ToggleButton option) {
- if(option.equals(geography)) {
- return SideBarModule.GEOGRAPHY;
- } else if(option.equals(history)) {
- return SideBarModule.HISTORY;
- } if(option.equals(language)) {
- return SideBarModule.LANGUAGE;
- }if(option.equals(literature)) {
- return SideBarModule.LITERATURE;
- }if(option.equals(people)) {
- return SideBarModule.PEOPLE;
- }if(option.equals(search)) {
- return SideBarModule.SEARCH;
- }
- return SideBarModule.NONE;
- }
+ public SideBarModule getSelectedModule() {
+ for (final ToggleButton option : getOptions()) {
+ if (option.isDown()) {
+ return getModuleName(option);
+ }
+ }
+ return SideBarModule.NONE;
+ }
+
+ private SideBarModule getModuleName(final ToggleButton option) {
+ if (option.equals(geography)) {
+ return SideBarModule.GEOGRAPHY;
+ } else if (option.equals(history)) {
+ return SideBarModule.HISTORY;
+ }
+ if (option.equals(language)) {
+ return SideBarModule.LANGUAGE;
+ }
+ if (option.equals(literature)) {
+ return SideBarModule.LITERATURE;
+ }
+ if (option.equals(people)) {
+ return SideBarModule.PEOPLE;
+ }
+ if (option.equals(search)) {
+ return SideBarModule.SEARCH;
+ }
+ return SideBarModule.NONE;
+ }
+
+ public Widget getContainerWidget() {
+ return this;
+ }
}
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -4,19 +4,35 @@
import java.util.List;
import java.util.SortedMap;
+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.HasChangeHandlers;
+import com.google.gwt.event.dom.client.HasKeyPressHandlers;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+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.HTML;
import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.presenter.ScripturePresenter;
import com.tyndalehouse.step.web.client.toolkit.HasSource;
-import com.tyndalehouse.step.web.client.toolkit.SourceListBox;
import com.tyndalehouse.step.web.client.toolkit.scripture.ScriptureDisplayConstants;
import com.tyndalehouse.step.web.client.toolkit.scripture.VerseLabel;
+import com.tyndalehouse.step.web.client.view.internal.Area;
+import com.tyndalehouse.step.web.client.view.internal.Version;
import com.tyndalehouse.step.web.shared.scripture.Passage;
import com.tyndalehouse.step.web.shared.scripture.TextualElement;
import com.tyndalehouse.step.web.shared.scripture.Title;
@@ -34,19 +50,9 @@
*
*/
public class ScriptureView extends Composite implements ScripturePresenter.Display {
+ private String currentPassage;
/**
- * the auto list of bible versions
- */
- private final SourceListBox bibleVersions;
-
- // TODO: to be removed into the presenter
- /**
- * the default event bus
- */
- // private final EventBus eventBus;
-
- /**
* a list of VerseLabel (wrappers of bible text) that are currently being
* displayed and contain lemmas
*/
@@ -58,62 +64,65 @@
*/
private final List<VerseLabel> morphs;
+ interface Binder extends UiBinder<Widget, ScriptureView> {
+ }
+
+ private static Binder binder = GWT.create(Binder.class);
+
/**
* a logical display of scripture, in that events can be attached to each of
* the elements on this panel
*/
- private final Panel scriptureHolder;
+ @UiField
+ protected FlowPanel scriptureHolder;
/**
- * a simple display of scripture as text
+ * text box in which to filter by bible versions
*/
- private final HTML scriptureHTML;
+ @UiField
+ protected TextBox bibleVersionSuggestion;
/**
+ * a list of bible versions organised in a tree
+ */
+ @UiField
+ protected Tree bibleVersions;
+
+ // /**
+ // * a button to click ok!
+ // */
+ // @UiField
+ // Button changeBibleVersion;
+
+ /**
+ * layout panel
+ */
+ @UiField
+ protected LayoutPanel scriptureLayoutPanel;
+ @UiField
+ protected Panel selectorPanel;
+ @UiField
+ Panel treePanel;
+
+ /**
* The default constructor
*
- * @param eventBus
- * eventBus - //TODO: remove this
*/
- // @Inject
- public ScriptureView(/* final EventBus eventBus */) {
- // this.eventBus = eventBus;
- final VerticalPanel vp = new VerticalPanel();
- scriptureHolder = new FlowPanel();
+ public ScriptureView() {
+ initWidget(binder.createAndBindUi(this));
lemmaWords = new ArrayList<VerseLabel>();
morphs = new ArrayList<VerseLabel>();
- initWidget(vp);
-
- bibleVersions = new SourceListBox();
- bibleVersions.setStylePrimaryName("bibleVersionsDropDown");
-
- // adding the dropdown with the bible versions
- vp.add(bibleVersions);
-
- // adding the html display of scripture
- // TODO : Localise this here.
- scriptureHTML = new HTML("Please lookup a reference");
- vp.add(scriptureHTML);
- vp.add(scriptureHolder);
+ // set initial properties
+ bibleVersionSuggestion.setStyleName("prompt");
+ scriptureLayoutPanel.getWidgetContainerElement(scriptureHolder).getStyle().setZIndex(1000);
+ scriptureLayoutPanel.getWidgetContainerElement(selectorPanel).getStyle().setZIndex(1000);
+ scriptureLayoutPanel.getWidgetContainerElement(treePanel).getStyle().setZIndex(2000);
+ hideSuggestions();
+ addHandlersForFilterBox();
+ addHandlersForTree();
}
- public Widget asWidget() {
- return this;
- }
-
- public HasChangeHandlers getChangeHandlers() {
- return bibleVersions;
- }
-
- public String getSelectedBibleVersion() {
- return bibleVersions.getValue(bibleVersions.getSelectedIndex());
- }
-
- public HasSource<SortedMap<String, String>> getSource() {
- return bibleVersions;
- }
-
public void highlight(final List<String> lemmaList) {
for (final VerseLabel vl : lemmaWords) {
for (final String l : lemmaList) {
@@ -139,20 +148,12 @@
doVerse((Verse) v);
}
}
-
}
- // TODO: probably remove the following function, and ensure the service is
- // removed at the same time
- public void setPassage(final String text) {
- scriptureHTML.setHTML(text);
- }
-
public void startProcessing() {
}
public void stopProcessing() {
- // TODO: to be completed
}
/**
@@ -204,4 +205,267 @@
}
}
}
+
+ /**
+ * @return the currentPassage
+ */
+ public String getCurrentPassage() {
+ return currentPassage;
+ }
+
+ /**
+ * @param currentPassage
+ * the currentPassage to set
+ */
+ public void setCurrentPassage(final String currentPassage) {
+ this.currentPassage = currentPassage;
+ }
+
+ /**
+ * adds the default handlers for the filter box
+ */
+ private void addHandlersForFilterBox() {
+ // add internal handlers
+ bibleVersionSuggestion.addKeyUpHandler(new KeyUpHandler() {
+ public void onKeyUp(final KeyUpEvent keyUp) {
+ if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
+ hideSuggestions();
+ } else if (!keyUp.isAnyModifierKeyDown()) {
+ showSuggestions();
+ refilterTree();
+ }
+ }
+ });
+
+ bibleVersionSuggestion.addFocusHandler(new FocusHandler() {
+ public void onFocus(final FocusEvent focusEvent) {
+ if (bibleVersionSuggestion.getStyleName().contains("prompt")) {
+ bibleVersionSuggestion.setText("");
+ bibleVersionSuggestion.removeStyleName("prompt");
+ }
+ }
+ });
+
+ // });
+ //
+ // bibleVersionSuggestion.addBlurHandler(new BlurHandler() {
+ // public void onBlur(final BlurEvent arg0) {
+ // // DeferredCommand.addCommand(hideSuggestionsCommand);
+ // }
+ // });
+ }
+
+ private void showSuggestions() {
+ bibleVersions.setVisible(true);
+ }
+
+ private void hideSuggestions() {
+ bibleVersions.setVisible(false);
+ }
+
+ /**
+ * adds handlers for tree
+ */
+ private void addHandlersForTree() {
+ bibleVersions.addSelectionHandler(new SelectionHandler<TreeItem>() {
+ public void onSelection(final SelectionEvent<TreeItem> selectionEvent) {
+ if (selectionEvent.getSelectedItem().getChildCount() == 0) {
+ // on selection we close the tree and set the selected
+ // version
+ bibleVersionSuggestion.setText(bibleVersions.getSelectedItem().getText());
+ hideSuggestions();
+ }
+ }
+ });
+
+ bibleVersions.addFocusHandler(new FocusHandler() {
+ public void onFocus(final FocusEvent arg0) {
+ showSuggestions();
+ }
+ });
+
+ bibleVersions.addBlurHandler(new BlurHandler() {
+
+ public void onBlur(final BlurEvent arg0) {
+ hideSuggestions();
+ }
+ });
+ }
+
+ /**
+ * filters through the tree
+ */
+ protected void refilterTree() {
+ for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
+ filterTreeItem(bibleVersions.getItem(ii), bibleVersionSuggestion.getText().toLowerCase());
+ }
+
+ hideEmptyParents();
+ }
+
+ /**
+ * Hide parents where there are no children
+ */
+ private void hideEmptyParents() {
+ for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
+ final TreeItem parentLevelItem = bibleVersions.getItem(ii);
+ // we ignore first level elements, only hide ones below for now
+
+ for (int jj = 0; jj < parentLevelItem.getChildCount(); jj++) {
+ final TreeItem child = parentLevelItem.getChild(jj);
+ if (!hasVisibleChildren(child)) {
+ child.setVisible(false);
+ } else {
+ child.setVisible(true);
+ }
+ }
+ }
+ }
+
+ /**
+ * returns the number of visible children
+ *
+ * @param node
+ * to be evaluated for number of visible children
+ * @return
+ */
+ private boolean hasVisibleChildren(final TreeItem node) {
+ if (node.getChildCount() == 0) {
+ return false;
+ }
+ for (int ii = 0; ii < node.getChildCount(); ii++) {
+ // first work out whether
+
+ if (node.getChild(ii).isVisible()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * filters tree items and their children
+ *
+ * @param item
+ * item to be filtered
+ * @param text
+ * the text currently in the box
+ */
+ private void filterTreeItem(final TreeItem item, final String text) {
+ // check for leaf node
+ if (item.getChildCount() == 0) {
+ // then filter
+ // Area node = (Area) item.getUserObject();
+ final Object o = item.getUserObject();
+ if (item.getText().toLowerCase().startsWith(text)
+ || (o instanceof Version && ((Version) o).getInitials().toLowerCase().startsWith(text))) {
+ item.setVisible(true);
+ item.setState(true);
+ item.getParentItem().setState(true);
+ item.getParentItem().getParentItem().setState(true);
+ } else {
+ item.setVisible(false);
+ }
+ } else {
+ for (int ii = 0; ii < item.getChildCount(); ii++) {
+ filterTreeItem(item.getChild(ii), text);
+ }
+ }
+ }
+
+ /**
+ * TODO: do work off the DOM for performance? adds a version to the tree...
+ */
+ public void addVersion(final String area, final String language, final String versionInitials,
+ final String versionName) {
+ // look for area first
+ for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
+ final TreeItem item = bibleVersions.getItem(ii);
+ if (item.getText().equals(area)) {
+ // now get the language
+ createLanguageVersionTreeSection(language, versionInitials, versionName, item);
+ return;
+ }
+ }
+
+ // create the whole area field
+ final Area areaParent = new Area(area);
+ final TreeItem areaItem = new TreeItem(area);
+ areaItem.setUserObject(areaParent);
+ bibleVersions.addItem(areaItem);
+
+ createLanguageVersionTreeSection(language, versionInitials, versionName, areaItem);
+ }
+
+ /**
+ * creates the language and version node in the tree
+ *
+ * @param language
+ * language to be added to the tree
+ * @param versionInitials
+ * initials of the bible versions
+ * @param versionName
+ * version name as in jsword
+ * @param item
+ * parent item
+ */
+ private void createLanguageVersionTreeSection(final String language, final String versionInitials,
+ final String versionName, final TreeItem item) {
+ final TreeItem languageParent = findItem(item, language);
+ final TreeItem version = new TreeItem(versionName);
+ version.setUserObject(new Version(versionInitials, language));
+ languageParent.addItem(version);
+ }
+
+ private TreeItem findItem(final TreeItem parent, final String language) {
+ for (int ii = 0; ii < parent.getChildCount(); ii++) {
+ final TreeItem child = parent.getChild(ii);
+ final Area area = (Area) child.getUserObject();
+ if (area.getName().equals(language)) {
+ return child;
+ }
+ }
+
+ final TreeItem newChild = new TreeItem(language);
+ newChild.setUserObject(new Area(language));
+ parent.addItem(newChild);
+ return newChild;
+ }
+
+ //
+ // public HasClickHandlers getVersionSelectionButton() {
+ // return changeBibleVersion;
+ // }
+
+ public HasKeyPressHandlers getVersionSelectionEntered() {
+ return bibleVersionSuggestion;
+ }
+
+ public String getCurrentlySelectedVersion() {
+ final Area area = (Area) bibleVersions.getSelectedItem().getUserObject();
+ if (area != null && area instanceof Version) {
+ return ((Version) area).getInitials();
+ }
+ return null;
+ }
+
+ public HasChangeHandlers getChangeHandlers() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getSelectedBibleVersion() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public HasSource<SortedMap<String, String>> getSource() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,16 +1,17 @@
package com.tyndalehouse.step.web.client.view;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.event.logical.shared.ResizeEvent;
+import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
import com.tyndalehouse.step.web.client.presenter.StepPresenter;
/**
@@ -24,61 +25,103 @@
private static final String VISIBLE = "visible";
private static final String INVISIBLE = "invisible";
- interface MyUiBinder extends UiBinder<Widget, StepView> {
- }
+ final private SimplePanel topPanel = new SimplePanel();
+ final private SimplePanel sidePanel = new SimplePanel();
+ final private SimplePanel leftColumnPanel = new SimplePanel();
+ final private SimplePanel centerPanel = new SimplePanel();
+ final private SimplePanel rightColumnPanel = new SimplePanel();
+ final private SimplePanel filterPanel = new SimplePanel();
+ final private LayoutPanel stepPanelLayout = new LayoutPanel();
- private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
+ final private static int SIDE_PANEL_LEFT = 0;
+ final private static int SIDE_PANEL_WIDTH = 80;
+ final private static int SCRIPTURE_PANEL_LEFT = SIDE_PANEL_LEFT + SIDE_PANEL_WIDTH;
+ final private static int FILTER_PANEL_LEFT = SIDE_PANEL_LEFT + SIDE_PANEL_WIDTH;
+ final private static int FILTER_PANEL_WIDTH = 700;
+ final private static int TOP_PANEL_TOP = 0;
+ final private static int TOP_PANEL_HEIGHT = 75;
+ final private static int COLUMN_TOP = TOP_PANEL_TOP + TOP_PANEL_HEIGHT;
+ final private static int COLUMN_BOTTOM = 10;
+ final private static int CENTER_PANEL_TOP = COLUMN_TOP + 10;
+ final private static int CENTER_PANEL_BOTTOM = COLUMN_BOTTOM + 10;
+ final private static int CENTER_PANEL_WIDTH = 80;
- @UiField
- SimplePanel topPanel;
- @UiField
- SimplePanel sidePanel;
- @UiField
- SimplePanel leftColumnPanel;
- @UiField
- SimplePanel centerBand;
- @UiField
- SimplePanel rightColumnPanel;
- @UiField
- SimplePanel filterPanel;
- @UiField
- LayoutPanel stepPanelLayout;
-
/**
* Main STEP entry view, sets up the layout in a pluggable and replaceable
* way
*/
public StepView() {
- initWidget(uiBinder.createAndBindUi(this));
+ addPanelsToLayout();
+ setInitialLayout();
+ initWidget(stepPanelLayout);
}
- public Widget asWidget() {
- return this;
+ private void addPanelsToLayout() {
+ // stepPanelLayout.add(topPanel);
+ stepPanelLayout.add(sidePanel);
+ // stepPanelLayout.add(leftScriptureSelectorPanel);
+ stepPanelLayout.add(leftColumnPanel);
+ stepPanelLayout.add(centerPanel);
+ // stepPanelLayout.add(rightScriptureSelectorPanel);
+ stepPanelLayout.add(rightColumnPanel);
+ stepPanelLayout.add(filterPanel);
+
+ // set z-indexes
+ final Style sidePanelStyle = stepPanelLayout.getWidgetContainerElement(sidePanel).getStyle();
+ sidePanelStyle.setZIndex(1000);
+ sidePanelStyle.setBackgroundColor("#BCD56D");
+
+ stepPanelLayout.getWidgetContainerElement(leftColumnPanel).getStyle().setZIndex(1000);
+ stepPanelLayout.getWidgetContainerElement(centerPanel).getStyle().setZIndex(1000);
+
+ final Style filterPanelStyle = stepPanelLayout.getWidgetContainerElement(filterPanel).getStyle();
+ filterPanelStyle.setZIndex(2000);
+ filterPanelStyle.setBackgroundColor("#BCD56D");
}
- public void setLeftColumn(final Widget w) {
+ private void setInitialLayout() {
+ stepPanelLayout.setWidgetLeftWidth(sidePanel, SIDE_PANEL_LEFT, Unit.PX, SIDE_PANEL_WIDTH, Unit.PX);
+ stepPanelLayout.setWidgetLeftWidth(filterPanel, FILTER_PANEL_LEFT, Unit.PX, FILTER_PANEL_WIDTH, Unit.PX);
+ stepPanelLayout.setWidgetTopBottom(leftColumnPanel, COLUMN_TOP, Unit.PX, COLUMN_BOTTOM, Unit.PX);
+ stepPanelLayout.setWidgetTopBottom(rightColumnPanel, COLUMN_TOP, Unit.PX, COLUMN_BOTTOM, Unit.PX);
+ stepPanelLayout.setWidgetTopBottom(centerPanel, CENTER_PANEL_TOP, Unit.PX, CENTER_PANEL_BOTTOM, Unit.PX);
+ }
+
+ public void setLeftColumn(final StepViewInterface w) {
replaceContents(leftColumnPanel, w);
}
- public void setFilterPanel(final Widget w) {
+ public void setFilterPanel(final StepViewInterface w) {
replaceContents(filterPanel, w);
}
- public void setRightColumn(final Widget w) {
+ public void setRightColumn(final StepViewInterface w) {
replaceContents(rightColumnPanel, w);
}
- public void setSideBar(final Widget w) {
+ public void setSideBar(final StepViewInterface w) {
replaceContents(sidePanel, w);
}
- public void setTop(final Widget w) {
+ public void setTop(final StepViewInterface w) {
replaceContents(topPanel, w);
}
- private void replaceContents(final Panel p, final Widget w) {
+ public void setCenterPanel(final StepViewInterface w) {
+ replaceContents(centerPanel, w);
+ }
+
+ public void setLeftScriptureSelectorPanel(final StepViewInterface w) {
+ // replaceContents(leftScriptureSelectorPanel, w);
+ }
+
+ public void setRightScriptureSelectorPanel(final StepViewInterface w) {
+ // replaceContents(rightScriptureSelectorPanel, w);
+ }
+
+ private void replaceContents(final Panel p, final StepViewInterface w) {
p.clear();
- p.add(w);
+ p.add(w.getContainerWidget());
}
public void startProcessing() {
@@ -94,16 +137,45 @@
@Override
protected void onLoad() {
super.onLoad();
+
+ // finally add listener for changes to layout
+ addLayoutChangeListeners();
+ }
+
+ /**
+ * repositions boxes around the screen to ensure they are always where they
+ * should be and visible
+ */
+ public void reLay() {
final int windowHeight = Window.getClientHeight();
final int windowWidth = Window.getClientWidth();
+ final int sidePanelHeight = sidePanel.getWidget().getOffsetHeight();
+ final int centerPanelLeft = (windowWidth - CENTER_PANEL_WIDTH + SIDE_PANEL_WIDTH) / 2;
- final int sidePanelHeight = sidePanel.getWidget().getOffsetHeight();
repositionVertically(sidePanel, windowHeight, sidePanelHeight);
repositionVertically(filterPanel, windowHeight, sidePanelHeight);
- repositionHorizontally(centerBand, windowWidth);
+
+ stepPanelLayout.setWidgetLeftWidth(centerPanel, centerPanelLeft, Unit.PX, CENTER_PANEL_WIDTH, Unit.PX);
+
+ stepPanelLayout.setWidgetLeftRight(leftColumnPanel, SIDE_PANEL_LEFT + SIDE_PANEL_WIDTH, Unit.PX,
+ centerPanelLeft + CENTER_PANEL_WIDTH - SIDE_PANEL_WIDTH, Unit.PX);
+
+ stepPanelLayout.setWidgetLeftRight(rightColumnPanel, centerPanelLeft + CENTER_PANEL_WIDTH, Unit.PX, 0, Unit.PX);
+
setFilterPanelVisible(false);
}
+ /**
+ * some changes that will cause to relayout
+ */
+ private void addLayoutChangeListeners() {
+ Window.addResizeHandler(new ResizeHandler() {
+ public void onResize(final ResizeEvent arg0) {
+ reLay();
+ }
+ });
+ }
+
private void repositionVertically(final SimplePanel childPanel, final int windowHeight, final int widgetHeight) {
final Widget childWidget = childPanel.getWidget();
if (childWidget != null) {
@@ -113,21 +185,16 @@
}
}
- private void repositionHorizontally(final SimplePanel childPanel, final int windowWidth) {
- final Widget childWidget = childPanel.getWidget();
- if (childWidget != null) {
- final int widgetWidth = childWidget.getOffsetWidth();
- final int newGap = (windowWidth - widgetWidth) / 2;
- stepPanelLayout.setWidgetLeftRight(childPanel, newGap, Unit.PX, newGap, Unit.PX);
- }
- }
-
/**
* sets the visibility of the side par
*/
public void setFilterPanelVisible(final boolean visible) {
final Element widgetContainerElement = stepPanelLayout.getWidgetContainerElement(filterPanel);
- widgetContainerElement.removeClassName(visible ? INVISIBLE : VISIBLE);
- widgetContainerElement.addClassName(visible ? VISIBLE : INVISIBLE);
+ widgetContainerElement.removeClassName(visible ? StepView.INVISIBLE : StepView.VISIBLE);
+ widgetContainerElement.addClassName(visible ? StepView.VISIBLE : StepView.INVISIBLE);
}
+
+ public Widget getContainerWidget() {
+ return this;
+ }
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/VersionSelectorView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/VersionSelectorView.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/VersionSelectorView.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,246 +0,0 @@
-package com.tyndalehouse.step.web.client.view;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-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.TextBox;
-import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeItem;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.inject.Singleton;
-import com.tyndalehouse.step.web.client.presenter.VersionSelectorPresenter;
-import com.tyndalehouse.step.web.client.view.internal.Area;
-import com.tyndalehouse.step.web.client.view.internal.Version;
-
- at Singleton
-public class VersionSelectorView extends Composite implements
- VersionSelectorPresenter.Display {
-
- interface MyUiBinder extends UiBinder<Widget, VersionSelectorView> {
- }
-
- private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
-
- @UiField
- TextBox bibleVersionSuggestion;
-
- @UiField
- Tree bibleVersions;
-
- public VersionSelectorView() {
- initWidget(uiBinder.createAndBindUi(this));
- addHandlersForFilterBox();
- addHandlersForTree();
- }
-
- /**
- * adds the default handlers for the filter box
- */
- private void addHandlersForFilterBox() {
- // add internal handlers
- bibleVersionSuggestion.addKeyUpHandler(new KeyUpHandler() {
- public void onKeyUp(KeyUpEvent keyUp) {
- refilterTree();
- }
- });
-
- bibleVersionSuggestion.addFocusHandler(new FocusHandler() {
- public void onFocus(FocusEvent focusEvent) {
- bibleVersions.setVisible(true);
- }
- });
- }
-
- /**
- * adds handlers for tree
- */
- private void addHandlersForTree() {
- bibleVersions.addSelectionHandler(new SelectionHandler<TreeItem>() {
- public void onSelection(SelectionEvent<TreeItem> selectionEvent) {
- if (selectionEvent.getSelectedItem().getChildCount() == 0) {
- // on selection we close the tree and set the selected version
- bibleVersionSuggestion.setText(bibleVersions.getSelectedItem().getText());
- bibleVersions.setVisible(false);
- }
- }
- });
- }
-
- /**
- * filters through the tree
- */
- protected void refilterTree() {
- for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
- filterTreeItem(bibleVersions.getItem(ii), bibleVersionSuggestion
- .getText().toLowerCase());
- }
-
- hideEmptyParents();
- }
-
- /**
- * Hide parents where there are no children
- */
- private void hideEmptyParents() {
- for(int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
- TreeItem parentLevelItem = bibleVersions.getItem(ii);
- //we ignore first level elements, only hide ones below for now
-
- for(int jj = 0; jj < parentLevelItem.getChildCount(); jj++) {
- TreeItem child = parentLevelItem.getChild(jj);
- if(!hasVisibleChildren(child)) {
- child.setVisible(false);
- } else {
- child.setVisible(true);
- }
- }
- }
- }
-
- /**
- * returns the number of visible children
- * @param node to be evaluated for number of visible children
- * @return
- */
- private boolean hasVisibleChildren(final TreeItem node) {
- if(node.getChildCount() == 0) {
- return false;
- }
- for(int ii = 0; ii < node.getChildCount(); ii++) {
- //first work out whether
-
-
- if(node.getChild(ii).isVisible()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * filters tree items and their children
- *
- * @param item
- * item to be filtered
- * @param text
- * the text currently in the box
- */
- private void filterTreeItem(final TreeItem item, final String text) {
- // check for leaf node
- if (item.getChildCount() == 0) {
- // then filter
- //Area node = (Area) item.getUserObject();
- Object o = item.getUserObject();
- if (item.getText().toLowerCase().startsWith(text)
- || (o instanceof Version && ((Version) o).getInitials().toLowerCase().startsWith(text) )) {
- item.setVisible(true);
- item.setState(true);
- item.getParentItem().setState(true);
- item.getParentItem().getParentItem().setState(true);
- } else {
- item.setVisible(false);
- }
- } else {
- for (int ii = 0; ii < item.getChildCount(); ii++) {
- filterTreeItem(item.getChild(ii), text);
- }
- }
- }
-
- /**
- * TODO: do work off the DOM for performance? adds a version to the tree...
- */
- public void addVersion(final String area, String language,
- final String versionInitials, final String versionName) {
- // look for area first
- for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
- TreeItem item = bibleVersions.getItem(ii);
- if (item.getText().equals(area)) {
- // now get the language
- createLanguageVersionTreeSection(language, versionInitials,
- versionName, item);
- return;
- }
- }
-
- // create the whole area field
- Area areaParent = new Area(area);
- TreeItem areaItem = new TreeItem(area);
- areaItem.setUserObject(areaParent);
- bibleVersions.addItem(areaItem);
-
- createLanguageVersionTreeSection(language, versionInitials,
- versionName, areaItem);
- }
-
- /**
- * creates the language and version node in the tree
- *
- * @param language
- * language to be added to the tree
- * @param versionInitials
- * initials of the bible versions
- * @param versionName
- * version name as in jsword
- * @param item
- * parent item
- */
- private void createLanguageVersionTreeSection(String language,
- final String versionInitials, final String versionName,
- TreeItem item) {
- TreeItem languageParent = findItem(item, language);
- TreeItem version = new TreeItem(versionName);
- version.setUserObject(new Version(versionInitials, language));
- languageParent.addItem(version);
- }
-
- private TreeItem findItem(final TreeItem parent, final String language) {
- for (int ii = 0; ii < parent.getChildCount(); ii++) {
- TreeItem child = parent.getChild(ii);
- Area area = (Area) child.getUserObject();
- if (area.getName().equals(language)) {
- return child;
- }
- }
-
- final TreeItem newChild = new TreeItem(language);
- newChild.setUserObject(new Area(language));
- parent.addItem(newChild);
- return newChild;
- }
-
-
-// /**
-// *
-// * @param handler handler to be added
-// */
-// public void addVersionChangeHandler(final SelectionHandler<VersionChangeEvent> handler) {
-// bibleVersions.addSelectionHandler(new SelectionHandler<TreeItem>() {
-// public void onSelection(SelectionEvent<TreeItem> selectedItem) {
-// Area area = (Area) selectedItem.getSelectedItem().getUserObject();
-// if(area instanceof Version) {
-//
-// handler.onSelection(new VersionChangeEvent((Version) area));
-// }
-// }
-// });
-// }
-
- public Widget getWidget() {
- return this;
- }
-
- public void startProcessing() {
- }
-
- public void stopProcessing() {
- }
-
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasSelectionHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasSelectionHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasSelectionHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -4,5 +4,5 @@
import com.extjs.gxt.ui.client.event.SelectionListener;
public interface HasSelectionHandler {
- void addSelectionListener(SelectionListener<ButtonEvent> be);
+ void addSelectionListener(SelectionListener<ButtonEvent> be);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -4,12 +4,14 @@
public class StepSplitButton extends SplitButton implements HasSelectionHandler {
- /**
- * calling the parent
- * @param label label to be put on the button
- */
- public StepSplitButton(String label) {
- super(label);
- }
-
+ /**
+ * calling the parent
+ *
+ * @param label
+ * label to be put on the button
+ */
+ public StepSplitButton(final String label) {
+ super(label);
+ }
+
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Area.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Area.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Area.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,16 +1,15 @@
package com.tyndalehouse.step.web.client.view.internal;
public class Area {
- private static final long serialVersionUID = -6102955370495012585L;
- private final String name;
+ private static final long serialVersionUID = -6102955370495012585L;
+ private final String name;
- public Area(final String name) {
- this.name = name;
- }
+ public Area(final String name) {
+ this.name = name;
+ }
- public String getName() {
- return name;
- }
-
-
+ public String getName() {
+ return name;
+ }
+
}
\ No newline at end of file
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Version.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Version.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/internal/Version.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,22 +1,21 @@
package com.tyndalehouse.step.web.client.view.internal;
-
public class Version extends Area {
- private static final long serialVersionUID = 4553661659473647985L;
- private String initials;
+ private static final long serialVersionUID = 4553661659473647985L;
+ private final String initials;
- /**
- * create a bible version
- * @param initials
- * @param versionName
- */
- public Version(final String initials, final String versionName) {
- super(versionName);
- this.initials = initials;
- }
+ /**
+ * create a bible version
+ *
+ * @param initials
+ * @param versionName
+ */
+ public Version(final String initials, final String versionName) {
+ super(versionName);
+ this.initials = initials;
+ }
- public String getInitials() {
- return initials;
- }
+ public String getInitials() {
+ return initials;
+ }
}
-
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/css/step.css 2010-06-19 17:36:35 UTC (rev 136)
@@ -6,11 +6,24 @@
display: none;
}
+.prompt {
+ color: lightgrey;
+}
.bibleVersionsDropDown {
width: 250px;
}
+.stepPanelBackground {
+ background-color: #BCD56D;
+ border: black solid 1px;
+}
+
+.lightPanelBackground {
+ background-color: #CCFFCC;
+}
+
+
.scripture-interlinear {
display: inline;
float: left;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/AbstractStepHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,32 +13,33 @@
*
* @author CJBurrell
*
- * @param <A> the action in question
- * @param <R> the response to be sent back to the client
+ * @param <A>
+ * the action in question
+ * @param <R>
+ * the response to be sent back to the client
*/
-public abstract class AbstractStepHandler<A extends Action<R>, R extends Result> implements
- ActionHandler<A, R> {
+public abstract class AbstractStepHandler<A extends Action<R>, R extends Result> implements ActionHandler<A, R> {
- /**
- * Logger for a particular instance of a handler
- */
- private final Logger logger = Logger.getLogger(this.getClass());
+ /**
+ * Logger for a particular instance of a handler
+ */
+ private final Logger logger = Logger.getLogger(this.getClass());
- @SuppressWarnings("unchecked")
- /*
- * returns the type of the action
- *
- * @return the type of the action
- */
- public final Class<A> getActionType() {
- final ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass();
- return (Class<A>) pt.getActualTypeArguments()[0];
- }
+ @SuppressWarnings("unchecked")
+ /*
+ * returns the type of the action
+ *
+ * @return the type of the action
+ */
+ public final Class<A> getActionType() {
+ final ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass();
+ return (Class<A>) pt.getActualTypeArguments()[0];
+ }
- /**
- * @return the logger
- */
- protected final Logger getLogger() {
- return logger;
- }
+ /**
+ * @return the logger
+ */
+ protected final Logger getLogger() {
+ return logger;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigNotLoadedException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigNotLoadedException.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigNotLoadedException.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,20 +9,20 @@
*/
public class ConfigNotLoadedException extends Exception {
- /**
- * serial id for serialization
- */
- private static final long serialVersionUID = 1644291687028980017L;
+ /**
+ * serial id for serialization
+ */
+ private static final long serialVersionUID = 1644291687028980017L;
- /**
- * public constructor an exceptoin to indicate that the configuration
- * properties have not been loaded
- *
- * @param e
- * the base exception
- */
- public ConfigNotLoadedException(final Exception e) {
- super("The configuration files could not be loaded", e);
- }
+ /**
+ * public constructor an exceptoin to indicate that the configuration
+ * properties have not been loaded
+ *
+ * @param e
+ * the base exception
+ */
+ public ConfigNotLoadedException(final Exception e) {
+ super("The configuration files could not be loaded", e);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigProvider.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigProvider.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/ConfigProvider.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -5,81 +5,95 @@
import java.util.Properties;
/**
- * Config Provider for Step.
- * TODO: Possibly should be rewritten to have a Guice element to it, with @Singleton tag
+ * Config Provider for Step. TODO: Possibly should be rewritten to have a Guice
+ * element to it, with @Singleton tag
+ *
* @author CJBurrell
- *
+ *
*/
public final class ConfigProvider {
- /**
- * internal static provider
- */
- private static ConfigProvider pr;
-
- /**
- * Internal properties object
- */
- private Properties p = new Properties();
+ /**
+ * internal static provider
+ */
+ private static ConfigProvider pr;
- /**
- * private constructor to prevent initialisation.
- * @throws ConfigNotLoadedException exception should it fail to look up the parameter name
- */
- private ConfigProvider() throws ConfigNotLoadedException {
- load();
- }
+ /**
+ * Internal properties object
+ */
+ private final Properties p = new Properties();
- /**
- * Loads or reloads a properties file from the classpath.
- * TODO: investigate issue with concurrency here, since we might access p before it's fully loaded...
- * @throws ConfigNotLoadedException exception should it fail to look up the parameter name
- */
- public void load() throws ConfigNotLoadedException {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- URL url = loader.getResource("com/tyndalehouse/step/web/server/config/environment.properties");
- try {
- p.load(url.openStream());
- } catch (IOException e) {
- throw new ConfigNotLoadedException(e);
- }
- }
+ /**
+ * private constructor to prevent initialisation.
+ *
+ * @throws ConfigNotLoadedException
+ * exception should it fail to look up the parameter name
+ */
+ private ConfigProvider() throws ConfigNotLoadedException {
+ load();
+ }
- /**
- * Gets the value of a param.
- * @param name the name of the param
- * @return the value of the param
- * @throws ConfigNotLoadedException A problem occured during loading of the config
- */
- public synchronized static String get(final String name) throws ConfigNotLoadedException {
- if (pr == null) {
- pr = new ConfigProvider();
- }
-
- String value = System.getProperty(name);
- if(value == null) {
- value = pr.readProperty(name);
- }
-
- return value;
-
- }
+ /**
+ * Loads or reloads a properties file from the classpath. TODO: investigate
+ * issue with concurrency here, since we might access p before it's fully
+ * loaded...
+ *
+ * @throws ConfigNotLoadedException
+ * exception should it fail to look up the parameter name
+ */
+ public void load() throws ConfigNotLoadedException {
+ final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ final URL url = loader.getResource("com/tyndalehouse/step/web/server/config/environment.properties");
+ try {
+ p.load(url.openStream());
+ } catch (final IOException e) {
+ throw new ConfigNotLoadedException(e);
+ }
+ }
- /**
- * reads a property on the properties object.
- * @param name name of the property
- * @return the value
- */
- private String readProperty(final String name) {
- return p.getProperty(name);
- }
+ /**
+ * Gets the value of a param.
+ *
+ * @param name
+ * the name of the param
+ * @return the value of the param
+ * @throws ConfigNotLoadedException
+ * A problem occured during loading of the config
+ */
+ public synchronized static String get(final String name) throws ConfigNotLoadedException {
+ if (ConfigProvider.pr == null) {
+ ConfigProvider.pr = new ConfigProvider();
+ }
- /**
- * returns an integer corresponding to the name of the parameter.
- * @param paramName the name of the parameter
- * @return an integer value for paramName
- * @throws ConfigNotLoadedException exception should it fail to look up the parameter name
- */
- public static int getInt(final String paramName) throws ConfigNotLoadedException {
- return Integer.parseInt(get(paramName));
- }
+ String value = System.getProperty(name);
+ if (value == null) {
+ value = ConfigProvider.pr.readProperty(name);
+ }
+
+ return value;
+
+ }
+
+ /**
+ * reads a property on the properties object.
+ *
+ * @param name
+ * name of the property
+ * @return the value
+ */
+ private String readProperty(final String name) {
+ return p.getProperty(name);
+ }
+
+ /**
+ * returns an integer corresponding to the name of the parameter.
+ *
+ * @param paramName
+ * the name of the parameter
+ * @return an integer value for paramName
+ * @throws ConfigNotLoadedException
+ * exception should it fail to look up the parameter name
+ */
+ public static int getInt(final String paramName) throws ConfigNotLoadedException {
+ return Integer.parseInt(get(paramName));
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/JSwordConstants.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/JSwordConstants.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/common/JSwordConstants.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -2,49 +2,52 @@
/**
* Constants to map back to the correct JSword modules, index entries
+ *
* @author CJBurrell
- *
+ *
*/
public final class JSwordConstants {
- /**
- * the pattern with which strong references in OSIS start
- */
- public static final String STRONG_PATTERN_START = "strong:";
-
- /**
- * a greek marker for strong numbers, e.g. strong:Gxxxx
- */
- public static final char STRONG_GREEK_MARKER = 'G';
-
- /**
- * Strong hebrew marker, for e.g. strong:Hxxxx
- */
- public static final char STRONG_HEBREW_MARKER = 'H';
-
- /**
- * Initials of default Hebrew JSword module to use for lookup of dictionary definitions
- */
- public static final String STRONG_HEBREW_DICTIONARY_INITIALS = "StrongsHebrew";
-
- /**
- * Initials of default Strong JSword greek dictionary module for lookup of dictionary definitions
- */
- public static final String STRONG_GREEK_DICTIONARY_INITIALS = "StrongsGreek";
-
- /**
- * Default hebrew text for interlinear purposes
- */
- public static final String DEFAULT_HEBREW_INTERLINEAR_TEXT = "LXX";
+ /**
+ * the pattern with which strong references in OSIS start
+ */
+ public static final String STRONG_PATTERN_START = "strong:";
- //TODO:This gives us greek!
- /**
- * Default Greek text for interlinear purposes
- */
- public static final String DEFAULT_GREEK_INTERLINEAR_TEXT = "BYZ";
+ /**
+ * a greek marker for strong numbers, e.g. strong:Gxxxx
+ */
+ public static final char STRONG_GREEK_MARKER = 'G';
- /**
- * hiding default constructor
- */
- private JSwordConstants() {
- }
+ /**
+ * Strong hebrew marker, for e.g. strong:Hxxxx
+ */
+ public static final char STRONG_HEBREW_MARKER = 'H';
+
+ /**
+ * Initials of default Hebrew JSword module to use for lookup of dictionary
+ * definitions
+ */
+ public static final String STRONG_HEBREW_DICTIONARY_INITIALS = "StrongsHebrew";
+
+ /**
+ * Initials of default Strong JSword greek dictionary module for lookup of
+ * dictionary definitions
+ */
+ public static final String STRONG_GREEK_DICTIONARY_INITIALS = "StrongsGreek";
+
+ /**
+ * Default hebrew text for interlinear purposes
+ */
+ public static final String DEFAULT_HEBREW_INTERLINEAR_TEXT = "LXX";
+
+ // TODO:This gives us greek!
+ /**
+ * Default Greek text for interlinear purposes
+ */
+ public static final String DEFAULT_GREEK_INTERLINEAR_TEXT = "BYZ";
+
+ /**
+ * hiding default constructor
+ */
+ private JSwordConstants() {
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/MalformedStepQueryException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/MalformedStepQueryException.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/MalformedStepQueryException.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -2,38 +2,46 @@
/**
* Query to be thrown if the query file cannot be parsed by our framework.
+ *
* @author CJBurrell
- *
+ *
*/
public class MalformedStepQueryException extends Exception {
- /**
- * serial id
- */
- private static final long serialVersionUID = -3607780460262284122L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -3607780460262284122L;
- /**
- * to instantiate the exception when a particular parameter name is incorrect
- * @param paramName parameter name that is incorrect
- * @param sql sql in which parameter name was incorrect
- */
- public MalformedStepQueryException(final String paramName, final String sql) {
- super(String.format("The argument %s was not recognised in query:\n %s", paramName, sql));
- }
+ /**
+ * to instantiate the exception when a particular parameter name is
+ * incorrect
+ *
+ * @param paramName
+ * parameter name that is incorrect
+ * @param sql
+ * sql in which parameter name was incorrect
+ */
+ public MalformedStepQueryException(final String paramName, final String sql) {
+ super(String.format("The argument %s was not recognised in query:\n %s", paramName, sql));
+ }
- /**
- * @param message the message
- * @param ex base exception to be passed up to the super class
- */
- public MalformedStepQueryException(final String message, final Exception ex) {
- super(message, ex);
- }
+ /**
+ * @param message
+ * the message
+ * @param ex
+ * base exception to be passed up to the super class
+ */
+ public MalformedStepQueryException(final String message, final Exception ex) {
+ super(message, ex);
+ }
- /**
- *
- * @param message simple message to instantiate the default exception
- */
- public MalformedStepQueryException(final String message) {
- super(message);
- }
+ /**
+ *
+ * @param message
+ * simple message to instantiate the default exception
+ */
+ public MalformedStepQueryException(final String message) {
+ super(message);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/Query.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/Query.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/Query.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -2,19 +2,20 @@
/**
* The interface for any enum describing the queries to be run
+ *
* @author CJBurrell
- *
+ *
*/
public interface Query {
- /**
- * @return the component name
- */
- String getComponent();
+ /**
+ * @return the component name
+ */
+ String getComponent();
- /**
- * returns the name of the enum
- *
- * @return the name of the query
- */
- String name();
+ /**
+ * returns the name of the enum
+ *
+ * @return the name of the query
+ */
+ String name();
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/QueryImpl.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/QueryImpl.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/QueryImpl.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,44 +7,45 @@
*
*/
public enum QueryImpl implements Query {
- /**
- * gets events for a particular date range
- */
- GET_EVENTS_FOR_DATE_RANGE("timeline"),
+ /**
+ * gets events for a particular date range
+ */
+ GET_EVENTS_FOR_DATE_RANGE("timeline"),
- /**
- * gets timeline description data
- */
- GET_TIMELINE_SETUP_DATA("timeline"),
+ /**
+ * gets timeline description data
+ */
+ GET_TIMELINE_SETUP_DATA("timeline"),
- /**
- * looks up which is the closest event, and on which timeline a given
- * scripture passage is
- */
- LOOKUP_TIMELINE_ORIGIN("timeline");
+ /**
+ * looks up which is the closest event, and on which timeline a given
+ * scripture passage is
+ */
+ LOOKUP_TIMELINE_ORIGIN("timeline");
- /**
- * component (folder) in which the component can be found
- */
- private final String component;
+ /**
+ * component (folder) in which the component can be found
+ */
+ private final String component;
- /**
- * default constructor for this enum
- *
- * @param component component/folder where the query resides
- */
- QueryImpl(final String component) {
- this.component = component;
- }
+ /**
+ * default constructor for this enum
+ *
+ * @param component
+ * component/folder where the query resides
+ */
+ QueryImpl(final String component) {
+ this.component = component;
+ }
- /**
- * (non-Javadoc)
- *
- * @see com.tyndalehouse.step.web.server.db.framework.Query#getComponent()
- * @return component/folder where the query resides
- */
- public String getComponent() {
- return component;
- }
+ /**
+ * (non-Javadoc)
+ *
+ * @see com.tyndalehouse.step.web.server.db.framework.Query#getComponent()
+ * @return component/folder where the query resides
+ */
+ public String getComponent() {
+ return component;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/ResultSetProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/ResultSetProcessor.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/ResultSetProcessor.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,35 +9,39 @@
/**
* @author CJBurrell This is used by the query runner to process result sets
- * @param <T> the type of bean to be returned
+ * @param <T>
+ * the type of bean to be returned
*/
public interface ResultSetProcessor<T> {
- /**
- * returns the parameters. Typically this would only be called by the query
- * framework
- *
- * @return a map, mapping the parameter name to the object to be passed into
- * the query (generally native types or Strings)
- */
- Map<String, Object> getParameters();
+ /**
+ * returns the parameters. Typically this would only be called by the query
+ * framework
+ *
+ * @return a map, mapping the parameter name to the object to be passed into
+ * the query (generally native types or Strings)
+ */
+ Map<String, Object> getParameters();
- /**
- * Returns the enum defining which query should be executed.
- *
- * @return the query to be executed.
- */
- Query getQuery();
+ /**
+ * Returns the enum defining which query should be executed.
+ *
+ * @return the query to be executed.
+ */
+ Query getQuery();
- /**
- * This method will be called after a query has been run by the query
- * framework. It returns a list of beans to the caller
- *
- * @param rs ResultSet to be processed
- * @return a list of beans to the UI of type T
- * @throws MalformedStepQueryException the query run was malformed
- * @throws ConfigNotLoadedException an error occured during the loading of
- * the database config
- * @throws SQLException a SQL exception occurred
- */
- List<T> process(ResultSet rs) throws MalformedStepQueryException, ConfigNotLoadedException, SQLException;
+ /**
+ * This method will be called after a query has been run by the query
+ * framework. It returns a list of beans to the caller
+ *
+ * @param rs
+ * ResultSet to be processed
+ * @return a list of beans to the UI of type T
+ * @throws MalformedStepQueryException
+ * the query run was malformed
+ * @throws ConfigNotLoadedException
+ * an error occured during the loading of the database config
+ * @throws SQLException
+ * a SQL exception occurred
+ */
+ List<T> process(ResultSet rs) throws MalformedStepQueryException, ConfigNotLoadedException, SQLException;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQuery.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQuery.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQuery.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -17,142 +17,154 @@
*
*/
public class StepQuery {
- /**
- * list of expected arguments
- */
- private final List<String> arguments;
+ /**
+ * list of expected arguments
+ */
+ private final List<String> arguments;
- /**
- * the types of the expected parameters
- */
- private final Map<String, Integer> paramTypes;
+ /**
+ * the types of the expected parameters
+ */
+ private final Map<String, Integer> paramTypes;
- /**
- * the SQL statements
- */
- private String sql;
+ /**
+ * the SQL statements
+ */
+ private String sql;
- /**
- * public constructor which initialises the arguments and parameters.
- */
- public StepQuery() {
- arguments = new ArrayList<String>();
- paramTypes = new HashMap<String, Integer>();
- }
+ /**
+ * public constructor which initialises the arguments and parameters.
+ */
+ public StepQuery() {
+ arguments = new ArrayList<String>();
+ paramTypes = new HashMap<String, Integer>();
+ }
- /**
- * adding an argument as found in the query definition: e.g. <code>
+ /**
+ * adding an argument as found in the query definition: e.g. <code>
* select 1 from table where value = #paramName#
* </code>
- *
- * @param paramName param name to be added to the query definition
- *
- */
- public void addArgument(final String paramName) {
- arguments.add(paramName);
- }
+ *
+ * @param paramName
+ * param name to be added to the query definition
+ *
+ */
+ public void addArgument(final String paramName) {
+ arguments.add(paramName);
+ }
- /**
- * addings a mapping from the definitions at the top of the file
- *
- * @param paramName parameter name
- * @param type type of the parameter
- */
- public void addParamTypeMapping(final String paramName, final Integer type) {
- paramTypes.put(paramName, type);
- }
+ /**
+ * addings a mapping from the definitions at the top of the file
+ *
+ * @param paramName
+ * parameter name
+ * @param type
+ * type of the parameter
+ */
+ public void addParamTypeMapping(final String paramName, final Integer type) {
+ paramTypes.put(paramName, type);
+ }
- /**
- * returns the SQL that gets executed
- *
- * @return the SQL query
- */
- public String getSQLText() {
- return sql;
- }
+ /**
+ * returns the SQL that gets executed
+ *
+ * @return the SQL query
+ */
+ public String getSQLText() {
+ return sql;
+ }
- /**
- * Sets the sql for the step query to be run
- *
- * @param sql sql representing the query to be run
- */
- public void setSQLText(final String sql) {
- this.sql = sql;
- }
+ /**
+ * Sets the sql for the step query to be run
+ *
+ * @param sql
+ * sql representing the query to be run
+ */
+ public void setSQLText(final String sql) {
+ this.sql = sql;
+ }
- /**
- * Sets up the prepared statement arguments in the correct order.
- *
- * @param ps the prepared statement
- * @param passedArguments the map of named arguments
- * @throws SQLException this is thrown if the passed in arguments do not
- * match the expected parameters as loaded from disk
- *
- */
- public void setupParameters(final PreparedStatement ps, final Map<String, Object> passedArguments)
- throws SQLException {
- int argIndex = 1;
- for (final String argName : arguments) {
- setArgument(ps, paramTypes.get(argName), passedArguments.get(argName), argIndex++);
- }
- }
+ /**
+ * Sets up the prepared statement arguments in the correct order.
+ *
+ * @param ps
+ * the prepared statement
+ * @param passedArguments
+ * the map of named arguments
+ * @throws SQLException
+ * this is thrown if the passed in arguments do not match the
+ * expected parameters as loaded from disk
+ *
+ */
+ public void setupParameters(final PreparedStatement ps, final Map<String, Object> passedArguments)
+ throws SQLException {
+ int argIndex = 1;
+ for (final String argName : arguments) {
+ setArgument(ps, paramTypes.get(argName), passedArguments.get(argName), argIndex++);
+ }
+ }
- /**
- * Validates the query loaded, to ensure that the number of arguments found
- * in the query match the number of arguments found in the declarations
- *
- * @throws MalformedStepQueryException this is thrown if the validation
- * fails
- */
- public void validate() throws MalformedStepQueryException {
- for (final String arg : arguments) {
- if (!paramTypes.containsKey(arg)) {
- throw new MalformedStepQueryException(arg, sql);
- }
- }
+ /**
+ * Validates the query loaded, to ensure that the number of arguments found
+ * in the query match the number of arguments found in the declarations
+ *
+ * @throws MalformedStepQueryException
+ * this is thrown if the validation fails
+ */
+ public void validate() throws MalformedStepQueryException {
+ for (final String arg : arguments) {
+ if (!paramTypes.containsKey(arg)) {
+ throw new MalformedStepQueryException(arg, sql);
+ }
+ }
- // TODO: optimize by compiling prepared statement here!
- }
+ // TODO: optimize by compiling prepared statement here!
+ }
- /**
- * Sets up the parameter into the prepared statement
- *
- * @param ps prepared statement
- * @param sqlType the type of the parameter
- * @param value the value of the parameter
- * @param argIndex the position at which the parameter is to be placed in
- * the prepared statement
- * @throws SQLException an exception thrown in case something goes wrong
- */
- private void setArgument(final PreparedStatement ps, final int sqlType, final Object value,
- final int argIndex) throws SQLException {
- // check for null first
- if (value == null) {
- ps.setNull(argIndex, sqlType);
- return;
- }
+ /**
+ * Sets up the parameter into the prepared statement
+ *
+ * @param ps
+ * prepared statement
+ * @param sqlType
+ * the type of the parameter
+ * @param value
+ * the value of the parameter
+ * @param argIndex
+ * the position at which the parameter is to be placed in the
+ * prepared statement
+ * @throws SQLException
+ * an exception thrown in case something goes wrong
+ */
+ private void setArgument(final PreparedStatement ps, final int sqlType, final Object value, final int argIndex)
+ throws SQLException {
+ // check for null first
+ if (value == null) {
+ ps.setNull(argIndex, sqlType);
+ return;
+ }
- // at this stage, we do not need to worry about null variables
- switch (sqlType) {
- case Types.INTEGER:
- ps.setInt(argIndex, (Integer) value);
- break;
- case Types.VARCHAR:
- ps.setString(argIndex, (String) value);
- break;
- case Types.BIGINT:
- ps.setLong(argIndex, (Long) value);
- break;
- case Types.SMALLINT:
- ps.setShort(argIndex, (Short) value);
- break;
- case Types.LONGVARCHAR:
- ps.setString(argIndex, (String) value);
- break;
- default:
- throw new SQLException(String.format(
- "The STEP query framework does not yet support this type/value (%d, %s)", sqlType, value
- .toString()));
- }
- }
+ // at this stage, we do not need to worry about null variables
+ switch (sqlType) {
+ case Types.INTEGER:
+ ps.setInt(argIndex, (Integer) value);
+ break;
+ case Types.VARCHAR:
+ ps.setString(argIndex, (String) value);
+ break;
+ case Types.BIGINT:
+ ps.setLong(argIndex, (Long) value);
+ break;
+ case Types.SMALLINT:
+ ps.setShort(argIndex, (Short) value);
+ break;
+ case Types.LONGVARCHAR:
+ ps.setString(argIndex, (String) value);
+ break;
+ default:
+ throw new SQLException(String.format(
+ "The STEP query framework does not yet support this type/value (%d, %s)", sqlType, value
+ .toString()));
+ }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunner.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunner.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunner.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,25 +11,28 @@
*/
public interface StepQueryRunner {
- /**
- * Clears the cache of parsed queries that are currently in the query runner
- */
- void clearCache();
+ /**
+ * Clears the cache of parsed queries that are currently in the query runner
+ */
+ void clearCache();
- /**
- * Tears down the database pool and starts it up again
- */
- void restartDatasourcePool();
+ /**
+ * Tears down the database pool and starts it up again
+ */
+ void restartDatasourcePool();
- /**
- * To run a query in the database
- *
- * @param <T> Type of bean to be returned
- * @param processor Processor to be invoked: @see {@link ResultSetProcessor}
- * @return a list of beans of type T
- * @throws UnableToRunQueryException if the configuration was not loaded or
- * a sql exception during parsing or execution of the call
- */
- <T> List<T> run(final ResultSetProcessor<T> processor) throws UnableToRunQueryException;
+ /**
+ * To run a query in the database
+ *
+ * @param <T>
+ * Type of bean to be returned
+ * @param processor
+ * Processor to be invoked: @see {@link ResultSetProcessor}
+ * @return a list of beans of type T
+ * @throws UnableToRunQueryException
+ * if the configuration was not loaded or a sql exception during
+ * parsing or execution of the call
+ */
+ <T> List<T> run(final ResultSetProcessor<T> processor) throws UnableToRunQueryException;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunnerImpl.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunnerImpl.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/StepQueryRunnerImpl.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -34,323 +34,330 @@
*/
@Singleton
public class StepQueryRunnerImpl implements StepQueryRunner {
- /**
- * query to indicate whether to cache prepared statements. Currently doesn't
- * work well with Apache Derby
- */
- private static final Object CACHE_QUERY_PROPERTY = "query.runner.cache";
+ /**
+ * query to indicate whether to cache prepared statements. Currently doesn't
+ * work well with Apache Derby
+ */
+ private static final Object CACHE_QUERY_PROPERTY = "query.runner.cache";
- /**
- * Datasource object which gets loaded through a conection pool
- */
- private static DataSource datasource = null;
+ /**
+ * Datasource object which gets loaded through a conection pool
+ */
+ private static DataSource datasource = null;
- /**
- * pattern definition of a declaration of argument at the top of a SQL file
- */
- private static final String DEFINITION_PATTERN = "define (\\w+) as (\\w+)";
+ /**
+ * pattern definition of a declaration of argument at the top of a SQL file
+ */
+ private static final String DEFINITION_PATTERN = "define (\\w+) as (\\w+)";
- /**
- * the HASH character
- */
- private static final String HASH = "#";
+ /**
+ * the HASH character
+ */
+ private static final String HASH = "#";
- /**
- * the hashmap containing the cache of all queries
- */
- private static HashMap<Query, StepQuery> queries = new HashMap<Query, StepQuery>();
+ /**
+ * the hashmap containing the cache of all queries
+ */
+ private static HashMap<Query, StepQuery> queries = new HashMap<Query, StepQuery>();
- /**
- * the ?, QUESTION MARK character
- */
- private static final String QUESTION_MARK = "?";
+ /**
+ * the ?, QUESTION MARK character
+ */
+ private static final String QUESTION_MARK = "?";
- /**
- * a pointer to the Log4J log
- */
- private final Log log;
+ /**
+ * a pointer to the Log4J log
+ */
+ private final Log log;
- /**
- * prevent instantiation
- *
- * @param log default logger to use throughout implementation
- */
- @Inject
- public StepQueryRunnerImpl(final Log log) {
- this.log = log;
- }
+ /**
+ * prevent instantiation
+ *
+ * @param log
+ * default logger to use throughout implementation
+ */
+ @Inject
+ public StepQueryRunnerImpl(final Log log) {
+ this.log = log;
+ }
- public void clearCache() {
- queries.clear();
- }
+ public void clearCache() {
+ StepQueryRunnerImpl.queries.clear();
+ }
- public void restartDatasourcePool() {
- // TODO: feature is to kill off all connections, and reload it.
+ public void restartDatasourcePool() {
+ // TODO: feature is to kill off all connections, and reload it.
- }
+ }
- /**
- * returns a list of beans of type T
- *
- * @param processor processor to be used
- * @param <T> the type of the bean to be returned
- * @return list of beans of type T
- * @throws UnableToRunQueryException unable to run the query for various
- * reasons
- * @see com.tyndalehouse.step.web.server.db.StepQueryRunner#run(com.tyndalehouse
- * .step.web.server.db.ResultSetProcessor)
- */
- public <T> List<T> run(final ResultSetProcessor<T> processor) throws UnableToRunQueryException {
- ResultSet rs;
- Connection connection = null;
- PreparedStatement ps = null;
+ /**
+ * returns a list of beans of type T
+ *
+ * @param processor
+ * processor to be used
+ * @param <T>
+ * the type of the bean to be returned
+ * @return list of beans of type T
+ * @throws UnableToRunQueryException
+ * unable to run the query for various reasons
+ * @see com.tyndalehouse.step.web.server.db.StepQueryRunner#run(com.tyndalehouse
+ * .step.web.server.db.ResultSetProcessor)
+ */
+ public <T> List<T> run(final ResultSetProcessor<T> processor) throws UnableToRunQueryException {
+ ResultSet rs;
+ Connection connection = null;
+ PreparedStatement ps = null;
- // check for null
- if (processor == null) {
- log.error("The passed in ResultSetProcessor was null.");
- throw new UnableToRunQueryException(new NullPointerException());
- }
+ // check for null
+ if (processor == null) {
+ log.error("The passed in ResultSetProcessor was null.");
+ throw new UnableToRunQueryException(new NullPointerException());
+ }
- final long tInit = System.currentTimeMillis();
- StepQuery stepQuery = null;
- try {
- stepQuery = prepareStepQuery(processor.getQuery());
+ final long tInit = System.currentTimeMillis();
+ StepQuery stepQuery = null;
+ try {
+ stepQuery = prepareStepQuery(processor.getQuery());
- final long tAfterLoad = System.currentTimeMillis();
- connection = datasource.getConnection();
- ps = connection.prepareStatement(stepQuery.getSQLText());
+ final long tAfterLoad = System.currentTimeMillis();
+ connection = StepQueryRunnerImpl.datasource.getConnection();
+ ps = connection.prepareStatement(stepQuery.getSQLText());
- final long tAfterParse = System.currentTimeMillis();
- stepQuery.setupParameters(ps, processor.getParameters());
+ final long tAfterParse = System.currentTimeMillis();
+ stepQuery.setupParameters(ps, processor.getParameters());
- logStepQuery(processor, stepQuery);
- final long tAfterLog = System.currentTimeMillis();
+ logStepQuery(processor, stepQuery);
+ final long tAfterLog = System.currentTimeMillis();
- // TODO: not returning anything!
- rs = ps.executeQuery();
- final long tAfterExecute = System.currentTimeMillis();
+ // TODO: not returning anything!
+ rs = ps.executeQuery();
+ final long tAfterExecute = System.currentTimeMillis();
- final List<T> results = processor.process(rs);
- final long tAfterParseResults = System.currentTimeMillis();
+ final List<T> results = processor.process(rs);
+ final long tAfterParseResults = System.currentTimeMillis();
- if (log.isInfoEnabled()) {
- log.info(String.format("StepQueryRunner (load, parse, execute, return) = (%d, %d, %d, %d)",
- tAfterLoad - tInit, tAfterParse - tAfterLoad, tAfterExecute - tAfterLog,
- tAfterParseResults - tAfterExecute));
- }
+ if (log.isInfoEnabled()) {
+ log.info(String.format("StepQueryRunner (load, parse, execute, return) = (%d, %d, %d, %d)", tAfterLoad
+ - tInit, tAfterParse - tAfterLoad, tAfterExecute - tAfterLog, tAfterParseResults
+ - tAfterExecute));
+ }
- return results;
- } catch (final ConfigNotLoadedException e) {
- log.error("Unable to load the configuration file to set up datasource.");
- throw new UnableToRunQueryException(e, stepQuery);
- } catch (final MalformedStepQueryException e) {
- log.error("An exception occured during the execution of the sql query");
- throw new UnableToRunQueryException(e, stepQuery);
- } catch (final SQLException e) {
- log.error("An exception occured file trying to locate the file.");
- throw new UnableToRunQueryException(e, stepQuery);
- } finally {
- // close the statement
- if (ps != null) {
- try {
- ps.close();
- } catch (final SQLException exception) {
- log.error("Error finalising connection", exception);
- }
- }
+ return results;
+ } catch (final ConfigNotLoadedException e) {
+ log.error("Unable to load the configuration file to set up datasource.");
+ throw new UnableToRunQueryException(e, stepQuery);
+ } catch (final MalformedStepQueryException e) {
+ log.error("An exception occured during the execution of the sql query");
+ throw new UnableToRunQueryException(e, stepQuery);
+ } catch (final SQLException e) {
+ log.error("An exception occured file trying to locate the file.");
+ throw new UnableToRunQueryException(e, stepQuery);
+ } finally {
+ // close the statement
+ if (ps != null) {
+ try {
+ ps.close();
+ } catch (final SQLException exception) {
+ log.error("Error finalising connection", exception);
+ }
+ }
- // close the connection
- if (connection != null) {
- try {
- connection.close();
- } catch (final SQLException exception) {
- log.error("Error finalising connection", exception);
- }
- }
- }
- }
+ // close the connection
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (final SQLException exception) {
+ log.error("Error finalising connection", exception);
+ }
+ }
+ }
+ }
- /**
- * if logging is enabled at trace level, then the query is output, with all
- * its parameters
- *
- * @param processor processor to process results of the query, which
- * contains the parameters
- * @param stepQuery the query to be logged
- */
- private void logStepQuery(final ResultSetProcessor<?> processor, final StepQuery stepQuery) {
- if (log.isTraceEnabled()) {
- final StringBuffer logOutput = new StringBuffer();
- logOutput.append("Query is: ");
- logOutput.append(stepQuery.getSQLText());
+ /**
+ * if logging is enabled at trace level, then the query is output, with all
+ * its parameters
+ *
+ * @param processor
+ * processor to process results of the query, which contains the
+ * parameters
+ * @param stepQuery
+ * the query to be logged
+ */
+ private void logStepQuery(final ResultSetProcessor<?> processor, final StepQuery stepQuery) {
+ if (log.isTraceEnabled()) {
+ final StringBuffer logOutput = new StringBuffer();
+ logOutput.append("Query is: ");
+ logOutput.append(stepQuery.getSQLText());
- for (final String paramName : processor.getParameters().keySet()) {
- logOutput.append(' ');
- logOutput.append(paramName);
- logOutput.append('=');
- logOutput.append(processor.getParameters().get(paramName));
- logOutput.append(", ");
- }
- log.trace(logOutput.toString());
- }
- }
+ for (final String paramName : processor.getParameters().keySet()) {
+ logOutput.append(' ');
+ logOutput.append(paramName);
+ logOutput.append('=');
+ logOutput.append(processor.getParameters().get(paramName));
+ logOutput.append(", ");
+ }
+ log.trace(logOutput.toString());
+ }
+ }
- /**
- * Faster than a regexp, so use this , in which we expect that there are
- * arguments to be parsed These would be defined as #query-param# within the
- * sql text. The function works by looking for a open and then a closed #
- * Unfortunately, it is not perfect and will have TODO; be rewritten to
- * ensure that the programmer can use the charact # in his query
- *
- * @param q is the query
- * @return a object of type {@link StepQuery}
- */
- private StepQuery parseArguments(final StringBuffer q) {
- final StepQuery query = new StepQuery();
+ /**
+ * Faster than a regexp, so use this , in which we expect that there are
+ * arguments to be parsed These would be defined as #query-param# within the
+ * sql text. The function works by looking for a open and then a closed #
+ * Unfortunately, it is not perfect and will have TODO; be rewritten to
+ * ensure that the programmer can use the charact # in his query
+ *
+ * @param q
+ * is the query
+ * @return a object of type {@link StepQuery}
+ */
+ private StepQuery parseArguments(final StringBuffer q) {
+ final StepQuery query = new StepQuery();
- int openingHash = 0;
- while ((openingHash = q.indexOf(HASH)) != -1) {
- final int endingHash = q.indexOf(HASH, openingHash + 1);
- final String paramName = q.substring(openingHash + 1, endingHash);
- query.addArgument(paramName);
- q.replace(openingHash, endingHash + 1, QUESTION_MARK);
- }
+ int openingHash = 0;
+ while ((openingHash = q.indexOf(StepQueryRunnerImpl.HASH)) != -1) {
+ final int endingHash = q.indexOf(StepQueryRunnerImpl.HASH, openingHash + 1);
+ final String paramName = q.substring(openingHash + 1, endingHash);
+ query.addArgument(paramName);
+ q.replace(openingHash, endingHash + 1, StepQueryRunnerImpl.QUESTION_MARK);
+ }
- return query;
- }
+ return query;
+ }
- /**
- * Look for all lines containing the pattern define variable_name as type
- * Then removes those into a map before continuing
- *
- * @param queryText sql text as loaded from disk
- * @param q query text to look through
- * @return a object of type {@link StepQuery}
- * @throws MalformedStepQueryException an exception is thrown to indicate an
- */
- private StepQuery parseDefinitions(final StringBuffer queryText, final StepQuery q)
- throws MalformedStepQueryException {
- // all sql files with parameters will have definitions for their
- // parameters at the top.
- final Pattern p = Pattern.compile(DEFINITION_PATTERN);
- final Matcher m = p.matcher(queryText);
+ /**
+ * Look for all lines containing the pattern define variable_name as type
+ * Then removes those into a map before continuing
+ *
+ * @param queryText
+ * sql text as loaded from disk
+ * @param q
+ * query text to look through
+ * @return a object of type {@link StepQuery}
+ * @throws MalformedStepQueryException
+ * an exception is thrown to indicate an
+ */
+ private StepQuery parseDefinitions(final StringBuffer queryText, final StepQuery q)
+ throws MalformedStepQueryException {
+ // all sql files with parameters will have definitions for their
+ // parameters at the top.
+ final Pattern p = Pattern.compile(StepQueryRunnerImpl.DEFINITION_PATTERN);
+ final Matcher m = p.matcher(queryText);
- // iterate through definitions that have been found
- while (m.find()) {
- final String paramName = m.group(1);
- final String paramType = m.group(2);
+ // iterate through definitions that have been found
+ while (m.find()) {
+ final String paramName = m.group(1);
+ final String paramType = m.group(2);
- try {
- final Integer type = Types.class.getField(paramType.toUpperCase()).getInt(null);
- q.addParamTypeMapping(paramName, type);
- } catch (final IllegalArgumentException e) {
- throw new MalformedStepQueryException(String.format("Could not parse argument type: %s",
- paramType), e);
- } catch (final SecurityException e) {
- throw new MalformedStepQueryException(String.format("Could not parse argument type: %s",
- paramType), e);
- } catch (final IllegalAccessException e) {
- throw new MalformedStepQueryException(String.format("Could not parse argument type: %s",
- paramType), e);
- } catch (final NoSuchFieldException e) {
- throw new MalformedStepQueryException(String.format("Could not parse argument type: %s",
- paramType), e);
- }
- }
+ try {
+ final Integer type = Types.class.getField(paramType.toUpperCase()).getInt(null);
+ q.addParamTypeMapping(paramName, type);
+ } catch (final IllegalArgumentException e) {
+ throw new MalformedStepQueryException(String.format("Could not parse argument type: %s", paramType), e);
+ } catch (final SecurityException e) {
+ throw new MalformedStepQueryException(String.format("Could not parse argument type: %s", paramType), e);
+ } catch (final IllegalAccessException e) {
+ throw new MalformedStepQueryException(String.format("Could not parse argument type: %s", paramType), e);
+ } catch (final NoSuchFieldException e) {
+ throw new MalformedStepQueryException(String.format("Could not parse argument type: %s", paramType), e);
+ }
+ }
- q.setSQLText(m.replaceAll(""));
- return q;
- }
+ q.setSQLText(m.replaceAll(""));
+ return q;
+ }
- /**
- * @param query query to be executed. If already cached, then this query is
- * returned otherwise, it is loaded from disk
- * @return a object of type {@link StepQuery}
- * @throws ConfigNotLoadedException if an issue occured during loading of
- * the configuration for STEP
- * @throws MalformedStepQueryException an exception is thrown to indicate an
- * issue with the sql file that could not be parsed
- */
- private StepQuery prepareStepQuery(final Query query) throws ConfigNotLoadedException,
- MalformedStepQueryException {
- StepQuery stepQuery = queries.get(query);
- // check whether query is in cache
- if (stepQuery == null) {
- stepQuery = readQueryFromFile(query);
- }
+ /**
+ * @param query
+ * query to be executed. If already cached, then this query is
+ * returned otherwise, it is loaded from disk
+ * @return a object of type {@link StepQuery}
+ * @throws ConfigNotLoadedException
+ * if an issue occured during loading of the configuration for
+ * STEP
+ * @throws MalformedStepQueryException
+ * an exception is thrown to indicate an issue with the sql file
+ * that could not be parsed
+ */
+ private StepQuery prepareStepQuery(final Query query) throws ConfigNotLoadedException, MalformedStepQueryException {
+ StepQuery stepQuery = StepQueryRunnerImpl.queries.get(query);
+ // check whether query is in cache
+ if (stepQuery == null) {
+ stepQuery = readQueryFromFile(query);
+ }
- // now check if datasource is null
- if (datasource == null) {
- datasource = setupDatasource();
- }
- return stepQuery;
- }
+ // now check if datasource is null
+ if (StepQueryRunnerImpl.datasource == null) {
+ StepQueryRunnerImpl.datasource = setupDatasource();
+ }
+ return stepQuery;
+ }
- /**
- * Reads a query from the file
- *
- * @param query query to be loaded
- * @return returns a loaded {@link StepQuery} object
- * @throws ConfigNotLoadedException failed to load the configuration
- * @throws MalformedStepQueryException thrown if arguments found don't match
- * a declaration
- */
- private StepQuery readQueryFromFile(final Query query) throws ConfigNotLoadedException,
- MalformedStepQueryException {
- // get base path from file
- final String basePath = ConfigProvider.get("query.repository.path");
- final String baseComponent = query.getComponent();
- final String filenameBase = query.name();
+ /**
+ * Reads a query from the file
+ *
+ * @param query
+ * query to be loaded
+ * @return returns a loaded {@link StepQuery} object
+ * @throws ConfigNotLoadedException
+ * failed to load the configuration
+ * @throws MalformedStepQueryException
+ * thrown if arguments found don't match a declaration
+ */
+ private StepQuery readQueryFromFile(final Query query) throws ConfigNotLoadedException, MalformedStepQueryException {
+ // get base path from file
+ final String basePath = ConfigProvider.get("query.repository.path");
+ final String baseComponent = query.getComponent();
+ final String filenameBase = query.name();
- // read query from file
- final ClassLoader loader = Thread.currentThread().getContextClassLoader();
- final String filename = String.format("%s%s/%s.sql", basePath, baseComponent, filenameBase
- .toLowerCase());
- final URL fileLocation = loader.getResource(filename);
- StepQuery stepQuery = null;
- StringBuffer q;
+ // read query from file
+ final ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ final String filename = String.format("%s%s/%s.sql", basePath, baseComponent, filenameBase.toLowerCase());
+ final URL fileLocation = loader.getResource(filename);
+ StepQuery stepQuery = null;
+ StringBuffer q;
- // check file location is non null:
- if (fileLocation == null) {
- throw new MalformedStepQueryException(String.format("The filename %s does not exist.", filename));
- }
+ // check file location is non null:
+ if (fileLocation == null) {
+ throw new MalformedStepQueryException(String.format("The filename %s does not exist.", filename));
+ }
- try {
- q = new StringBuffer(FileUtils.readFileToString(new File(fileLocation.getFile())));
- stepQuery = parseDefinitions(q, parseArguments(q));
- stepQuery.validate();
+ try {
+ q = new StringBuffer(FileUtils.readFileToString(new File(fileLocation.getFile())));
+ stepQuery = parseDefinitions(q, parseArguments(q));
+ stepQuery.validate();
- // check whether or not to cache the query:
- if (ConfigProvider.get("query.runner.cache").equals(CACHE_QUERY_PROPERTY)) {
- queries.put(query, stepQuery);
- }
- } catch (final IOException e) {
- throw new MalformedStepQueryException(
- String.format("Error reading query file: %s", filenameBase), e);
- }
+ // check whether or not to cache the query:
+ if (ConfigProvider.get("query.runner.cache").equals(StepQueryRunnerImpl.CACHE_QUERY_PROPERTY)) {
+ StepQueryRunnerImpl.queries.put(query, stepQuery);
+ }
+ } catch (final IOException e) {
+ throw new MalformedStepQueryException(String.format("Error reading query file: %s", filenameBase), e);
+ }
- return stepQuery;
- }
+ return stepQuery;
+ }
- /**
- * sets up the datasource from properties
- *
- * @return the datasource properly configured
- * @throws ConfigNotLoadedException throws if properties aren't found
- */
- private DataSource setupDatasource() throws ConfigNotLoadedException {
- final BasicDataSource ds = new BasicDataSource();
- ds.setDriverClassName(ConfigProvider.get("db.driver"));
- ds.setUsername(ConfigProvider.get("db.user"));
- ds.setPassword(ConfigProvider.get("db.password"));
- ds.setUrl(ConfigProvider.get("connection.string"));
- ds.setInitialSize(ConfigProvider.getInt("db.pool.initialSize"));
- ds.setMaxActive(ConfigProvider.getInt("db.pool.maxSize"));
- // ds.setValidationQuery(ConfigProvider.get("db.pool.validation.query"));
- // ds.setPoolPreparedStatements(true); //NOT Supported by java DB :(
- ds.setMaxOpenPreparedStatements(ConfigProvider.getInt("db.pool.prepared.size"));
- ds.setDefaultAutoCommit(false);
+ /**
+ * sets up the datasource from properties
+ *
+ * @return the datasource properly configured
+ * @throws ConfigNotLoadedException
+ * throws if properties aren't found
+ */
+ private DataSource setupDatasource() throws ConfigNotLoadedException {
+ final BasicDataSource ds = new BasicDataSource();
+ ds.setDriverClassName(ConfigProvider.get("db.driver"));
+ ds.setUsername(ConfigProvider.get("db.user"));
+ ds.setPassword(ConfigProvider.get("db.password"));
+ ds.setUrl(ConfigProvider.get("connection.string"));
+ ds.setInitialSize(ConfigProvider.getInt("db.pool.initialSize"));
+ ds.setMaxActive(ConfigProvider.getInt("db.pool.maxSize"));
+ // ds.setValidationQuery(ConfigProvider.get("db.pool.validation.query"));
+ // ds.setPoolPreparedStatements(true); //NOT Supported by java DB :(
+ ds.setMaxOpenPreparedStatements(ConfigProvider.getInt("db.pool.prepared.size"));
+ ds.setDefaultAutoCommit(false);
- return ds;
- }
+ return ds;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/framework/UnableToRunQueryException.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,49 +8,53 @@
*/
public class UnableToRunQueryException extends Exception {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -7810594097160119720L;
+ private static final long serialVersionUID = -7810594097160119720L;
- /**
- * The StepQuery at the origin of the exception
- */
- private StepQuery stepQuery;
+ /**
+ * The StepQuery at the origin of the exception
+ */
+ private StepQuery stepQuery;
- /**
- * Pass in the root cause of the exception
- *
- * @param e the root exception
- */
- public UnableToRunQueryException(final Exception e) {
- super(e);
- }
+ /**
+ * Pass in the root cause of the exception
+ *
+ * @param e
+ * the root exception
+ */
+ public UnableToRunQueryException(final Exception e) {
+ super(e);
+ }
- /**
- * Unable to run a query exception, with the stepQuery itself, and the root
- * exception
- *
- * @param e the exception to be wrapped
- * @param stepQuery a step query that was attempted to be executed
- */
- public UnableToRunQueryException(final Exception e, final StepQuery stepQuery) {
- this(e);
- this.stepQuery = stepQuery;
- }
+ /**
+ * Unable to run a query exception, with the stepQuery itself, and the root
+ * exception
+ *
+ * @param e
+ * the exception to be wrapped
+ * @param stepQuery
+ * a step query that was attempted to be executed
+ */
+ public UnableToRunQueryException(final Exception e, final StepQuery stepQuery) {
+ this(e);
+ this.stepQuery = stepQuery;
+ }
- /**
- * @return the stepQuery
- */
- public final StepQuery getStepQuery() {
- return stepQuery;
- }
+ /**
+ * @return the stepQuery
+ */
+ public final StepQuery getStepQuery() {
+ return stepQuery;
+ }
- /**
- * @param stepQuery the stepQuery to set
- */
- public final void setStepQuery(final StepQuery stepQuery) {
- this.stepQuery = stepQuery;
- }
+ /**
+ * @param stepQuery
+ * the stepQuery to set
+ */
+ public final void setStepQuery(final StepQuery stepQuery) {
+ this.stepQuery = stepQuery;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimeBandVisibleDateProcessor.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,119 +16,130 @@
/**
* Processes a list of timebands from the database
+ *
* @author CJBurrell cjburrell
- *
+ *
*/
public class TimeBandVisibleDateProcessor implements ResultSetProcessor<TimelineEventBean> {
- /**
- * event type id
- */
- private static final String EVENT_TYPE_ID = "event_type_id";
- /**
- * certainty
- */
- private static final String CERTAINTY = "certainty";
- /**
- * importance if
- */
- private static final String IMPORTANCE_ID = "importance_id";
- /**
- * timeband id
- */
- private static final String TIMEBAND_ID = "timeband_id";
- /**
- * name
- */
- private static final String NAME = "name";
- /**
- * to precision
- */
- private static final String TO_PRECISION = "to_precision";
- /**
- * from precision
- */
- private static final String FROM_PRECISION = "from_precision";
- /**
- * to date
- */
- private static final String TO_DATE = "to_date";
- /**
- * from date
- */
- private static final String FROM_DATE = "from_date";
- /**
- * event id
- */
- private static final String EVENT_ID = "event_id";
- /**
- * min date
- */
- private static final String MIN_DATE = "min_date";
- /**
- * max date
- */
- private static final String MAX_DATE = "max_date";
- /**
- * params to be passed in to the query
- */
- private Map<String, Object> params;
+ /**
+ * event type id
+ */
+ private static final String EVENT_TYPE_ID = "event_type_id";
+ /**
+ * certainty
+ */
+ private static final String CERTAINTY = "certainty";
+ /**
+ * importance if
+ */
+ private static final String IMPORTANCE_ID = "importance_id";
+ /**
+ * timeband id
+ */
+ private static final String TIMEBAND_ID = "timeband_id";
+ /**
+ * name
+ */
+ private static final String NAME = "name";
+ /**
+ * to precision
+ */
+ private static final String TO_PRECISION = "to_precision";
+ /**
+ * from precision
+ */
+ private static final String FROM_PRECISION = "from_precision";
+ /**
+ * to date
+ */
+ private static final String TO_DATE = "to_date";
+ /**
+ * from date
+ */
+ private static final String FROM_DATE = "from_date";
+ /**
+ * event id
+ */
+ private static final String EVENT_ID = "event_id";
+ /**
+ * min date
+ */
+ private static final String MIN_DATE = "min_date";
+ /**
+ * max date
+ */
+ private static final String MAX_DATE = "max_date";
+ /**
+ * params to be passed in to the query
+ */
+ private final Map<String, Object> params;
- /**
- * public constructor to create the processor with default parameters
- * @param minDate min date to be passed to the query
- * @param maxDate max date to be passed to the query
- * @param timebandId the timeband id to be looked up
- */
- public TimeBandVisibleDateProcessor(final long minDate, final long maxDate, final int timebandId) {
- params = new HashMap<String, Object>();
- params.put(MIN_DATE, minDate);
- params.put(MAX_DATE, maxDate);
- params.put(TIMEBAND_ID, timebandId);
- }
+ /**
+ * public constructor to create the processor with default parameters
+ *
+ * @param minDate
+ * min date to be passed to the query
+ * @param maxDate
+ * max date to be passed to the query
+ * @param timebandId
+ * the timeband id to be looked up
+ */
+ public TimeBandVisibleDateProcessor(final long minDate, final long maxDate, final int timebandId) {
+ params = new HashMap<String, Object>();
+ params.put(TimeBandVisibleDateProcessor.MIN_DATE, minDate);
+ params.put(TimeBandVisibleDateProcessor.MAX_DATE, maxDate);
+ params.put(TimeBandVisibleDateProcessor.TIMEBAND_ID, timebandId);
+ }
+ /**
+ * @see {@link ResultSetProcessor}
+ * @return the map of parameters
+ */
+ public final Map<String, Object> getParameters() {
+ return params;
+ }
- /**
- * @see {@link ResultSetProcessor}
- * @return the map of parameters
- */
- public final Map<String, Object> getParameters() {
- return params;
- }
+ /**
+ * @see {@link ResultSetProcessor}
+ * @return the query to be executed
+ */
+ public final Query getQuery() {
+ return QueryImpl.GET_EVENTS_FOR_DATE_RANGE;
+ }
-
- /**
- * @see {@link ResultSetProcessor}
- * @return the query to be executed
- */
- public final Query getQuery() {
- return QueryImpl.GET_EVENTS_FOR_DATE_RANGE;
- }
-
- /**
- *
- * @param rs result set to be processed
- * @see com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor#process(java.sql.ResultSet)
- * @return a list of {@link TimelineEventBean} returned by the query
- * @exception MalformedStepQueryException an error occurred during the execution of the query
- * @exception ConfigNotLoadedException an error occurred during the loading of the configuration
- * @exception SQLException an runtime SQL exception occurred
- */
- public final List<TimelineEventBean> process(final ResultSet rs)
- throws MalformedStepQueryException, ConfigNotLoadedException, SQLException {
- // TODO: parse the event in some object, as opposed to just fields like
- // that!
- // in particular the precision type
- List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
- while (rs.next()) {
- Long toDate = rs.getObject(TO_DATE) == null ? null : rs.getLong(TO_DATE);
- TimelineEventBean teb = new TimelineEventBean(rs.getInt(EVENT_ID), rs.getLong(FROM_DATE),
- toDate,
- rs.getString(FROM_PRECISION), rs.getString(TO_PRECISION),
- rs.getString(NAME), rs.getInt(TIMEBAND_ID), rs.getInt(IMPORTANCE_ID),
- rs.getString(CERTAINTY), rs.getInt(EVENT_TYPE_ID));
- events.add(teb);
- }
- return events;
- }
+ /**
+ *
+ * @param rs
+ * result set to be processed
+ * @see com.tyndalehouse.step.web.server.db.framework.ResultSetProcessor#process(java.sql.ResultSet)
+ * @return a list of {@link TimelineEventBean} returned by the query
+ * @exception MalformedStepQueryException
+ * an error occurred during the execution of the query
+ * @exception ConfigNotLoadedException
+ * an error occurred during the loading of the configuration
+ * @exception SQLException
+ * an runtime SQL exception occurred
+ */
+ public final List<TimelineEventBean> process(final ResultSet rs) throws MalformedStepQueryException,
+ ConfigNotLoadedException, SQLException {
+ // TODO: parse the event in some object, as opposed to just fields like
+ // that!
+ // in particular the precision type
+ final List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
+ while (rs.next()) {
+ final Long toDate = rs.getObject(TimeBandVisibleDateProcessor.TO_DATE) == null ? null : rs
+ .getLong(TimeBandVisibleDateProcessor.TO_DATE);
+ final TimelineEventBean teb = new TimelineEventBean(rs.getInt(TimeBandVisibleDateProcessor.EVENT_ID), rs
+ .getLong(TimeBandVisibleDateProcessor.FROM_DATE), toDate, rs
+ .getString(TimeBandVisibleDateProcessor.FROM_PRECISION), rs
+ .getString(TimeBandVisibleDateProcessor.TO_PRECISION), rs
+ .getString(TimeBandVisibleDateProcessor.NAME), rs.getInt(TimeBandVisibleDateProcessor.TIMEBAND_ID),
+ rs.getInt(TimeBandVisibleDateProcessor.IMPORTANCE_ID), rs
+ .getString(TimeBandVisibleDateProcessor.CERTAINTY), rs
+ .getInt(TimeBandVisibleDateProcessor.EVENT_TYPE_ID));
+ events.add(teb);
+ }
+ return events;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginDbBean.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginDbBean.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginDbBean.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -3,73 +3,77 @@
import com.tyndalehouse.step.web.shared.timeline.Unit;
/**
- * Timeline Origin DB Bean, containing the default configuration for each timeband
+ * Timeline Origin DB Bean, containing the default configuration for each
+ * timeband
+ *
* @author CJBurrell
- *
+ *
*/
public class TimelineOriginDbBean {
-
- /**
- * origin in time (milli seconds since epoch)
- */
- private long origin;
- /**
- * recommended time unit to be displayed
- */
- private Unit unit;
-
- /**
- * timeband id to be looked up
- */
- private int timebandId;
+ /**
+ * origin in time (milli seconds since epoch)
+ */
+ private long origin;
+ /**
+ * recommended time unit to be displayed
+ */
+ private Unit unit;
- /**
- * @return the origin
- */
- public final long getOrigin() {
- return origin;
- }
+ /**
+ * timeband id to be looked up
+ */
+ private int timebandId;
- /**
- * @return the unit
- */
- public final Unit getUnit() {
- return unit;
- }
+ /**
+ * @return the origin
+ */
+ public final long getOrigin() {
+ return origin;
+ }
- /**
- * Sets the origin field
- * @param origin value in ms for oring
- */
- public final void setOrigin(final long origin) {
- this.origin = origin;
- }
+ /**
+ * @return the unit
+ */
+ public final Unit getUnit() {
+ return unit;
+ }
- /**
- * Sets the unit for the bean
- *
- * @param unit
- * unit that should be shown on screen
- */
- public final void setUnit(final String unit) {
- this.unit = Unit.valueOf(unit);
- }
+ /**
+ * Sets the origin field
+ *
+ * @param origin
+ * value in ms for oring
+ */
+ public final void setOrigin(final long origin) {
+ this.origin = origin;
+ }
- /**
- * returns the timeband id
- * @return timeband id
- */
- public final int getTimebandId() {
- return timebandId;
- }
+ /**
+ * Sets the unit for the bean
+ *
+ * @param unit
+ * unit that should be shown on screen
+ */
+ public final void setUnit(final String unit) {
+ this.unit = Unit.valueOf(unit);
+ }
- /**
- * @param timebandId
- * the timebandId to set
- */
- public final void setTimebandId(final int timebandId) {
- this.timebandId = timebandId;
- }
+ /**
+ * returns the timeband id
+ *
+ * @return timeband id
+ */
+ public final int getTimebandId() {
+ return timebandId;
+ }
+ /**
+ * @param timebandId
+ * the timebandId to set
+ */
+ public final void setTimebandId(final int timebandId) {
+ this.timebandId = timebandId;
+ }
+
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineOriginProcessor.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -20,58 +20,60 @@
*
*/
public class TimelineOriginProcessor implements ResultSetProcessor<TimelineOriginDbBean> {
- /** result column origin */
- private static final String ORIGIN = "origin";
+ /** result column origin */
+ private static final String ORIGIN = "origin";
- /** input qry end,, verse no for which to restrict the query */
- private static final String QRY_END = "qry_end";
+ /** input qry end,, verse no for which to restrict the query */
+ private static final String QRY_END = "qry_end";
- /** input qry start, verse no for which to restrict the query */
- private static final String QRY_START = "qry_start";
+ /** input qry start, verse no for which to restrict the query */
+ private static final String QRY_START = "qry_start";
- /** result column timeband id */
- private static final String TIMEBAND = "timeband_id";
+ /** result column timeband id */
+ private static final String TIMEBAND = "timeband_id";
- // TODO: move to enum
- /** result column unit */
- private static final String UNIT = "unit";
+ // TODO: move to enum
+ /** result column unit */
+ private static final String UNIT = "unit";
- /** parameters to pass in to the query */
- private final Map<String, Object> params;
+ /** parameters to pass in to the query */
+ private final Map<String, Object> params;
- /**
- * Given a scripture range, it
- *
- * @param qryStart minimum verse no to restrict range lookup
- * @param qryEnd maximum verse no to restrict range lookup
- */
- public TimelineOriginProcessor(final int qryStart, final int qryEnd) {
- params = new HashMap<String, Object>();
- params.put(QRY_START, qryStart);
- params.put(QRY_END, qryEnd);
- }
+ /**
+ * Given a scripture range, it
+ *
+ * @param qryStart
+ * minimum verse no to restrict range lookup
+ * @param qryEnd
+ * maximum verse no to restrict range lookup
+ */
+ public TimelineOriginProcessor(final int qryStart, final int qryEnd) {
+ params = new HashMap<String, Object>();
+ params.put(TimelineOriginProcessor.QRY_START, qryStart);
+ params.put(TimelineOriginProcessor.QRY_END, qryEnd);
+ }
- public Map<String, Object> getParameters() {
- return params;
+ public Map<String, Object> getParameters() {
+ return params;
- }
+ }
- public Query getQuery() {
- return QueryImpl.LOOKUP_TIMELINE_ORIGIN;
- }
+ public Query getQuery() {
+ return QueryImpl.LOOKUP_TIMELINE_ORIGIN;
+ }
- public List<TimelineOriginDbBean> process(final ResultSet rs) throws MalformedStepQueryException,
- ConfigNotLoadedException, SQLException {
- final List<TimelineOriginDbBean> origins = new ArrayList<TimelineOriginDbBean>();
+ public List<TimelineOriginDbBean> process(final ResultSet rs) throws MalformedStepQueryException,
+ ConfigNotLoadedException, SQLException {
+ final List<TimelineOriginDbBean> origins = new ArrayList<TimelineOriginDbBean>();
- while (rs.next()) {
- final TimelineOriginDbBean bean = new TimelineOriginDbBean();
- bean.setOrigin(rs.getLong(ORIGIN));
- bean.setUnit(rs.getString(UNIT));
- bean.setTimebandId(rs.getInt(TIMEBAND));
- origins.add(bean);
- }
- return origins;
- }
+ while (rs.next()) {
+ final TimelineOriginDbBean bean = new TimelineOriginDbBean();
+ bean.setOrigin(rs.getLong(TimelineOriginProcessor.ORIGIN));
+ bean.setUnit(rs.getString(TimelineOriginProcessor.UNIT));
+ bean.setTimebandId(rs.getInt(TimelineOriginProcessor.TIMEBAND));
+ origins.add(bean);
+ }
+ return origins;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/timeline/TimelineSetupDataProcessor.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -22,48 +22,48 @@
*
*/
public class TimelineSetupDataProcessor implements ResultSetProcessor<TimelineBean> {
- /**
- * the result column timeband_description
- */
- private static final String TIMEBAND_DESCRIPTION = "timeband_description";
+ /**
+ * the result column timeband_description
+ */
+ private static final String TIMEBAND_DESCRIPTION = "timeband_description";
- /** the result column timeband_id */
- private static final String TIMEBAND_ID = "timeband_id";
+ /** the result column timeband_id */
+ private static final String TIMEBAND_ID = "timeband_id";
- /** the result column timeband unit */
- private static final String TIMEBAND_UNIT = "timeband_unit";
+ /** the result column timeband unit */
+ private static final String TIMEBAND_UNIT = "timeband_unit";
- /** the parameters to pass in to the query */
- private final Map<String, Object> params;
+ /** the parameters to pass in to the query */
+ private final Map<String, Object> params;
- /**
- * public constructor
- */
- public TimelineSetupDataProcessor() {
- params = new HashMap<String, Object>();
- }
+ /**
+ * public constructor
+ */
+ public TimelineSetupDataProcessor() {
+ params = new HashMap<String, Object>();
+ }
- public Map<String, Object> getParameters() {
- return params;
+ public Map<String, Object> getParameters() {
+ return params;
- }
+ }
- public Query getQuery() {
- return QueryImpl.GET_TIMELINE_SETUP_DATA;
- }
+ public Query getQuery() {
+ return QueryImpl.GET_TIMELINE_SETUP_DATA;
+ }
- public List<TimelineBean> process(final ResultSet rs) throws MalformedStepQueryException,
- ConfigNotLoadedException, SQLException {
- final List<TimelineBean> timelines = new ArrayList<TimelineBean>();
+ public List<TimelineBean> process(final ResultSet rs) throws MalformedStepQueryException, ConfigNotLoadedException,
+ SQLException {
+ final List<TimelineBean> timelines = new ArrayList<TimelineBean>();
- while (rs.next()) {
- final TimelineBean bean = new TimelineBean();
- bean.setTimelineId(rs.getInt(TIMEBAND_ID));
- bean.setTimelineDescription(rs.getString(TIMEBAND_DESCRIPTION));
- bean.setUnit(rs.getString(TIMEBAND_UNIT));
- timelines.add(bean);
- }
- return timelines;
- }
+ while (rs.next()) {
+ final TimelineBean bean = new TimelineBean();
+ bean.setTimelineId(rs.getInt(TimelineSetupDataProcessor.TIMEBAND_ID));
+ bean.setTimelineDescription(rs.getString(TimelineSetupDataProcessor.TIMEBAND_DESCRIPTION));
+ bean.setUnit(rs.getString(TimelineSetupDataProcessor.TIMEBAND_UNIT));
+ timelines.add(bean);
+ }
+ return timelines;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/CustomDispatchServiceServlet.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -17,31 +17,33 @@
@Singleton
public class CustomDispatchServiceServlet extends DispatchServiceServlet {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -6063357416925075136L;
+ private static final long serialVersionUID = -6063357416925075136L;
- /**
- * default logger
- */
- private final Log logger;
+ /**
+ * default logger
+ */
+ private final Log logger;
- /**
- * normal constructor
- *
- * @param dispatch dispath object
- * @param logger logger to be provided
- */
- @Inject
- public CustomDispatchServiceServlet(final Dispatch dispatch, final Log logger) {
- super(dispatch);
- this.logger = logger;
- };
+ /**
+ * normal constructor
+ *
+ * @param dispatch
+ * dispath object
+ * @param logger
+ * logger to be provided
+ */
+ @Inject
+ public CustomDispatchServiceServlet(final Dispatch dispatch, final Log logger) {
+ super(dispatch);
+ this.logger = logger;
+ };
- @Override
- protected void doUnexpectedFailure(final Throwable e) {
- logger.error("An unexpected error happened on the bridge between server and client", e);
- }
+ @Override
+ protected void doUnexpectedFailure(final Throwable e) {
+ logger.error("An unexpected error happened on the bridge between server and client", e);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/DispatchServletModule.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,11 +10,11 @@
*/
public class DispatchServletModule extends ServletModule {
- @Override
- public void configureServlets() {
- // NOTE: the servlet context will probably need changing
+ @Override
+ public void configureServlets() {
+ // NOTE: the servlet context will probably need changing
- serve("/step/dispatch").with(CustomDispatchServiceServlet.class);
- }
+ serve("/step/dispatch").with(CustomDispatchServiceServlet.class);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/LogProvider.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -14,30 +14,30 @@
*/
@Singleton
public class LogProvider implements Provider<Log> {
- // enforce singleton to allow static methods to get to the same log
- /**
- * TODO: there should be a logger per class really. All appending to the
- * same file, but so that we can turn them on and off
- *
- */
- private static Log logger = new Log4JLogger("step.jetty");
+ // enforce singleton to allow static methods to get to the same log
+ /**
+ * TODO: there should be a logger per class really. All appending to the
+ * same file, but so that we can turn them on and off
+ *
+ */
+ private static Log logger = new Log4JLogger("step.jetty");
- /**
- * The static equivalent of the above, so that static contexts can log as
- * well
- *
- * @return the log to use
- */
- public static Log getLogger() {
- return logger;
- }
+ /**
+ * The static equivalent of the above, so that static contexts can log as
+ * well
+ *
+ * @return the log to use
+ */
+ public static Log getLogger() {
+ return LogProvider.logger;
+ }
- /**
- * The instantiated log to be returned
- *
- * @return the Log file to be used
- */
- public Log get() {
- return logger;
- }
+ /**
+ * The instantiated log to be returned
+ *
+ * @return the Log file to be used
+ */
+ public Log get() {
+ return LogProvider.logger;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/MyGuiceServletConfig.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,8 +12,8 @@
*/
public class MyGuiceServletConfig extends GuiceServletContextListener {
- @Override
- protected Injector getInjector() {
- return Guice.createInjector(new ServerModule(), new DispatchServletModule());
- }
+ @Override
+ protected Injector getInjector() {
+ return Guice.createInjector(new ServerModule(), new DispatchServletModule());
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -21,17 +21,17 @@
*/
public class ServerModule extends ActionHandlerModule {
- @Override
- protected void configureHandlers() {
- bindHandler(GetAvailableBibleVersionsHandler.class);
- bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
- bindHandler(GetBibleBooksHandler.class);
- bindHandler(GetCurrentBibleTextHandler.class);
- bindHandler(GetEventsForDateRangeHandler.class);
- bindHandler(GetTimelineUISetupHandler.class);
- bindHandler(GetTimelineOriginForScriptureHandler.class);
- bindHandler(GetDictionaryDefinitionHandler.class);
+ @Override
+ protected void configureHandlers() {
+ bindHandler(GetAvailableBibleVersionsHandler.class);
+ bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
+ bindHandler(GetBibleBooksHandler.class);
+ bindHandler(GetCurrentBibleTextHandler.class);
+ bindHandler(GetEventsForDateRangeHandler.class);
+ bindHandler(GetTimelineUISetupHandler.class);
+ bindHandler(GetTimelineOriginForScriptureHandler.class);
+ bindHandler(GetDictionaryDefinitionHandler.class);
- bind(StepQueryRunner.class).to(StepQueryRunnerImpl.class).in(Singleton.class);
- }
+ bind(StepQueryRunner.class).to(StepQueryRunnerImpl.class).in(Singleton.class);
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetAvailableBibleVersionsHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -25,48 +25,48 @@
* @author CJBurrell TODO: add logging to this class
*/
public class GetAvailableBibleVersionsHandler extends
- AbstractStepHandler<GetAvailableBibleVersionsCommand, GetAvailableBibleVersionsResult> {
- /**
- * Default logger
- */
- private final Log logger;
+ 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;
- }
+ /**
+ * 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>();
+ 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>();
- List<BibleVersion> versions = new ArrayList<BibleVersion>();
- for (final Book b : books) {
- if(b.getBookCategory().equals(BookCategory.BIBLE)) {
- BibleVersion bibleVersion = new BibleVersion();
- bibleVersion.setInitials(b.getInitials());
- bibleVersion.setName(b.getName());
- bibleVersion.setLanguage(b.getLanguage().getName());
- versions.add(bibleVersion);
- }
- }
- GetAvailableBibleVersionsResult result = new GetAvailableBibleVersionsResult();
- result.setBibleVersions(versions);
- return result;
- }
+ 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");
- }
+ public void rollback(final GetAvailableBibleVersionsCommand arg0, final GetAvailableBibleVersionsResult arg1,
+ final ExecutionContext arg2) throws ActionException {
+ logger.error("Rolling back GetAvailableBibleVersions");
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetBibleBooksHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -23,48 +23,46 @@
* @author CJBurrell
*
*/
-public class GetBibleBooksHandler extends
- AbstractStepHandler<GetBibleBooksCommand, GetBibleBooksCommandResult> {
- /**
- * public constructor
- */
- @Inject
- public GetBibleBooksHandler() {
- }
+public class GetBibleBooksHandler extends AbstractStepHandler<GetBibleBooksCommand, GetBibleBooksCommandResult> {
+ /**
+ * public constructor
+ */
+ @Inject
+ public GetBibleBooksHandler() {
+ }
+ public GetBibleBooksCommandResult execute(final GetBibleBooksCommand command, final ExecutionContext arg1)
+ throws ActionException {
- public GetBibleBooksCommandResult execute(final GetBibleBooksCommand command,
- final ExecutionContext arg1) throws ActionException {
+ getLogger().debug("GetBibleBooksCommandResult has been called...");
- 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
- // 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>();
- // 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);
+ }
- // 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);
+ }
- return new GetBibleBooksCommandResult(suggestions);
- }
+ public void rollback(final GetBibleBooksCommand arg0, final GetBibleBooksCommandResult arg1,
+ final ExecutionContext context) throws ActionException {
- public void rollback(final GetBibleBooksCommand arg0, final GetBibleBooksCommandResult arg1,
- final ExecutionContext context) throws ActionException {
-
- }
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetCurrentBibleTextHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -52,463 +52,485 @@
*
*/
public class GetCurrentBibleTextHandler extends
- AbstractStepHandler<GetCurrentBibleTextCommand, GetCurrentBibleTextResult> {
+ AbstractStepHandler<GetCurrentBibleTextCommand, GetCurrentBibleTextResult> {
- /**
- * default constructor with the getLogger
- *
- */
- @Inject
- public GetCurrentBibleTextHandler() {
+ /**
+ * 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();
- 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");
+ }
- // 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 GetCurrentBibleTextResult result = new GetCurrentBibleTextResult();
+ final BookData data = getBookData(version, reference);
- 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;
+ }
- 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");
- 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
- /**
- * 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);
- // VerseRange.remainder(vrf, null);
+ // getBookData(version, reference);
+ }
- // 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);
+ }
- /**
- * 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;
- /**
- * 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;
+ }
- 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);
+ }
- // 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);
+ }
- 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 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);
+ }
- /**
- * 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 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 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);
- /**
- * 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());
+ }
+ }
+ }
- 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();
- /**
- * 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);
- 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);
+ }
- // 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 "";
+ }
- /**
- * 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 "";
+ }
- // Make sure Hebrew displays from Right to Left
- final BookMetaData bmd = data.getFirstBook().getBookMetaData();
- if (bmd == null) {
- return "";
- }
+ try {
+ final SAXEventProvider osissep = data.getSAXEventProvider();
- 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 "";
+ }
- 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);
+ }
+ }
- /**
- * 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;
- /**
- * 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);
+ }
- 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);
- 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());
+ }
+ }
+ }
- if (lemmaAttribute != null) {
- if (morphAttribute != null) {
- strongMorphMap.addWord(lemmaAttribute.getValue(), morphAttribute.getValue(),
- word.getValue());
- } else {
- strongMorphMap.addWord(lemmaAttribute.getValue(), word.getValue());
- }
- }
- }
+ return strongMorphMap;
+ }
- 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;
+ }
- /**
- * 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;
- /**
- * 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();
- // 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);
- final StringBuffer alternativeWording = new StringBuffer(64);
+ // we iterate through each lemma, knowing that we may
+ // not have morphs at all (Hebrew text)
+ // we cannot use the morph without the lemma, although
+ // TODO: check what we're supposed to do
+ // when we only have one morphology for several lemmas
+ // always 0 or equal to number of lemmas
+ for (int ii = 0; ii < lemma.size(); ii++) {
+ final String l = lemma.get(ii);
+ final String m = ii < morph.size() ? morph.get(ii) : null;
+ final String text = strongMorphMap.get(l, m);
+ if (text != null) {
+ alternativeWording.append(text);
+ alternativeWording.append(' ');
+ }
+ w.setAlternativeWord(alternativeWording.toString());
+ }
+ }
+ }
+ }
+ }
+ }
- // we iterate through each lemma, knowing that we may
- // not have morphs at all (Hebrew text)
- // we cannot use the morph without the lemma, although
- // TODO: check what we're supposed to do
- // when we only have one morphology for several lemmas
- // always 0 or equal to number of lemmas
- for (int ii = 0; ii < lemma.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");
+ }
- /**
- * 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();
- 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;
- // 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");
+ }
+ }
- 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;
- }
+ return passage;
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetDictionaryDefinitionHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -35,141 +35,142 @@
*
*/
public class GetDictionaryDefinitionHandler extends
- AbstractStepHandler<GetDictionaryDefinitionCommand, GetDictionaryDefinitionResult> {
+ AbstractStepHandler<GetDictionaryDefinitionCommand, GetDictionaryDefinitionResult> {
- /**
- * The dictionary definition handler's constructor
- */
- @Inject
- public GetDictionaryDefinitionHandler() {
- }
+ /**
+ * 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 />");
- public GetDictionaryDefinitionResult execute(final GetDictionaryDefinitionCommand command,
- final ExecutionContext arg1) throws ActionException {
- final List<String> referenceList = command.getLookupReferencce();
- final GetDictionaryDefinitionResult result = new GetDictionaryDefinitionResult();
+ }
+ result.setDefinition(definitions.toString());
+ return result;
+ }
- 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 />");
+ public void rollback(final GetDictionaryDefinitionCommand arg0, final GetDictionaryDefinitionResult arg1,
+ final ExecutionContext arg2) throws ActionException {
+ getLogger().error("Get Dictionary definition Text rolling back");
- }
- 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 "";
+ }
- /**
- * 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 "";
- }
+ /**
+ * 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));
+ }
- 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 "";
- }
+ /**
+ * 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));
+ }
- /**
- * 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));
- }
+ /**
+ * 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);
- /**
- * 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);
- }
- }
+ 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);
+ }
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetEventsForDateRangeHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -25,80 +25,77 @@
*
*/
public class GetEventsForDateRangeHandler extends
- AbstractStepHandler<GetEventsForDateRangeCommand, GetEventsForDateRangeResult> {
+ AbstractStepHandler<GetEventsForDateRangeCommand, GetEventsForDateRangeResult> {
- /**
- * The step query runner to run queries against the database
- */
- private final StepQueryRunner queryRunner;
+ /**
+ * 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;
- }
+ /**
+ * 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);
+ }
- // 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;
+ }
- logEventsRetrieved(result.getEvents());
- return result;
- }
+ public void rollback(final GetEventsForDateRangeCommand arg0, final GetEventsForDateRangeResult arg1,
+ final ExecutionContext arg2) throws ActionException {
- 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");
- /**
- * 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()));
- 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()));
- }
+ } 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()));
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetLocationsHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,36 +16,35 @@
* @author CJBurrell
*
*/
-public class GetLocationsHandler extends
- AbstractStepHandler<GetLocationsCommand, GetLocationsResult> {
+public class GetLocationsHandler extends AbstractStepHandler<GetLocationsCommand, GetLocationsResult> {
- /**
- * Default constructor
- *
- * @param queryRunner a query runner
- */
- @Inject
- public GetLocationsHandler(final StepQueryRunner queryRunner) {
-// this.queryRunner = queryRunner;
- }
+ /**
+ * 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 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");
- }
+ public void rollback(final GetLocationsCommand arg0, final GetLocationsResult arg1, final ExecutionContext arg2)
+ throws ActionException {
+ getLogger().error("Get Locations Handler rolling back");
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -31,91 +31,88 @@
*
*/
public class GetTimelineOriginForScriptureHandler extends
- AbstractStepHandler<GetTimelineOriginForScriptureCommand, GetTimelineOriginForScriptureResult> {
- /**
- * The step query runner to run queries against the database
- */
- private final StepQueryRunner queryRunner;
+ 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;
- }
+ /**
+ * 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());
- // 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 {
- 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();
- // 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);
- 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);
- // 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);
+ }
- 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 {
- 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);
- /**
- * 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);
-
- }
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -21,46 +21,45 @@
* @author CJBurrell
*
*/
-public class GetTimelineUISetupHandler extends
- AbstractStepHandler<GetTimelineUISetupCommand, GetTimelineUISetupResult> {
- /**
- * The step query runner to run queries against the database
- */
- private final StepQueryRunner queryRunner;
+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;
- }
+ /**
+ * 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
+ // 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);
+ 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);
- }
- }
+ 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");
+ public void rollback(final GetTimelineUISetupCommand arg0, final GetTimelineUISetupResult arg1,
+ final ExecutionContext arg2) throws ActionException {
+ getLogger().error("Get Timeline UI Setup Handler rolling back");
- }
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/InstallJswordModuleHandler.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -25,126 +25,123 @@
*
*/
public class InstallJswordModuleHandler extends
- AbstractStepHandler<InstallJswordModuleCommand, InstallJswordModuleResult> {
+ 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";
+ // 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";
+ /**
+ * 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;
+ /**
+ * 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() {
- }
+ /**
+ * 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");
+ }
- public InstallJswordModuleResult execute(final InstallJswordModuleCommand cmd,
- final ExecutionContext context) throws ActionException {
+ try {
+ final HttpSwordInstaller newCustomInstaller = getNewCustomInstaller();
- final String initials = cmd.getInitials();
- if (initials == null) {
- throw new ActionException("Module initials provided was null");
- }
+ // 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()));
+ }
- try {
- final HttpSwordInstaller newCustomInstaller = getNewCustomInstaller();
+ // now kick off install
+ final Book bookToBeInstalled = newCustomInstaller.getBook(initials);
+ newCustomInstaller.install(bookToBeInstalled);
- // 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()));
- }
+ getLogger().debug(String.format("Installing %s", initials));
- // now kick off install
- final Book bookToBeInstalled = newCustomInstaller.getBook(initials);
- newCustomInstaller.install(bookToBeInstalled);
+ // 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);
- getLogger().debug(String.format("Installing %s", initials));
+ @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);
+ }
- // 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(WAIT_TIME_FOR_INSTALLER);
+ // wait for module to be completed
- @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(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);
- }
+ return new InstallJswordModuleResult(true);
+ }
- // wait for module to be completed
+ public void rollback(final InstallJswordModuleCommand arg0, final InstallJswordModuleResult arg1,
+ final ExecutionContext arg2) throws ActionException {
+ getLogger().error("Rolling back InstallJswordModule");
+ }
- return new InstallJswordModuleResult(true);
- }
+ /**
+ * 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();
- public void rollback(final InstallJswordModuleCommand arg0,
- final InstallJswordModuleResult arg1, final ExecutionContext arg2) throws ActionException {
- getLogger().error("Rolling back InstallJswordModule");
- }
+ 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));
- /**
- * 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();
+ resourceInstaller.setHost(host);
+ if (proxyHost != null) {
+ resourceInstaller.setProxyHost(proxyHost);
+ }
+ if (proxyPort != null) {
+ resourceInstaller.setProxyPort(Integer.parseInt(proxyPort));
+ }
- 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(PROXY_HOST);
- final String proxyPort = System.getProperty(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;
- }
+ getLogger().info("Setting package and catalog directories");
+ resourceInstaller.setPackageDirectory("/ftpmirror/pub/sword/packages/rawzip");
+ resourceInstaller.setCatalogDirectory("/ftpmirror/pub/sword/raw");
+ return resourceInstaller;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/StrongMorphMap.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/StrongMorphMap.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/util/passage/StrongMorphMap.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -27,93 +27,100 @@
*
*/
public class StrongMorphMap {
- // lemmas morphs word
- /**
- * this map maps strong numbers to morphs. it is the first level of
- * indirection to the map of morphs which maps to a word
- */
- private final Map<String, Map<String, String>> strongToMorph;
+ // lemmas morphs word
+ /**
+ * this map maps strong numbers to morphs. it is the first level of
+ * indirection to the map of morphs which maps to a word
+ */
+ private final Map<String, Map<String, String>> strongToMorph;
- /**
- * this map maps the strong number ot the word directly
- */
- private final Map<String, String> strongToWord;
+ /**
+ * this map maps the strong number ot the word directly
+ */
+ private final Map<String, String> strongToWord;
- /**
- * Default constructor that initialises the two maps
- */
- public StrongMorphMap() {
- strongToMorph = new HashMap<String, Map<String, String>>();
- strongToWord = new HashMap<String, String>();
- }
+ /**
+ * Default constructor that initialises the two maps
+ */
+ public StrongMorphMap() {
+ strongToMorph = new HashMap<String, Map<String, String>>();
+ strongToWord = new HashMap<String, String>();
+ }
- /**
- * only to be used if no morph is available
- *
- * @param strong the strong number or lemma
- * @param word the word to be stored
- */
- public final void addWord(final String strong, final String word) {
- strongToWord.put(strong, word);
- }
+ /**
+ * only to be used if no morph is available
+ *
+ * @param strong
+ * the strong number or lemma
+ * @param word
+ * the word to be stored
+ */
+ public final void addWord(final String strong, final String word) {
+ strongToWord.put(strong, word);
+ }
- /**
- * adds a word to the map
- *
- * @param strong the lemma/strong number
- * @param morph the morph / indicating morphology
- * @param word the word
- */
- public final void addWord(final String strong, final String morph, final String word) {
- if (morph == null) {
- addWord(strong, word);
- return;
- }
+ /**
+ * adds a word to the map
+ *
+ * @param strong
+ * the lemma/strong number
+ * @param morph
+ * the morph / indicating morphology
+ * @param word
+ * the word
+ */
+ public final void addWord(final String strong, final String morph, final String word) {
+ if (morph == null) {
+ addWord(strong, word);
+ return;
+ }
- Map<String, String> morphsToWords = strongToMorph.get(strong);
- if (morphsToWords == null) {
- morphsToWords = new HashMap<String, String>();
- strongToMorph.put(strong, morphsToWords);
- }
+ Map<String, String> morphsToWords = strongToMorph.get(strong);
+ if (morphsToWords == null) {
+ morphsToWords = new HashMap<String, String>();
+ strongToMorph.put(strong, morphsToWords);
+ }
- // guaranteed non-null map
- morphsToWords.put(morph, word);
- }
+ // guaranteed non-null map
+ morphsToWords.put(morph, word);
+ }
- /**
- * Looks up the (lemma, morph) key in the map. If morph is null, lookup is
- * done solely on strong number, and takes the first of the morphs
- *
- * @param lemma lemma associated to a a word
- * @param morph morph, can be passed in null, refering to the grammar of a
- * word in a language
- * @return the word associated in the map to the (lemma, morph) combination
- */
- // TODO: check for nulls on lemma
- public final String get(final String lemma, final String morph) {
- final Map<String, String> morphToWord = strongToMorph.get(lemma);
+ /**
+ * Looks up the (lemma, morph) key in the map. If morph is null, lookup is
+ * done solely on strong number, and takes the first of the morphs
+ *
+ * @param lemma
+ * lemma associated to a a word
+ * @param morph
+ * morph, can be passed in null, refering to the grammar of a
+ * word in a language
+ * @return the word associated in the map to the (lemma, morph) combination
+ */
+ // TODO: check for nulls on lemma
+ public final String get(final String lemma, final String morph) {
+ final Map<String, String> morphToWord = strongToMorph.get(lemma);
- if (morphToWord != null) {
- if (morph != null) {
- // use the chain from morphs to word
- final String word = morphToWord.get(morph);
- if (word != null) {
- return word;
- } else {
- // well we didn't find our morph, so the best option is to
- // return another morph for the same strong number
- final Collection<String> words = morphToWord.values();
- final Iterator<String> wordsIterator = words.iterator();
- if (wordsIterator.hasNext()) {
- return wordsIterator.next();
- }
- }
- }
- }
+ if (morphToWord != null) {
+ if (morph != null) {
+ // use the chain from morphs to word
+ final String word = morphToWord.get(morph);
+ if (word != null) {
+ return word;
+ } else {
+ // well we didn't find our morph, so the best option is to
+ // return another morph for the same strong number
+ final Collection<String> words = morphToWord.values();
+ final Iterator<String> wordsIterator = words.iterator();
+ if (wordsIterator.hasNext()) {
+ return wordsIterator.next();
+ }
+ }
+ }
+ }
- // if we get here, there is nothing valuable in the map going through
- // the morphs
- // therefore, let's just return something from the other map
- return strongToWord.get(lemma);
- }
+ // if we get here, there is nothing valuable in the map going through
+ // the morphs
+ // therefore, let's just return something from the other map
+ return strongToWord.get(lemma);
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/ConfigurableHTMLConverter.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -43,128 +43,130 @@
* @author Joe Walker [joe at eireneh dot com]
*/
public class ConfigurableHTMLConverter implements Converter {
- /**
+ /**
*
*/
- static final class XSLTFilter implements URIFilter {
+ static final class XSLTFilter implements URIFilter {
- public boolean accept(final String name) {
- return name.endsWith(FileUtil.EXTENSION_XSLT);
- }
- }
+ 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 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$
+ /**
+ * 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() {
+ /**
+ * 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 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
+ // */
+ // 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 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 style;
- }
+ /**
+ * 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;
- }
+ /**
+ * 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/" + style; //$NON-NLS-1$
- final URL xslurl = ResourceUtil.getResource(path);
+ /**
+ *
+ *
+ * @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);
- }
- }
+ 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];
- }
- }
+ /**
+ * 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];
+ }
+ }
}
Modified: 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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/XSLTProperty.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -42,280 +42,294 @@
*/
@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$
+ /**
+ * 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$
+ /**
+ * 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$
+ /**
+ * 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$
+ /**
+ * 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 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$
+ /**
+ * 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$
+ /**
+ * 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$
+ /**
+ * 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$
+ /**
+ * 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$
+ /**
+ * 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 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$
+ /**
+ * 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 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$
+ /**
+ * 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$
+ /**
+ * Should cross references be shown
+ */
+ public static final XSLTProperty XREF = new XSLTProperty("XRef", true); //$NON-NLS-1$
- /**
- * Support for serialization
- *
- */
- private static int nextObj;
+ /**
+ * Support for serialization
+ *
+ */
+ private static int nextObj;
- /**
- * Serialization ID
- */
- private static final long serialVersionUID = 3257567325749326905L;
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = 3257567325749326905L;
- /**
- * list of xslt properties
- */
- private static final XSLTProperty[] VALUES = { STRONGS_NUMBERS, MORPH, START_VERSE_ON_NEWLINE,
- VERSE_NUMBERS, CV, BCV, NO_VERSE_NUMBERS, TINY_VERSE_NUMBERS, HEADINGS, NOTES, XREF, BASE_URL,
- DIRECTION, FONT, CSS, };
+ /**
+ * 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;
+ /**
+ * 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 default state of the XSLTProperty
+ */
+ private final String defaultState;
- /**
- * The name of the XSLTProperty
- */
- private final String name;
+ /**
+ * 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 = nextObj++;
+ /**
+ * 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;
+ /**
+ * 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 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.
+ */
+ 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;
- }
+ /**
+ * @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 VALUES[i];
- }
+ /**
+ * 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 < VALUES.length; i++) {
- final XSLTProperty o = VALUES[i];
- if (o.name.equalsIgnoreCase(name)) {
- return o;
- }
- }
- assert false;
- return null;
- }
+ /**
+ * 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 < VALUES.length; i++) {
- VALUES[i].setProperty(provider);
- }
- }
+ /**
+ *
+ * @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
+ */
+ public boolean getDefaultState() {
+ return Boolean.valueOf(defaultState).booleanValue();
+ }
- /**
- *
- * @return default state as a string
- */
- public String getDefaultStringState() {
- return defaultState;
- }
+ /**
+ *
+ * @return default state as a string
+ */
+ public String getDefaultStringState() {
+ return defaultState;
+ }
- /**
- * @return the name of the property
- */
- public String getName() {
- return name;
- }
+ /**
+ * @return the name of the property
+ */
+ public String getName() {
+ return name;
+ }
- /**
- * @return the state
- */
- public boolean getState() {
- return Boolean.valueOf(state).booleanValue();
- }
+ /**
+ * @return the state
+ */
+ public boolean getState() {
+ return Boolean.valueOf(state).booleanValue();
+ }
- /**
- *
- * @return state as a string
- */
- public String getStringState() {
- return state;
- }
+ /**
+ *
+ * @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 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 boolean newState) {
+ state = Boolean.toString(newState);
+ }
- /**
- * @param newState sets the state to newState
- */
- public void setState(final String newState) {
- state = 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;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return name;
+ }
- /**
- * TODO: redo this whole class
- *
- * @return an object
- */
- Object readResolve() {
- return VALUES[obj];
- }
+ /**
+ * TODO: redo this whole class
+ *
+ * @return an object
+ */
+ Object readResolve() {
+ return XSLTProperty.VALUES[obj];
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/BooksRequiredType.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/BooksRequiredType.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/BooksRequiredType.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,8 +7,8 @@
*
*/
public enum BooksRequiredType {
- /**
- * only retrieve bibles
- */
- BIBLE,
+ /**
+ * only retrieve bibles
+ */
+ BIBLE,
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetAvailableBibleVersionsCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,36 +11,37 @@
*
*/
public class GetAvailableBibleVersionsCommand implements Action<GetAvailableBibleVersionsResult> {
- /**
- * serial id.
- */
- private static final long serialVersionUID = 5781027650600417430L;
+ /**
+ * serial id.
+ */
+ private static final long serialVersionUID = 5781027650600417430L;
- // TODO: later change that to list modules, bibles, etc.
- /**
- * Describes which types of modules are required to be returned.
- */
- private BooksRequiredType booksRequired = BooksRequiredType.BIBLE;
+ // TODO: later change that to list modules, bibles, etc.
+ /**
+ * Describes which types of modules are required to be returned.
+ */
+ private BooksRequiredType booksRequired = BooksRequiredType.BIBLE;
- /**
- * Default constructor needs to be available for GWT it seems.
- */
- public GetAvailableBibleVersionsCommand() {
+ /**
+ * Default constructor needs to be available for GWT it seems.
+ */
+ public GetAvailableBibleVersionsCommand() {
- }
+ }
- /**
- * @return the booksRequired
- */
- public BooksRequiredType getBooksRequired() {
- return booksRequired;
- }
+ /**
+ * @return the booksRequired
+ */
+ public BooksRequiredType getBooksRequired() {
+ return booksRequired;
+ }
- /**
- * @param booksRequired the booksRequired to set
- */
- public void setBooksRequired(final BooksRequiredType booksRequired) {
- this.booksRequired = booksRequired;
- }
+ /**
+ * @param booksRequired
+ * the booksRequired to set
+ */
+ public void setBooksRequired(final BooksRequiredType booksRequired) {
+ this.booksRequired = booksRequired;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetBibleBooksCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,28 +13,29 @@
*/
public class GetBibleBooksCommand implements Action<GetBibleBooksCommandResult> {
- /**
- * serial id
- */
- private static final long serialVersionUID = 2749008090105331922L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 2749008090105331922L;
- /**
- * Initials of version to use to lookup bible
- */
- private String initials;
+ /**
+ * Initials of version to use to lookup bible
+ */
+ private String initials;
- /**
- * @return the initials
- */
- public final String getInitials() {
- return initials;
- }
+ /**
+ * @return the initials
+ */
+ public final String getInitials() {
+ return initials;
+ }
- /**
- * @param initials the initials to set
- */
- public final void setInitials(final String initials) {
- this.initials = initials;
- }
+ /**
+ * @param initials
+ * the initials to set
+ */
+ public final void setInitials(final String initials) {
+ this.initials = initials;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetCurrentBibleTextCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -22,86 +22,91 @@
*
*/
public class GetCurrentBibleTextCommand implements Action<GetCurrentBibleTextResult> {
- /**
- * serial id
- */
- private static final long serialVersionUID = -6828956918275592036L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -6828956918275592036L;
- /**
- * the biblical reference, for e.g. Gen 1:1
- */
- private String reference;
+ /**
+ * the biblical reference, for e.g. Gen 1:1
+ */
+ private String reference;
- /**
- * type of lookup to make
- */
- private BibleTextLookupType typeOfLookup;
+ /**
+ * type of lookup to make
+ */
+ private BibleTextLookupType typeOfLookup;
- // TODO: add validation to the handler/client to ensure that
- // version/interlinear matches correctly
- /**
- * the version of the bible to use.
- */
- private String version;
+ // TODO: add validation to the handler/client to ensure that
+ // version/interlinear matches correctly
+ /**
+ * the version of the bible to use.
+ */
+ private String version;
- /**
- * default constructor TODO: can this be made private? I think so
- */
- public GetCurrentBibleTextCommand() {
+ /**
+ * default constructor TODO: can this be made private? I think so
+ */
+ public GetCurrentBibleTextCommand() {
- }
+ }
- /**
- * constructor for a version,reference combo
- *
- * @param version version to be used in the lookup (intials)
- * @param reference reference to be used in the lookup (for e.g. Gen 1:1)
- */
- public GetCurrentBibleTextCommand(final String version, final String reference) {
- this.version = version;
- this.reference = reference;
- }
+ /**
+ * constructor for a version,reference combo
+ *
+ * @param version
+ * version to be used in the lookup (intials)
+ * @param reference
+ * reference to be used in the lookup (for e.g. Gen 1:1)
+ */
+ public GetCurrentBibleTextCommand(final String version, final String reference) {
+ this.version = version;
+ this.reference = reference;
+ }
- /**
- * @return the biblical reference (Gen 1:1-5 for example)
- */
- public String getReference() {
- return reference;
- }
+ /**
+ * @return the biblical reference (Gen 1:1-5 for example)
+ */
+ public String getReference() {
+ return reference;
+ }
- /**
- * @return the typeOfLookup
- */
- public final BibleTextLookupType getTypeOfLookup() {
- return typeOfLookup;
- }
+ /**
+ * @return the typeOfLookup
+ */
+ public final BibleTextLookupType getTypeOfLookup() {
+ return typeOfLookup;
+ }
- /**
- * @return the initials of the version to be used in the lookup
- */
- public String getVersion() {
- return version;
- }
+ /**
+ * @return the initials of the version to be used in the lookup
+ */
+ public String getVersion() {
+ return version;
+ }
- /**
- * @param reference the reference to set
- */
- public void setReference(final String reference) {
- this.reference = reference;
- }
+ /**
+ * @param reference
+ * the reference to set
+ */
+ public void setReference(final String reference) {
+ this.reference = reference;
+ }
- /**
- * @param typeOfLookup the typeOfLookup to set
- */
- public final void setTypeOfLookup(final BibleTextLookupType typeOfLookup) {
- this.typeOfLookup = typeOfLookup;
- }
+ /**
+ * @param typeOfLookup
+ * the typeOfLookup to set
+ */
+ public final void setTypeOfLookup(final BibleTextLookupType typeOfLookup) {
+ this.typeOfLookup = typeOfLookup;
+ }
- /**
- * @param version the version to set
- */
- public void setVersion(final String version) {
- this.version = version;
- }
+ /**
+ * @param version
+ * the version to set
+ */
+ public void setVersion(final String version) {
+ this.version = version;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetDictionaryDefinitionCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,34 +13,35 @@
*
*/
public class GetDictionaryDefinitionCommand implements Action<GetDictionaryDefinitionResult> {
- /**
- * serial id
- */
- private static final long serialVersionUID = -6139208624046856543L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -6139208624046856543L;
- /**
- * references to be looked up
- */
- private List<String> lookupReferencce;
+ /**
+ * references to be looked up
+ */
+ private List<String> lookupReferencce;
- /**
- * the public constructor
- */
- public GetDictionaryDefinitionCommand() {
+ /**
+ * the public constructor
+ */
+ public GetDictionaryDefinitionCommand() {
- }
+ }
- /**
- * @return the lookupReferencce
- */
- public List<String> getLookupReferencce() {
- return lookupReferencce;
- }
+ /**
+ * @return the lookupReferencce
+ */
+ public List<String> getLookupReferencce() {
+ return lookupReferencce;
+ }
- /**
- * @param lookupReferences the list lookupReferencce to set
- */
- public void setLookupReference(final List<String> lookupReferences) {
- this.lookupReferencce = lookupReferences;
- }
+ /**
+ * @param lookupReferences
+ * the list lookupReferencce to set
+ */
+ public void setLookupReference(final List<String> lookupReferences) {
+ this.lookupReferencce = lookupReferences;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetEventsForDateRangeCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,63 +16,66 @@
*
*/
public class GetEventsForDateRangeCommand implements Action<GetEventsForDateRangeResult> {
- /**
- * default uid
- */
- private static final long serialVersionUID = 5781027650600417430L;
+ /**
+ * default uid
+ */
+ private static final long serialVersionUID = 5781027650600417430L;
- /**
- * whether to retrieve durations (this is a DEBUG flag really)
- */
- private boolean showDuration = true;
+ /**
+ * whether to retrieve durations (this is a DEBUG flag really)
+ */
+ private boolean showDuration = true;
- /**
- * the list of timebands and the times that are currently showing
- */
- private List<TimeBandVisibleDate> visbleDates;
+ /**
+ * the list of timebands and the times that are currently showing
+ */
+ private List<TimeBandVisibleDate> visbleDates;
- /**
- * Used for serialization
- */
- public GetEventsForDateRangeCommand() {
+ /**
+ * Used for serialization
+ */
+ public GetEventsForDateRangeCommand() {
- }
+ }
- /**
- * default constructor that should be used
- *
- * @param visbleDates list of date ranges encapsulated in a
- * TimeBandVisibleDate object
- */
- public GetEventsForDateRangeCommand(final List<TimeBandVisibleDate> visbleDates) {
- this.visbleDates = visbleDates;
- }
+ /**
+ * default constructor that should be used
+ *
+ * @param visbleDates
+ * list of date ranges encapsulated in a TimeBandVisibleDate
+ * object
+ */
+ public GetEventsForDateRangeCommand(final List<TimeBandVisibleDate> visbleDates) {
+ this.visbleDates = visbleDates;
+ }
- /**
- * @return the visbleDates
- */
- public List<TimeBandVisibleDate> getVisbleDates() {
- return visbleDates;
- }
+ /**
+ * @return the visbleDates
+ */
+ public List<TimeBandVisibleDate> getVisbleDates() {
+ return visbleDates;
+ }
- /**
- * @return the showDuration
- */
- public boolean isShowDuration() {
- return showDuration;
- }
+ /**
+ * @return the showDuration
+ */
+ public boolean isShowDuration() {
+ return showDuration;
+ }
- /**
- * @param showDuration the showDuration to set
- */
- public void setShowDuration(final boolean showDuration) {
- this.showDuration = showDuration;
- }
+ /**
+ * @param showDuration
+ * the showDuration to set
+ */
+ public void setShowDuration(final boolean showDuration) {
+ this.showDuration = showDuration;
+ }
- /**
- * @param visbleDates the visbleDates to set
- */
- public void setVisbleDates(final List<TimeBandVisibleDate> visbleDates) {
- this.visbleDates = visbleDates;
- }
+ /**
+ * @param visbleDates
+ * the visbleDates to set
+ */
+ public void setVisbleDates(final List<TimeBandVisibleDate> visbleDates) {
+ this.visbleDates = visbleDates;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetLocationsCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetLocationsCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetLocationsCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,9 +13,9 @@
*/
public class GetLocationsCommand implements Action<GetLocationsResult> {
- /**
- * serial id
- */
- private static final long serialVersionUID = -4636855791737543490L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -4636855791737543490L;
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineOriginForScriptureCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,44 +11,46 @@
*
*/
public class GetTimelineOriginForScriptureCommand implements Action<GetTimelineOriginForScriptureResult> {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -6454957611866927920L;
- /**
- * default uid
- */
+ private static final long serialVersionUID = -6454957611866927920L;
+ /**
+ * default uid
+ */
- private String scriptureReference;
+ private String scriptureReference;
- /**
- * default constructor that should be used
- *
- * @param scriptureReference the biblical reference/range to be looked up
- */
- public GetTimelineOriginForScriptureCommand(final String scriptureReference) {
- this.scriptureReference = scriptureReference;
- }
+ /**
+ * default constructor that should be used
+ *
+ * @param scriptureReference
+ * the biblical reference/range to be looked up
+ */
+ public GetTimelineOriginForScriptureCommand(final String scriptureReference) {
+ this.scriptureReference = scriptureReference;
+ }
- /**
- * Used for serialization
- */
- @SuppressWarnings("unused")
- private GetTimelineOriginForScriptureCommand() {
+ /**
+ * Used for serialization
+ */
+ @SuppressWarnings("unused")
+ private GetTimelineOriginForScriptureCommand() {
- }
+ }
- /**
- * @return the scriptureReference
- */
- public String getScriptureReference() {
- return scriptureReference;
- }
+ /**
+ * @return the scriptureReference
+ */
+ public String getScriptureReference() {
+ return scriptureReference;
+ }
- /**
- * @param scriptureReference the scriptureReference to set
- */
- public void setScriptureReference(final String scriptureReference) {
- this.scriptureReference = scriptureReference;
- }
+ /**
+ * @param scriptureReference
+ * the scriptureReference to set
+ */
+ public void setScriptureReference(final String scriptureReference) {
+ this.scriptureReference = scriptureReference;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/GetTimelineUISetupCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,15 +13,15 @@
*/
public class GetTimelineUISetupCommand implements Action<GetTimelineUISetupResult> {
- /**
- * serial id
- */
- private static final long serialVersionUID = 7813083800240239846L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 7813083800240239846L;
- /**
- * public constructor
- */
- public GetTimelineUISetupCommand() {
+ /**
+ * public constructor
+ */
+ public GetTimelineUISetupCommand() {
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/command/InstallJswordModuleCommand.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,34 +12,35 @@
*/
public class InstallJswordModuleCommand implements Action<InstallJswordModuleResult> {
- /**
- * serial id
- */
- private static final long serialVersionUID = 3416377875572322721L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 3416377875572322721L;
- /**
- * the initials to be used to check/install the book
- */
- private String initials;
+ /**
+ * the initials to be used to check/install the book
+ */
+ private String initials;
- /**
- * the install jsword module command constructor
- */
- public InstallJswordModuleCommand() {
+ /**
+ * the install jsword module command constructor
+ */
+ public InstallJswordModuleCommand() {
- }
+ }
- /**
- * @return the initials of module to be installed
- */
- public String getInitials() {
- return initials;
- }
+ /**
+ * @return the initials of module to be installed
+ */
+ public String getInitials() {
+ return initials;
+ }
- /**
- * @param initials the initials of the module to set
- */
- public void setInitials(final String initials) {
- this.initials = initials;
- }
+ /**
+ * @param initials
+ * the initials of the module to set
+ */
+ public void setInitials(final String initials) {
+ this.initials = initials;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocation.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocation.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocation.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,129 +12,135 @@
*
*/
public class GeoLocation implements Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = -2429722523530262993L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -2429722523530262993L;
- /**
- * description of the location
- */
- private String description;
+ /**
+ * description of the location
+ */
+ private String description;
- /**
- * value of the latitude
- */
- private long latitude;
+ /**
+ * value of the latitude
+ */
+ private long latitude;
- /**
- * List of lat longs
- */
- private List<LatLong> latlongs;
+ /**
+ * List of lat longs
+ */
+ private List<LatLong> latlongs;
- /**
- * type of location, for e.g. a city, a memorial, a fountain, etc.
- */
- private GeoLocationType locationType;
+ /**
+ * type of location, for e.g. a city, a memorial, a fountain, etc.
+ */
+ private GeoLocationType locationType;
- /**
- * value of the longitude
- */
- private long longitude;
+ /**
+ * value of the longitude
+ */
+ private long longitude;
- /**
- * Name of the place, for e.g. Golgotha
- */
- private String placeName;
+ /**
+ * Name of the place, for e.g. Golgotha
+ */
+ private String placeName;
- /**
- * default constructor
- */
- public GeoLocation() {
- latlongs = new ArrayList<LatLong>();
- }
+ /**
+ * default constructor
+ */
+ public GeoLocation() {
+ latlongs = new ArrayList<LatLong>();
+ }
- /**
- * @return the description
- */
- public final String getDescription() {
- return description;
- }
+ /**
+ * @return the description
+ */
+ public final String getDescription() {
+ return description;
+ }
- /**
- * @return the latitude
- */
- public final long getLatitude() {
- return latitude;
- }
+ /**
+ * @return the latitude
+ */
+ public final long getLatitude() {
+ return latitude;
+ }
- /**
- * @return the latlongs
- */
- public final List<LatLong> getLatlongs() {
- return latlongs;
- }
+ /**
+ * @return the latlongs
+ */
+ public final List<LatLong> getLatlongs() {
+ return latlongs;
+ }
- /**
- * @return the locationType
- */
- public final GeoLocationType getLocationType() {
- return locationType;
- }
+ /**
+ * @return the locationType
+ */
+ public final GeoLocationType getLocationType() {
+ return locationType;
+ }
- /**
- * @return the longitude
- */
- public final long getLongitude() {
- return longitude;
- }
+ /**
+ * @return the longitude
+ */
+ public final long getLongitude() {
+ return longitude;
+ }
- /**
- * @return the placeName
- */
- public final String getPlaceName() {
- return placeName;
- }
+ /**
+ * @return the placeName
+ */
+ public final String getPlaceName() {
+ return placeName;
+ }
- /**
- * @param description the description to set
- */
- public final void setDescription(final String description) {
- this.description = description;
- }
+ /**
+ * @param description
+ * the description to set
+ */
+ public final void setDescription(final String description) {
+ this.description = description;
+ }
- /**
- * @param latitude the latitude to set
- */
- public final void setLatitude(final long latitude) {
- this.latitude = latitude;
- }
+ /**
+ * @param latitude
+ * the latitude to set
+ */
+ public final void setLatitude(final long latitude) {
+ this.latitude = latitude;
+ }
- /**
- * @param latlongs the latlongs to set
- */
- public final void setLatlongs(final List<LatLong> latlongs) {
- this.latlongs = latlongs;
- }
+ /**
+ * @param latlongs
+ * the latlongs to set
+ */
+ public final void setLatlongs(final List<LatLong> latlongs) {
+ this.latlongs = latlongs;
+ }
- /**
- * @param locationType the locationType to set
- */
- public final void setLocationType(final GeoLocationType locationType) {
- this.locationType = locationType;
- }
+ /**
+ * @param locationType
+ * the locationType to set
+ */
+ public final void setLocationType(final GeoLocationType locationType) {
+ this.locationType = locationType;
+ }
- /**
- * @param longitude the longitude to set
- */
- public final void setLongitude(final long longitude) {
- this.longitude = longitude;
- }
+ /**
+ * @param longitude
+ * the longitude to set
+ */
+ public final void setLongitude(final long longitude) {
+ this.longitude = longitude;
+ }
- /**
- * @param placeName the placeName to set
- */
- public final void setPlaceName(final String placeName) {
- this.placeName = placeName;
- }
+ /**
+ * @param placeName
+ * the placeName to set
+ */
+ public final void setPlaceName(final String placeName) {
+ this.placeName = placeName;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocationType.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocationType.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/GeoLocationType.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,11 +8,11 @@
*
*/
public enum GeoLocationType {
- /** CITY */
- CITY,
- /** A FOUNTAIN */
- FOUNTAIN,
- /** A REGION */
- REGION,
+ /** CITY */
+ CITY,
+ /** A FOUNTAIN */
+ FOUNTAIN,
+ /** A REGION */
+ REGION,
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/LatLong.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/LatLong.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/maps/LatLong.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,41 +7,43 @@
*
*/
public class LatLong {
- /**
- * latitude of the point
- */
- private long latitude;
+ /**
+ * latitude of the point
+ */
+ private long latitude;
- /**
- * longitude of the point
- */
- private long longitude;
+ /**
+ * longitude of the point
+ */
+ private long longitude;
- /**
- * @return the latitude
- */
- public final long getLatitude() {
- return latitude;
- }
+ /**
+ * @return the latitude
+ */
+ public final long getLatitude() {
+ return latitude;
+ }
- /**
- * @return the longitude
- */
- public final long getLongitude() {
- return longitude;
- }
+ /**
+ * @return the longitude
+ */
+ public final long getLongitude() {
+ return longitude;
+ }
- /**
- * @param latitude the latitude to set
- */
- public final void setLatitude(final long latitude) {
- this.latitude = latitude;
- }
+ /**
+ * @param latitude
+ * the latitude to set
+ */
+ public final void setLatitude(final long latitude) {
+ this.latitude = latitude;
+ }
- /**
- * @param longitude the longitude to set
- */
- public final void setLongitude(final long longitude) {
- this.longitude = longitude;
- }
+ /**
+ * @param longitude
+ * the longitude to set
+ */
+ public final void setLongitude(final long longitude) {
+ this.longitude = longitude;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/scripturelookup/BibleTextLookupType.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,14 +7,14 @@
*
*/
public enum BibleTextLookupType {
- /** a classic interlinear is required */
- CLASSIC_INTERLINEAR,
- /** a logical form, POJO form of the text is required */
- LOGICAL,
- /** only the text is required */
- PLAIN_TEXT,
- /** a reverse interlinear is required */
- REVERSE_INTERLINEAR,
- /** the text, using a default xslt is required */
- XSLT,
+ /** a classic interlinear is required */
+ CLASSIC_INTERLINEAR,
+ /** a logical form, POJO form of the text is required */
+ LOGICAL,
+ /** only the text is required */
+ PLAIN_TEXT,
+ /** a reverse interlinear is required */
+ REVERSE_INTERLINEAR,
+ /** the text, using a default xslt is required */
+ XSLT,
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimeBandVisibleDate.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimeBandVisibleDate.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimeBandVisibleDate.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -14,123 +14,130 @@
*/
public class TimeBandVisibleDate implements Serializable {
- /**
- * default serial id
- */
- private static final long serialVersionUID = -7384255321830177509L;
+ /**
+ * default serial id
+ */
+ private static final long serialVersionUID = -7384255321830177509L;
- /**
- * max date visible on the timeband
- */
- private long maxDate;
+ /**
+ * max date visible on the timeband
+ */
+ private long maxDate;
- /**
- * min date visible on the time band
- */
- private long minDate;
+ /**
+ * min date visible on the time band
+ */
+ private long minDate;
- /**
- * true indicates no request is required on the server
- */
- private boolean noRequest;
+ /**
+ * true indicates no request is required on the server
+ */
+ private boolean noRequest;
- /**
- * time band id
- */
- private int timebandId;
+ /**
+ * time band id
+ */
+ private int timebandId;
- /**
- * so that
- *
- * @param timebandId the timebandId referred to in the module
- * @param minDate minDate in the range of dates to ask the server
- * @param maxDate maxDate in the range of dates to the ask the server
- */
- public TimeBandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
- this.timebandId = timebandId;
- this.minDate = minDate;
- this.maxDate = maxDate;
- noRequest = false;
- }
+ /**
+ * so that
+ *
+ * @param timebandId
+ * the timebandId referred to in the module
+ * @param minDate
+ * minDate in the range of dates to ask the server
+ * @param maxDate
+ * maxDate in the range of dates to the ask the server
+ */
+ public TimeBandVisibleDate(final int timebandId, final long minDate, final long maxDate) {
+ this.timebandId = timebandId;
+ this.minDate = minDate;
+ this.maxDate = maxDate;
+ noRequest = false;
+ }
- /**
- * removing default constructor from view of other callers. Only accessible
- * through reflection, and therefore GWT
- */
- private TimeBandVisibleDate() {
- }
+ /**
+ * removing default constructor from view of other callers. Only accessible
+ * through reflection, and therefore GWT
+ */
+ private TimeBandVisibleDate() {
+ }
- /**
- * returns a TimeBandVisibleDate object tagged to indicate no request is
- * required on the server
- *
- * @return a marked TimeBandVisibleDate object, marked with a flag saying no
- * request is required
- */
- public static TimeBandVisibleDate getNoRequest() {
- final TimeBandVisibleDate tvd = new TimeBandVisibleDate();
- tvd.setNoRequest(true);
- return tvd;
- }
+ /**
+ * returns a TimeBandVisibleDate object tagged to indicate no request is
+ * required on the server
+ *
+ * @return a marked TimeBandVisibleDate object, marked with a flag saying no
+ * request is required
+ */
+ public static TimeBandVisibleDate getNoRequest() {
+ final TimeBandVisibleDate tvd = new TimeBandVisibleDate();
+ tvd.setNoRequest(true);
+ return tvd;
+ }
- /**
- * @return the maxDate
- */
- public long getMaxDate() {
- return maxDate;
- }
+ /**
+ * @return the maxDate
+ */
+ public long getMaxDate() {
+ return maxDate;
+ }
- /**
- * @return the minDate
- */
- public long getMinDate() {
- return minDate;
- }
+ /**
+ * @return the minDate
+ */
+ public long getMinDate() {
+ return minDate;
+ }
- /**
- * @return the timebandId
- */
- public int getTimebandId() {
- return timebandId;
- }
+ /**
+ * @return the timebandId
+ */
+ public int getTimebandId() {
+ return timebandId;
+ }
- /**
- * NoRequest determines whether the values in here should be sent back.
- * Perhaps we've got everything we need already, so we don't need to send
- * anything back to the server
- *
- * @return the noRequest
- */
- public boolean isNoRequest() {
- return noRequest;
- }
+ /**
+ * NoRequest determines whether the values in here should be sent back.
+ * Perhaps we've got everything we need already, so we don't need to send
+ * anything back to the server
+ *
+ * @return the noRequest
+ */
+ public boolean isNoRequest() {
+ return noRequest;
+ }
- /**
- * @param maxDate the maxDate to set
- */
- public void setMaxDate(final long maxDate) {
- this.maxDate = maxDate;
- }
+ /**
+ * @param maxDate
+ * the maxDate to set
+ */
+ public void setMaxDate(final long maxDate) {
+ this.maxDate = maxDate;
+ }
- /**
- * @param minDate the minDate to set
- */
- public void setMinDate(final long minDate) {
- this.minDate = minDate;
- }
+ /**
+ * @param minDate
+ * the minDate to set
+ */
+ public void setMinDate(final long minDate) {
+ this.minDate = minDate;
+ }
- /**
- * @param noRequest the noRequest to set
- */
- public void setNoRequest(final boolean noRequest) {
- this.noRequest = noRequest;
- }
+ /**
+ * @param noRequest
+ * the noRequest to set
+ */
+ public void setNoRequest(final boolean noRequest) {
+ this.noRequest = noRequest;
+ }
- /**
- * @param timebandId the timebandId to set
- */
- public void setTimebandId(final int timebandId) {
- this.timebandId = timebandId;
- }
+ /**
+ * @param timebandId
+ * the timebandId to set
+ */
+ public void setTimebandId(final int timebandId) {
+ this.timebandId = timebandId;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineBean.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,121 +10,124 @@
*
*/
public class TimelineBean implements Serializable {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -1734142151232501392L;
+ private static final long serialVersionUID = -1734142151232501392L;
- /**
- * Timeline description from the server layer
- */
- private String timelineDescription;
+ /**
+ * Timeline description from the server layer
+ */
+ private String timelineDescription;
- /**
- * timeline id sent across the wire
- */
- private int timelineId;
+ /**
+ * timeline id sent across the wire
+ */
+ private int timelineId;
- /**
- * unit to be used when first display the timeband
- */
- private String unit;
+ /**
+ * unit to be used when first display the timeband
+ */
+ private String unit;
- /**
- * default constructor made public
- */
- public TimelineBean() {
+ /**
+ * default constructor made public
+ */
+ public TimelineBean() {
- }
+ }
- /**
- * @return the timelineDescription
- */
- public String getTimelineDescription() {
- return timelineDescription;
- }
+ /**
+ * @return the timelineDescription
+ */
+ public String getTimelineDescription() {
+ return timelineDescription;
+ }
- /**
- * @return the timelineId
- */
- public int getTimelineId() {
- return timelineId;
- }
+ /**
+ * @return the timelineId
+ */
+ public int getTimelineId() {
+ return timelineId;
+ }
- /**
- * @return the unit
- */
- public String getUnit() {
- return unit;
- }
+ /**
+ * @return the unit
+ */
+ public String getUnit() {
+ return unit;
+ }
- /**
- * @param timelineDescription the timelineDescription to set
- */
- public void setTimelineDescription(final String timelineDescription) {
- this.timelineDescription = timelineDescription;
- }
+ /**
+ * @param timelineDescription
+ * the timelineDescription to set
+ */
+ public void setTimelineDescription(final String timelineDescription) {
+ this.timelineDescription = timelineDescription;
+ }
- /**
- * @param timelineId the timelineId to set
- */
- public void setTimelineId(final int timelineId) {
- this.timelineId = timelineId;
- }
+ /**
+ * @param timelineId
+ * the timelineId to set
+ */
+ public void setTimelineId(final int timelineId) {
+ this.timelineId = timelineId;
+ }
- /**
- * sets the unit field
- *
- * @param unit the unit to be set
- */
- public void setUnit(final String unit) {
- this.unit = unit;
+ /**
+ * sets the unit field
+ *
+ * @param unit
+ * the unit to be set
+ */
+ public void setUnit(final String unit) {
+ this.unit = unit;
- }
+ }
- // /**
- // * @return the minDate
- // */
- // public long getMinDate() {
- // return minDate;
- // }
- //
- // /**
- // * @param minDate the minDate to set
- // */
- // public void setMinDate(long minDate) {
- // this.minDate = minDate;
- // }
- //
- // /**
- // * @return the maxDate
- // */
- // public long getMaxDate() {
- // return maxDate;
- // }
- //
- // /**
- // * @param maxDate the maxDate to set
- // */
- // public void setMaxDate(long maxDate) {
- // this.maxDate = maxDate;
- // }
+ // /**
+ // * @return the minDate
+ // */
+ // public long getMinDate() {
+ // return minDate;
+ // }
+ //
+ // /**
+ // * @param minDate the minDate to set
+ // */
+ // public void setMinDate(long minDate) {
+ // this.minDate = minDate;
+ // }
+ //
+ // /**
+ // * @return the maxDate
+ // */
+ // public long getMaxDate() {
+ // return maxDate;
+ // }
+ //
+ // /**
+ // * @param maxDate the maxDate to set
+ // */
+ // public void setMaxDate(long maxDate) {
+ // this.maxDate = maxDate;
+ // }
- // /**
- // * @return the timelineCode
- // */
- // public String getTimelineCode() {
- // return timelineCode;
- // }
- //
- // public void setEventCount(int eventCount) {
- // this.eventCount = eventCount;
- // }
- //
- // /**
- // * @return the eventCount
- // */
- // public int getEventCount() {
- // return eventCount;
- // }
+ // /**
+ // * @return the timelineCode
+ // */
+ // public String getTimelineCode() {
+ // return timelineCode;
+ // }
+ //
+ // public void setEventCount(int eventCount) {
+ // this.eventCount = eventCount;
+ // }
+ //
+ // /**
+ // * @return the eventCount
+ // */
+ // public int getEventCount() {
+ // return eventCount;
+ // }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/common/timeline/TimelineEventBean.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,225 +11,242 @@
*/
public class TimelineEventBean implements Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = -7664806988001700477L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -7664806988001700477L;
- /**
- * The certainty of dating, as provided in input CSV files
- */
- private String certainty;
+ /**
+ * The certainty of dating, as provided in input CSV files
+ */
+ private String certainty;
- /**
- * the event id
- */
- private int eventId;
+ /**
+ * the event id
+ */
+ private int eventId;
- /**
- * the type of the event, where we distinguish battles, from births, etc.
- * (TODO: still to be done)
- */
- private int eventTypeId;
+ /**
+ * the type of the event, where we distinguish battles, from births, etc.
+ * (TODO: still to be done)
+ */
+ private int eventTypeId;
- /**
- * the from date
- */
- private Long fromDate;
+ /**
+ * the from date
+ */
+ private Long fromDate;
- /**
- * how precise the date is, whether to the day, month, etc. see schema
- * definition for details
- */
- private String fromPrecision;
+ /**
+ * how precise the date is, whether to the day, month, etc. see schema
+ * definition for details
+ */
+ private String fromPrecision;
- /**
- * Name/Description of the event
- */
- private String name;
+ /**
+ * Name/Description of the event
+ */
+ private String name;
- /**
- * The timeband/timeline on which the event should be displayed
- */
- private int timelineId;
+ /**
+ * The timeband/timeline on which the event should be displayed
+ */
+ private int timelineId;
- /**
- * the to-date in the case of a duration
- */
- private Long toDate;
+ /**
+ * the to-date in the case of a duration
+ */
+ private Long toDate;
- /**
- * the precision of the "to-date", whether to the day, month, etc. see
- * schema definition for details
- */
- private String toPrecision;
+ /**
+ * the precision of the "to-date", whether to the day, month, etc. see
+ * schema definition for details
+ */
+ private String toPrecision;
- /**
- * making public
- */
- public TimelineEventBean() {
+ /**
+ * making public
+ */
+ public TimelineEventBean() {
- }
+ }
- /**
- * a constructor to set up everything in one go
- *
- * @param eventId the event id from the database
- * @param fromDate the from date, at which the event starts/is
- * @param toDate the to date, if the date is a duratio
- * @param fromPrecision how precise the from date is (see schema for more
- * details)
- * @param toPrecision how precise the to date is (see schema for more
- * details)
- * @param name the description of the event
- * @param timelineId the timeband on which to be located
- * @param importanceId the importance id as defined in the input files
- * @param certainty the certainty as defined in the input files
- * @param eventTypeId the event type, describing different types, and
- * therefore different representations of the event on the UI
- *
- */
- // CHECKSTYLE:OFF
- public TimelineEventBean(final int eventId, final Long fromDate, final Long toDate,
- final String fromPrecision, final String toPrecision, final String name, final int timelineId,
- final int importanceId, final String certainty, final int eventTypeId) {
- // CHECKSTYLE:ON
- this.eventId = eventId;
- this.fromDate = fromDate;
- this.toDate = toDate;
- this.fromPrecision = fromPrecision;
- this.toPrecision = toPrecision;
- this.timelineId = timelineId;
- this.certainty = certainty;
- this.eventTypeId = eventTypeId;
- this.name = name;
- }
+ /**
+ * a constructor to set up everything in one go
+ *
+ * @param eventId
+ * the event id from the database
+ * @param fromDate
+ * the from date, at which the event starts/is
+ * @param toDate
+ * the to date, if the date is a duratio
+ * @param fromPrecision
+ * how precise the from date is (see schema for more details)
+ * @param toPrecision
+ * how precise the to date is (see schema for more details)
+ * @param name
+ * the description of the event
+ * @param timelineId
+ * the timeband on which to be located
+ * @param importanceId
+ * the importance id as defined in the input files
+ * @param certainty
+ * the certainty as defined in the input files
+ * @param eventTypeId
+ * the event type, describing different types, and therefore
+ * different representations of the event on the UI
+ *
+ */
+ // CHECKSTYLE:OFF
+ public TimelineEventBean(final int eventId, final Long fromDate, final Long toDate, final String fromPrecision,
+ final String toPrecision, final String name, final int timelineId, final int importanceId,
+ final String certainty, final int eventTypeId) {
+ // CHECKSTYLE:ON
+ this.eventId = eventId;
+ this.fromDate = fromDate;
+ this.toDate = toDate;
+ this.fromPrecision = fromPrecision;
+ this.toPrecision = toPrecision;
+ this.timelineId = timelineId;
+ this.certainty = certainty;
+ this.eventTypeId = eventTypeId;
+ this.name = name;
+ }
- /**
- * @return the certainty
- */
- public String getCertainty() {
- return certainty;
- }
+ /**
+ * @return the certainty
+ */
+ public String getCertainty() {
+ return certainty;
+ }
- /**
- * @return the eventId
- */
- public int getEventId() {
- return eventId;
- }
+ /**
+ * @return the eventId
+ */
+ public int getEventId() {
+ return eventId;
+ }
- /**
- * @return the eventTypeId
- */
- public int getEventTypeId() {
- return eventTypeId;
- }
+ /**
+ * @return the eventTypeId
+ */
+ public int getEventTypeId() {
+ return eventTypeId;
+ }
- /**
- * @return the fromDate
- */
- public Long getFromDate() {
- return fromDate;
- }
+ /**
+ * @return the fromDate
+ */
+ public Long getFromDate() {
+ return fromDate;
+ }
- /**
- * @return the fromPrecision
- */
- public String getFromPrecision() {
- return fromPrecision;
- }
+ /**
+ * @return the fromPrecision
+ */
+ public String getFromPrecision() {
+ return fromPrecision;
+ }
- /**
- * returns the name/description of the event
- *
- * @return the description of the event
- */
- public String getName() {
- return name;
- }
+ /**
+ * returns the name/description of the event
+ *
+ * @return the description of the event
+ */
+ public String getName() {
+ return name;
+ }
- /**
- * @return the timelineId
- */
- public int getTimelineId() {
- return timelineId;
- }
+ /**
+ * @return the timelineId
+ */
+ public int getTimelineId() {
+ return timelineId;
+ }
- /**
- * @return the toDate
- */
- public Long getToDate() {
- return toDate;
- }
+ /**
+ * @return the toDate
+ */
+ public Long getToDate() {
+ return toDate;
+ }
- /**
- * @return the toPrecision
- */
- public String getToPrecision() {
- return toPrecision;
- }
+ /**
+ * @return the toPrecision
+ */
+ public String getToPrecision() {
+ return toPrecision;
+ }
- /**
- * @param certainty the certainty to set
- */
- public void setCertainty(final String certainty) {
- this.certainty = certainty;
- }
+ /**
+ * @param certainty
+ * the certainty to set
+ */
+ public void setCertainty(final String certainty) {
+ this.certainty = certainty;
+ }
- /**
- * @param eventId the eventId to set
- */
- public void setEventId(final int eventId) {
- this.eventId = eventId;
- }
+ /**
+ * @param eventId
+ * the eventId to set
+ */
+ public void setEventId(final int eventId) {
+ this.eventId = eventId;
+ }
- /**
- * @param eventTypeId the eventTypeId to set
- */
- public void setEventTypeId(final int eventTypeId) {
- this.eventTypeId = eventTypeId;
- }
+ /**
+ * @param eventTypeId
+ * the eventTypeId to set
+ */
+ public void setEventTypeId(final int eventTypeId) {
+ this.eventTypeId = eventTypeId;
+ }
- /**
- * @param fromDate the fromDate to set
- */
- public void setFromDate(final Long fromDate) {
- this.fromDate = fromDate;
- }
+ /**
+ * @param fromDate
+ * the fromDate to set
+ */
+ public void setFromDate(final Long fromDate) {
+ this.fromDate = fromDate;
+ }
- /**
- * @param fromPrecision the fromPrecision to set
- */
- public void setFromPrecision(final String fromPrecision) {
- this.fromPrecision = fromPrecision;
- }
+ /**
+ * @param fromPrecision
+ * the fromPrecision to set
+ */
+ public void setFromPrecision(final String fromPrecision) {
+ this.fromPrecision = fromPrecision;
+ }
- /**
- * @param name the name to set
- */
- public void setName(final String name) {
- this.name = name;
- }
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
- /**
- * @param timelineId the timelineId to set
- */
- public void setTimelineId(final int timelineId) {
- this.timelineId = timelineId;
- }
+ /**
+ * @param timelineId
+ * the timelineId to set
+ */
+ public void setTimelineId(final int timelineId) {
+ this.timelineId = timelineId;
+ }
- /**
- * @param toDate the toDate to set
- */
- public void setToDate(final Long toDate) {
- this.toDate = toDate;
- }
+ /**
+ * @param toDate
+ * the toDate to set
+ */
+ public void setToDate(final Long toDate) {
+ this.toDate = toDate;
+ }
- /**
- * @param toPrecision the toPrecision to set
- */
- public void setToPrecision(final String toPrecision) {
- this.toPrecision = toPrecision;
- }
+ /**
+ * @param toPrecision
+ * the toPrecision to set
+ */
+ public void setToPrecision(final String toPrecision) {
+ this.toPrecision = toPrecision;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetAvailableBibleVersionsResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -17,20 +17,22 @@
*
*/
public class GetAvailableBibleVersionsResult implements Result {
- private static final long serialVersionUID = 1441380470741483969L;
+ private static final long serialVersionUID = 1441380470741483969L;
- List<BibleVersion> bibleVersions;
+ List<BibleVersion> bibleVersions;
- /**
- * @return the bibleVersions
- */
- public List<BibleVersion> getBibleVersions() {
- return bibleVersions;
- }
+ /**
+ * @return the bibleVersions
+ */
+ public List<BibleVersion> getBibleVersions() {
+ return bibleVersions;
+ }
- /**
- * @param bibleVersions the bibleVersions to set
- */
- public void setBibleVersions(List<BibleVersion> bibleVersions) {
- this.bibleVersions = bibleVersions;
- }}
+ /**
+ * @param bibleVersions
+ * the bibleVersions to set
+ */
+ public void setBibleVersions(final List<BibleVersion> bibleVersions) {
+ this.bibleVersions = bibleVersions;
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetBibleBooksCommandResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -14,39 +14,40 @@
*/
public class GetBibleBooksCommandResult implements Result {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -26170538247007172L;
+ private static final long serialVersionUID = -26170538247007172L;
- /**
- * the list of books
- */
- private List<String> books;
+ /**
+ * the list of books
+ */
+ private List<String> books;
- /**
- * the list of bible books provided to the constructor
- *
- * @param books the list of books
- */
- public GetBibleBooksCommandResult(final List<String> books) {
- this.books = books;
- }
+ /**
+ * the list of bible books provided to the constructor
+ *
+ * @param books
+ * the list of books
+ */
+ public GetBibleBooksCommandResult(final List<String> books) {
+ this.books = books;
+ }
- /**
- * this constructor is used for reflection and must be present
- */
- @SuppressWarnings("unused")
- private GetBibleBooksCommandResult() {
+ /**
+ * this constructor is used for reflection and must be present
+ */
+ @SuppressWarnings("unused")
+ private GetBibleBooksCommandResult() {
- }
+ }
- /**
- * returns a list of books
- *
- * @return the list of books
- */
- public Collection<String> getBooks() {
- return Collections.unmodifiableList(books);
- }
+ /**
+ * returns a list of books
+ *
+ * @return the list of books
+ */
+ public Collection<String> getBooks() {
+ return Collections.unmodifiableList(books);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetCurrentBibleTextResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,72 +12,75 @@
*/
public class GetCurrentBibleTextResult implements Result {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -5781394877510591218L;
+ private static final long serialVersionUID = -5781394877510591218L;
- /**
- * the passage in logical form
- */
- private Passage passage;
+ /**
+ * the passage in logical form
+ */
+ private Passage passage;
- /**
- * the passage text
- */
- private String passageText;
+ /**
+ * the passage text
+ */
+ private String passageText;
- /**
- * The xslted text
- */
- private String xsltedText;
+ /**
+ * The xslted text
+ */
+ private String xsltedText;
- /**
- * returns the logical form passage
- *
- * @return the logical form of the passage
- */
- public Passage getPassage() {
- return passage;
- }
+ /**
+ * returns the logical form passage
+ *
+ * @return the logical form of the passage
+ */
+ public Passage getPassage() {
+ return passage;
+ }
- /**
- * returns the passage text
- *
- * @return the passage text
- */
- public String getPassageText() {
- return passageText;
- }
+ /**
+ * returns the passage text
+ *
+ * @return the passage text
+ */
+ public String getPassageText() {
+ return passageText;
+ }
- /**
- * @return the xsltedText
- */
- public String getXsltedText() {
- return xsltedText;
- }
+ /**
+ * @return the xsltedText
+ */
+ public String getXsltedText() {
+ return xsltedText;
+ }
- /**
- * sets the logical form of the passage
- *
- * @param p passage
- */
- public void setPassage(final Passage p) {
- this.passage = p;
- }
+ /**
+ * sets the logical form of the passage
+ *
+ * @param p
+ * passage
+ */
+ public void setPassage(final Passage p) {
+ this.passage = p;
+ }
- /**
- * @param passageText the passageText to set
- */
- public void setPassageText(final String passageText) {
- this.passageText = passageText;
- }
+ /**
+ * @param passageText
+ * the passageText to set
+ */
+ public void setPassageText(final String passageText) {
+ this.passageText = passageText;
+ }
- /**
- * @param xsltedText the xsltedText to set
- */
- public void setXsltedText(final String xsltedText) {
- this.xsltedText = xsltedText;
- }
+ /**
+ * @param xsltedText
+ * the xsltedText to set
+ */
+ public void setXsltedText(final String xsltedText) {
+ this.xsltedText = xsltedText;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetDictionaryDefinitionResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,43 +11,45 @@
*/
public class GetDictionaryDefinitionResult implements Result {
- /**
- * serial id
- */
- private static final long serialVersionUID = 3121326970467885008L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 3121326970467885008L;
- /**
- * the xslted definition of the definition that was looked up
- */
- private String xsltedDefinition;
+ /**
+ * the xslted definition of the definition that was looked up
+ */
+ private String xsltedDefinition;
- /**
- * Default constructor
- */
- public GetDictionaryDefinitionResult() {
+ /**
+ * Default constructor
+ */
+ public GetDictionaryDefinitionResult() {
- }
+ }
- /**
- * @return the xsltedDefinition
- */
- public String getXsltedDefinition() {
- return xsltedDefinition;
- }
+ /**
+ * @return the xsltedDefinition
+ */
+ public String getXsltedDefinition() {
+ return xsltedDefinition;
+ }
- /**
- * sets the definition
- *
- * @param xsltedDefinition the definition to be set
- */
- public void setDefinition(final String xsltedDefinition) {
- this.xsltedDefinition = xsltedDefinition;
- }
+ /**
+ * sets the definition
+ *
+ * @param xsltedDefinition
+ * the definition to be set
+ */
+ public void setDefinition(final String xsltedDefinition) {
+ this.xsltedDefinition = xsltedDefinition;
+ }
- /**
- * @param xsltedDefinition the xsltedDefinition to set
- */
- public void setXsltedDefinition(final String xsltedDefinition) {
- this.xsltedDefinition = xsltedDefinition;
- }
+ /**
+ * @param xsltedDefinition
+ * the xsltedDefinition to set
+ */
+ public void setXsltedDefinition(final String xsltedDefinition) {
+ this.xsltedDefinition = xsltedDefinition;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetEventsForDateRangeResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -15,42 +15,44 @@
*/
public class GetEventsForDateRangeResult implements Result {
- /**
- * default serial id
- */
- private static final long serialVersionUID = 7118668612721569823L;
+ /**
+ * default serial id
+ */
+ private static final long serialVersionUID = 7118668612721569823L;
- /** list of events */
- private List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
+ /** list of events */
+ private List<TimelineEventBean> events = new ArrayList<TimelineEventBean>();
- /**
- * public constructor
- */
- public GetEventsForDateRangeResult() {
+ /**
+ * public constructor
+ */
+ public GetEventsForDateRangeResult() {
- }
+ }
- /**
- * Adds a new Event in Tim to the response
- *
- * @param teb the event to add to the response
- */
- public void add(final TimelineEventBean teb) {
- getEvents().add(teb);
+ /**
+ * Adds a new Event in Tim to the response
+ *
+ * @param teb
+ * the event to add to the response
+ */
+ public void add(final TimelineEventBean teb) {
+ getEvents().add(teb);
- }
+ }
- /**
- * @return a list of events within a specified date range
- */
- public List<TimelineEventBean> getEvents() {
- return events;
- }
+ /**
+ * @return a list of events within a specified date range
+ */
+ public List<TimelineEventBean> getEvents() {
+ return events;
+ }
- /**
- * @param events the events to set
- */
- public void setEvents(final List<TimelineEventBean> events) {
- this.events = events;
- }
+ /**
+ * @param events
+ * the events to set
+ */
+ public void setEvents(final List<TimelineEventBean> events) {
+ this.events = events;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetLocationsResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,35 +16,36 @@
*/
public class GetLocationsResult implements Result {
- /**
- * serial id for serialisation
- */
- private static final long serialVersionUID = 1516648078862839012L;
+ /**
+ * serial id for serialisation
+ */
+ private static final long serialVersionUID = 1516648078862839012L;
- /**
- * list of locations
- */
- private List<GeoLocation> locations;
+ /**
+ * list of locations
+ */
+ private List<GeoLocation> locations;
- /**
- * default constructor
- */
- public GetLocationsResult() {
- locations = new ArrayList<GeoLocation>();
- }
+ /**
+ * default constructor
+ */
+ public GetLocationsResult() {
+ locations = new ArrayList<GeoLocation>();
+ }
- /**
- * @return the locations
- */
- public final List<GeoLocation> getLocations() {
- return locations;
- }
+ /**
+ * @return the locations
+ */
+ public final List<GeoLocation> getLocations() {
+ return locations;
+ }
- /**
- * @param locations the locations to set
- */
- public final void setLocations(final List<GeoLocation> locations) {
- this.locations = locations;
- }
+ /**
+ * @param locations
+ * the locations to set
+ */
+ public final void setLocations(final List<GeoLocation> locations) {
+ this.locations = locations;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineOriginForScriptureResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -13,119 +13,127 @@
*
*/
public class GetTimelineOriginForScriptureResult implements Result {
- /**
- * generated serial version id
- */
- private static final long serialVersionUID = 4256230588330550554L;
+ /**
+ * generated serial version id
+ */
+ private static final long serialVersionUID = 4256230588330550554L;
- /**
- * whether no data was returned, because no events matched the biblical
- * reference
- */
- private boolean isEmpty;
+ /**
+ * whether no data was returned, because no events matched the biblical
+ * reference
+ */
+ private boolean isEmpty;
- /**
- * the date of the recommended
- */
- private Long originDate;
+ /**
+ * the date of the recommended
+ */
+ private Long originDate;
- /**
- * the suggested timescale the UI should use
- */
- private Unit suggestedTimeScale;
+ /**
+ * the suggested timescale the UI should use
+ */
+ private Unit suggestedTimeScale;
- /**
- * the timeband id on which this date should be used
- */
- private int timebandId;
+ /**
+ * the timeband id on which this date should be used
+ */
+ private int timebandId;
- /**
- * public constructor for this result object
- *
- * @param isEmpty true if no data was found
- */
- public GetTimelineOriginForScriptureResult(final boolean isEmpty) {
- this.isEmpty = isEmpty;
- }
+ /**
+ * public constructor for this result object
+ *
+ * @param isEmpty
+ * true if no data was found
+ */
+ public GetTimelineOriginForScriptureResult(final boolean isEmpty) {
+ this.isEmpty = isEmpty;
+ }
- /**
- * another constructor to provide the correct origin information, including
- *
- * @param originDate the date at which the timeline should be positioned
- * @param unit the unit that should be used for this timeband
- * @param timebandId the timeband id
- */
- public GetTimelineOriginForScriptureResult(final Long originDate, final Unit unit, final int timebandId) {
- this.originDate = originDate;
- this.suggestedTimeScale = unit;
- this.timebandId = timebandId;
- isEmpty = false;
- }
+ /**
+ * another constructor to provide the correct origin information, including
+ *
+ * @param originDate
+ * the date at which the timeline should be positioned
+ * @param unit
+ * the unit that should be used for this timeband
+ * @param timebandId
+ * the timeband id
+ */
+ public GetTimelineOriginForScriptureResult(final Long originDate, final Unit unit, final int timebandId) {
+ this.originDate = originDate;
+ this.suggestedTimeScale = unit;
+ this.timebandId = timebandId;
+ isEmpty = false;
+ }
- /**
- * private constructor, used by GWT serialisation
- */
- @SuppressWarnings("unused")
- private GetTimelineOriginForScriptureResult() {
+ /**
+ * private constructor, used by GWT serialisation
+ */
+ @SuppressWarnings("unused")
+ private GetTimelineOriginForScriptureResult() {
- }
+ }
- /**
- * @return the originDate
- */
- public Long getOriginDate() {
- return originDate;
- }
+ /**
+ * @return the originDate
+ */
+ public Long getOriginDate() {
+ return originDate;
+ }
- /**
- * @return the suggestedTimeScale
- */
- public Unit getSuggestedTimeScale() {
- return suggestedTimeScale;
- }
+ /**
+ * @return the suggestedTimeScale
+ */
+ public Unit getSuggestedTimeScale() {
+ return suggestedTimeScale;
+ }
- /**
- * gets the timeband id
- *
- * @return timebandId
- */
- public int getTimebandId() {
- return timebandId;
- }
+ /**
+ * gets the timeband id
+ *
+ * @return timebandId
+ */
+ public int getTimebandId() {
+ return timebandId;
+ }
- /**
- * @return the isEmpty
- */
- public boolean isEmpty() {
- return isEmpty;
- }
+ /**
+ * @return the isEmpty
+ */
+ public boolean isEmpty() {
+ return isEmpty;
+ }
- /**
- * @param isEmpty the isEmpty to set
- */
- public void setEmpty(final boolean isEmpty) {
- this.isEmpty = isEmpty;
- }
+ /**
+ * @param isEmpty
+ * the isEmpty to set
+ */
+ public void setEmpty(final boolean isEmpty) {
+ this.isEmpty = isEmpty;
+ }
- /**
- * @param originDate the originDate to set
- */
- public void setOriginDate(final Long originDate) {
- this.originDate = originDate;
- }
+ /**
+ * @param originDate
+ * the originDate to set
+ */
+ public void setOriginDate(final Long originDate) {
+ this.originDate = originDate;
+ }
- /**
- * @param unit the suggestedTimeScale to set
- */
- public void setSuggestedTimeScale(final Unit unit) {
- this.suggestedTimeScale = unit;
- }
+ /**
+ * @param unit
+ * the suggestedTimeScale to set
+ */
+ public void setSuggestedTimeScale(final Unit unit) {
+ this.suggestedTimeScale = unit;
+ }
- /**
- * @param timebandId the timebandId to set
- */
- public void setTimebandId(final int timebandId) {
- this.timebandId = timebandId;
- }
+ /**
+ * @param timebandId
+ * the timebandId to set
+ */
+ public void setTimebandId(final int timebandId) {
+ this.timebandId = timebandId;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/GetTimelineUISetupResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -16,38 +16,39 @@
*/
public class GetTimelineUISetupResult implements Result {
- /**
- * serial id
- */
- private static final long serialVersionUID = -566447989637280143L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -566447989637280143L;
- /**
- * A list of timebands
- */
- private List<TimelineBean> tlb;
+ /**
+ * A list of timebands
+ */
+ private List<TimelineBean> tlb;
- /**
- * Default constructor made public
- */
- public GetTimelineUISetupResult() {
+ /**
+ * Default constructor made public
+ */
+ public GetTimelineUISetupResult() {
- }
+ }
- /**
- * returns a list of timebands
- *
- * @return a list of timeband beans
- */
- public List<TimelineBean> getTimelines() {
- return tlb;
- }
+ /**
+ * returns a list of timebands
+ *
+ * @return a list of timeband beans
+ */
+ public List<TimelineBean> getTimelines() {
+ return tlb;
+ }
- /**
- * sets the list. made available for reflection
- *
- * @param tlb the list of timeline beans
- */
- public void setTimelines(final List<TimelineBean> tlb) {
- this.tlb = tlb;
- }
+ /**
+ * sets the list. made available for reflection
+ *
+ * @param tlb
+ * the list of timeline beans
+ */
+ public void setTimelines(final List<TimelineBean> tlb) {
+ this.tlb = tlb;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/InstallJswordModuleResult.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,44 +11,46 @@
*
*/
public class InstallJswordModuleResult implements Result {
- /**
- * generated serial id
- */
- private static final long serialVersionUID = -5063510082176727310L;
+ /**
+ * generated serial id
+ */
+ private static final long serialVersionUID = -5063510082176727310L;
- /**
- * true if installation was successful
- */
- private boolean successful;
+ /**
+ * true if installation was successful
+ */
+ private boolean successful;
- /**
- * Default constructor made public
- */
- public InstallJswordModuleResult() {
+ /**
+ * Default constructor made public
+ */
+ public InstallJswordModuleResult() {
- }
+ }
- /**
- * Constructor with the success flag passed in
- *
- * @param successful true to indicate success
- */
- public InstallJswordModuleResult(final boolean successful) {
- this.successful = successful;
+ /**
+ * Constructor with the success flag passed in
+ *
+ * @param successful
+ * true to indicate success
+ */
+ public InstallJswordModuleResult(final boolean successful) {
+ this.successful = successful;
- }
+ }
- /**
- * @return the successful
- */
- public boolean isSuccessful() {
- return successful;
- }
+ /**
+ * @return the successful
+ */
+ public boolean isSuccessful() {
+ return successful;
+ }
- /**
- * @param successful the successful to set
- */
- public void setSuccessful(final boolean successful) {
- this.successful = successful;
- }
+ /**
+ * @param successful
+ * the successful to set
+ */
+ public void setSuccessful(final boolean successful) {
+ this.successful = successful;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/beans/BibleVersion.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/beans/BibleVersion.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/result/beans/BibleVersion.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -3,51 +3,61 @@
import java.io.Serializable;
/**
- * Contains information about a bible version to be displayed on the screen in the UI
+ * Contains information about a bible version to be displayed on the screen in
+ * the UI
+ *
* @author CJBurrell
- *
+ *
*/
public class BibleVersion implements Serializable {
- private static final long serialVersionUID = 6598606392490334637L;
- private String initials;
- private String name;
- private String language;
-
- /**
- * @return the initials
- */
- public String getInitials() {
- return initials;
- }
- /**
- * @param initials the initials to set
- */
- public void setInitials(String initials) {
- this.initials = initials;
- }
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
- /**
- * @return the language
- */
- public String getLanguage() {
- return language;
- }
- /**
- * @param language the language to set
- */
- public void setLanguage(String language) {
- this.language = language;
- }
-
+ private static final long serialVersionUID = 6598606392490334637L;
+ private String initials;
+ private String name;
+ private String language;
+
+ /**
+ * @return the initials
+ */
+ public String getInitials() {
+ return initials;
+ }
+
+ /**
+ * @param initials
+ * the initials to set
+ */
+ public void setInitials(final String initials) {
+ this.initials = initials;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the language
+ */
+ public String getLanguage() {
+ return language;
+ }
+
+ /**
+ * @param language
+ * the language to set
+ */
+ public void setLanguage(final String language) {
+ this.language = language;
+ }
+
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Milestone.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,52 +10,54 @@
*
*/
public class Milestone extends Text implements TextualElement, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = 6444472622836494795L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 6444472622836494795L;
- /**
- * optional marker
- */
- private String marker;
+ /**
+ * optional marker
+ */
+ private String marker;
- /**
- * Type of milestone, see OSIS details for clarifications
- */
- private String type;
+ /**
+ * Type of milestone, see OSIS details for clarifications
+ */
+ private String type;
- /**
- * Default constructor made public
- */
- public Milestone() {
- }
+ /**
+ * Default constructor made public
+ */
+ public Milestone() {
+ }
- /**
- * @return the marker
- */
- public String getMarker() {
- return marker;
- }
+ /**
+ * @return the marker
+ */
+ public String getMarker() {
+ return marker;
+ }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
- /**
- * @param marker the marker to set
- */
- public void setMarker(final String marker) {
- this.marker = marker;
- }
+ /**
+ * @param marker
+ * the marker to set
+ */
+ public void setMarker(final String marker) {
+ this.marker = marker;
+ }
- /**
- * @param type the type to set
- */
- public void setType(final String type) {
- this.type = type;
- }
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(final String type) {
+ this.type = type;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Note.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -10,33 +10,34 @@
*
*/
public class Note extends Text implements TextualElement, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = 4592986819523938392L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 4592986819523938392L;
- /**
- * The type of note
- */
- private String type;
+ /**
+ * The type of note
+ */
+ private String type;
- /**
- * Default constructor made public
- */
- public Note() {
- }
+ /**
+ * Default constructor made public
+ */
+ public Note() {
+ }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
- /**
- * @param type the type to set
- */
- public void setType(final String type) {
- this.type = type;
- }
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(final String type) {
+ this.type = type;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/OSISConstants.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,37 +7,37 @@
*
*/
public final class OSISConstants {
- /**
- * A marker in the text, for formatting purposes: TODO: check this and the
- * other two with online people
- */
- public static final String MARKER = "marker";
+ /**
+ * A marker in the text, for formatting purposes: TODO: check this and the
+ * other two with online people
+ */
+ public static final String MARKER = "marker";
- /**
- * A milestone, between two portions of scripture
- */
- public static final String MILESTONE = "milestone";
+ /**
+ * A milestone, between two portions of scripture
+ */
+ public static final String MILESTONE = "milestone";
- /**
- * A decision by the translator to make a change?
- */
- public static final String TRANS_CHANGE = "transChange";
+ /**
+ * A decision by the translator to make a change?
+ */
+ public static final String TRANS_CHANGE = "transChange";
- // public static final String LEMMA = "lemma";
- // public static final String MORPH = "morph";
- // public static final Object NOTE = "note";
- // public static final String OSISID = "osisID";
- // public static final String TITLE = "title";
+ // public static final String LEMMA = "lemma";
+ // public static final String MORPH = "morph";
+ // public static final Object NOTE = "note";
+ // public static final String OSISID = "osisID";
+ // public static final String TITLE = "title";
- // public static final String TYPE = "type";
- // public static final String VERSE = "verse";
- // public static final String WORD = "w";
+ // public static final String TYPE = "type";
+ // public static final String VERSE = "verse";
+ // public static final String WORD = "w";
- /**
- * Making the constructor private
- */
- private OSISConstants() {
+ /**
+ * Making the constructor private
+ */
+ private OSISConstants() {
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Passage.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,64 +11,66 @@
*
*/
public class Passage implements TextualElement, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = -3926440372519158967L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -3926440372519158967L;
- /**
- * List of verses/title throughout the passage
- */
- private List<VerseContent> verseContent;
+ /**
+ * List of verses/title throughout the passage
+ */
+ private List<VerseContent> verseContent;
- /**
- * making the constructor public and initialising list
- */
- public Passage() {
- verseContent = new ArrayList<VerseContent>();
- }
+ /**
+ * making the constructor public and initialising list
+ */
+ public Passage() {
+ verseContent = new ArrayList<VerseContent>();
+ }
- /**
- * Adding a passage element, such as a {@link Verse} or a {@link Title}
- *
- * @param vc a verse or a title
- */
- public void addPassageElement(final VerseContent vc) {
- verseContent.add(vc);
- }
+ /**
+ * Adding a passage element, such as a {@link Verse} or a {@link Title}
+ *
+ * @param vc
+ * a verse or a title
+ */
+ public void addPassageElement(final VerseContent vc) {
+ verseContent.add(vc);
+ }
- /**
- * returns the text representation of a passage. This is NOT performance
- * optimized and therefore should not be used more than once.
- * Non-optimization is due to the fact that we won't to reduce traffic over
- * the wire
- *
- *TODO: this could be further optimized by not relying on strings in
- * versecontent being returned as strings
- *
- * @return the passage in a string form.
- */
- public String getText() {
- final StringBuffer text = new StringBuffer(1024);
- for (final VerseContent vc : verseContent) {
- if (!(vc instanceof Title)) {
- text.append(vc.getText());
- }
- }
- return text.toString();
- }
+ /**
+ * returns the text representation of a passage. This is NOT performance
+ * optimized and therefore should not be used more than once.
+ * Non-optimization is due to the fact that we won't to reduce traffic over
+ * the wire
+ *
+ *TODO: this could be further optimized by not relying on strings in
+ * versecontent being returned as strings
+ *
+ * @return the passage in a string form.
+ */
+ public String getText() {
+ final StringBuffer text = new StringBuffer(1024);
+ for (final VerseContent vc : verseContent) {
+ if (!(vc instanceof Title)) {
+ text.append(vc.getText());
+ }
+ }
+ return text.toString();
+ }
- /**
- * @return the verseContent list of a combination of verses and titles
- */
- public List<VerseContent> getVerseContent() {
- return verseContent;
- }
+ /**
+ * @return the verseContent list of a combination of verses and titles
+ */
+ public List<VerseContent> getVerseContent() {
+ return verseContent;
+ }
- /**
- * @param verseContent the verseContent to set
- */
- public void setVerseContent(final List<VerseContent> verseContent) {
- this.verseContent = verseContent;
- }
+ /**
+ * @param verseContent
+ * the verseContent to set
+ */
+ public void setVerseContent(final List<VerseContent> verseContent) {
+ this.verseContent = verseContent;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Text.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,43 +9,45 @@
*
*/
public class Text implements TextualElement, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = -7068301858306124428L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -7068301858306124428L;
- /**
- * the string representing the portion of scripture for each OSIS element
- */
- private String text;
+ /**
+ * the string representing the portion of scripture for each OSIS element
+ */
+ private String text;
- /**
- * A simple text, default constructor made public
- */
- public Text() {
- }
+ /**
+ * A simple text, default constructor made public
+ */
+ public Text() {
+ }
- /**
- * Initialising a text with a String
- *
- * @param text text is the string representation of the #text element
- */
- public Text(final String text) {
- this.text = text;
- }
+ /**
+ * Initialising a text with a String
+ *
+ * @param text
+ * text is the string representation of the #text element
+ */
+ public Text(final String text) {
+ this.text = text;
+ }
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
- /**
- * @param text the text to set
- */
- public void setText(final String text) {
- this.text = text;
- }
+ /**
+ * @param text
+ * the text to set
+ */
+ public void setText(final String text) {
+ this.text = text;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TextualElement.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,10 +9,10 @@
*/
public interface TextualElement {
- /**
- * returns the text
- *
- * @return text to be returned
- */
- String getText();
+ /**
+ * returns the text
+ *
+ * @return text to be returned
+ */
+ String getText();
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Title.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -7,37 +7,38 @@
*
*/
public class Title extends Text implements VerseContent {
- /**
- * serial id
- */
- private static final long serialVersionUID = -4362500737203594954L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -4362500737203594954L;
- /**
- * Type of title as defined in OSIS spec
- */
- private String type;
+ /**
+ * Type of title as defined in OSIS spec
+ */
+ private String type;
- /**
- * Making default constructor public
- */
- public Title() {
- }
+ /**
+ * Making default constructor public
+ */
+ public Title() {
+ }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
- /**
- * type of title
- *
- * @param type title
- */
- public void setType(final String type) {
- this.type = type;
+ /**
+ * type of title
+ *
+ * @param type
+ * title
+ */
+ public void setType(final String type) {
+ this.type = type;
- }
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/TransChange.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -9,33 +9,34 @@
*
*/
public class TransChange extends Text implements TextualElement, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = 4557607388014222750L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = 4557607388014222750L;
- /**
- * Type of trans change
- */
- private String type;
+ /**
+ * Type of trans change
+ */
+ private String type;
- /**
- * Default constructor made public
- */
- public TransChange() {
- }
+ /**
+ * Default constructor made public
+ */
+ public TransChange() {
+ }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
+ /**
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
- /**
- * @param type the type to set
- */
- public void setType(final String type) {
- this.type = type;
- }
+ /**
+ * @param type
+ * the type to set
+ */
+ public void setType(final String type) {
+ this.type = type;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Verse.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,82 +11,85 @@
*
*/
public class Verse implements VerseContent, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = -7000973434382091156L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -7000973434382091156L;
- /**
- * the OSIS key, for e.g. gen 1:1
- */
- private String osisID;
+ /**
+ * the OSIS key, for e.g. gen 1:1
+ */
+ private String osisID;
- /**
- * list of textual elements that are contained in this verse
- */
- private List<TextualElement> verseContent;
+ /**
+ * list of textual elements that are contained in this verse
+ */
+ private List<TextualElement> verseContent;
- /**
- * public constructor to create a logical form of a verse
- */
- public Verse() {
- verseContent = new ArrayList<TextualElement>();
- }
+ /**
+ * public constructor to create a logical form of a verse
+ */
+ public Verse() {
+ verseContent = new ArrayList<TextualElement>();
+ }
- /**
- * adds a textual element to the verse
- *
- * @param te textual element
- */
- public void addTextualElement(final TextualElement te) {
- this.verseContent.add(te);
- }
+ /**
+ * adds a textual element to the verse
+ *
+ * @param te
+ * textual element
+ */
+ public void addTextualElement(final TextualElement te) {
+ this.verseContent.add(te);
+ }
- /**
- * @return the osisID
- */
- public String getOsisID() {
- return osisID;
- }
+ /**
+ * @return the osisID
+ */
+ public String getOsisID() {
+ return osisID;
+ }
- /**
- * This method is not optimized for performance. It iterates through the
- * list each time it is required. The reason it is not optimized, is that it
- * should not be used except to display the text once.
- *
- * Not storing the result of the concatenation enables us to have shorted
- * messages going across the wire
- *
- * @return the concatenated text
- */
- public String getText() {
- final StringBuilder sb = new StringBuilder(128);
- for (final TextualElement te : verseContent) {
- if (!(te instanceof Note)) {
- sb.append(te.getText());
- }
- }
- return sb.toString();
- }
+ /**
+ * This method is not optimized for performance. It iterates through the
+ * list each time it is required. The reason it is not optimized, is that it
+ * should not be used except to display the text once.
+ *
+ * Not storing the result of the concatenation enables us to have shorted
+ * messages going across the wire
+ *
+ * @return the concatenated text
+ */
+ public String getText() {
+ final StringBuilder sb = new StringBuilder(128);
+ for (final TextualElement te : verseContent) {
+ if (!(te instanceof Note)) {
+ sb.append(te.getText());
+ }
+ }
+ return sb.toString();
+ }
- /**
- * @return the text
- */
- public List<TextualElement> getVerseContent() {
- return verseContent;
- }
+ /**
+ * @return the text
+ */
+ public List<TextualElement> getVerseContent() {
+ return verseContent;
+ }
- /**
- * @param osisID the osisID to set
- */
- public void setOsisID(final String osisID) {
- this.osisID = osisID;
- }
+ /**
+ * @param osisID
+ * the osisID to set
+ */
+ public void setOsisID(final String osisID) {
+ this.osisID = osisID;
+ }
- /**
- * @param text the text to set
- */
- public void setVerseContent(final List<TextualElement> text) {
- this.verseContent = text;
- }
+ /**
+ * @param text
+ * the text to set
+ */
+ public void setVerseContent(final List<TextualElement> text) {
+ this.verseContent = text;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/scripture/Word.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -15,123 +15,129 @@
*
*/
public class Word extends Text implements TextualElement, Serializable {
- /**
- * serial id
- */
- private static final long serialVersionUID = -5750252359953024623L;
+ /**
+ * serial id
+ */
+ private static final long serialVersionUID = -5750252359953024623L;
- /**
- * An alternative word, such as a different language
- */
- private String alternativeWord;
+ /**
+ * An alternative word, such as a different language
+ */
+ private String alternativeWord;
- // TODO: FIX: this is a bug, we can have several lemmas or morphologies for
- // one translated word
- /**
- * a list of lemmas referring to a portion of text
- */
- private List<String> lemma;
+ // TODO: FIX: this is a bug, we can have several lemmas or morphologies for
+ // one translated word
+ /**
+ * a list of lemmas referring to a portion of text
+ */
+ private List<String> lemma;
- /**
- * A list of morphs referring to a portion of text. A morph is a coded
- * string indicating the grammar and form of the original word
- */
- private List<String> morph;
+ /**
+ * A list of morphs referring to a portion of text. A morph is a coded
+ * string indicating the grammar and form of the original word
+ */
+ private List<String> morph;
- /**
- * default constructor initialises internal lists
- */
- public Word() {
- lemma = new ArrayList<String>();
- morph = new ArrayList<String>();
- }
+ /**
+ * default constructor initialises internal lists
+ */
+ public Word() {
+ lemma = new ArrayList<String>();
+ morph = new ArrayList<String>();
+ }
- /**
- * Adds a new lemma to the Word
- *
- * @param newLemma the lemma to set
- */
- public void addLemma(final String newLemma) {
- lemma.add(newLemma);
- }
+ /**
+ * Adds a new lemma to the Word
+ *
+ * @param newLemma
+ * the lemma to set
+ */
+ public void addLemma(final String newLemma) {
+ lemma.add(newLemma);
+ }
- /**
- * Adds an array of lemmas to the Word
- *
- * @param lemmas a list of lemmas
- */
- public void addLemmas(final String[] lemmas) {
- for (final String l : lemmas) {
- this.lemma.add(l);
- }
- }
+ /**
+ * Adds an array of lemmas to the Word
+ *
+ * @param lemmas
+ * a list of lemmas
+ */
+ public void addLemmas(final String[] lemmas) {
+ for (final String l : lemmas) {
+ this.lemma.add(l);
+ }
+ }
- /**
- * Adds an array of morphs to the Word
- *
- * @param morphs array of morphs to be associated with the Word (portion of
- * a verse)
- */
- public void addMorphs(final String[] morphs) {
- for (final String m : morphs) {
- this.morph.add(m);
- }
+ /**
+ * Adds an array of morphs to the Word
+ *
+ * @param morphs
+ * array of morphs to be associated with the Word (portion of a
+ * verse)
+ */
+ public void addMorphs(final String[] morphs) {
+ for (final String m : morphs) {
+ this.morph.add(m);
+ }
- }
+ }
- /**
- * @return the alternativeWord
- */
- public String getAlternativeWord() {
- return alternativeWord;
- }
+ /**
+ * @return the alternativeWord
+ */
+ public String getAlternativeWord() {
+ return alternativeWord;
+ }
- /**
- * @return the lemma
- */
- public List<String> getLemma() {
- return lemma;
- }
+ /**
+ * @return the lemma
+ */
+ public List<String> getLemma() {
+ return lemma;
+ }
- /**
- * @return the morph
- */
- public List<String> getMorph() {
- return morph;
- }
+ /**
+ * @return the morph
+ */
+ public List<String> getMorph() {
+ return morph;
+ }
- /**
- * sets an alternative word (such as a hebrew original word)
- *
- * @param alternativeWord a word equivalent, different language. For e.g.
- * Hebrew word
- *
- */
- public void setAlternativeWord(final String alternativeWord) {
- this.alternativeWord = alternativeWord;
- }
+ /**
+ * sets an alternative word (such as a hebrew original word)
+ *
+ * @param alternativeWord
+ * a word equivalent, different language. For e.g. Hebrew word
+ *
+ */
+ public void setAlternativeWord(final String alternativeWord) {
+ this.alternativeWord = alternativeWord;
+ }
- /**
- * @param lemma the lemma to set
- */
- public void setLemma(final List<String> lemma) {
- this.lemma = lemma;
- }
+ /**
+ * @param lemma
+ * the lemma to set
+ */
+ public void setLemma(final List<String> lemma) {
+ this.lemma = lemma;
+ }
- /**
- * @param morph the morph to set
- */
- public void setMorph(final List<String> morph) {
- this.morph = morph;
- }
+ /**
+ * @param morph
+ * the morph to set
+ */
+ public void setMorph(final List<String> morph) {
+ this.morph = morph;
+ }
- /**
- * Adding a morph to the Word
- *
- * @param newMorph the morph to set
- */
- public void setMorph(final String newMorph) {
- morph.add(newMorph);
- }
+ /**
+ * Adding a morph to the Word
+ *
+ * @param newMorph
+ * the morph to set
+ */
+ public void setMorph(final String newMorph) {
+ morph.add(newMorph);
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/timeline/Unit.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/timeline/Unit.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/timeline/Unit.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -8,93 +8,96 @@
*
*/
public enum Unit {
- /**
- * century
- */
- CENTURY(10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
- /**
- * day
- */
- DAY(24L * 3600L * 1000L, "dd MMM yyyy G"),
- /**
- * decade
- */
- DECADE(10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
- /**
- * hour
- */
- HOUR(3600L * 1000L),
- /**
- * 1000 years
- */
- MILLENIUM(10L * 10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
- /**
- * a minute
- */
- MINUTE(60L * 1000L),
- /**
- * a month
- */
- // CHECKSTYLE:OFF
- MONTH((365L * 24L * 3600L * 1000L) / 12, "MMM yyyy G"),
- // CHECKSTYLE:ON
- /**
- * a second
- */
- SECOND(1000L),
- /**
- * a week
- *
- */
- WEEK(7L * 24L * 3600L * 1000L, "dd MMM yyyy G"),
- /**
- * a year
- */
- YEAR(365L * 24 * 3600 * 1000L, "yyyy G");
+ /**
+ * century
+ */
+ CENTURY(10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
+ /**
+ * day
+ */
+ DAY(24L * 3600L * 1000L, "dd MMM yyyy G"),
+ /**
+ * decade
+ */
+ DECADE(10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
+ /**
+ * hour
+ */
+ HOUR(3600L * 1000L),
+ /**
+ * 1000 years
+ */
+ MILLENIUM(10L * 10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
+ /**
+ * a minute
+ */
+ MINUTE(60L * 1000L),
+ /**
+ * a month
+ */
+ // CHECKSTYLE:OFF
+ MONTH((365L * 24L * 3600L * 1000L) / 12, "MMM yyyy G"),
+ // CHECKSTYLE:ON
+ /**
+ * a second
+ */
+ SECOND(1000L),
+ /**
+ * a week
+ *
+ */
+ WEEK(7L * 24L * 3600L * 1000L, "dd MMM yyyy G"),
+ /**
+ * a year
+ */
+ YEAR(365L * 24 * 3600 * 1000L, "yyyy G");
- /**
- * format to be applied when displaying
- */
- private final String format;
- /**
- * length of unit in milliseconds
- */
- private final long milliseconds;
+ /**
+ * format to be applied when displaying
+ */
+ private final String format;
+ /**
+ * length of unit in milliseconds
+ */
+ private final long milliseconds;
- /**
- * constructor to create a unit, with a default format of dd MMM YYYY G
- *
- * @param milliseconds length of unit in milliseconds
- */
- Unit(final long milliseconds) {
- this(milliseconds, "dd MMM YYYY G");
- }
+ /**
+ * constructor to create a unit, with a default format of dd MMM YYYY G
+ *
+ * @param milliseconds
+ * length of unit in milliseconds
+ */
+ Unit(final long milliseconds) {
+ this(milliseconds, "dd MMM YYYY G");
+ }
- /**
- * creates a unit enum
- *
- * @param milliseconds length of unit in milliseconds
- * @param format format to be applied if different to default one of dd MMM
- * YYYY G
- */
- Unit(final long milliseconds, final String format) {
- this.format = format;
- this.milliseconds = milliseconds;
- }
+ /**
+ * creates a unit enum
+ *
+ * @param milliseconds
+ * length of unit in milliseconds
+ * @param format
+ * format to be applied if different to default one of dd MMM
+ * YYYY G
+ */
+ Unit(final long milliseconds, final String format) {
+ this.format = format;
+ this.milliseconds = milliseconds;
+ }
- /**
- * returns the format to be used for the unit
- *
- * @return the format format
- */
- public String getFormat() {
- return format;
- }
+ /**
+ * returns the format to be used for the unit
+ *
+ * @return the format format
+ */
+ public String getFormat() {
+ return format;
+ }
- /**
- * @return the value In Milliseconds of the length of the unit
- */
- public long getMilliseconds() {
- return milliseconds;
- }
+ /**
+ * @return the value In Milliseconds of the length of the unit
+ */
+ public long getMilliseconds() {
+ return milliseconds;
+ }
}
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/BookmarkView.ui.xml 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,5 +1,5 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:c='urn:import:org.cobogw.gwt.user.client.ui'>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' >
<g:SimplePanel>
<g:HTML>
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-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/FilterResultsView.ui.xml 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,5 +1,8 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui' xmlns:c='urn:import:org.cobogw.gwt.user.client.ui'>
+ xmlns:g='urn:import:com.google.gwt.user.client.ui' >
+
+ <ui:style src="views.css" />
+
<g:SimplePanel>
<g:FlowPanel height="100%">
<g:TextBox ui:field='filterQuery' />
Added: 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 (rev 0)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/ScriptureView.ui.xml 2010-06-19 17:36:35 UTC (rev 136)
@@ -0,0 +1,27 @@
+<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:LayoutPanel ui:field='scriptureLayoutPanel'>
+ <g:layer top='0px' height='25px' left='10px' width='90%'>
+ <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>
+
+ <g:layer top='20px' height='300px' left='10px' width='90%'>
+ <g:SimplePanel ui:field='treePanel'>
+ <g:Tree ui:field='bibleVersions' addStyleNames="{style.lightPanelBackground}" />
+ </g:SimplePanel>
+ </g:layer>
+ </g:LayoutPanel>
+</ui:UiBinder>
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/StepView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/StepView.ui.xml 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/StepView.ui.xml 2010-06-19 17:36:35 UTC (rev 136)
@@ -4,27 +4,36 @@
<ui:style src="views.css" />
<g:LayoutPanel ui:field="stepPanelLayout">
- <g:layer height='80'>
+ <g:layer height='75'>
<g:SimplePanel ui:field='topPanel' />
</g:layer>
<g:layer left='0' width='80' top='0' bottom='0'>
- <g:SimplePanel ui:field='sidePanel' addStyleNames="{style.stepPanelBackground}"/>
+ <g:SimplePanel ui:field='sidePanel' />
</g:layer>
- <g:layer left='80' width='35%'>
+ <g:layer left='90' width='300' top='80' height='20'>
+ <g:SimplePanel ui:field='leftScriptureSelectorPanel'/>
+ </g:layer>
+
+ <g:layer left='90' width='300' top='100' bottom='10'>
<g:SimplePanel ui:field='leftColumnPanel'/>
</g:layer>
<g:layer left='500' width='50px' top='30px' height='75%'>
- <g:SimplePanel ui:field='centerBand' addStyleNames="{style.stepPanelBackground}" />
+ <g:SimplePanel ui:field='centerBand' />
</g:layer>
+
+ <g:layer right='90' width='300' top='80' height='20'>
+ <g:SimplePanel ui:field='rightScriptureSelectorPanel'/>
+ </g:layer>
+
<g:layer right='0' width='35%'>
<g:SimplePanel ui:field='rightColumnPanel' />
</g:layer>
<g:layer width='800' top='100' bottom='100' left='80'>
- <g:SimplePanel ui:field='filterPanel' addStyleNames="{style.stepPanelBackground}" />
+ <g:SimplePanel ui:field='filterPanel' />
</g:layer>
</g:LayoutPanel>
</ui:UiBinder>
Deleted: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/VersionSelectorView.ui.xml
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/VersionSelectorView.ui.xml 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/VersionSelectorView.ui.xml 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,11 +0,0 @@
-<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">
-
-<g:FlowPanel>
- <g:TextBox ui:field="bibleVersionSuggestion" />
-
- <g:ScrollPanel height="250px" >
- <g:Tree ui:field="bibleVersions" />
- </g:ScrollPanel>
-</g:FlowPanel>
-</ui:UiBinder>
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/views.css
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/views.css 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/client/view/views.css 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,5 +1,3 @@
-.stepPanelBackground {
- padding-top: 10px;
- background-color: #BCD56D;
- border: black solid 1px;
+.lightPanelBackground {
+ background-color: #CCFFCC;
}
Deleted: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenterTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenterTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenterTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,12 +0,0 @@
-package com.tyndalehouse.step.web.client.presenter;
-
-import net.customware.gwt.dispatch.client.DefaultDispatchAsync;
-
-import org.junit.Test;
-
-public class VersionSelectorPresenterTest {
- @Test
- public void testSomething() {
- VersionSelectorPresenter vsp = new VersionSelectorPresenter(null);
- }
-}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/service/ModuleRefDataServiceTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/service/ModuleRefDataServiceTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/service/ModuleRefDataServiceTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -12,11 +12,11 @@
*
*/
public class ModuleRefDataServiceTest {
- @Test
- public void testModuleHierarchy() {
- new ModuleName("test module", null);
- ModuleRefData.getInstance().getListOfModules("Module");
+ @Test
+ public void testModuleHierarchy() {
+ new ModuleName("test module", null);
+ ModuleRefData.getInstance().getListOfModules("Module");
- // Assert.assertTrue(modules.contains(module.getModuleName()));
- }
+ // Assert.assertTrue(modules.contains(module.getModuleName()));
+ }
}
Deleted: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/views/VersionSelectorViewTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/views/VersionSelectorViewTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/client/views/VersionSelectorViewTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -1,20 +0,0 @@
-package com.tyndalehouse.step.web.client.views;
-
-import junit.framework.TestCase;
-
-public class VersionSelectorViewTest extends TestCase /* extends GWTTestCase */{
-
- /* @Override */
- public String getModuleName() {
- return "com.tyndalehouse.step.web.step";
- }
-
- public void testMe() {
-
- }
- //
- // public void testRegisterVersionSelectorHandler() {
- // VersionSelectorView versionSelectorView = new VersionSelectorView();
- // versionSelectorView.getVersionSelectors();
- // }
-}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestProcessor.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -19,34 +19,33 @@
*
*/
public class TestProcessor implements ResultSetProcessor<String> {
- /**
- * simple constructor
- */
- public TestProcessor() {
+ /**
+ * simple constructor
+ */
+ public TestProcessor() {
- }
+ }
+ public Map<String, Object> getParameters() {
+ final Map<String, Object> params = new HashMap<String, Object>();
+ params.put("event_name", "Events in Africa");
+ params.put("event_id", 2);
+ final long l = -160321161544388L;
+ params.put("date_of_event", l);
+ return params;
+ }
- public Map<String, Object> getParameters() {
- final Map<String, Object> params = new HashMap<String, Object>();
- params.put("event_name", "Events in Africa");
- params.put("event_id", 2);
- final long l = -160321161544388L;
- params.put("date_of_event", l);
- return params;
- }
+ public Query getQuery() {
+ return TestQueryImpl.TEST_QUERY_PARAMS_DIFFERENT_TYPES;
+ }
- public Query getQuery() {
- return TestQueryImpl.TEST_QUERY_PARAMS_DIFFERENT_TYPES;
- }
+ public List<String> process(final ResultSet rs) throws MalformedStepQueryException, ConfigNotLoadedException,
+ SQLException {
+ final List<String> events = new ArrayList<String>();
- public List<String> process(final ResultSet rs) throws MalformedStepQueryException,
- ConfigNotLoadedException, SQLException {
- final List<String> events = new ArrayList<String>();
-
- while (rs.next()) {
- events.add(rs.getString("name"));
- }
- return events;
- }
+ while (rs.next()) {
+ events.add(rs.getString("name"));
+ }
+ return events;
+ }
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/db/helper/TestQueryImpl.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -3,26 +3,25 @@
import com.tyndalehouse.step.web.server.db.framework.Query;
public enum TestQueryImpl implements Query {
- /** a test query */
- TEST_QUERY_PARAMS_DIFFERENT_TYPES("tests");
+ /** a test query */
+ TEST_QUERY_PARAMS_DIFFERENT_TYPES("tests");
- /**
- * component, directory of the test queries
- */
- private final String component;
+ /**
+ * component, directory of the test queries
+ */
+ private final String component;
- /**
- * creates the enum
- *
- * @param component given a component/directory where the test sql script
- * lives
- */
- TestQueryImpl(final String component) {
- this.component = component;
- }
+ /**
+ * creates the enum
+ *
+ * @param component
+ * given a component/directory where the test sql script lives
+ */
+ TestQueryImpl(final String component) {
+ this.component = component;
+ }
-
- public String getComponent() {
- return component;
- }
+ public String getComponent() {
+ return component;
+ }
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetCurrentBibleTextHandlerTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -23,116 +23,118 @@
*/
@RunWith(JMock.class)
public class GetCurrentBibleTextHandlerTest {
- /**
- * The standard context for mocking objects
- */
- private final Mockery context = new Mockery();
+ /**
+ * The standard context for mocking objects
+ */
+ private final Mockery context = new Mockery();
- /**
- * tests a greek reverse interlinear
- *
- * @throws ActionException exception during test
- **/
- @Test
- public void testGreekReverseInterlinear() throws ActionException {
- final Log log = context.mock(Log.class);
+ /**
+ * tests a greek reverse interlinear
+ *
+ * @throws ActionException
+ * exception during test
+ **/
+ @Test
+ public void testGreekReverseInterlinear() throws ActionException {
+ final Log log = context.mock(Log.class);
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
+ context.checking(new Expectations() {
+ {
+ ignoring(log);
+ }
+ });
- final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "acts 1:1");
- cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "acts 1:1");
+ cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
- final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
+ final GetCurrentBibleTextResult result = handler.execute(cmd, null);
- Assert.assertNotNull(result.getPassage());
- Assert.assertNotNull(result.getPassage().getVerseContent());
- Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
+ Assert.assertNotNull(result.getPassage());
+ Assert.assertNotNull(result.getPassage().getVerseContent());
+ Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
- // TODO: add interlinear specific stuff
+ // TODO: add interlinear specific stuff
- }
+ }
- /**
- * tests hebrew reverse interlinear
- *
- * @throws ActionException an exception during execution
- */
- @Test
- public void testHebrewReverseInterlinear() throws ActionException {
- final Log log = context.mock(Log.class);
+ /**
+ * tests hebrew reverse interlinear
+ *
+ * @throws ActionException
+ * an exception during execution
+ */
+ @Test
+ public void testHebrewReverseInterlinear() throws ActionException {
+ final Log log = context.mock(Log.class);
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
+ context.checking(new Expectations() {
+ {
+ ignoring(log);
+ }
+ });
- final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "Gen 1:1");
- cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("KJV", "Gen 1:1");
+ cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
- final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
+ final GetCurrentBibleTextResult result = handler.execute(cmd, null);
- Assert.assertNotNull(result.getPassage());
- Assert.assertNotNull(result.getPassage().getVerseContent());
- Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
+ Assert.assertNotNull(result.getPassage());
+ Assert.assertNotNull(result.getPassage().getVerseContent());
+ Assert.assertTrue(result.getPassage().getVerseContent().size() != 0);
- // TODO: add interlinear specific stuff
+ // TODO: add interlinear specific stuff
- }
+ }
- /**
- * tests a logical lookup of the passage, as opposed to plain text
- *
- * @throws ActionException exception during running
- */
- @Test
- public void testLogicalPassage() throws ActionException {
- final Log log = context.mock(Log.class);
+ /**
+ * tests a logical lookup of the passage, as opposed to plain text
+ *
+ * @throws ActionException
+ * exception during running
+ */
+ @Test
+ public void testLogicalPassage() throws ActionException {
+ final Log log = context.mock(Log.class);
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
+ context.checking(new Expectations() {
+ {
+ ignoring(log);
+ }
+ });
- final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
- cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
+ cmd.setTypeOfLookup(BibleTextLookupType.LOGICAL);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
- final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
+ final GetCurrentBibleTextResult result = handler.execute(cmd, null);
- Assert.assertEquals(result.getPassage().getText(),
- "In the beginning, God created the heavens and the earth.");
- }
+ Assert.assertEquals(result.getPassage().getText(), "In the beginning, God created the heavens and the earth.");
+ }
- /**
- * An lookup for plain text
- *
- * @throws ActionException exception during the retrieval of the text
- */
- @Test
- public void testLookupText() throws ActionException {
- final Log log = context.mock(Log.class);
+ /**
+ * An lookup for plain text
+ *
+ * @throws ActionException
+ * exception during the retrieval of the text
+ */
+ @Test
+ public void testLookupText() throws ActionException {
+ final Log log = context.mock(Log.class);
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
+ context.checking(new Expectations() {
+ {
+ ignoring(log);
+ }
+ });
- final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
- cmd.setTypeOfLookup(BibleTextLookupType.PLAIN_TEXT);
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand("ESV", "Gen 1:1");
+ cmd.setTypeOfLookup(BibleTextLookupType.PLAIN_TEXT);
- final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
- final GetCurrentBibleTextResult result = handler.execute(cmd, null);
+ final GetCurrentBibleTextHandler handler = new GetCurrentBibleTextHandler();
+ final GetCurrentBibleTextResult result = handler.execute(cmd, null);
- Assert.assertEquals(result.getPassageText(),
- "In the beginning, God created the heavens and the earth.");
- }
+ Assert.assertEquals(result.getPassageText(), "In the beginning, God created the heavens and the earth.");
+ }
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetDictionaryDefinitionHandlerTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -26,44 +26,45 @@
@RunWith(JMock.class)
public class GetDictionaryDefinitionHandlerTest {
- /**
- * The standard context for mocking objects
- */
- private final Mockery context = new Mockery();
+ /**
+ * The standard context for mocking objects
+ */
+ private final Mockery context = new Mockery();
- // TODO: add test to ensure that we have a negative,
- // what happens when we lookup a reference that doesn't exist
- // at the moment we get a false positive
+ // TODO: add test to ensure that we have a negative,
+ // what happens when we lookup a reference that doesn't exist
+ // at the moment we get a false positive
- /**
- * looks up some text for two references, one greek, one hebrew
- *
- * @throws ActionException an exception during execution of the test
- */
- @Test
- public void testLookupText() throws ActionException {
- final List<String> lookupReferences = new ArrayList<String>();
- lookupReferences.add("strong:G00051");
- lookupReferences.add("strong:H00052");
+ /**
+ * looks up some text for two references, one greek, one hebrew
+ *
+ * @throws ActionException
+ * an exception during execution of the test
+ */
+ @Test
+ public void testLookupText() throws ActionException {
+ final List<String> lookupReferences = new ArrayList<String>();
+ lookupReferences.add("strong:G00051");
+ lookupReferences.add("strong:H00052");
- final Log log = context.mock(Log.class);
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
+ final Log log = context.mock(Log.class);
+ context.checking(new Expectations() {
+ {
+ ignoring(log);
+ }
+ });
- final GetDictionaryDefinitionCommand cmd = new GetDictionaryDefinitionCommand();
- cmd.setLookupReference(lookupReferences);
+ final GetDictionaryDefinitionCommand cmd = new GetDictionaryDefinitionCommand();
+ cmd.setLookupReference(lookupReferences);
- final GetDictionaryDefinitionHandler handler = new GetDictionaryDefinitionHandler();
- final GetDictionaryDefinitionResult result = handler.execute(cmd, null);
+ final GetDictionaryDefinitionHandler handler = new GetDictionaryDefinitionHandler();
+ final GetDictionaryDefinitionResult result = handler.execute(cmd, null);
- Assert.assertTrue(result.getXsltedDefinition().contains(">00051<"));
- Assert.assertTrue(result.getXsltedDefinition().contains("Abshay"));
+ Assert.assertTrue(result.getXsltedDefinition().contains(">00051<"));
+ Assert.assertTrue(result.getXsltedDefinition().contains("Abshay"));
- Assert.assertTrue(result.getXsltedDefinition().contains(">00052<"));
- Assert.assertTrue(result.getXsltedDefinition().contains("a thing ignored"));
+ Assert.assertTrue(result.getXsltedDefinition().contains(">00052<"));
+ Assert.assertTrue(result.getXsltedDefinition().contains("a thing ignored"));
- }
+ }
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/GetTimelineUISetupHandlerTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -24,37 +24,38 @@
@RunWith(JMock.class)
public class GetTimelineUISetupHandlerTest {
- /**
- * The standard context for mocking objects
- */
- private final Mockery context = new Mockery();
+ /**
+ * The standard context for mocking objects
+ */
+ private final Mockery context = new Mockery();
- /**
- * looks up
- *
- * @throws ActionException an exception during the running
- */
- @Test
- public void testTimelineUIHandler() throws ActionException {
- final Log log = context.mock(Log.class);
+ /**
+ * looks up
+ *
+ * @throws ActionException
+ * an exception during the running
+ */
+ @Test
+ public void testTimelineUIHandler() throws ActionException {
+ final Log log = context.mock(Log.class);
- context.checking(new Expectations() {
- {
- ignoring(log);
- }
- });
+ context.checking(new Expectations() {
+ {
+ ignoring(log);
+ }
+ });
- final StepQueryRunner runner = context.mock(StepQueryRunner.class);
- context.checking(new Expectations() {
- {
- atMost(1).of(runner);
- will(returnValue(new ArrayList<TimelineBean>()));
- }
- });
+ final StepQueryRunner runner = context.mock(StepQueryRunner.class);
+ context.checking(new Expectations() {
+ {
+ atMost(1).of(runner);
+ will(returnValue(new ArrayList<TimelineBean>()));
+ }
+ });
- new GetTimelineUISetupHandler(runner).execute(null, null);
+ new GetTimelineUISetupHandler(runner).execute(null, null);
- // this test is purely to check we are not calling the database more
- // than is required.
- }
+ // this test is purely to check we are not calling the database more
+ // than is required.
+ }
}
Modified: trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java
===================================================================
--- trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java 2010-06-12 16:38:14 UTC (rev 135)
+++ trunk/step-web-app/src/test/java/com/tyndalehouse/step/web/server/handlers/JSwordInstallTest.java 2010-06-19 17:36:35 UTC (rev 136)
@@ -11,26 +11,30 @@
*
*/
public class JSwordInstallTest {
- /**
- * tests the installation of a bible version from JSword/crosswire.org
- *
- * @throws ActionException an exception during execution of the tests
- */
- @Test
- public void testInstallESV() throws ActionException {
- //TODO: change to a module that's tiny. Because this test is quite slow, also relies on outside world
-//
-// final String initials = "ASV";
-// final InstallJswordModuleCommand cmd = new InstallJswordModuleCommand();
-// cmd.setInitials(initials);
-//
-//
-// final InstallJswordModuleHandler ijmh = new InstallJswordModuleHandler();
-// final InstallJswordModuleResult result = ijmh.execute(cmd, null);
-//
-// Assert.assertTrue(result.isSuccessful());
-// Assert.assertTrue(Books.installed().getBook(initials) != null);
-// // check book is installed
+ /**
+ * tests the installation of a bible version from JSword/crosswire.org
+ *
+ * @throws ActionException
+ * an exception during execution of the tests
+ */
+ @Test
+ public void testInstallESV() throws ActionException {
+ // TODO: change to a module that's tiny. Because this test is quite
+ // slow, also relies on outside world
+ //
+ // final String initials = "ASV";
+ // final InstallJswordModuleCommand cmd = new
+ // InstallJswordModuleCommand();
+ // cmd.setInitials(initials);
+ //
+ //
+ // final InstallJswordModuleHandler ijmh = new
+ // InstallJswordModuleHandler();
+ // final InstallJswordModuleResult result = ijmh.execute(cmd, null);
+ //
+ // Assert.assertTrue(result.isSuccessful());
+ // Assert.assertTrue(Books.installed().getBook(initials) != null);
+ // // check book is installed
- }
+ }
}
More information about the Tynstep-svn
mailing list