[Tynstep-svn] r100 - in trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client: . event eventhandler gin presenter toolkit/timeline/components view
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Tue Mar 9 13:32:51 MST 2010
Author: ChrisBurrell
Date: 2010-03-09 13:32:51 -0700 (Tue, 09 Mar 2010)
New Revision: 100
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/NewArticleSelectedEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/NewArticleSelectedEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/widgets/
Modified:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java
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/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/LemmaClickedEventHandler.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/ScriptureChangeEventHandler.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/eventhandler/VersionChangeEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/AppPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/HistoryModulePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSelectorPresenter.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/ScriptureSelectorPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepModulePresenter.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/TimebandListPresenter.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/toolkit/timeline/components/TimelineConstants.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/HistoryModuleView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSelectorView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java
Log:
removing warnings and documenting the client side code
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/CachingDispatchAsync.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -2,33 +2,60 @@
import java.util.HashMap;
import java.util.Map;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.inject.Inject;
+
import net.customware.gwt.dispatch.client.DispatchAsync;
import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+
//TODO: investigate the user of this client side cache
/**
* Dispatcher which support caching of data in memory
*
*/
public class CachingDispatchAsync implements DispatchAsync {
- private DispatchAsync dispatcher;
- private 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 constructor
+ *
+ * @param dispatcher uses the default dispatcher
+ */
@Inject
public CachingDispatchAsync(final DispatchAsync dispatcher) {
this.dispatcher = dispatcher;
}
- /*
- * (non-Javadoc)
+ /**
+ * 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)
+ * com.google.gwt.user.client.rpc.AsyncCallback)
*/
- public <A extends Action<R>, R extends Result> void execute(final A action, final AsyncCallback<R> callback) {
+ public <A extends Action<R>, R extends Result> void execute(final A action,
+ final AsyncCallback<R> callback) {
dispatcher.execute(action, callback);
}
@@ -36,17 +63,14 @@
* 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
+ * @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) {
+ 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) {
@@ -54,23 +78,15 @@
} else {
dispatcher.execute(action, new AsyncCallback<R>() {
- public void onFailure(Throwable caught) {
+ public void onFailure(final Throwable caught) {
callback.onFailure(caught);
}
- public void onSuccess(R result) {
+ public void onSuccess(final R result) {
cache.put((Action) action, (Result) result);
callback.onSuccess(result);
}
-
});
}
}
-
- /**
- * Clear the cache
- */
- public void clear() {
- cache.clear();
- }
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -6,9 +6,22 @@
import com.tyndalehouse.step.web.client.gin.StepInjector;
import com.tyndalehouse.step.web.client.presenter.AppPresenter;
+/**
+ * Entry point to the one and only application page
+ *
+ * @author cjburrell
+ *
+ */
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() {
final AppPresenter appPresenter = injector.getAppPresenter();
appPresenter.go(RootPanel.get());
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/NewArticleSelectedEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/NewArticleSelectedEvent.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/NewArticleSelectedEvent.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -1,23 +0,0 @@
-package com.tyndalehouse.step.web.client.event;
-
-import com.google.gwt.event.shared.GwtEvent;
-import com.tyndalehouse.step.web.client.eventhandler.NewArticleSelectedEventHandler;
-
-public class NewArticleSelectedEvent extends GwtEvent<NewArticleSelectedEventHandler> {
- /**
- * The default Type Handler
- * Type is parameterized by the handler type in order to make the addHandler method type safe.
- */
-public static Type<NewArticleSelectedEventHandler> TYPE = new Type<NewArticleSelectedEventHandler>();
-
- @Override
- protected void dispatch(NewArticleSelectedEventHandler handler) {
- handler.onNewArticleSelected(this);
- }
-
- @Override
- public Type<NewArticleSelectedEventHandler> getAssociatedType() {
- return TYPE;
- }
-
-}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/BookSelectedEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,20 @@
import com.google.gwt.event.shared.EventHandler;
import com.tyndalehouse.step.web.client.event.BookSelectedEvent;
+/**
+ * Contract for any handler wanting to handle a BookSelectedEvent In particular
+ * this means handling a click for e.g. on the UI in the list of bible books
+ * (Genesis, Exodus, etc.)
+ *
+ * @author cjburrell
+ *
+ */
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);
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,20 @@
import com.google.gwt.event.shared.EventHandler;
import com.tyndalehouse.step.web.client.event.DictionaryDefinitionFoundEvent;
+/**
+ * This contract is relevant to any handler who wants to be notified when a
+ * definition was looked up from the server
+ *
+ * @author cjburrell
+ *
+ */
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);
}
Modified: 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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/LemmaClickedEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,19 @@
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ModuleChangeEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,18 @@
import com.google.gwt.event.shared.EventHandler;
import com.tyndalehouse.step.web.client.event.ModuleChangeEvent;
+/**
+ * Contract for handlers interested in a selection of a different module
+ *
+ * @author cjburrell
+ *
+ */
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);
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/NewArticleSelectedEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/NewArticleSelectedEventHandler.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/NewArticleSelectedEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -1,8 +0,0 @@
-package com.tyndalehouse.step.web.client.eventhandler;
-
-import com.google.gwt.event.shared.EventHandler;
-import com.tyndalehouse.step.web.client.event.NewArticleSelectedEvent;
-
-public interface NewArticleSelectedEventHandler extends EventHandler {
- void onNewArticleSelected(NewArticleSelectedEvent event);
-}
Modified: 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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/ScriptureChangeEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,18 @@
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,20 @@
import com.google.gwt.event.shared.EventHandler;
import com.tyndalehouse.step.web.client.event.TimebandListUpdateRequiredEvent;
+/**
+ * Contract for handlers requiring notification of updates to the number of
+ * events on the timebands
+ *
+ * @author cjburrell
+ *
+ */
public interface TimebandListUpdateRequiredEventHandler extends EventHandler {
- public 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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,21 @@
import com.google.gwt.event.shared.EventHandler;
import com.tyndalehouse.step.web.client.event.TimelineScrollEvent;
+/**
+ * Contract for handlers wanting to be alerted when the timeline is being
+ * scrolled
+ *
+ * @author cjburrell
+ *
+ */
public interface TimelineScrollEventHandler extends EventHandler {
- public 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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,8 +3,21 @@
import com.google.gwt.event.shared.EventHandler;
import com.tyndalehouse.step.web.client.event.UserInterestInBandEvent;
+/**
+ * Contract for handlers requiring notifications of timebands being
+ * selected/unselected
+ *
+ * @author cjburrell
+ *
+ */
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);
}
Modified: 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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/VersionChangeEventHandler.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -3,6 +3,19 @@
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/gin/StepClientModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -25,6 +25,13 @@
import com.tyndalehouse.step.web.client.view.TimebandListView;
import com.tyndalehouse.step.web.client.view.TimelineView;
+/**
+ * Gin configuration for the the step client. In addition to normal guice
+ * operations, this binds presenters to their views
+ *
+ * @author cjburrell
+ *
+ */
public class StepClientModule extends AbstractPresenterModule {
@Override
@@ -35,23 +42,14 @@
bind(EventBus.class).to(StepEventBus.class).in(Singleton.class);
bind(AppPresenter.class).in(Singleton.class);
bind(PlaceManager.class).in(Singleton.class);
- // bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
- // bind(ScriptureSelectorPresenter.class);
- // bindDisplay(ScriptureSelectorPresenter.Display.class,
- // ScriptureSelectorView.class);
-
- // bind(ScriptureSelectorPresenter.class);
-
bindPresenter(StepPresenter.class, StepPresenter.Display.class, StepView.class);
bind(ScriptureSelectorPresenter.class);
bind(ScriptureSelectorPresenter.Display.class).to(ScriptureSelectorView.class).in(Singleton.class);
bind(ModuleSelectorPresenter.class);
bind(ModuleSelectorPresenter.Display.class).to(ModuleSelectorView.class).in(Singleton.class);
-
bind(ScripturePresenter.class);
bind(ScripturePresenter.Display.class).to(ScriptureView.class); // .in(Singleton.class);
-
bind(TimelinePresenter.class);
bind(TimelinePresenter.Display.class).to(TimelineView.class); // .in(Singleton.class);
bind(TimebandListPresenter.Display.class).to(TimebandListView.class); // .in(Singleton.class);
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -7,9 +7,25 @@
import com.google.gwt.inject.client.Ginjector;
import com.tyndalehouse.step.web.client.presenter.AppPresenter;
- at GinModules({ ClientDispatchModule.class, StepClientModule.class })
+/**
+ * Gin injector. This defines the modules all the Gin modules
+ *
+ * @author cjburrell
+ *
+ */
+ at GinModules( { ClientDispatchModule.class, StepClientModule.class })
public interface StepInjector extends Ginjector {
+ /**
+ * Returns the App Presenter, the main presenter for STEP
+ *
+ * @return the main presenter for STEP
+ */
AppPresenter getAppPresenter();
+ /**
+ * Returns a place manager
+ *
+ * @return the step place manager
+ */
PlaceManager getPlaceManager();
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/AppPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/AppPresenter.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/AppPresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -6,11 +6,39 @@
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.inject.Inject;
+/**
+ * Main presenter for STEP, entry point
+ *
+ * @author cjburrell
+ *
+ */
public class AppPresenter {
+ /**
+ * container for any main widgets
+ */
private HasWidgets container;
- private StepPresenter stepPresenter;
+
+ // TODO: investigate whether there is a neater way of doing this
+ /**
+ * Main dispatcher.
+ */
+ @SuppressWarnings(value = "unused")
private final DispatchAsync dispatcher;
+ /**
+ * The step presenter - TODO: probably one layer of abstration too many,
+ * should be moved this class into StepPresenter
+ */
+ private final StepPresenter stepPresenter;
+
+ /**
+ * The default app presenter for STEP.
+ *
+ * @param dispatcher the dispatcher to use within this class (passed in here
+ * to get it initialised)
+ * @param stepPresenter the step presenter responsible for handling all
+ * other presenters and views
+ */
// passing them in to have GIN initialise them!
@Inject
public AppPresenter(final DispatchAsync dispatcher, final StepPresenter stepPresenter) {
@@ -19,13 +47,21 @@
Log.debug("AppPresenter is being initialised");
}
+ /**
+ * Call go to initialise the step application and render
+ *
+ * @param container container on which to add the Step Application
+ */
+ public void go(final HasWidgets container) {
+ this.container = container;
+ showMain();
+ }
+
+ /**
+ * Repaints the page with the step presenter/view
+ */
private void showMain() {
container.clear();
container.add(stepPresenter.getDisplay().asWidget());
}
-
- public void go(final HasWidgets container) {
- this.container = container;
- showMain();
- }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/HistoryModulePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/HistoryModulePresenter.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/HistoryModulePresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -6,22 +6,52 @@
import com.google.inject.Inject;
+/**
+ * History module presenter, responsible for displaying articles on the page
+ *
+ * @author cjburrell
+ *
+ */
public class HistoryModulePresenter extends StepModulePresenter<HistoryModulePresenter.Display> {
+ /**
+ * Interface for the History Module View
+ *
+ * @author cjburrell
+ *
+ */
+ public interface Display extends StepModulePresenter.Display {
+
+ }
+
+ /**
+ * default constructor, injected by Gin
+ *
+ * @param display display, comes from Gin
+ * @param eventBus eventBus comes from Gin
+ */
@Inject
- public HistoryModulePresenter(Display display, EventBus eventBus) {
+ public HistoryModulePresenter(final Display display, final EventBus eventBus) {
super(display, eventBus);
bind();
}
- public interface Display extends StepModulePresenter.Display {
+ @Override
+ public Place getPlace() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ @Override
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
+
}
@Override
- public Place getPlace() {
+ public void revealDisplay() {
// TODO Auto-generated method stub
- return null;
+
}
@Override
@@ -58,7 +88,7 @@
}
@Override
- protected void onPlaceRequest(PlaceRequest request) {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@@ -69,16 +99,4 @@
}
- @Override
- public void refreshDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
- }
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSelectorPresenter.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSelectorPresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -17,71 +17,142 @@
import com.tyndalehouse.step.web.client.service.refdata.ModuleRefData;
import com.tyndalehouse.step.web.client.toolkit.HasSource;
-public class ModuleSelectorPresenter extends WidgetPresenter<ModuleSelectorPresenter.Display> implements ChangeHandler {
+/**
+ * Module selector module, responsible for displaying the dropdowns on the user
+ * interface
+ *
+ * @author cjburrell
+ *
+ */
+public class ModuleSelectorPresenter extends WidgetPresenter<ModuleSelectorPresenter.Display> implements
+ ChangeHandler {
- @Inject
- public ModuleSelectorPresenter(Display display, EventBus eventBus, DispatchAsync dispatcher) {
- super(display, eventBus);
- bind();
- }
-
+ /**
+ * Interface to the module selector view
+ *
+ * @author cjburrell
+ *
+ */
public interface Display extends WidgetDisplay {
+ /**
+ *
+ * @return Returns any change handlers so that the presenter can
+ * register event handlers
+ */
HasChangeHandlers getModuleChangeHandlers();
+ /**
+ *
+ * @return returns a change handler for the "Depth" dropdown/list
+ */
HasChangeHandlers getModuleDepthChangeHandlers();
- HasChangeHandlers getSubModuleChangeHandlers();
-
+ /**
+ * @return returns the source associated to the Module Depth
+ * dropdown/list
+ */
HasSource<List<String>> getModuleDepthSource();
+ /**
+ *
+ * @return the source for the module list/dropdown
+ */
HasSource<List<String>> getModuleSource();
- HasSource<List<String>> getSubModuleSource();
-
+ /**
+ *
+ * @return current selected depth (for example scholarly detail)
+ */
String getSelectedDepth();
+ /**
+ *
+ * @return currently selected module
+ */
String getSelectedModule();
+ /**
+ *
+ * @return currently selected sub-module
+ */
String getSelectedSubModule();
- void setSelectedModule(String string);
+ /**
+ *
+ * @return change handlers on which to register event handlers for the
+ * sub module dropdown/list
+ */
+ HasChangeHandlers getSubModuleChangeHandlers();
+
+ /**
+ *
+ * @return source for the sub module dropdown/list
+ */
+ HasSource<List<String>> getSubModuleSource();
+
+ /**
+ * Changes the selected module
+ *
+ * @param newlySelectedModule the new module to be selected
+ */
+ void setSelectedModule(String newlySelectedModule);
}
+ /**
+ * Default constructor
+ *
+ * @param display display passed in by Gin
+ * @param eventBus eventBus passed in by Gin
+ * @param dispatcher dispatch passed in by Gin
+ */
+ @Inject
+ public ModuleSelectorPresenter(final Display display, final EventBus eventBus,
+ final DispatchAsync dispatcher) {
+ super(display, eventBus);
+ bind();
+ }
+
@Override
public Place getPlace() {
// TODO Auto-generated method stub
return null;
}
+ /**
+ * Used for submodule and depth
+ *
+ * @param event event that was fired by the view.
+ */
@Override
- protected void onBind() {
- // do nothing at the moment
- // add event notifications...
- addDropdownChangeHandlers();
+ public void onChange(final ChangeEvent event) {
+ fireChange();
+ }
- // TODO: remove default into configurable options, preferences, etc.
- String defaultModule = "History";
- ModuleRefData mrd = ModuleRefData.getInstance();
- List<String> moduleNames = mrd.getListOfModules("Module");
- List<String> subModules = mrd.getListOfModules(defaultModule);
- List<String> depths = mrd.getDepths();
+ @Override
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
- display.setSelectedModule(defaultModule);
- display.getModuleSource().setSource(moduleNames);
- display.getSubModuleSource().setSource(subModules);
- display.getModuleDepthSource().setSource(depths);
+ }
- // do i need to fire an module change event?
+ @Override
+ public void revealDisplay() {
+ // TODO Auto-generated method stub
+
}
+ /**
+ * adds the module change handlers, for module list, sub module list and
+ * depth list
+ */
private void addDropdownChangeHandlers() {
// fires the dropdown change event as a ModuleChangeEvent
display.getModuleChangeHandlers().addChangeHandler(new ChangeHandler() {
@Override
- public void onChange(ChangeEvent event) {
+ public void onChange(final ChangeEvent event) {
// in here, we need to reload the events
- display.getSubModuleSource().setSource(ModuleRefData.getInstance().getListOfModules(display.getSelectedModule()));
+ display.getSubModuleSource().setSource(
+ ModuleRefData.getInstance().getListOfModules(display.getSelectedModule()));
// this hopefully fires the on Change below since the sub module
// dropdown changes...
// but it doesn't :( so...
@@ -97,44 +168,42 @@
* fires the change of dropdown selectors to the event bus.
*/
private void fireChange() {
- eventBus.fireEvent(new ModuleChangeEvent(display.getSelectedModule(), display.getSelectedSubModule(), display.getSelectedDepth()));
+ eventBus.fireEvent(new ModuleChangeEvent(display.getSelectedModule(), display.getSelectedSubModule(),
+ display.getSelectedDepth()));
}
- /**
- * Used for submodule and depth
- */
@Override
- public void onChange(final ChangeEvent event) {
- fireChange();
- }
+ protected void onBind() {
+ // do nothing at the moment
+ // add event notifications...
+ addDropdownChangeHandlers();
- @Override
- protected void onPlaceRequest(PlaceRequest request) {
- // TODO Auto-generated method stub
+ // TODO: remove default into configurable options, preferences, etc.
+ final String defaultModule = "History";
+ final ModuleRefData mrd = ModuleRefData.getInstance();
+ final List<String> moduleNames = mrd.getListOfModules("Module");
+ final List<String> subModules = mrd.getListOfModules(defaultModule);
+ final List<String> depths = mrd.getDepths();
- }
+ display.setSelectedModule(defaultModule);
+ display.getModuleSource().setSource(moduleNames);
+ display.getSubModuleSource().setSource(subModules);
+ display.getModuleDepthSource().setSource(depths);
- @Override
- protected void onUnbind() {
- // TODO Auto-generated method stub
-
+ // do i need to fire an module change event?
}
@Override
- public void refreshDisplay() {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@Override
- public void revealDisplay() {
+ protected void onUnbind() {
// TODO Auto-generated method stub
}
- public EventBus getEventBus() {
- return eventBus;
- }
-
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -28,59 +28,161 @@
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
import com.tyndalehouse.step.web.shared.scripture.Passage;
+/**
+ * This presenter is responsible for displaying scripture to the user, in an
+ * interactive way including the highlight-on-click, querying the server for
+ * portions of text, etc.
+ *
+ * @author cjburrell
+ *
+ */
public class ScripturePresenter extends WidgetPresenter<ScripturePresenter.Display> {
+ /**
+ * Description of the view for presenting scripture to the user
+ *
+ * @author cjburrell
+ *
+ */
+ public interface Display extends WidgetDisplay {
+ /**
+ * TODO: change the name, it's a bit meaningless change handlers to the
+ * bible versions dropdown
+ *
+ * @return bible versions change handlers
+ */
+ HasChangeHandlers getChangeHandlers();
+
+ /**
+ *
+ * @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
+ */
+ HasSource<SortedMap<String, String>> getSource();
+
+ /**
+ * action to highlight portions of the biblical text that are tagged
+ * with a lemma
+ *
+ * @param lemmas lemmas to look for in the presented biblical text.
+ */
+ void highlight(List<String> lemmas);
+
+ /**
+ * @param passage a logical passage to be displayed
+ */
+ void setPassage(Passage passage);
+
+ /**
+ * @param text the text form of the passage
+ */
+ void setPassage(String text);
+ }
+
+ /**
+ * default asynchronous dispatcher
+ */
private final DispatchAsync dispatcher;
- private ScriptureSelectorPresenter.Display scriptureSelectorView;
+ /**
+ * the view itself, used to interact with it
+ */
+ private final ScriptureSelectorPresenter.Display scriptureSelectorView;
+
+ /**
+ *
+ * @param display the view, provided by Gin
+ * @param eventBus the event bus, provided by Gin
+ * @param dispatcher the dispatcher, provided by Gin
+ * @param scriptureSelectorView the scripture selector view (i.e. the bit
+ * with the reference in it), provided by Gin
+ */
@Inject
- public ScripturePresenter(Display display, EventBus eventBus, DispatchAsync dispatcher, ScriptureSelectorPresenter.Display scriptureSelectorView) {
+ public ScripturePresenter(final Display display, final EventBus eventBus, final DispatchAsync dispatcher,
+ final ScriptureSelectorPresenter.Display scriptureSelectorView) {
super(display, eventBus);
+ // TODO: remove dependency on scripture selector view
this.dispatcher = dispatcher;
this.scriptureSelectorView = scriptureSelectorView;
Log.debug("Initialising Scripture Presenter");
bind();
}
- public interface Display extends WidgetDisplay {
- HasSource<SortedMap<String, String>> getSource();
+ @Override
+ public Place getPlace() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- String getSelectedBibleVersion();
+ @Override
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
- HasChangeHandlers getChangeHandlers();
-
- void setPassage(String text);
-
- void setPassage(Passage passage);
-
- void highlight(List<String> lemmas);
}
@Override
- public Place getPlace() {
+ public void revealDisplay() {
// TODO Auto-generated method stub
- return null;
+
}
- @Override
- protected void onBind() {
- Log.debug("Binding Scripture Presenter");
- // get list of versions now...
- dispatcher.execute(new GetAvailableBibleVersionsCommand(), new DisplayCallback<GetAvailableBibleVersionsResult>(display) {
+ /**
+ * 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
+ */
+ private void doRefreshScripture() {
+ final GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(display
+ .getSelectedBibleVersion(), scriptureSelectorView.getReference().getValue());
+ // TODO: decide if this should be made static or UI driven
+ cmd.setLogicalFormRequired(true);
+ cmd.setSimpleTextRequired(false);
+ cmd.setXsltRequired(false);
+ cmd.setInterlinear(true);
+ cmd.setInterlinearClassic(false);
+
+ dispatcher.execute(cmd, new DisplayCallback<GetCurrentBibleTextResult>(display) {
+
@Override
- protected void handleFailure(Throwable e) {
- Log.error("An error occurred while retrieving bible versions: ", e);
+ protected void handleFailure(final Throwable e) {
+ Log.error("An error has occurred", e);
}
@Override
- protected void handleSuccess(GetAvailableBibleVersionsResult result) {
- display.getSource().setSource(result.getBooks());
+ protected void handleSuccess(final GetCurrentBibleTextResult result) {
+ // String text = result.getPassageText();
+ display.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() {
@Override
- public void onChange(ChangeEvent event) {
+ public void onChange(final ChangeEvent event) {
eventBus.fireEvent(new VersionChangeEvent());
doRefreshScripture();
}
@@ -89,7 +191,7 @@
eventBus.addHandler(ScriptureChangeEvent.TYPE, new ScriptureChangeEventHandler() {
@Override
- public void onScriptureChange(ScriptureChangeEvent event) {
+ public void onScriptureChange(final ScriptureChangeEvent event) {
Log.debug("Scripture Change event captured");
doRefreshScripture();
}
@@ -100,7 +202,7 @@
eventBus.addHandler(LemmaClickedEvent.TYPE, new LemmaClickedEventHandler() {
@Override
- public void onLemmaClicked(LemmaClickedEvent lemmaClickedEvent) {
+ public void onLemmaClicked(final LemmaClickedEvent lemmaClickedEvent) {
Log.error("Lemma Clicked event handler invoked");
highlightAllLemmas(lemmaClickedEvent.getLemma());
}
@@ -111,34 +213,8 @@
});
}
- private void doRefreshScripture() {
- GetCurrentBibleTextCommand cmd = new GetCurrentBibleTextCommand(display.getSelectedBibleVersion(), scriptureSelectorView.getReference()
- .getValue());
- // TODO: decide if this should be made static or UI driven
- cmd.setLogicalFormRequired(true);
- cmd.setSimpleTextRequired(false);
- cmd.setXsltRequired(false);
- cmd.setInterlinear(true);
- cmd.setInterlinearClassic(false);
-
- dispatcher.execute(cmd, new DisplayCallback<GetCurrentBibleTextResult>(display) {
-
- @Override
- protected void handleFailure(Throwable e) {
- Log.error("An error has occurred", e);
- }
-
- @Override
- protected void handleSuccess(GetCurrentBibleTextResult result) {
- // String text = result.getPassageText();
- display.setPassage(result.getPassage());
- }
-
- });
- }
-
@Override
- protected void onPlaceRequest(PlaceRequest request) {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@@ -149,16 +225,4 @@
}
- @Override
- public void refreshDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
- }
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -20,22 +20,65 @@
import com.tyndalehouse.step.web.shared.command.GetBibleBooksCommand;
import com.tyndalehouse.step.web.shared.result.GetBibleBooksCommandResult;
+/**
+ * Presenter for the Scripture Selector Presenter module. This module aims to
+ * present the user with a way of selecting a passage, including suggesting the
+ * bible book.
+ *
+ * @author cjburrell
+ *
+ */
public class ScriptureSelectorPresenter extends WidgetPresenter<ScriptureSelectorPresenter.Display> {
- private final DispatchAsync dispatcher;
-
+ /**
+ * The contract with the view, which will disaply a way for the user to
+ * select/key in a bible reference
+ *
+ * @author cjburrell
+ *
+ */
public interface Display extends WidgetDisplay {
+ /**
+ * adds a suggestion to the list of bibles
+ *
+ * @param suggestion a suggestion, such as a bible book name
+ */
void addSuggestion(String suggestion);
+ /**
+ * Adds a list of suggestions
+ *
+ * @param suggestions the collection of suggestions (bible book names,
+ * for e.g.)
+ */
void addSuggestions(Collection<String> suggestions);
+ /**
+ * @return the reference which is currently keyed in
+ */
HasValue<String> getReference();
+ /**
+ * @return the handler for clicking on a search button
+ */
HasClickHandlers getSearch();
}
+ /**
+ * The default dispatcher to use to send requests to the server
+ */
+ private final DispatchAsync dispatcher;
+
+ /**
+ * Constructor to set up the timeline module
+ *
+ * @param display the view, passed in by Gin
+ * @param eventBus the event bus, passed in by Gin
+ * @param dispatcher the dispatcher, passed in by Gin
+ */
@Inject
- public ScriptureSelectorPresenter(Display display, EventBus eventBus, DispatchAsync dispatcher) {
+ public ScriptureSelectorPresenter(final Display display, final EventBus eventBus,
+ final DispatchAsync dispatcher) {
super(display, eventBus);
this.dispatcher = dispatcher;
@@ -44,6 +87,13 @@
bind();
}
+ /**
+ * @return the current reference as keyed in by the user.
+ */
+ public String getCurrentReference() {
+ return display.getReference().getValue();
+ }
+
@Override
public Place getPlace() {
// TODO Auto-generated method stub
@@ -51,18 +101,31 @@
}
@Override
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void revealDisplay() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
protected void onBind() {
Log.debug("onBind called in ScriptureSelector");
- dispatcher.execute(new GetBibleBooksCommand(), new DisplayCallback<GetBibleBooksCommandResult>(display) {
+ dispatcher.execute(new GetBibleBooksCommand(), new DisplayCallback<GetBibleBooksCommandResult>(
+ display) {
@Override
- protected void handleFailure(Throwable e) {
+ protected void handleFailure(final Throwable e) {
// TODO Auto-generated method stub
Log.error("Unable to get books from server", e);
}
@Override
- protected void handleSuccess(GetBibleBooksCommandResult value) {
+ protected void handleSuccess(final GetBibleBooksCommandResult value) {
display.addSuggestions(value.getBooks());
}
});
@@ -72,7 +135,7 @@
@Override
public void onClick(final ClickEvent event) {
// can't use complicated classes here, as GWT java doesn't cope!
- String reference = display.getReference().getValue();
+ final String reference = display.getReference().getValue();
if (reference == null || reference.length() == 0) {
// return validation message perhaps? or ignore?
Log.error("No reference was provided, so no lookup can occur.");
@@ -86,7 +149,7 @@
}
@Override
- protected void onPlaceRequest(PlaceRequest request) {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@@ -97,20 +160,4 @@
}
- @Override
- public void refreshDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- public String getCurrentReference() {
- return display.getReference().getValue();
- }
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepModulePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepModulePresenter.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepModulePresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -6,14 +6,35 @@
import com.google.inject.Inject;
+/**
+ * Abstract class for all main StepModules such as History, Geography, etc. This
+ * class is required for Gin, so that we do not need to bind at the level of the
+ * module class, but have a common ancestor instead.
+ *
+ * @param <T> The type of the module (History, Geography)
+ * @author cjburrell
+ *
+ */
public abstract class StepModulePresenter<T extends StepModulePresenter.Display> extends WidgetPresenter<T> {
+ /**
+ * Contract for the view for any main STEP module
+ *
+ * @author cjburrell
+ *
+ */
public interface Display extends WidgetDisplay {
-
+ // TODO: extend this to have show/hide functionality for e.g.
}
+ /**
+ * Constructor to set up the timeline module
+ *
+ * @param display the view, passed in by Gin
+ * @param eventBus the event bus, passed in by Gin
+ */
@Inject
- public StepModulePresenter(T display, EventBus eventBus) {
+ public StepModulePresenter(final T display, final EventBus eventBus) {
super(display, eventBus);
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -29,13 +29,29 @@
*
*/
public class StepPresenter extends WidgetPresenter<StepPresenter.Display> {
- private final DispatchAsync dispatcher;
-
+ /**
+ * The contract with the Step View, the main layout of Step
+ *
+ * @author cjburrell
+ *
+ */
public interface Display extends WidgetDisplay {
}
+ /**
+ * the default dispatcher for async server requests
+ */
+ private final DispatchAsync dispatcher;
+
+ /**
+ * Constructor to set up the timeline module
+ *
+ * @param display the view, passed in by Gin
+ * @param eventBus the event bus, passed in by Gin
+ * @param dispatcher the dispatcher, passed in by Gin
+ */
@Inject
- public StepPresenter(Display display, EventBus eventBus, DispatchAsync dispatcher) {
+ public StepPresenter(final Display display, final EventBus eventBus, final DispatchAsync dispatcher) {
super(display, eventBus);
this.dispatcher = dispatcher;
@@ -50,39 +66,48 @@
}
@Override
- protected void onBind() {
- Log.debug("onBind called in STEP presenter");
- addSingletonEventHandlers();
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
}
+ @Override
+ public void revealDisplay() {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ * adds event handlers when they need to be parsed only once, but multiple
+ * presenters may be interested this is a proxy. Typically an event should
+ * then be fired if necessary to the presenters
+ */
private void addSingletonEventHandlers() {
// TODO: this handler needs to be moved somewhere else, and fire off
// definition found
eventBus.addHandler(LemmaClickedEvent.TYPE, new LemmaClickedEventHandler() {
@Override
- public void onLemmaClicked(LemmaClickedEvent lemmaClickedEvent) {
+ public void onLemmaClicked(final LemmaClickedEvent lemmaClickedEvent) {
Log.error("Lemma Clicked event handler invoked");
getLemmaDefinition(lemmaClickedEvent.getLemma());
}
private void getLemmaDefinition(final List<String> lemmaDefs) {
- GetDictionaryDefinitionCommand cmd = new GetDictionaryDefinitionCommand();
+ final GetDictionaryDefinitionCommand cmd = new GetDictionaryDefinitionCommand();
cmd.setLookupReference(lemmaDefs);
dispatcher.execute(cmd, new DisplayCallback<GetDictionaryDefinitionResult>(display) {
@Override
- protected void handleFailure(Throwable e) {
+ protected void handleFailure(final Throwable e) {
Log.error(e.getMessage());
}
@Override
- protected void handleSuccess(GetDictionaryDefinitionResult lemmaDefinition) {
+ protected void handleSuccess(final GetDictionaryDefinitionResult lemmaDefinition) {
Log.warn(lemmaDefinition.getXsltedDefinition());
// TODO: check whether definition came back alright!
// TODO: change the XSLT to something nicer
- PopupPanel popup = new PopupPanel();
+ final PopupPanel popup = new PopupPanel();
popup.setWidget(new HTML(lemmaDefinition.getXsltedDefinition()));
popup.setAutoHideEnabled(true);
popup.show();
@@ -100,22 +125,18 @@
}
@Override
- protected void onPlaceRequest(PlaceRequest request) {
- // TODO Auto-generated method stub
+ protected void onBind() {
+ Log.debug("onBind called in STEP presenter");
+ addSingletonEventHandlers();
}
@Override
- protected void onUnbind() {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@Override
- public void refreshDisplay() {
+ protected void onUnbind() {
// TODO Auto-generated method stub
}
-
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
- }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimebandListPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimebandListPresenter.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimebandListPresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -13,20 +13,48 @@
import com.tyndalehouse.step.web.client.eventhandler.TimebandListUpdateRequiredEventHandler;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
+/**
+ * The TimebandList presenter is the presenter for the Timeband list module.
+ * This module is a list of items, each one representing one timeband. Each item
+ * contains the real-time statistics of what is displayed on the timeband,
+ * including the number of event and the number of events currently visible
+ *
+ * @author cjburrell
+ *
+ */
+// TODO: refactor to ensure events get captured and dealt with in the presenter,
+// rather than in the view.
public class TimebandListPresenter extends WidgetPresenter<TimebandListPresenter.Display> {
+ /**
+ * Contract with any TimebandList view
+ *
+ * @author cjburrell
+ *
+ */
+ public interface Display extends WidgetDisplay {
+ // TODO: probably don't want to pass the whole of the timeline
+ // perhaps only the stats out of it, decoupling the counter a little?
+ /**
+ * This method updates the list displayed with the latest statistics
+ *
+ * @param stats statistics to be sent to the view for update
+ */
+ void updateList(List<CurrentBandStats> stats);
+ }
+
+ /**
+ * Default constructor, injected with Gin
+ *
+ * @param display the view, provided by Gin
+ * @param eventBus the event bus, provided by Gin
+ */
@Inject
- public TimebandListPresenter(Display display, EventBus eventBus) {
+ public TimebandListPresenter(final Display display, final EventBus eventBus) {
super(display, eventBus);
bind();
}
- public interface Display extends WidgetDisplay {
- // TODO: probably don't want to pass the whole of the timeline
- // perhaps only the stats out of it, decoupling the counter a little?
- public void updateList(List<CurrentBandStats> stats);
- }
-
@Override
public Place getPlace() {
// TODO Auto-generated method stub
@@ -34,37 +62,40 @@
}
@Override
- protected void onBind() {
- eventBus.addHandler(TimebandListUpdateRequiredEvent.TYPE, new TimebandListUpdateRequiredEventHandler() {
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
- @Override
- public void onTimebandListRequiringUpdate(TimebandListUpdateRequiredEvent timebandListUpdateRequiredEvent) {
- List<CurrentBandStats> stats = timebandListUpdateRequiredEvent.getTimelineStats();
- display.updateList(stats);
- }
- });
}
@Override
- protected void onPlaceRequest(PlaceRequest request) {
+ public void revealDisplay() {
// TODO Auto-generated method stub
}
@Override
- protected void onUnbind() {
- // TODO Auto-generated method stub
+ protected void onBind() {
+ eventBus.addHandler(TimebandListUpdateRequiredEvent.TYPE,
+ new TimebandListUpdateRequiredEventHandler() {
+ @Override
+ public void onTimebandListRequiringUpdate(
+ final TimebandListUpdateRequiredEvent timebandListUpdateRequiredEvent) {
+ final List<CurrentBandStats> stats = timebandListUpdateRequiredEvent
+ .getTimelineStats();
+ display.updateList(stats);
+ }
+ });
}
@Override
- public void refreshDisplay() {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@Override
- public void revealDisplay() {
+ protected void onUnbind() {
// TODO Auto-generated method stub
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -20,9 +20,10 @@
import com.tyndalehouse.step.web.client.event.TimelineScrollEvent;
import com.tyndalehouse.step.web.client.eventhandler.ScriptureChangeEventHandler;
import com.tyndalehouse.step.web.client.eventhandler.TimelineScrollEventHandler;
+import com.tyndalehouse.step.web.client.toolkit.timeline.TimeEvent;
import com.tyndalehouse.step.web.client.toolkit.timeline.Timeband;
-import com.tyndalehouse.step.web.client.toolkit.timeline.TimeEvent;
import com.tyndalehouse.step.web.client.toolkit.timeline.Timeline;
+import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimelineConstants;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.TimeBandNotFoundException;
import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
import com.tyndalehouse.step.web.shared.beans.TimelineBean;
@@ -35,35 +36,63 @@
import com.tyndalehouse.step.web.shared.result.GetTimelineUISetupResult;
import com.tyndalehouse.step.web.shared.timeline.Unit;
+/**
+ * TimelinePresenter is the presenter object for the Timeline module This is
+ * responsible for getting all the events from the server, firing changes across
+ * the event bus, if need be, repainting the timeline module, etc.
+ *
+ * @author cjburrell
+ *
+ */
+// TODO: timeline module needs refactoring quite a bit, since most of the logic
+// seems to be doing the view
+// as well, really ought to rewrite parts of it to remove the logic from the
+// display component
public class TimelinePresenter extends WidgetPresenter<TimelinePresenter.Display> {
- private final DispatchAsync dispatcher;
+ /**
+ * the view contract for the timeline module
+ *
+ * @author cjburrell
+ *
+ */
+ public interface Display extends WidgetDisplay {
- @Inject
- public TimelinePresenter(Display display, EventBus eventBus, DispatchAsync dispatcher) {
- super(display, eventBus);
- this.dispatcher = dispatcher;
-
- bind();
- }
-
- public interface Display extends WidgetDisplay {
+ /**
+ * @return the timeline module
+ */
Timeline getTimeline();
/**
- * the zoom in Button
- *
- * @return
+ * @return the zoom in Button
*/
HasClickHandlers getZoomIn();
/**
- * The zoom out button
- *
- * @return
+ * @return The zoom out button
*/
HasClickHandlers getZoomOut();
}
+ /**
+ * The dispatcher for requests to the server
+ */
+ private final DispatchAsync dispatcher;
+
+ /**
+ * Constructor to set up the timeline module
+ *
+ * @param display the view, passed in by Gin
+ * @param eventBus the event bus, passed in by Gin
+ * @param dispatcher the dispatcher, passed in by Gin
+ */
+ @Inject
+ public TimelinePresenter(final Display display, final EventBus eventBus, final DispatchAsync dispatcher) {
+ super(display, eventBus);
+ this.dispatcher = dispatcher;
+
+ bind();
+ }
+
@Override
public Place getPlace() {
// TODO Auto-generated method stub
@@ -71,51 +100,90 @@
}
@Override
- protected void onBind() {
- dispatcher.execute(new GetTimelineUISetupCommand(), new DisplayCallback<GetTimelineUISetupResult>(display) {
+ public void refreshDisplay() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void revealDisplay() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * registers interest in @see {@link ScriptureChangeEvent}
+ */
+ private void addScriptureChangeHandler() {
+ eventBus.addHandler(ScriptureChangeEvent.TYPE, new ScriptureChangeEventHandler() {
+
@Override
- protected void handleFailure(Throwable e) {
- Log.debug("Unable to initialise UI", e);
- }
+ public void onScriptureChange(final ScriptureChangeEvent event) {
+ Log.debug("Scripture Change event captured");
- @Override
- protected void handleSuccess(GetTimelineUISetupResult setupData) {
- Log.debug("Succesfully got timeline setup data");
- setupTimeline(setupData);
+ dispatcher.execute(new GetTimelineOriginForScriptureCommand(event.getNewReference()),
+ new DisplayCallback<GetTimelineOriginForScriptureResult>(display) {
+
+ @Override
+ protected void handleFailure(final Throwable e) {
+ Log.error("Failed to get timeline origin", e);
+ }
+
+ @Override
+ protected void handleSuccess(final GetTimelineOriginForScriptureResult value) {
+ if (!value.isEmpty()) {
+ final Timeline tl = display.getTimeline();
+ tl.repaint(value.getOriginDate(), value.getSuggestedTimeScale(), value
+ .getTimebandId());
+ // don't fire event to update list here,
+ // events haven't been requested yet!
+ }
+ // validation will be coped for elsewhere, in
+ // the relevant module, therefore do nothing at
+ // this stage
+ }
+
+ });
+
+ // so now we update the timeline, and we need to work out
+ // where to go.
+
}
});
+ }
- // TODO: all those anonymous classes make the code rather untidy... can
- // we possible put
- // all this somewhere else?
+ /**
+ *
+ */
+ private void addScrollHandler() {
eventBus.addHandler(TimelineScrollEvent.TYPE, new TimelineScrollEventHandler() {
@Override
public void onScroll(final TimelineScrollEvent event) {
dispatcher.execute(new GetEventsForDateRangeCommand(event.getTimebandVisibleDates()),
new DisplayCallback<GetEventsForDateRangeResult>(display) {
@Override
- protected void handleFailure(Throwable e) {
+ protected void handleFailure(final Throwable e) {
Log.error("An error occurred while tyring to get events for the timeline", e);
}
// TODO: push this down in to timeline component?
@Override
- protected void handleSuccess(GetEventsForDateRangeResult resultingEvents) {
+ protected void handleSuccess(final GetEventsForDateRangeResult resultingEvents) {
Log.debug("Request for events came back succesfully!");
- Log.debug("Request was for " + event.getTimebandVisibleDates().size() + " timebands.");
+ Log.debug("Request was for " + event.getTimebandVisibleDates().size()
+ + " timebands.");
- List<TimelineEventBean> events = resultingEvents.getEvents();
- Timeline tl = getDisplay().getTimeline();
+ final List<TimelineEventBean> events = resultingEvents.getEvents();
+ final Timeline tl = getDisplay().getTimeline();
- for (TimelineEventBean ev : events) {
- int timebandId = ev.getTimelineId();
+ for (final TimelineEventBean ev : events) {
+ final int timebandId = ev.getTimelineId();
try {
- Timeband correctBand = tl.getBand(timebandId);
- correctBand.addEvent(new TimeEvent(ev.getEventId(), ev.getName(), ev.getFromDate(), ev.getToDate(),
- correctBand));
- } catch (TimeBandNotFoundException e) {
+ final Timeband correctBand = tl.getBand(timebandId);
+ correctBand.addEvent(new TimeEvent(ev.getEventId(), ev.getName(), ev
+ .getFromDate(), ev.getToDate(), correctBand));
+ } catch (final TimeBandNotFoundException e) {
Log.debug("Could not find timeband");
}
}
@@ -124,12 +192,12 @@
// the timebands that their minimum received
// windows are slightly more
// and also resize the bands too
- for (TimeBandVisibleDate tbvd : event.getTimebandVisibleDates()) {
+ for (final TimeBandVisibleDate tbvd : event.getTimebandVisibleDates()) {
try {
- Timeband tb = tl.getBand(tbvd.getTimebandId());
+ final Timeband tb = tl.getBand(tbvd.getTimebandId());
tb.adjustRequestedView(tbvd.getMinDate(), tbvd.getMaxDate());
tb.resizeBand();
- } catch (TimeBandNotFoundException e) {
+ } catch (final TimeBandNotFoundException e) {
// if for some reason the timeband has
// gone, we can but ignore
// the error
@@ -137,16 +205,22 @@
}
}
- eventBus.fireEvent(new TimebandListUpdateRequiredEvent(tl.getCurrentBandStats()));
+ eventBus.fireEvent(new TimebandListUpdateRequiredEvent(tl
+ .getCurrentBandStats()));
}
});
}
});
+ }
+ /**
+ * Adds zoom in and out handlers to the timeline module
+ */
+ private void addZoomHandlers() {
display.getZoomIn().addClickHandler(new ClickHandler() {
@Override
- public void onClick(ClickEvent event) {
+ public void onClick(final ClickEvent event) {
// call zoom in on the timeline widget
display.getTimeline().zoomIn();
}
@@ -155,102 +229,45 @@
display.getZoomOut().addClickHandler(new ClickHandler() {
@Override
- public void onClick(ClickEvent event) {
+ public void onClick(final ClickEvent event) {
// call zoom in on the timeline widget
display.getTimeline().zoomOut();
}
});
+ }
- eventBus.addHandler(ScriptureChangeEvent.TYPE, new ScriptureChangeEventHandler() {
+ /**
+ * calling the server for the initial data setup
+ */
+ private void doInitialSetup() {
+ dispatcher.execute(new GetTimelineUISetupCommand(), new DisplayCallback<GetTimelineUISetupResult>(
+ display) {
@Override
- public void onScriptureChange(ScriptureChangeEvent event) {
- Log.debug("Scripture Change event captured");
+ protected void handleFailure(final Throwable e) {
+ Log.debug("Unable to initialise UI", e);
+ }
- dispatcher.execute(new GetTimelineOriginForScriptureCommand(event.getNewReference()),
- new DisplayCallback<GetTimelineOriginForScriptureResult>(display) {
-
- @Override
- protected void handleFailure(Throwable e) {
- Log.error("Failed to get timeline origin", e);
- }
-
- @Override
- protected void handleSuccess(GetTimelineOriginForScriptureResult value) {
- if (value.isEmpty()) {
- // do nothing - the reference submitted was
- // either invalid or had no events to
- // be shown.
- } else {
- Timeline tl = display.getTimeline();
- tl.repaint(value.getOriginDate(), value.getSuggestedTimeScale(), value.getTimebandId());
- // don't fire event to update list here,
- // events haven't been requested yet!
- }
- }
-
- });
-
- // so now we update the timeline, and we need to work out
- // where to go.
-
+ @Override
+ protected void handleSuccess(final GetTimelineUISetupResult setupData) {
+ Log.debug("Succesfully got timeline setup data");
+ setupTimeline(setupData);
}
});
-
- // eventBus.addHandler(NewArticleSelectedEvent.TYPE, new
- // NewArticleSelectedEventHandler() {
- // @Override
- // public void onNewArticleSelected(NewArticleSelectedEvent event) {
- //
- // }
- //
- //
- // });
- //
- // eventBus.addHandler(MultipleWordsSelectedEvent.TYPE, new
- // MultipleWordsSelectedEventHandler() {
- // @Override
- // public void onMultipleWordsSelected(MultipleWordsSelectedEvent event)
- // {
- // }
- // });
- //
- // eventBus.addHandler(WordSelectedEvent.TYPE, new
- // WordSelectedEventHandler() {
- // @Override
- // public void onWordSelectedEvent(WordSelectedEvent event) {
- //
- // }
- // });
}
- protected void setupTimeline(GetTimelineUISetupResult setupData) {
- Timeline timeline = display.getTimeline();
-
- // copy across to UI widget
- // we could avoid the copying here, since the timline bean
- // is essentially what is needed, but nice to have it decoupled.
- for (TimelineBean tb : setupData.getTimelines()) {
- Timeband band = new Timeband(timeline, tb.getTimelineId(), tb.getTimelineDescription());
-
- band.setPixelsPerUnit(100);
- Log.debug("Unit of band is: " + tb.getUnit());
- band.setOriginalUnit(Unit.valueOf(tb.getUnit()));
-
- // set the date to the middle of the band: TODO: again something
- // that needs changing.
- // band.setCurrentDate((tb.getMaxDate() + tb.getMinDate()) / 2);
- band.setCurrentDate(-61183987174853L); // one of the events in
- // Jesus' life
- band.setCurrentDateX(32000);
- timeline.addBand(band);
- }
- // timeline.fireTimelineScrollEvent();
- // timeline.initialise();
+ @Override
+ protected void onBind() {
+ // TODO: all those anonymous classes make the code rather untidy... can
+ // we possible put all this somewhere else?
+ doInitialSetup();
+ addScrollHandler();
+ addZoomHandlers();
+ addScriptureChangeHandler();
}
@Override
- protected void onPlaceRequest(PlaceRequest request) {
+ protected void onPlaceRequest(final PlaceRequest request) {
// TODO Auto-generated method stub
}
@@ -261,15 +278,28 @@
}
- @Override
- public void refreshDisplay() {
- // TODO Auto-generated method stub
+ /**
+ * sets up the timeline view, height, intial timebands, etc.
+ *
+ * @param setupData data returned from the server including all the
+ * timebands, and their units, etc.
+ */
+ protected void setupTimeline(final GetTimelineUISetupResult setupData) {
+ final Timeline timeline = display.getTimeline();
- }
+ // copy across to UI widget
+ // we could avoid the copying here, since the timline bean
+ // is essentially what is needed, but nice to have it decoupled.
+ // TODO: change TimelineBean to be a TimebandBean
+ for (final TimelineBean tb : setupData.getTimelines()) {
+ final Timeband band = new Timeband(timeline, tb.getTimelineId(), tb.getTimelineDescription());
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
+ band.setPixelsPerUnit(TimelineConstants.DEFAULT_PIXELS_PER_UNIT);
+ Log.debug("Unit of band is: " + tb.getUnit());
+ band.setOriginalUnit(Unit.valueOf(tb.getUnit()));
+ band.setCurrentDate(TimelineConstants.INITIAL_DATE);
+ band.setCurrentDateX(TimelineConstants.TIMELINE_WIDTH);
+ timeline.addBand(band);
+ }
}
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/TimelineConstants.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -9,6 +9,10 @@
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";
@@ -24,20 +28,26 @@
* 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";
+
/**
* 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
*/
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/HistoryModuleView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/HistoryModuleView.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/HistoryModuleView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -4,27 +4,49 @@
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.tyndalehouse.step.web.client.presenter.HistoryModulePresenter;
import com.tyndalehouse.step.web.client.toolkit.HtmlList;
import com.tyndalehouse.step.web.client.toolkit.HtmlList.ListType;
-import com.tyndalehouse.step.web.client.presenter.HistoryModulePresenter;
+/**
+ * The history module TODO: revamp this completely
+ *
+ * @author cjburrell
+ *
+ */
public class HistoryModuleView extends Composite implements HistoryModulePresenter.Display {
- private HTML article;
- private HtmlList contentsTable;
+ /**
+ * an article
+ */
+ private final HTML article;
- HistoryModuleView() {
- VerticalPanel vp = new VerticalPanel();
+ /**
+ * A contents page to choose from
+ */
+ private final HtmlList contentsTable;
+
+ /**
+ * default constructor
+ */
+ public HistoryModuleView() {
+ final VerticalPanel vp = new VerticalPanel();
initWidget(vp);
article = new HTML();
- article.setHTML("Abija Aviyam: \"father of the sea\" or \"my father " + "is the sea\" or \"my father is Yah\") was the fourth king "
- + "of the House of David and the second of the Kingdom of " + "Judah. He was the son of Rehoboam, the grandson of Solomon "
- + "and the great-grandson of David. The Chronicler refers to " + "him as \"Abijah (Hebrew, \"my father is The LORD\"). "
- + "William F. Albright has dated his reign to 915 BC - 913 " + "BC, while E. R. Thiele offers the dates 914/913 - 911/910 BC. "
+ article.setHTML("Abija Aviyam: \"father of the sea\" or \"my father "
+ + "is the sea\" or \"my father is Yah\") was the fourth king "
+ + "of the House of David and the second of the Kingdom of "
+ + "Judah. He was the son of Rehoboam, the grandson of Solomon "
+ + "and the great-grandson of David. The Chronicler refers to "
+ + "him as \"Abijah (Hebrew, \"my father is The LORD\"). "
+ + "William F. Albright has dated his reign to 915 BC - 913 "
+ + "BC, while E. R. Thiele offers the dates 914/913 - 911/910 BC. "
+ "[1] As explained in the Rehoboam article, Thiele's chronology for "
- + "the first kings of Judah contained an internal inconsistency " + "that later scholars corrected by dating these kings "
- + "one year earlier, so that Abijah's dates are taken as 915/914 " + "to 912/911 BC in the present article. The Hebrew Bible gives "
+ + "the first kings of Judah contained an internal inconsistency "
+ + "that later scholars corrected by dating these kings "
+ + "one year earlier, so that Abijah's dates are taken as 915/914 "
+ + "to 912/911 BC in the present article. The Hebrew Bible gives "
+ "his reign length as three years. His mother's name was Maacah, "
+ "or Micaiah, the granddaughter of the infamous Abishalom (Absalom). "
+ "Abijah married fourteen wives, and had 22 sons and 16 daughters. " + "[2]");
@@ -39,15 +61,20 @@
vp.add(article);
}
- public void setArticle(final String articleText) {
- article.setHTML(articleText);
- }
-
@Override
public Widget asWidget() {
return this;
}
+ /**
+ * Sets the current article
+ *
+ * @param articleText the text of the article to be viewed
+ */
+ public void setArticle(final String articleText) {
+ article.setHTML(articleText);
+ }
+
@Override
public void startProcessing() {
// TODO Auto-generated method stub
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSelectorView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSelectorView.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSelectorView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -10,14 +10,40 @@
import com.tyndalehouse.step.web.client.toolkit.HasSource;
import com.tyndalehouse.step.web.client.toolkit.SimpleListBox;
+/**
+ * The module selector view, displaying three levels of study
+ * <p />
+ * The module: History, Geography, etc. <br />
+ * <p />
+ * The sub-module: Genealogies,
+ * <p />
+ *
+ * The depth: the depth at which people want to study (scholarly, light etc.)
+ *
+ * @author cjburrell
+ *
+ */
public class ModuleSelectorView extends Composite implements ModuleSelectorPresenter.Display {
+ /**
+ * a list of modules
+ */
+ private final SimpleListBox module;
- private final SimpleListBox module;
+ /**
+ * a list of depths
+ */
private final SimpleListBox moduleDepth;
+
+ /**
+ * a list of sub modules, correlated to the list of modules
+ */
private final SimpleListBox subModule;
- ModuleSelectorView() {
- FlowPanel p = new FlowPanel();
+ /**
+ * The default constructor
+ */
+ public ModuleSelectorView() {
+ final FlowPanel p = new FlowPanel();
initWidget(p);
module = new SimpleListBox();
@@ -30,21 +56,39 @@
}
@Override
- public HasSource<List<String>> getModuleSource() {
+ public Widget asWidget() {
+ return this;
+ }
+
+ @Override
+ public HasChangeHandlers getModuleChangeHandlers() {
return module;
}
@Override
+ public HasChangeHandlers getModuleDepthChangeHandlers() {
+ return moduleDepth;
+ }
+
+ @Override
public HasSource<List<String>> getModuleDepthSource() {
return moduleDepth;
}
@Override
- public HasSource<List<String>> getSubModuleSource() {
- return subModule;
+ public HasSource<List<String>> getModuleSource() {
+ return module;
}
@Override
+ public String getSelectedDepth() {
+ if (moduleDepth.getItemCount() == 0) {
+ return null;
+ }
+ return moduleDepth.getValue(moduleDepth.getSelectedIndex());
+ }
+
+ @Override
public String getSelectedModule() {
// check that the module has been populated already!
if (module.getItemCount() == 0) {
@@ -63,31 +107,25 @@
}
@Override
- public String getSelectedDepth() {
- if (moduleDepth.getItemCount() == 0) {
- return null;
- }
- return moduleDepth.getValue(moduleDepth.getSelectedIndex());
+ public HasChangeHandlers getSubModuleChangeHandlers() {
+ return subModule;
}
@Override
- public HasChangeHandlers getModuleChangeHandlers() {
- return module;
- }
-
- @Override
- public HasChangeHandlers getSubModuleChangeHandlers() {
+ public HasSource<List<String>> getSubModuleSource() {
return subModule;
}
@Override
- public HasChangeHandlers getModuleDepthChangeHandlers() {
- return moduleDepth;
- }
+ public void setSelectedModule(final String value) {
+ // simple linear search
+ for (int ii = 0; ii < module.getItemCount(); ii++) {
+ if (value.equals(module.getValue(ii))) {
+ module.setSelectedIndex(ii);
+ return;
+ }
+ }
- @Override
- public Widget asWidget() {
- return this;
}
@Override
@@ -102,16 +140,4 @@
}
- @Override
- public void setSelectedModule(String value) {
- // simple linear search
- for (int ii = 0; ii < module.getItemCount(); ii++) {
- if (value.equals(module.getValue(ii))) {
- module.setSelectedIndex(ii);
- return;
- }
- }
-
- }
-
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -13,13 +13,34 @@
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.presenter.ScriptureSelectorPresenter;
+/**
+ * This view provides the user with a way to select a portion of scripture. It
+ * therefore contains a textbox and a button to fire the event. The textbox is
+ * an auto-complete textbox
+ *
+ * @author cjburrell
+ */
public class ScriptureSelectorView extends Composite implements ScriptureSelectorPresenter.Display {
- final private MultiWordSuggestOracle oracle;
- final private SuggestBox reference;
- final private Button search;
+ /**
+ * the source of the auto comlete textbox
+ */
+ private final MultiWordSuggestOracle oracle;
+ /**
+ * the auto complete text box
+ */
+ private final SuggestBox reference;
+
+ /**
+ * the button fired to search
+ */
+ private final Button search;
+
+ /**
+ * the default constructor to render the view
+ */
public ScriptureSelectorView() {
- FlowPanel p = new FlowPanel();
+ final FlowPanel p = new FlowPanel();
initWidget(p);
oracle = new MultiWordSuggestOracle();
@@ -34,39 +55,46 @@
}
@Override
- public Widget asWidget() {
- return this;
+ public void addSuggestion(final String suggestion) {
+ oracle.add(suggestion);
}
@Override
- public void startProcessing() {
- // TODO Auto-generated method stub
+ public void addSuggestions(final Collection<String> suggestions) {
+ oracle.addAll(suggestions);
}
@Override
- public void stopProcessing() {
- // TODO Auto-generated method stub
+ public Widget asWidget() {
+ return this;
+ }
+ /**
+ * @return the unvalidated biblical reference that is currently in the
+ * textbox
+ */
+ public HasValue<String> getReference() {
+ return reference;
}
- @Override
- public void addSuggestion(final String suggestion) {
- oracle.add(suggestion);
+ /**
+ * @return the search button on which to append listeners
+ */
+ public HasClickHandlers getSearch() {
+ return search;
}
@Override
- public void addSuggestions(final Collection<String> suggestions) {
- oracle.addAll(suggestions);
+ public void startProcessing() {
+ // TODO Auto-generated method stub
}
- public HasValue<String> getReference() {
- return reference;
- }
+ @Override
+ public void stopProcessing() {
+ // TODO Auto-generated method stub
- public HasClickHandlers getSearch() {
- return search;
}
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -27,19 +27,60 @@
import com.tyndalehouse.step.web.shared.scripture.VerseContent;
import com.tyndalehouse.step.web.shared.scripture.Word;
+/**
+ * This view aims to show Scripture to the user. In order to do this, the user
+ * can select a version from a dropdown. The
+ *
+ * TODO: remove the eventBus from the view.
+ *
+ * @author cjburrell
+ *
+ */
public class ScriptureView extends Composite implements ScripturePresenter.Display {
+ /**
+ * the auto list of bible versions
+ */
private final SourceListBox bibleVersions;
- private final HTML scriptureHTML;
- private final Panel scriptureHolder;
+
+ // TODO: to be removed into the presenter
+ /**
+ * the default event bus
+ */
private final EventBus eventBus;
- private List<VerseLabel> lemmaWords;
- private List<VerseLabel> morphs;
+ /**
+ * a list of VerseLabel (wrappers of bible text) that are currently being
+ * displayed and contain lemmas
+ */
+ private final List<VerseLabel> lemmaWords;
+
+ /**
+ * a list of VerseLabel (wrappers of bible text) that are currently being
+ * displayed and contain morphs
+ */
+ private final List<VerseLabel> morphs;
+
+ /**
+ * a logical display of scripture, in that events can be attached to each of
+ * the elements on this panel
+ */
+ private final Panel scriptureHolder;
+
+ /**
+ * a simple display of scripture as text
+ */
+ private final HTML scriptureHTML;
+
+ /**
+ * The default constructor
+ *
+ * @param eventBus eventBus - //TODO: remove this
+ */
@Inject
- public ScriptureView(EventBus eventBus) {
+ public ScriptureView(final EventBus eventBus) {
this.eventBus = eventBus;
- VerticalPanel vp = new VerticalPanel();
+ final VerticalPanel vp = new VerticalPanel();
scriptureHolder = new FlowPanel();
lemmaWords = new ArrayList<VerseLabel>();
morphs = new ArrayList<VerseLabel>();
@@ -65,42 +106,41 @@
}
@Override
- public void startProcessing() {
- }
-
- @Override
- public HasSource<SortedMap<String, String>> getSource() {
+ public HasChangeHandlers getChangeHandlers() {
return bibleVersions;
}
@Override
- public void stopProcessing() {
- //TODO: to be completed
+ public String getSelectedBibleVersion() {
+ return bibleVersions.getValue(bibleVersions.getSelectedIndex());
}
@Override
- public HasChangeHandlers getChangeHandlers() {
+ public HasSource<SortedMap<String, String>> getSource() {
return bibleVersions;
}
@Override
- public String getSelectedBibleVersion() {
- return bibleVersions.getValue(bibleVersions.getSelectedIndex());
+ public void highlight(final List<String> lemmaList) {
+ for (final VerseLabel vl : lemmaWords) {
+ for (final String l : lemmaList) {
+ if (vl.getLemma().equals(l)) {
+ vl.setStyleName(ScriptureDisplayConstants.EMPHASISE);
+ } else {
+ vl.removeStyleName(ScriptureDisplayConstants.EMPHASISE);
+ }
+ }
+ }
}
@Override
- public void setPassage(String text) {
- scriptureHTML.setHTML(text);
- }
+ public void setPassage(final Passage passage) {
+ final List<VerseContent> verseContent = passage.getVerseContent();
- @Override
- public void setPassage(Passage passage) {
- List<VerseContent> verseContent = passage.getVerseContent();
-
// clear current text:
scriptureHolder.clear();
- for (VerseContent v : verseContent) {
+ for (final VerseContent v : verseContent) {
if (v instanceof Title) {
doTitle((Title) v);
} else if (v instanceof Verse) {
@@ -110,10 +150,41 @@
}
- private void doVerse(Verse v) {
+ // TODO: probably remove the following function, and ensure the service is
+ // removed at the same time
+ @Override
+ public void setPassage(final String text) {
+ scriptureHTML.setHTML(text);
+ }
+
+ @Override
+ public void startProcessing() {
+ }
+
+ @Override
+ public void stopProcessing() {
+ // TODO: to be completed
+ }
+
+ /**
+ * Create an element to display a title
+ *
+ * @param v the logical representation of a title
+ */
+ private void doTitle(final Title v) {
+ final InlineLabel il = new InlineLabel(v.getText());
+ scriptureHolder.add(il);
+ }
+
+ /**
+ * Create a display for the verse
+ *
+ * @param v the logical representation of the verse
+ */
+ private void doVerse(final Verse v) {
VerseLabel vl;
- for (TextualElement text : v.getVerseContent()) {
+ for (final TextualElement text : v.getVerseContent()) {
// check that text is not nullable
if (text.getText() != null) {
vl = new VerseLabel(text.getText(), eventBus);
@@ -121,19 +192,19 @@
// then do specifics
if (text instanceof Word) {
- Word w = (Word) text;
+ final Word w = (Word) text;
// if there's an alternative, then we ensure that we set
// that up
// eventually UI design will mean changes here
vl.setAlternativeWord(w.getAlternativeWord());
- List<String> lemma = w.getLemma();
+ final List<String> lemma = w.getLemma();
if (lemma != null) {
lemmaWords.add(vl);
vl.setLemmas(lemma);
}
- List<String> morph = w.getMorph();
+ final List<String> morph = w.getMorph();
if (morph != null) {
vl.setMorphs(morph);
morphs.add(vl);
@@ -142,22 +213,4 @@
}
}
}
-
- private void doTitle(Title v) {
- InlineLabel il = new InlineLabel(v.getText());
- scriptureHolder.add(il);
- }
-
- @Override
- public void highlight(final List<String> lemmaList) {
- for (VerseLabel vl : lemmaWords) {
- for (String l : lemmaList) {
- if (vl.getLemma().equals(l)) {
- vl.setStyleName(ScriptureDisplayConstants.EMPHASISE);
- } else {
- vl.removeStyleName(ScriptureDisplayConstants.EMPHASISE);
- }
- }
- }
- }
}
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-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -14,28 +14,58 @@
import com.tyndalehouse.step.web.client.presenter.TimebandListPresenter;
import com.tyndalehouse.step.web.client.presenter.TimelinePresenter;
+/**
+ * This View sets up the many different views and the layout of the Step
+ * Application
+ *
+ * @author cjburrell
+ *
+ */
public class StepView extends Composite implements StepPresenter.Display {
/**
* This is the panel on which you display scripture side by side.
*/
- private DockPanel dp;
+ private final DockPanel dp;
// TODO: i should be able to pass in the ScriptureSelectorPresenter as
// opposed to the display directly
// we want one that is attached. that would remove the need for
+
+ /**
+ *
+ * Default constructor inputting most presenters, which initialises the
+ * views via Gin
+ *
+ * @param scriptureSelector a view allowing the user to key in a biblical
+ * reference
+ * @param scripture a view showing scripture
+ * @param scripture2 a second view showing scripture
+ * @param moduleSelector a view allowing the user to select his module of
+ * interest (history, geography, etc.)
+ * @param module the view display the various different modules (history,
+ * geography, etc.)
+ * @param timelinePresenter a view allowing the user to show
+ * @param timebandListPresenter a view showing the current numbers of events
+ * displayed on the timeline
+ * <p>
+ * TODO: experiment if these can be passed in using just the
+ * View, but their interface definition for e.g.
+ * ScripturePresenter.Display
+ */
@Inject
- public StepView(ScriptureSelectorPresenter scriptureSelector, ScripturePresenter scripture, ScripturePresenter scripture2,
- ModuleSelectorPresenter moduleSelector, StepModulePresenter<? extends StepModulePresenter.Display> module,
- TimelinePresenter timelinePresenter, TimebandListPresenter timebandListPresenter) {
+ public StepView(final ScriptureSelectorPresenter scriptureSelector, final ScripturePresenter scripture,
+ final ScripturePresenter scripture2, final ModuleSelectorPresenter moduleSelector,
+ final StepModulePresenter<? extends StepModulePresenter.Display> module,
+ final TimelinePresenter timelinePresenter, final TimebandListPresenter timebandListPresenter) {
- FlowPanel flow = new FlowPanel();
+ final FlowPanel flow = new FlowPanel();
dp = new DockPanel();
flow.add(dp);
initWidget(flow);
- HorizontalPanel northPanel = new HorizontalPanel();
+ final HorizontalPanel northPanel = new HorizontalPanel();
dp.add(northPanel, DockPanel.NORTH);
northPanel.add(scriptureSelector.getDisplay().asWidget());
@@ -60,7 +90,12 @@
dp.add(timebandListPresenter.getDisplay().asWidget(), DockPanel.SOUTH);
}
- public void addScriptureDisplay(ScripturePresenter scripture) {
+ /**
+ * adds a scripture display component to the page
+ *
+ * @param scripture scripture "view"
+ */
+ public void addScriptureDisplay(final ScripturePresenter scripture) {
dp.add(scripture.getDisplay().asWidget(), DockPanel.WEST);
// scripturePanels.add(scripture.getDisplay().asWidget());
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -17,17 +17,65 @@
import com.tyndalehouse.step.web.client.presenter.TimebandListPresenter;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
+/**
+ * The timeband list view is a list of timebands. The list includes numbers of
+ * events currently on the timeband and the number of events that could be
+ * shown, in the visible section, of the timeband should the user express
+ * interest
+ *
+ * @author cjburrell
+ *
+ */
public class TimebandListView extends Composite implements TimebandListPresenter.Display {
- private Map<Integer, CheckBox> checkboxes = new HashMap<Integer, CheckBox>();
- private VerticalPanel fp = new VerticalPanel();
+ /**
+ * the map of checkboxes displayed on the page
+ */
+ private final Map<Integer, CheckBox> checkboxes = new HashMap<Integer, CheckBox>();
+
+ /**
+ * TODO: remove this event bus
+ */
private final EventBus eventBus;
+ /**
+ * the vertical panel on which the checkboxes are added
+ */
+ private final VerticalPanel fp = new VerticalPanel();
+
+ /**
+ * The default constructor
+ *
+ * @param eventBus TODO: TO BE REMOVED
+ */
@Inject
- public TimebandListView(EventBus eventBus) {
+ public TimebandListView(final EventBus eventBus) {
this.eventBus = eventBus;
initWidget(fp);
}
+ @Override
+ public Widget asWidget() {
+ return this;
+ }
+
+ @Override
+ public void startProcessing() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopProcessing() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * method called to update the list of timebands with the latest statistics
+ *
+ * @param stats is a list of current numbers of events (total/visible) on
+ * each timeband
+ */
// TODO: should the event adding somehow be moved into the presenter?
public void updateList(final List<CurrentBandStats> stats) {
for (final CurrentBandStats band : stats) {
@@ -37,35 +85,18 @@
fp.add(cb);
cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
+ public void onValueChange(final ValueChangeEvent<Boolean> event) {
eventBus.fireEvent(new UserInterestInBandEvent(band.getBandId(), event.getValue()));
}
});
}
- int numEventsInBand = band.getNumVisibleElements();
+ final int numEventsInBand = band.getNumVisibleElements();
cb.setText(band.getBandDescription() + " (" + numEventsInBand + ")");
cb.setTitle("Click here to show " + numEventsInBand + " more events.");
cb.setValue(band.isUserInterested(), false);
checkboxes.put(band.getBandId(), cb);
}
}
-
- @Override
- public Widget asWidget() {
- return this;
- }
-
- @Override
- public void startProcessing() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void stopProcessing() {
- // TODO Auto-generated method stub
-
- }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java 2010-03-08 19:43:41 UTC (rev 99)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java 2010-03-09 20:32:51 UTC (rev 100)
@@ -12,20 +12,47 @@
import com.tyndalehouse.step.web.client.presenter.TimelinePresenter;
import com.tyndalehouse.step.web.client.toolkit.timeline.Timeline;
+/**
+ * the timeline view is a wrapper around the whole timeline component used for
+ * displaying events stored in the database. These events can be point-in-time
+ * or in duration.
+ *
+ * A timeline is split into a timebands, which are then split in to time tracks.
+ * The events are added to a timetrack
+ *
+ * @author cjburrell
+ *
+ */
public class TimelineView extends Composite implements TimelinePresenter.Display {
- private Timeline timeline;
- private Button zoomOut;
- private Button zoomIn;
+ /**
+ * The timeline component
+ */
+ private final Timeline timeline;
+ /**
+ * The zoom in button
+ */
+ private final Button zoomIn;
+
+ /**
+ * The zoom out button
+ */
+ private final Button zoomOut;
+
+ /**
+ * Default constructor TODO: remove eventBus
+ *
+ * @param eventBus remove event bus from here
+ */
@Inject
- public TimelineView(EventBus eventBus) {
+ public TimelineView(final EventBus eventBus) {
// to do a custom timeline for testing
// TODO: change to a provider, lookup Gin/Guice manual to do this...
timeline = new Timeline(eventBus);
- VerticalPanel vp = new VerticalPanel();
- FlowPanel fp = new FlowPanel();
+ final VerticalPanel vp = new VerticalPanel();
+ final FlowPanel fp = new FlowPanel();
vp.add(fp);
vp.setWidth("100%");
@@ -45,18 +72,6 @@
return this;
}
- @Override
- public void startProcessing() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void stopProcessing() {
- // TODO Auto-generated method stub
-
- }
-
/**
* @return the timeline
*/
@@ -64,11 +79,29 @@
return timeline;
}
+ /**
+ * @return A click handler on which to register an event for zooming in
+ */
public HasClickHandlers getZoomIn() {
return zoomIn;
}
+ /**
+ * @return A click handler on which to register an event for zooming out
+ */
public HasClickHandlers getZoomOut() {
return zoomOut;
}
+
+ @Override
+ public void startProcessing() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void stopProcessing() {
+ // TODO Auto-generated method stub
+
+ }
}
More information about the Tynstep-svn
mailing list