[Tynstep-svn] r132 - in trunk/step-web-app/src/main/java/com/tyndalehouse/step/web: . client/framework client/gin client/presenter client/toolkit/scripture client/toolkit/timeline client/view
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Sat Jun 12 09:31:04 MST 2010
Author: ChrisBurrell
Date: 2010-06-12 09:31:04 -0700 (Sat, 12 Jun 2010)
New Revision: 132
Removed:
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/ScriptureSelectorPresenter.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
Modified:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/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/ScripturePresenter.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/presenter/VersionSelectorPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.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/TimebandListView.java
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/step.gwt.xml
Log:
removing dependency on gwt-presenter
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/framework/StepEventBus.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,5 +1,7 @@
package com.tyndalehouse.step.web.client.framework;
+import java.util.List;
+
import com.google.gwt.user.client.ui.Widget;
import com.mvp4g.client.annotation.Event;
import com.mvp4g.client.annotation.Events;
@@ -11,6 +13,7 @@
import com.tyndalehouse.step.web.client.presenter.StepPresenter;
import com.tyndalehouse.step.web.client.presenter.VersionSelectorPresenter;
import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
+import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
import com.tyndalehouse.step.web.client.view.StepView;
@Events(startView = StepView.class, ginModule = StepClientModule.class)
@@ -43,4 +46,14 @@
@Event(handlers = { FilterResultsPresenter.class, StepPresenter.class, FilterResultsPresenter.class })
void moduleChanged(SideBarModule selectedModule);
+ /**
+ * when the timeband is updated
+ *
+ * @param currentBandStats
+ * a list of stats that have reflect the latest status of the
+ * timeband
+ */
+ @Event()
+ void timebandUpdated(List<CurrentBandStats> currentBandStats);
+
}
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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepClientModule.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -17,44 +17,6 @@
@Override
protected void configure() {
- //
- // // put the bindings in here
- //
- // bind(EventBus.class).to(StepEventBusImpl.class).in(Singleton.class);
- // bind(TimebandListPresenter.Display.class).to(TimebandListView.class);
- //
- // bind(AppPresenter.class).in(Singleton.class);
- // bind(PlaceManager.class).in(Singleton.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(VersionSelectorPresenter.Display.class).to(VersionSelectorView.class);
- //
- // //
- // // bind(ITimeLineRender.class).to(TimelineRenderer.class);
- //
- // bind(HistoryModulePresenter.class);
- // bind(HistoryModulePresenter.Display.class).to(HistoryModuleView.class);
- //
- // // bind(new TypeLiteral<StepModulePresenter<? extends
- // // StepModulePresenter.Display>>() {
- // // }).to(HistoryModulePresenter.class);
-
bind(DispatchAsync.class).to(DefaultDispatchAsync.class).in(Singleton.class);
- // bind(CachingDispatchAsync.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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/StepInjector.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -11,20 +11,4 @@
*/
@GinModules(StepClientModule.class)
public interface StepInjector extends Ginjector {
-
- // StepPresenter.Display getStepPresenterDisplay();
- //
- // /**
- // * 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();
}
Deleted: 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/AppPresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,67 +0,0 @@
-package com.tyndalehouse.step.web.client.presenter;
-
-import net.customware.gwt.dispatch.client.DispatchAsync;
-
-import com.allen_sauer.gwt.log.client.Log;
-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;
-//
-// // 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) {
-// this.dispatcher = dispatcher;
-// this.stepPresenter = stepPresenter;
-// 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());
-// }
-}
Deleted: 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/HistoryModulePresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,103 +0,0 @@
-package com.tyndalehouse.step.web.client.presenter;
-
-import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.Place;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
-
-/**
- * History module presenter, responsible for displaying articles on the page
- *
- * @author cjburrell
- *
- */
-public class HistoryModulePresenter extends WidgetPresenter<HistoryModulePresenter.Display> {
-
- /**
- * Interface for the History Module View
- *
- * @author cjburrell
- *
- */
- public interface Display extends WidgetDisplay {
-
- }
-
- /**
- * default constructor, injected by Gin
- *
- * @param display
- * display, comes from Gin
- * @param eventBus
- * eventBus comes from Gin
- */
- // @Inject
- public HistoryModulePresenter(final Display display, final EventBus eventBus) {
- super(display, eventBus);
- bind();
- }
-
- @Override
- public Place getPlace() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void refreshDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onBind() {
-
- // eventBus.addHandler(MultipleWordsSelectedEvent.TYPE, new
- // MultipleWordsSelectedEventHandler() {
- //
- // @Override
- // public void onMultipleWordsSelected(MultipleWordsSelectedEvent event)
- // {
- // // TODO Auto-generated method stub
- //
- // }
- // });
- //
- // eventBus.addHandler(WordSelectedEvent.TYPE, new
- // WordSelectedEventHandler() {
- //
- // @Override
- // public void onWordSelectedEvent(WordSelectedEvent event) {
- //
- // }
- // });
- //
- // eventBus.addHandler(DepthChangeEvent.TYPE, new
- // DepthChangeEventHandler() {
- //
- // @Override
- // public void onDepthChange(DepthChangeEvent event) {
- //
- // }
- // });
- }
-
- @Override
- protected void onPlaceRequest(final PlaceRequest request) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onUnbind() {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted: 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSelectorPresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,208 +0,0 @@
-package com.tyndalehouse.step.web.client.presenter;
-
-import java.util.List;
-
-import net.customware.gwt.dispatch.client.DispatchAsync;
-import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.Place;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
-
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.HasChangeHandlers;
-import com.tyndalehouse.step.web.client.event.ModuleChangeEvent;
-import com.tyndalehouse.step.web.client.service.refdata.ModuleRefData;
-import com.tyndalehouse.step.web.client.toolkit.HasSource;
-
-/**
- * Module selector module, responsible for displaying the dropdowns on the user
- * interface
- *
- * @author cjburrell
- *
- */
-public class ModuleSelectorPresenter extends WidgetPresenter<ModuleSelectorPresenter.Display> implements ChangeHandler {
-
- /**
- * 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();
-
- /**
- * @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();
-
- /**
- *
- * @return current selected depth (for example scholarly detail)
- */
- String getSelectedDepth();
-
- /**
- *
- * @return currently selected module
- */
- String getSelectedModule();
-
- /**
- *
- * @return currently selected sub-module
- */
- String getSelectedSubModule();
-
- /**
- *
- * @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.
- */
- public void onChange(final ChangeEvent event) {
- fireChange();
- }
-
- public void refreshDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @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() {
-
- public void onChange(final ChangeEvent event) {
- // in here, we need to reload the events
- 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...
- fireChange();
- }
- });
-
- display.getSubModuleChangeHandlers().addChangeHandler(this);
- display.getModuleDepthChangeHandlers().addChangeHandler(this);
- }
-
- /**
- * fires the change of dropdown selectors to the event bus.
- */
- private void fireChange() {
- eventBus.fireEvent(new ModuleChangeEvent(display.getSelectedModule(), display.getSelectedSubModule(), display
- .getSelectedDepth()));
-
- }
-
- @Override
- protected void onBind() {
- // do nothing at the moment
- // add event notifications...
- addDropdownChangeHandlers();
-
- // 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);
-
- // do i need to fire an module change event?
- }
-
- @Override
- protected void onPlaceRequest(final PlaceRequest request) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onUnbind() {
- // TODO Auto-generated method stub
-
- }
-
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -4,28 +4,9 @@
import java.util.SortedMap;
import net.customware.gwt.dispatch.client.DispatchAsync;
-import net.customware.gwt.presenter.client.DisplayCallback;
-import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.Place;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
-import com.tyndalehouse.step.web.client.event.LemmaClickedEvent;
-import com.tyndalehouse.step.web.client.event.ScriptureChangeEvent;
-import com.tyndalehouse.step.web.client.event.VersionChangeEvent;
-import com.tyndalehouse.step.web.client.eventhandler.LemmaClickedEventHandler;
-import com.tyndalehouse.step.web.client.eventhandler.ScriptureChangeEventHandler;
import com.tyndalehouse.step.web.client.toolkit.HasSource;
-import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
-import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
-import com.tyndalehouse.step.web.shared.common.scripturelookup.BibleTextLookupType;
-import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
-import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
import com.tyndalehouse.step.web.shared.scripture.Passage;
/**
@@ -36,7 +17,10 @@
* @author cjburrell
*
*/
-public class ScripturePresenter extends WidgetPresenter<ScripturePresenter.Display> {
+public class ScripturePresenter /*
+ * extends
+ * WidgetPresenter<ScripturePresenter.Display>
+ */{
/**
* Description of the view for presenting scripture to the user
@@ -44,7 +28,7 @@
* @author cjburrell
*
*/
- public interface Display extends WidgetDisplay {
+ public interface Display /* extends WidgetDisplay */{
/**
* TODO: change the name, it's a bit meaningless change handlers to the
* bible versions dropdown
@@ -91,14 +75,9 @@
/**
* default asynchronous dispatcher
*/
- private final DispatchAsync dispatcher;
+ private DispatchAsync dispatcher;
/**
- * the view itself, used to interact with it
- */
- private final ScriptureSelectorPresenter.Display scriptureSelectorView;
-
- /**
*
* @param display
* the view, provided by Gin
@@ -111,126 +90,111 @@
* in it), provided by Gin
*/
// @Inject
- public ScripturePresenter(final Display display, final EventBus eventBus, final DispatchAsync dispatcher,
- final ScriptureSelectorPresenter.Display scriptureSelectorView) {
- super(display, eventBus);
+ public ScripturePresenter(/*
+ * final Display display, final EventBus eventBus,
+ * final DispatchAsync dispatcher
+ */) {
+ // super(display, eventBus);
// TODO: remove dependency on scripture selector view
- this.dispatcher = dispatcher;
- this.scriptureSelectorView = scriptureSelectorView;
- Log.debug("Initialising Scripture Presenter");
- bind();
+ // this.dispatcher = dispatcher;
+ // Log.debug("Initialising Scripture Presenter");
+ // bind();
}
- @Override
- public Place getPlace() {
- // TODO Auto-generated method stub
- return null;
- }
-
public void refreshDisplay() {
// TODO Auto-generated method stub
}
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
- }
-
/**
* 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());
+ // final GetCurrentBibleTextCommand cmd = new
+ // GetCurrentBibleTextCommand(display.getSelectedBibleVersion(),
+ // scriptureSelectorView.getReference().getValue());
// TODO: decide if this should be made static or UI driven
- cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
-
- dispatcher.execute(cmd, new DisplayCallback<GetCurrentBibleTextResult>(display) {
-
- @Override
- protected void handleFailure(final Throwable e) {
- Log.error("An error has occurred", e);
- }
-
- @Override
- protected void handleSuccess(final GetCurrentBibleTextResult result) {
- // String text = result.getPassageText();
- display.setPassage(result.getPassage());
- }
-
- });
+ // cmd.setTypeOfLookup(BibleTextLookupType.REVERSE_INTERLINEAR);
+ //
+ // dispatcher.execute(cmd, new
+ // DisplayCallback<GetCurrentBibleTextResult>(display) {
+ //
+ // @Override
+ // protected void handleFailure(final Throwable e) {
+ // Log.error("An error has occurred", e);
+ // }
+ //
+ // @Override
+ // protected void handleSuccess(final GetCurrentBibleTextResult result)
+ // {
+ // // String text = result.getPassageText();
+ // display.setPassage(result.getPassage());
+ // }
+ //
+ // });
}
- @Override
+ // @Override
protected void onBind() {
- Log.debug("Binding Scripture Presenter");
- // get list of versions now...
- dispatcher.execute(new GetAvailableBibleVersionsCommand(),
- new DisplayCallback<GetAvailableBibleVersionsResult>(display) {
- @Override
- protected void handleFailure(final Throwable e) {
- Log.error("An error occurred while retrieving bible versions: ", e);
- }
-
- @Override
- protected void handleSuccess(final GetAvailableBibleVersionsResult result) {
- // display.getSource().setSource(result.getBooks());
- }
- });
-
- display.getChangeHandlers().addChangeHandler(new ChangeHandler() {
- public void onChange(final ChangeEvent event) {
- eventBus.fireEvent(new VersionChangeEvent());
- doRefreshScripture();
- }
- });
-
- eventBus.addHandler(ScriptureChangeEvent.TYPE, new ScriptureChangeEventHandler() {
-
- public void onScriptureChange(final ScriptureChangeEvent event) {
- Log.debug("Scripture Change event captured");
- doRefreshScripture();
- }
- });
-
- // TODO: this handler needs to be moved somewhere else, and fire off
- // definition found
- // TODO: given the handler name, our event bus, should be able to derive
- // the type of it,
- // since the type = Type<HandlerName>, at which point we can probably
- // get rid of
- // the type variable in the event.
- // we would have to change the event to return the static type declared
- // in the
- // event handler
-
- final LemmaClickedEventHandler lceh = new LemmaClickedEventHandler() {
- public void onLemmaClicked(final LemmaClickedEvent lemmaClickedEvent) {
- Log.error("Lemma Clicked event handler invoked");
- highlightAllLemmas(lemmaClickedEvent.getLemma());
- }
-
- private void highlightAllLemmas(final List<String> lemmas) {
- display.highlight(lemmas);
- }
- };
- eventBus.addHandler(LemmaClickedEvent.TYPE, lceh);
+ // Log.debug("Binding Scripture Presenter");
+ // // get list of versions now...
+ // dispatcher.execute(new GetAvailableBibleVersionsCommand(),
+ // new DisplayCallback<GetAvailableBibleVersionsResult>(display) {
+ // @Override
+ // protected void handleFailure(final Throwable e) {
+ // Log.error("An error occurred while retrieving bible versions: ", e);
+ // }
+ //
+ // @Override
+ // protected void handleSuccess(final GetAvailableBibleVersionsResult
+ // result) {
+ // // display.getSource().setSource(result.getBooks());
+ // }
+ // });
+ //
+ // display.getChangeHandlers().addChangeHandler(new ChangeHandler() {
+ // public void onChange(final ChangeEvent event) {
+ // eventBus.fireEvent(new VersionChangeEvent());
+ // doRefreshScripture();
+ // }
+ // });
+ //
+ // eventBus.addHandler(ScriptureChangeEvent.TYPE, new
+ // ScriptureChangeEventHandler() {
+ //
+ // public void onScriptureChange(final ScriptureChangeEvent event) {
+ // Log.debug("Scripture Change event captured");
+ // doRefreshScripture();
+ // }
+ // });
+ //
+ // // TODO: this handler needs to be moved somewhere else, and fire off
+ // // definition found
+ // // TODO: given the handler name, our event bus, should be able to
+ // derive
+ // // the type of it,
+ // // since the type = Type<HandlerName>, at which point we can probably
+ // // get rid of
+ // // the type variable in the event.
+ // // we would have to change the event to return the static type
+ // declared
+ // // in the
+ // // event handler
+ //
+ // final LemmaClickedEventHandler lceh = new LemmaClickedEventHandler()
+ // {
+ // public void onLemmaClicked(final LemmaClickedEvent lemmaClickedEvent)
+ // {
+ // Log.error("Lemma Clicked event handler invoked");
+ // highlightAllLemmas(lemmaClickedEvent.getLemma());
+ // }
+ //
+ // private void highlightAllLemmas(final List<String> lemmas) {
+ // display.highlight(lemmas);
+ // }
+ // };
+ // eventBus.addHandler(LemmaClickedEvent.TYPE, lceh);
}
-
- @Override
- protected void onPlaceRequest(final PlaceRequest request) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onUnbind() {
- // TODO Auto-generated method stub
-
- }
-
}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,162 +0,0 @@
-package com.tyndalehouse.step.web.client.presenter;
-
-import java.util.Collection;
-
-import net.customware.gwt.dispatch.client.DispatchAsync;
-import net.customware.gwt.presenter.client.DisplayCallback;
-import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.Place;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.user.client.ui.HasValue;
-import com.tyndalehouse.step.web.client.event.ScriptureChangeEvent;
-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> {
- /**
- * 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(final Display display, final EventBus eventBus, final DispatchAsync dispatcher) {
- super(display, eventBus);
-
- this.dispatcher = dispatcher;
-
- Log.debug("ScriptureSelectorPresenter initialised");
- 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
- return null;
- }
-
- 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) {
- @Override
- protected void handleFailure(final Throwable e) {
- // TODO Auto-generated method stub
- Log.error("Unable to get books from server", e);
- }
-
- @Override
- protected void handleSuccess(final GetBibleBooksCommandResult value) {
- display.addSuggestions(value.getBooks());
- }
- });
-
- display.getSearch().addClickHandler(new ClickHandler() {
-
- public void onClick(final ClickEvent event) {
- // can't use complicated classes here, as GWT java doesn't cope!
- 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.");
- return;
- }
-
- eventBus.fireEvent(new ScriptureChangeEvent(display.getReference().getValue()));
- }
- });
-
- }
-
- @Override
- protected void onPlaceRequest(final PlaceRequest request) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onUnbind() {
- // 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimebandListPresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -2,14 +2,9 @@
import java.util.List;
-import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.Place;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
-
+import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.event.TimebandListUpdateRequiredEvent;
-import com.tyndalehouse.step.web.client.eventhandler.TimebandListUpdateRequiredEventHandler;
+import com.tyndalehouse.step.web.client.framework.StepEventBus;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
/**
@@ -24,7 +19,7 @@
// 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> {
+public class TimebandListPresenter extends BasePresenter<TimebandListPresenter.Display, StepEventBus> {
/**
* Contract with any TimebandList view
@@ -32,7 +27,7 @@
* @author cjburrell
*
*/
- public interface Display extends WidgetDisplay {
+ public interface Display {
/**
* This method updates the list displayed with the latest statistics
*
@@ -52,49 +47,12 @@
*/
// TODO
// @Inject
- public TimebandListPresenter(final TimebandListPresenter.Display display, final EventBus eventBus) {
- super(display, eventBus);
- bind();
+ public TimebandListPresenter(final TimebandListPresenter.Display display) {
+ // bind();
}
- @Override
- protected void onBind() {
- eventBus.addHandler(TimebandListUpdateRequiredEvent.TYPE, new TimebandListUpdateRequiredEventHandler() {
-
- public void onTimebandListRequiringUpdate(
- final TimebandListUpdateRequiredEvent timebandListUpdateRequiredEvent) {
- final List<CurrentBandStats> stats = timebandListUpdateRequiredEvent.getTimelineStats();
- display.updateList(stats);
- }
- });
+ public void onTimebandListRequiringUpdate(final TimebandListUpdateRequiredEvent timebandListUpdateRequiredEvent) {
+ final List<CurrentBandStats> stats = timebandListUpdateRequiredEvent.getTimelineStats();
+ super.view.updateList(stats);
}
-
- @Override
- public Place getPlace() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void refreshDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void revealDisplay() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onPlaceRequest(final PlaceRequest request) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -3,27 +3,22 @@
import java.util.List;
import net.customware.gwt.dispatch.client.DispatchAsync;
-import net.customware.gwt.presenter.client.DisplayCallback;
-import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.Place;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+import com.mvp4g.client.annotation.Presenter;
+import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.event.ScriptureChangeEvent;
-import com.tyndalehouse.step.web.client.event.TimebandListUpdateRequiredEvent;
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.framework.StepEventBus;
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.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.client.view.TimelineView;
import com.tyndalehouse.step.web.shared.command.GetEventsForDateRangeCommand;
import com.tyndalehouse.step.web.shared.command.GetTimelineOriginForScriptureCommand;
import com.tyndalehouse.step.web.shared.command.GetTimelineUISetupCommand;
@@ -47,14 +42,15 @@
// 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> {
+ at Presenter(view = TimelineView.class)
+public class TimelinePresenter extends BasePresenter<TimelinePresenter.Display, StepEventBus> {
/**
* the view contract for the timeline module
*
* @author cjburrell
*
*/
- public interface Display extends WidgetDisplay {
+ public interface Display {
/**
* @return the timeline module
@@ -87,194 +83,37 @@
* @param dispatcher
* the dispatcher, passed in by Gin
*/
- // TODO
- // @Inject
- public TimelinePresenter(final Display display, final EventBus eventBus, final DispatchAsync dispatcher) {
- super(display, eventBus);
+ @Inject
+ public TimelinePresenter(final DispatchAsync dispatcher) {
this.dispatcher = dispatcher;
- bind();
+ // bind();
}
- @Override
- public Place getPlace() {
- // TODO Auto-generated method stub
- return null;
+ protected void onBind() {
+ // TODO: all those anonymous classes make the code rather untidy... can
+ // we possible put all this somewhere else?
+ doInitialSetup();
}
- 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() {
-
- public void onScriptureChange(final ScriptureChangeEvent event) {
- Log.debug("Scripture Change event captured");
-
- 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.
-
- }
- });
- }
-
- /**
- *
- */
- private void addScrollHandler() {
- eventBus.addHandler(TimelineScrollEvent.TYPE, new TimelineScrollEventHandler() {
- public void onScroll(final TimelineScrollEvent event) {
- dispatcher.execute(new GetEventsForDateRangeCommand(event.getTimebandVisibleDates()),
- new DisplayCallback<GetEventsForDateRangeResult>(display) {
- @Override
- 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(final GetEventsForDateRangeResult resultingEvents) {
- Log.debug("Request for events came back succesfully!");
- Log.debug("Request was for " + event.getTimebandVisibleDates().size() + " timebands.");
-
- final List<TimelineEventBean> events = resultingEvents.getEvents();
- final Timeline tl = getDisplay().getTimeline();
-
- for (final TimelineEventBean ev : events) {
- final int timebandId = ev.getTimelineId();
-
- try {
- 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");
- }
- }
-
- // now that we've added something, we can notify
- // the timebands that their minimum received
- // windows are slightly more
- // and also resize the bands too
- for (final TimeBandVisibleDate tbvd : event.getTimebandVisibleDates()) {
- try {
- final Timeband tb = tl.getBand(tbvd.getTimebandId());
- tb.adjustRequestedView(tbvd.getMinDate(), tbvd.getMaxDate());
- tb.resizeBand();
- } catch (final TimeBandNotFoundException e) {
- // if for some reason the timeband has
- // gone, we can but ignore
- // the error
- Log.error("Timeband " + tbvd.getTimebandId() + " cannot be found.");
- }
- }
-
- eventBus.fireEvent(new TimebandListUpdateRequiredEvent(tl.getCurrentBandStats()));
- }
- });
- }
- });
- }
-
- /**
- * Adds zoom in and out handlers to the timeline module
- */
- private void addZoomHandlers() {
- display.getZoomIn().addClickHandler(new ClickHandler() {
-
- public void onClick(final ClickEvent event) {
- // call zoom in on the timeline widget
- display.getTimeline().zoomIn();
- }
- });
-
- display.getZoomOut().addClickHandler(new ClickHandler() {
-
- public void onClick(final ClickEvent event) {
- // call zoom in on the timeline widget
- display.getTimeline().zoomOut();
- }
- });
- }
-
- /**
* calling the server for the initial data setup
*/
private void doInitialSetup() {
// TODO: this result can be cached quite successfully on the server
// (perhaps in the dispatch module
- dispatcher.execute(new GetTimelineUISetupCommand(), new DisplayCallback<GetTimelineUISetupResult>(display) {
-
- @Override
- protected void handleFailure(final Throwable e) {
+ dispatcher.execute(new GetTimelineUISetupCommand(), new AsyncCallback<GetTimelineUISetupResult>() {
+ public void onFailure(final Throwable e) {
Log.debug("Unable to initialise UI", e);
}
- @Override
- protected void handleSuccess(final GetTimelineUISetupResult setupData) {
+ public void onSuccess(final GetTimelineUISetupResult setupData) {
Log.debug("Succesfully got timeline setup data");
setupTimeline(setupData);
}
});
}
- @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(final PlaceRequest request) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- protected void onUnbind() {
- // TODO Auto-generated method stub
-
- }
-
/**
* sets up the timeline view, height, intial timebands, etc.
*
@@ -283,7 +122,7 @@
* their units, etc.
*/
protected void setupTimeline(final GetTimelineUISetupResult setupData) {
- final Timeline timeline = display.getTimeline();
+ final Timeline timeline = view.getTimeline();
// copy across to UI widget
// we could avoid the copying here, since the timline bean
@@ -300,4 +139,90 @@
timeline.addBand(band);
}
}
+
+ public void onScriptureChange(final ScriptureChangeEvent sce) {
+ Log.debug("Scripture Change event captured");
+ dispatcher.execute(new GetTimelineOriginForScriptureCommand(sce.getNewReference()),
+ new AsyncCallback<GetTimelineOriginForScriptureResult>() {
+ public void onFailure(final Throwable e) {
+ Log.error("Failed to get timeline origin", e);
+ }
+
+ public void onSuccess(final GetTimelineOriginForScriptureResult value) {
+ if (!value.isEmpty()) {
+ final Timeline tl = view.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.
+
+ /**
+ * to be called when timeband is scrolling
+ */
+ public void onScroll(final TimelineScrollEvent event) {
+ dispatcher.execute(new GetEventsForDateRangeCommand(event.getTimebandVisibleDates()),
+ new AsyncCallback<GetEventsForDateRangeResult>() {
+ public void onFailure(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?
+ public void onSuccess(final GetEventsForDateRangeResult resultingEvents) {
+ Log.debug("Request for events came back succesfully!");
+ Log.debug("Request was for " + event.getTimebandVisibleDates().size() + " timebands.");
+
+ final List<TimelineEventBean> events = resultingEvents.getEvents();
+ final Timeline tl = view.getTimeline();
+
+ for (final TimelineEventBean ev : events) {
+ final int timebandId = ev.getTimelineId();
+
+ try {
+ 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");
+ }
+ }
+
+ // now that we've added something, we can notify
+ // the timebands that their minimum received
+ // windows are slightly more
+ // and also resize the bands too
+ for (final TimeBandVisibleDate tbvd : event.getTimebandVisibleDates()) {
+ try {
+ final Timeband tb = tl.getBand(tbvd.getTimebandId());
+ tb.adjustRequestedView(tbvd.getMinDate(), tbvd.getMaxDate());
+ tb.resizeBand();
+ } catch (final TimeBandNotFoundException e) {
+ // if for some reason the timeband has
+ // gone, we can but ignore
+ // the error
+ Log.error("Timeband " + tbvd.getTimebandId() + " cannot be found.");
+ }
+ }
+
+ eventBus.timebandUpdated(tl.getCurrentBandStats());
+ }
+ });
+ }
+
+ public void onZoomIn() {
+ view.getTimeline().zoomIn();
+ }
+
+ public void onZoomOut() {
+ view.getTimeline().zoomOut();
+ }
+
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/VersionSelectorPresenter.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -3,69 +3,69 @@
import java.util.List;
import net.customware.gwt.dispatch.client.DispatchAsync;
-import net.customware.gwt.presenter.client.DisplayCallback;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
-import com.tyndalehouse.step.web.client.event.VersionChangeEvent;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
import com.tyndalehouse.step.web.client.view.VersionSelectorView;
import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
import com.tyndalehouse.step.web.shared.result.beans.BibleVersion;
-
@Presenter(view = VersionSelectorView.class)
public class VersionSelectorPresenter extends BasePresenter<VersionSelectorPresenter.Display, StepEventBus> {
- private final DispatchAsync dispatcher;
+ private final DispatchAsync dispatcher;
- /**
- * Interface for the Version Selector Module View
- */
- public interface Display {
- void addVersion(String continent, String language, String versionInitials, String versionName);
-// void addVersionChangeHandler(final SelectionHandler<VersionChangeEvent> handler);
+ /**
+ * Interface for the Version Selector Module View
+ */
+ public interface Display {
+ void addVersion(String continent, String language, String versionInitials, String versionName);
- Widget getWidget();
- }
+ // void addVersionChangeHandler(final
+ // SelectionHandler<VersionChangeEvent> handler);
- @Inject
- VersionSelectorPresenter(final DispatchAsync dispatcher) {
- this.dispatcher = dispatcher;
- }
-
- public void onStart() {
- super.eventBus.setLeftColumn(super.view.getWidget());
-
- dispatcher.execute(new GetAvailableBibleVersionsCommand(), new AsyncCallback<GetAvailableBibleVersionsResult>() {
-
- public void onFailure(Throwable e) {
- // TODO Auto-generated method stub
- Log.debug("Error getting available versions: ", e);
- }
+ Widget getWidget();
+ }
- public void onSuccess(GetAvailableBibleVersionsResult versions) {
- List<BibleVersion> bibleVersions = versions.getBibleVersions();
- for(BibleVersion bv : bibleVersions) {
- view.addVersion("Bibles", bv.getLanguage(), bv.getInitials(), bv.getName());
- }
- }
- });
- }
-
- public void bind() {
- //TODO: try with HasSelectionHandlers<TreeItem>
-// view.addVersionChangeHandler(new SelectionHandler<VersionSelectionEvent>() {
-// public void onSelection(SelectionEvent<VersionSelectionEvent> event) {
-// Log.debug("selection was changed");
-// }
-// });
- }
+ @Inject
+ VersionSelectorPresenter(final DispatchAsync dispatcher) {
+ this.dispatcher = dispatcher;
+ }
+
+ public void onStart() {
+ super.eventBus.setLeftColumn(super.view.getWidget());
+
+ dispatcher.execute(new GetAvailableBibleVersionsCommand(),
+ new AsyncCallback<GetAvailableBibleVersionsResult>() {
+
+ public void onFailure(final Throwable e) {
+ // TODO Auto-generated method stub
+ Log.debug("Error getting available versions: ", e);
+ }
+
+ public void onSuccess(final GetAvailableBibleVersionsResult versions) {
+ final List<BibleVersion> bibleVersions = versions.getBibleVersions();
+ for (final BibleVersion bv : bibleVersions) {
+ view.addVersion("Bibles", bv.getLanguage(), bv.getInitials(), bv.getName());
+ }
+ }
+ });
+ }
+
+ @Override
+ public void bind() {
+ // TODO: try with HasSelectionHandlers<TreeItem>
+ // view.addVersionChangeHandler(new
+ // SelectionHandler<VersionSelectionEvent>() {
+ // public void onSelection(SelectionEvent<VersionSelectionEvent> event)
+ // {
+ // Log.debug("selection was changed");
+ // }
+ // });
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -2,15 +2,12 @@
import java.util.List;
-import net.customware.gwt.presenter.client.EventBus;
-
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
-import com.tyndalehouse.step.web.client.event.LemmaClickedEvent;
/**
* Composite wrapper around a portion of scriptural text. The wrapper contains
@@ -21,112 +18,117 @@
*
*/
public class VerseLabel extends Composite {
- /**
- * if there is an interlinear, then this is where the alternative word is
- * stored
- */
- private Label alternativeWord;
+ /**
+ * if there is an interlinear, then this is where the alternative word is
+ * stored
+ */
+ private Label alternativeWord;
- /**
- * TODO: this should be removed into the presenter the event bus to fire off
- * events
- */
- private final EventBus eventBus;
+ /**
+ * TODO: this should be removed into the presenter the event bus to fire off
+ * events
+ */
+ // private final EventBus eventBus;
- /**
- * Flow panel for display
- */
- private final FlowPanel fp;
+ /**
+ * Flow panel for display
+ */
+ private final FlowPanel fp;
- /**
- * List of Strong numbers associated to this portion of text
- */
- private List<String> lemmas;
+ /**
+ * List of Strong numbers associated to this portion of text
+ */
+ private List<String> lemmas;
- /**
- * The main word(s) to be displayed
- */
- private final Label mainWord;
+ /**
+ * The main word(s) to be displayed
+ */
+ private final Label mainWord;
- /**
- * list of morphs associated to this wrapper of text
- */
- private List<String> morphs;
+ /**
+ * list of morphs associated to this wrapper of text
+ */
+ private List<String> morphs;
- /**
- * This constructors initialises an instance of the composite wrapper and
- * sets up the panel, css, etc.
- *
- * @param text the text to be wrapped
- * @param eventBus the event bus if events are to be fired
- */
- public VerseLabel(final String text, final EventBus eventBus) {
- fp = new FlowPanel();
+ /**
+ * This constructors initialises an instance of the composite wrapper and
+ * sets up the panel, css, etc.
+ *
+ * @param text
+ * the text to be wrapped
+ * @param eventBus
+ * the event bus if events are to be fired
+ */
+ public VerseLabel(final String text /* TODO , final EventBus eventBus */) {
+ fp = new FlowPanel();
- // TODO: store all strings to do with css somewhere central
- fp.setStyleName("scripture-interlinear");
- initWidget(fp);
+ // TODO: store all strings to do with css somewhere central
+ fp.setStyleName("scripture-interlinear");
+ initWidget(fp);
- // main word display (from the version selected)
- mainWord = new Label(text);
- fp.add(mainWord);
+ // main word display (from the version selected)
+ mainWord = new Label(text);
+ fp.add(mainWord);
- this.eventBus = eventBus;
- }
+ // this.eventBus = eventBus;
+ }
- /**
- * @return the lemma
- */
- public List<String> getLemma() {
- return lemmas;
- }
+ /**
+ * @return the lemma
+ */
+ public List<String> getLemma() {
+ return lemmas;
+ }
- /**
- * @return the morph
- */
- public List<String> getMorph() {
- return morphs;
- }
+ /**
+ * @return the morph
+ */
+ public List<String> getMorph() {
+ return morphs;
+ }
- /**
- * sets the alternative word. This could be a Hebrew word, but for a classic
- * interlinear it could also be a English word, where the main word is the
- * Hebrew
- *
- * @param originalWord an original word (for e.g. a hebrew translation)
- */
- public void setAlternativeWord(final String originalWord) {
- if (alternativeWord != null) {
- alternativeWord.setText(originalWord);
- return;
- }
+ /**
+ * sets the alternative word. This could be a Hebrew word, but for a classic
+ * interlinear it could also be a English word, where the main word is the
+ * Hebrew
+ *
+ * @param originalWord
+ * an original word (for e.g. a hebrew translation)
+ */
+ public void setAlternativeWord(final String originalWord) {
+ if (alternativeWord != null) {
+ alternativeWord.setText(originalWord);
+ return;
+ }
- alternativeWord = new Label(originalWord);
- fp.add(alternativeWord);
- }
+ alternativeWord = new Label(originalWord);
+ fp.add(alternativeWord);
+ }
- /**
- * @param lemma the lemma to set
- */
- public void setLemmas(final List<String> lemma) {
- this.lemmas = lemma;
+ /**
+ * @param lemma
+ * the lemma to set
+ */
+ public void setLemmas(final List<String> lemma) {
+ this.lemmas = lemma;
- if (lemma != null) {
- // add a click listener
- mainWord.addClickHandler(new ClickHandler() {
+ if (lemma != null) {
+ // add a click listener
+ mainWord.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent event) {
- Log.debug("Firing event");
- eventBus.fireEvent(new LemmaClickedEvent(lemma));
- }
- });
- }
- }
+ public void onClick(final ClickEvent event) {
+ Log.debug("Firing event");
+ // eventBus.fireEvent(new LemmaClickedEvent(lemma));
+ }
+ });
+ }
+ }
- /**
- * @param morph the morph to set
- */
- public void setMorphs(final List<String> morph) {
- this.morphs = morph;
- }
+ /**
+ * @param morph
+ * the morph to set
+ */
+ public void setMorphs(final List<String> morph) {
+ this.morphs = morph;
+ }
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -3,8 +3,6 @@
import java.util.ArrayList;
import java.util.List;
-import net.customware.gwt.presenter.client.EventBus;
-
import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.core.El;
import com.google.gwt.dom.client.EventTarget;
@@ -17,10 +15,7 @@
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.event.TimebandListUpdateRequiredEvent;
import com.tyndalehouse.step.web.client.event.TimelineScrollEvent;
-import com.tyndalehouse.step.web.client.event.UserInterestInBandEvent;
-import com.tyndalehouse.step.web.client.eventhandler.UserInterestInBandEventHandler;
import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimelineConstants;
import com.tyndalehouse.step.web.client.toolkit.timeline.events.TimelineMouseHandler;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.IncapableOfCalculatingRequestWindowException;
@@ -48,517 +43,544 @@
*/
public class Timeline extends Widget {
- /**
- * Client X records the last X-axis mouse position
- */
- private int clientX;
+ /**
+ * Client X records the last X-axis mouse position
+ */
+ private int clientX;
- /**
- * Map of hover over popups that describe an event
- */
- private final TimeEventDescriptor descriptor;
+ /**
+ * Map of hover over popups that describe an event
+ */
+ private final TimeEventDescriptor descriptor;
- /**
- * keeps track of whether the mouse button is up or down
- */
- private boolean downStatus;
+ /**
+ * keeps track of whether the mouse button is up or down
+ */
+ private boolean downStatus;
- /**
- * The event bus on which to fire events
- */
- private final EventBus eventBus;
+ /**
+ * The event bus on which to fire events
+ */
+ // private final EventBus eventBus;
- /**
- * the current height of the timeline module
- */
- private int height;
+ /**
+ * the current height of the timeline module
+ */
+ private int height;
- /**
- * whether the timeline is displayed horizontally or vertically (vertically
- * is not currently supported)
- */
- private boolean isHorizontal;
+ /**
+ * whether the timeline is displayed horizontally or vertically (vertically
+ * is not currently supported)
+ */
+ private boolean isHorizontal;
- /**
- * whether the timeline module has been rendered
- */
- private boolean isRendered = false;
+ /**
+ * whether the timeline module has been rendered
+ */
+ private boolean isRendered = false;
- /**
- * The list of timebands
- */
- private final List<Timeband> timebands;
+ /**
+ * The list of timebands
+ */
+ private final List<Timeband> timebands;
- /**
- * The container for the timeline module, a DOM element wrapping the whole
- * lot this is for styling and makes it easier
- */
- private final Element timelineContainer;
+ /**
+ * The container for the timeline module, a DOM element wrapping the whole
+ * lot this is for styling and makes it easier
+ */
+ private final Element timelineContainer;
- /**
- * the timeline div, in which everything gets done.
- */
- private final Element timelineDiv;
+ /**
+ * the timeline div, in which everything gets done.
+ */
+ private final Element timelineDiv;
- /**
- * The current width of the timeline module when rendered
- */
- private int width;
+ /**
+ * The current width of the timeline module when rendered
+ */
+ private int width;
- /**
- * Default constructor
- *
- * @param eventBus the event bus to fire events on
- */
- public Timeline(final EventBus eventBus) {
- this.eventBus = eventBus;
- timebands = new ArrayList<Timeband>();
+ /**
+ * Default constructor
+ *
+ * @param eventBus
+ * the event bus to fire events on
+ */
+ public Timeline(/* final EventBus eventBus */) {
+ // this.eventBus = eventBus;
+ timebands = new ArrayList<Timeband>();
- timelineContainer = DOM.createDiv();
- timelineContainer.setClassName("step-timeline-container");
+ timelineContainer = DOM.createDiv();
+ timelineContainer.setClassName("step-timeline-container");
- timelineDiv = DOM.createDiv();
- timelineDiv.setClassName("step-timeline");
- setElement(timelineDiv);
+ timelineDiv = DOM.createDiv();
+ timelineDiv.setClassName("step-timeline");
+ setElement(timelineDiv);
- // set up hover over
- descriptor = new TimeEventDescriptor(this);
+ // set up hover over
+ descriptor = new TimeEventDescriptor(this);
- paint();
- addEventHandlers(eventBus);
- disableSelection(getElement());
- }
+ paint();
+ // addEventHandlers(eventBus);
+ disableSelection(getElement());
+ }
- /**
- * Adds a band to a timeline module
- *
- * @param band the timeband to be added
- */
- public synchronized void addBand(final Timeband band) {
- timebands.add(band);
- band.paint();
- }
+ /**
+ * Adds a band to a timeline module
+ *
+ * @param band
+ * the timeband to be added
+ */
+ public synchronized void addBand(final Timeband band) {
+ timebands.add(band);
+ band.paint();
+ }
- /**
- * Both on load and on scroll we are doing an awful lot of looping to
- * repaint just in case TODO: change this perhaps with a stack of repainting
- * needed to ensure that we only repaint those timebands that think they
- * need repainting. for example, we don't need to be repainting the whole
- * band for one event etc.
- */
- public void fireTimelineScrollEvent() {
- final TimelineScrollEvent tse = new TimelineScrollEvent();
+ /**
+ * Both on load and on scroll we are doing an awful lot of looping to
+ * repaint just in case TODO: change this perhaps with a stack of repainting
+ * needed to ensure that we only repaint those timebands that think they
+ * need repainting. for example, we don't need to be repainting the whole
+ * band for one event etc.
+ */
+ public void fireTimelineScrollEvent() {
+ final TimelineScrollEvent tse = new TimelineScrollEvent();
- // calculate only those bits that need requesting! but at the same time
- // we don't need to wait for the server to redraw timebands
- for (final Timeband tb : timebands) {
- try {
- tb.paint(); // the timeband is rendered, and there are no new
- // events,
- // so apart from looping through the events which are already
- // rendered
- // we are only repainting the timescale
+ // calculate only those bits that need requesting! but at the same time
+ // we don't need to wait for the server to redraw timebands
+ for (final Timeband tb : timebands) {
+ try {
+ tb.paint(); // the timeband is rendered, and there are no new
+ // events,
+ // so apart from looping through the events which are already
+ // rendered
+ // we are only repainting the timescale
- final TimeBandVisibleDate tvd = tb.getOustandingTimebandPeriod();
- Log.debug("firing scroll " + tb.getDescription() + " " + tvd.getMinDate() + ","
- + tvd.getMaxDate());
- tse.addTimebandVisibleDate(tvd);
- } catch (final IncapableOfCalculatingRequestWindowException e) {
- Log.error("Incapable of calculating request window", e);
- }
- }
+ final TimeBandVisibleDate tvd = tb.getOustandingTimebandPeriod();
+ Log.debug("firing scroll " + tb.getDescription() + " " + tvd.getMinDate() + "," + tvd.getMaxDate());
+ tse.addTimebandVisibleDate(tvd);
+ } catch (final IncapableOfCalculatingRequestWindowException e) {
+ Log.error("Incapable of calculating request window", e);
+ }
+ }
- // check we have something to fire
- if (tse.getTimebandVisibleDates().size() != 0) {
- eventBus.fireEvent(tse);
- } else {
- // this is fired after the scroll has got the events,
- // but in this case we're not event firing
- // the event, so should update the stats, since the visible view has
- // changed
- eventBus.fireEvent(new TimebandListUpdateRequiredEvent(getCurrentBandStats()));
- }
- }
+ // check we have something to fire
+ if (tse.getTimebandVisibleDates().size() != 0) {
+ // TODO
+ // eventBus.fireEvent(tse);
+ } else {
+ // this is fired after the scroll has got the events,
+ // but in this case we're not event firing
+ // the event, so should update the stats, since the visible view has
+ // changed
+ // TODO
+ // eventBus.fireEvent(new
+ // TimebandListUpdateRequiredEvent(getCurrentBandStats()));
+ }
+ }
- /**
- * returns a band to the caller based on the band id
- *
- * @param bandId the band id of the band to be returned
- * @return the relevant timeband
- * @throws TimeBandNotFoundException thrown if bandId is not part of this
- * timeline module
- */
- public Timeband getBand(final int bandId) throws TimeBandNotFoundException {
- // do a linear search - we're not going to have lots of timebands
- for (final Timeband t : timebands) {
- if (t.getId() == bandId) {
- return t;
- }
- }
+ /**
+ * returns a band to the caller based on the band id
+ *
+ * @param bandId
+ * the band id of the band to be returned
+ * @return the relevant timeband
+ * @throws TimeBandNotFoundException
+ * thrown if bandId is not part of this timeline module
+ */
+ public Timeband getBand(final int bandId) throws TimeBandNotFoundException {
+ // do a linear search - we're not going to have lots of timebands
+ for (final Timeband t : timebands) {
+ if (t.getId() == bandId) {
+ return t;
+ }
+ }
- throw new TimeBandNotFoundException("Timeband " + bandId + " was not found.");
- }
+ throw new TimeBandNotFoundException("Timeband " + bandId + " was not found.");
+ }
- /**
- * Returns the number of bands to the caller
- *
- * @return the number of bands on the timeline module
- */
- public int getBandCount() {
- return timebands.size();
- }
+ /**
+ * Returns the number of bands to the caller
+ *
+ * @return the number of bands on the timeline module
+ */
+ public int getBandCount() {
+ return timebands.size();
+ }
- /**
- * returns the list of the timeband. This is rather dangerous, and probably
- * should be protected
- *
- * @return the list of timebands
- */
- public List<Timeband> getBands() {
- return timebands;
- }
+ /**
+ * returns the list of the timeband. This is rather dangerous, and probably
+ * should be protected
+ *
+ * @return the list of timebands
+ */
+ public List<Timeband> getBands() {
+ return timebands;
+ }
- /**
- * returns the stats for all timebands to the caller
- *
- * @return a list containing lots of @see {@link CurrentBandStats}
- */
- public List<CurrentBandStats> getCurrentBandStats() {
- final List<CurrentBandStats> stats = new ArrayList<CurrentBandStats>();
- for (final Timeband band : timebands) {
+ /**
+ * returns the stats for all timebands to the caller
+ *
+ * @return a list containing lots of @see {@link CurrentBandStats}
+ */
+ public List<CurrentBandStats> getCurrentBandStats() {
+ final List<CurrentBandStats> stats = new ArrayList<CurrentBandStats>();
+ for (final Timeband band : timebands) {
- final CurrentBandStats bandStats = new CurrentBandStats(band.getId(), band.getDescription(), band
- .getEvents().size(), band.getNumberOfVisibleEvents(), band.isUserInterested());
- stats.add(bandStats);
- }
+ final CurrentBandStats bandStats = new CurrentBandStats(band.getId(), band.getDescription(), band
+ .getEvents().size(), band.getNumberOfVisibleEvents(), band.isUserInterested());
+ stats.add(bandStats);
+ }
- return stats;
- }
+ return stats;
+ }
- /**
- * @return the height
- */
- public int getHeight() {
- return height;
- }
+ /**
+ * @return the height
+ */
+ public int getHeight() {
+ return height;
+ }
- /**
- * @return the timelineContainer
- */
- public Element getTimelineContainer() {
- return timelineContainer;
- }
+ /**
+ * @return the timelineContainer
+ */
+ public Element getTimelineContainer() {
+ return timelineContainer;
+ }
- /**
- * @return the width
- */
- public int getWidth() {
- return width;
- }
+ /**
+ * @return the width
+ */
+ public int getWidth() {
+ return width;
+ }
- /**
- * handles the mouse event, by alerting all the various bands to capture the
- * position of the mouse on them
- *
- * @param e mouse event
- */
- public void handle(final MouseDownEvent e) {
- downStatus = true;
- clientX = e.getClientX();
+ /**
+ * handles the mouse event, by alerting all the various bands to capture the
+ * position of the mouse on them
+ *
+ * @param e
+ * mouse event
+ */
+ public void handle(final MouseDownEvent e) {
+ downStatus = true;
+ clientX = e.getClientX();
- // capture scrollLeft on every timeband
- for (final Timeband tb : timebands) {
- tb.captureScrollLeft(e);
- }
+ // capture scrollLeft on every timeband
+ for (final Timeband tb : timebands) {
+ tb.captureScrollLeft(e);
+ }
- // Log.debug("ClientX " + clientX);
+ // Log.debug("ClientX " + clientX);
- // change cursor to hand grab
- new El(timelineDiv).setStyleName("step-grab", true);
+ // change cursor to hand grab
+ new El(timelineDiv).setStyleName("step-grab", true);
- // cursor: hand; /* ? */ TODO
- }
+ // cursor: hand; /* ? */ TODO
+ }
- /**
- * handles a move of the mouse, Ensures we know what timeband has been fired
- * then if the mouse is down, then tells timebands to move across else,
- * perhaps we're mouse hovering over something, and a popup needs to be
- * shown
- *
- * @param e the mouse move event
- */
- public void handle(final MouseMoveEvent e) {
- if (timebands.size() != 0) {
- Timeband firedBand;
- try {
- firedBand = getFiredBand(e);
- } catch (final UnknownFiredElement e1) {
- Log.warn("Unknown element was fired");
- firedBand = timebands.get(0);
- }
+ /**
+ * handles a move of the mouse, Ensures we know what timeband has been fired
+ * then if the mouse is down, then tells timebands to move across else,
+ * perhaps we're mouse hovering over something, and a popup needs to be
+ * shown
+ *
+ * @param e
+ * the mouse move event
+ */
+ public void handle(final MouseMoveEvent e) {
+ if (timebands.size() != 0) {
+ Timeband firedBand;
+ try {
+ firedBand = getFiredBand(e);
+ } catch (final UnknownFiredElement e1) {
+ Log.warn("Unknown element was fired");
+ firedBand = timebands.get(0);
+ }
- final Unit unit = firedBand.getUnit();
- final int pixelsPerUnit = firedBand.getPixelsPerUnit();
+ final Unit unit = firedBand.getUnit();
+ final int pixelsPerUnit = firedBand.getPixelsPerUnit();
- if (downStatus) {
- // mouse is down so move the scroll bars on each timeband
- // for each timeband, scroll a certain amount... This amount
- // though
- // is relative to the scales
- // at the same time we want to add some new scroll visible event
- // to
- // allow service layer to update
- // the events shown if necessary on each timeband
- for (final Timeband tb : timebands) {
- tb.setScrollLeft(clientX, e.getClientX(), unit, pixelsPerUnit);
- // Log.debug("About to scroll: " + (clientX -
- // e.getClientX()));
- }
+ if (downStatus) {
+ // mouse is down so move the scroll bars on each timeband
+ // for each timeband, scroll a certain amount... This amount
+ // though
+ // is relative to the scales
+ // at the same time we want to add some new scroll visible event
+ // to
+ // allow service layer to update
+ // the events shown if necessary on each timeband
+ for (final Timeband tb : timebands) {
+ tb.setScrollLeft(clientX, e.getClientX(), unit, pixelsPerUnit);
+ // Log.debug("About to scroll: " + (clientX -
+ // e.getClientX()));
+ }
- // fire the event and let presenter decide how much of the event
- // needs to be passed back to the server...
- // TODO: this needs to be fired also in the case of window
- // resizing events
- fireTimelineScrollEvent();
- } else {
- handleMouseOverTimeEvent(e);
- }
- }
- // ignore if no timebands, as it is not fully rendered
- }
+ // fire the event and let presenter decide how much of the event
+ // needs to be passed back to the server...
+ // TODO: this needs to be fired also in the case of window
+ // resizing events
+ fireTimelineScrollEvent();
+ } else {
+ handleMouseOverTimeEvent(e);
+ }
+ }
+ // ignore if no timebands, as it is not fully rendered
+ }
- /**
- * Sets the down status to false, simulating a mouse up, recording whether
- * the mouse is up or down, to false
- *
- * @param event mouse out event
- */
- public void handle(final MouseOutEvent event) {
- downStatus = false;
- }
+ /**
+ * Sets the down status to false, simulating a mouse up, recording whether
+ * the mouse is up or down, to false
+ *
+ * @param event
+ * mouse out event
+ */
+ public void handle(final MouseOutEvent event) {
+ downStatus = false;
+ }
- /**
- * on mouse over event, we call handleMouseOverTimeEvent to work out which
- * TimeEvent fired the event if at all
- *
- * @param e mouse over event
- */
- public void handle(final MouseOverEvent e) {
- handleMouseOverTimeEvent(e);
- }
+ /**
+ * on mouse over event, we call handleMouseOverTimeEvent to work out which
+ * TimeEvent fired the event if at all
+ *
+ * @param e
+ * mouse over event
+ */
+ public void handle(final MouseOverEvent e) {
+ handleMouseOverTimeEvent(e);
+ }
- /**
- * on mouse up, we set the down status to false, and update the mouse icon
- *
- * @param e mouse up event
- */
- public void handle(final MouseUpEvent e) {
- downStatus = false;
- new El(timelineDiv).setStyleName("step-letgo", true);
- }
+ /**
+ * on mouse up, we set the down status to false, and update the mouse icon
+ *
+ * @param e
+ * mouse up event
+ */
+ public void handle(final MouseUpEvent e) {
+ downStatus = false;
+ new El(timelineDiv).setStyleName("step-letgo", true);
+ }
- /**
- * handles the display or remove of the popup An awful lot of events are
- * going to fired and captured and discarded and one wonders if this is
- * really the best way to do it
- *
- * @param e move over event
- */
- public void handleMouseOverTimeEvent(final MouseEvent<?> e) {
- final EventTarget et = e.getNativeEvent().getEventTarget();
- final Element targetElement = et.cast();
+ /**
+ * handles the display or remove of the popup An awful lot of events are
+ * going to fired and captured and discarded and one wonders if this is
+ * really the best way to do it
+ *
+ * @param e
+ * move over event
+ */
+ public void handleMouseOverTimeEvent(final MouseEvent<?> e) {
+ final EventTarget et = e.getNativeEvent().getEventTarget();
+ final Element targetElement = et.cast();
- // find out if moved over event:
- // Log.debug("Scanning " + timebands.size() + " timebands");
- for (final Timeband band : timebands) {
- // Log.debug("Scanning " + band.getEvents().size());
- for (final TimeEvent te : band.getEvents().values()) {
- if (te.getEventDiv().isOrHasChild(targetElement)) {
- // Log.debug("Found event:" + te.getId() + " " +
- // te.getDescription());
- this.descriptor.show(te, e);
- return;
- }
- }
- }
+ // find out if moved over event:
+ // Log.debug("Scanning " + timebands.size() + " timebands");
+ for (final Timeband band : timebands) {
+ // Log.debug("Scanning " + band.getEvents().size());
+ for (final TimeEvent te : band.getEvents().values()) {
+ if (te.getEventDiv().isOrHasChild(targetElement)) {
+ // Log.debug("Found event:" + te.getId() + " " +
+ // te.getDescription());
+ this.descriptor.show(te, e);
+ return;
+ }
+ }
+ }
- // if no events found, then hide description:
- this.descriptor.hide();
- }
+ // if no events found, then hide description:
+ this.descriptor.hide();
+ }
- /**
- * @return the isHorizontal
- */
- public boolean isHorizontal() {
- return isHorizontal;
- }
+ /**
+ * @return the isHorizontal
+ */
+ public boolean isHorizontal() {
+ return isHorizontal;
+ }
- /**
- * call this when you want to force a repaint
- */
- public synchronized void paint() {
- if (!isRendered) {
- timelineDiv.appendChild(timelineContainer);
+ /**
+ * call this when you want to force a repaint
+ */
+ public synchronized void paint() {
+ if (!isRendered) {
+ timelineDiv.appendChild(timelineContainer);
- int relativeTop = 0;
- for (final Timeband tb : timebands) {
- tb.paint();
- relativeTop += tb.getSizeTapeTracks() * TimelineConstants.TAPE_TRACK_HEIGHT;
- }
+ int relativeTop = 0;
+ for (final Timeband tb : timebands) {
+ tb.paint();
+ relativeTop += tb.getSizeTapeTracks() * TimelineConstants.TAPE_TRACK_HEIGHT;
+ }
- // the total relative at this stage is the total height of the
- // timeline
- new El(timelineDiv).setHeight(relativeTop);
- isRendered = true;
- }
- }
+ // the total relative at this stage is the total height of the
+ // timeline
+ new El(timelineDiv).setHeight(relativeTop);
+ isRendered = true;
+ }
+ }
- /**
- * Repaints a particular timeband
- *
- * @param originDate date at which to start
- * @param unit unit to be used on the timeband
- * @param timebandId the timeband id
- */
- public void repaint(final Long originDate, final Unit unit, final int timebandId) {
- // remove all the timebands from the timeline widget
- // TODO: HERE all we want to do is set the corect timeband with that
- // unit, not all of them, right?
- // what if we have several timebands in the origin, is that possible?
- // events on different timebands with the same scripture references
+ /**
+ * Repaints a particular timeband
+ *
+ * @param originDate
+ * date at which to start
+ * @param unit
+ * unit to be used on the timeband
+ * @param timebandId
+ * the timeband id
+ */
+ public void repaint(final Long originDate, final Unit unit, final int timebandId) {
+ // remove all the timebands from the timeline widget
+ // TODO: HERE all we want to do is set the corect timeband with that
+ // unit, not all of them, right?
+ // what if we have several timebands in the origin, is that possible?
+ // events on different timebands with the same scripture references
- // TODO: set other timbands back to their original scales
+ // TODO: set other timbands back to their original scales
- for (final Timeband band : timebands) {
- setUserInterestOnBand(band, timebandId, unit);
- band.setCurrentDate(originDate);
- band.setCurrentDateX(TimelineConstants.TIMELINE_WIDTH + timelineDiv.getClientWidth() / 2);
- band.scrollToCurrentDate();
- band.redrawEmptyBand();
- }
+ for (final Timeband band : timebands) {
+ setUserInterestOnBand(band, timebandId, unit);
+ band.setCurrentDate(originDate);
+ band.setCurrentDateX(TimelineConstants.TIMELINE_WIDTH + timelineDiv.getClientWidth() / 2);
+ band.scrollToCurrentDate();
+ band.redrawEmptyBand();
+ }
- fireTimelineScrollEvent();
- }
+ fireTimelineScrollEvent();
+ }
- /**
- * @param height the height to set
- */
- public void setHeight(final int height) {
- this.height = height;
- }
+ /**
+ * @param height
+ * the height to set
+ */
+ public void setHeight(final int height) {
+ this.height = height;
+ }
- /**
- * @param isHorizontal the isHorizontal to set
- */
- public void setHorizontal(final boolean isHorizontal) {
- this.isHorizontal = isHorizontal;
- }
+ /**
+ * @param isHorizontal
+ * the isHorizontal to set
+ */
+ public void setHorizontal(final boolean isHorizontal) {
+ this.isHorizontal = isHorizontal;
+ }
- /**
- * @param width the width to set
- */
- public void setWidth(final int width) {
- this.width = width;
- }
+ /**
+ * @param width
+ * the width to set
+ */
+ public void setWidth(final int width) {
+ this.width = width;
+ }
- /**
- * Zooming is done on a band level, so delegate to timebands
- */
- public void zoomIn() {
- for (final Timeband tb : timebands) {
- tb.zoomIn();
- }
- }
+ /**
+ * Zooming is done on a band level, so delegate to timebands
+ */
+ public void zoomIn() {
+ for (final Timeband tb : timebands) {
+ tb.zoomIn();
+ }
+ }
- /**
- * Zooming is done on a band level, so delegate to timebands
- */
- public void zoomOut() {
- for (final Timeband tb : timebands) {
- tb.zoomOut();
- }
- }
+ /**
+ * Zooming is done on a band level, so delegate to timebands
+ */
+ public void zoomOut() {
+ for (final Timeband tb : timebands) {
+ tb.zoomOut();
+ }
+ }
- /**
- * adds event handlers to capture mouse movements, clicks, etc
- *
- * @param eventBus event bus on which to register some handlers
- */
- // TODO: investigate pushing the handlers in to the handler!!!
- private void addEventHandlers(final EventBus eventBus) {
- final TimelineMouseHandler tmh = new TimelineMouseHandler(this);
- addDomHandler(tmh, MouseMoveEvent.getType());
- addDomHandler(tmh, MouseUpEvent.getType());
- addDomHandler(tmh, MouseDownEvent.getType());
- addDomHandler(tmh, MouseOutEvent.getType());
- addDomHandler(tmh, MouseOverEvent.getType());
+ /**
+ * adds event handlers to capture mouse movements, clicks, etc
+ *
+ * @param eventBus
+ * event bus on which to register some handlers
+ */
+ // TODO: investigate pushing the handlers in to the handler!!!
+ private void addEventHandlers(/* final EventBus eventBus */) {
+ final TimelineMouseHandler tmh = new TimelineMouseHandler(this);
+ addDomHandler(tmh, MouseMoveEvent.getType());
+ addDomHandler(tmh, MouseUpEvent.getType());
+ addDomHandler(tmh, MouseDownEvent.getType());
+ addDomHandler(tmh, MouseOutEvent.getType());
+ addDomHandler(tmh, MouseOverEvent.getType());
- eventBus.addHandler(UserInterestInBandEvent.TYPE, new UserInterestInBandEventHandler() {
+ // TODO
+ // eventBus.addHandler(UserInterestInBandEvent.TYPE, new
+ // UserInterestInBandEventHandler() {
+ //
+ // public void onUserInterestedInBand(final UserInterestInBandEvent
+ // userInterestInBandEvent) {
+ // try {
+ // final Timeband band = getBand(userInterestInBandEvent.getBandId());
+ // band.registerUserInterest(userInterestInBandEvent.isOfInterest());
+ // band.paint();
+ // } catch (final TimeBandNotFoundException e) {
+ // Log.warn("The user request a band that no longer exists.");
+ // }
+ // }
+ // });
- public void onUserInterestedInBand(final UserInterestInBandEvent userInterestInBandEvent) {
- try {
- final Timeband band = getBand(userInterestInBandEvent.getBandId());
- band.registerUserInterest(userInterestInBandEvent.isOfInterest());
- band.paint();
- } catch (final TimeBandNotFoundException e) {
- Log.warn("The user request a band that no longer exists.");
- }
- }
- });
+ // TODO: add window handler
- // TODO: add window handler
+ }
- }
+ /**
+ * Disables the user selection on the timeline widget, to ensure the user
+ * gets a good experience
+ *
+ * @param e
+ * the DOM element on which to perform these javascript
+ * operations
+ */
+ private native void disableSelection(final Element e) /*-{
+ e.ondrag = function() { return false; };
+ e.onselectstart = function() { return false; };
+ e.style.MozUserSelect = "none";
+ }-*/;
- /**
- * Disables the user selection on the timeline widget, to ensure the user
- * gets a good experience
- *
- * @param e the DOM element on which to perform these javascript operations
- */
- private native void disableSelection(final Element e) /*-{
- e.ondrag = function() { return false; };
- e.onselectstart = function() { return false; };
- e.style.MozUserSelect = "none";
- }-*/;
+ /**
+ * returns the fired timeband band, given a mouse move event
+ *
+ * @param e
+ * the mouse band
+ * @return the timeband that was fired
+ * @throws UnknownFiredElement
+ * thrown if we do not know which timeband was fired
+ */
+ private Timeband getFiredBand(final MouseMoveEvent e) throws UnknownFiredElement {
+ final EventTarget et = e.getNativeEvent().getEventTarget();
+ final Element targetElement = et.cast();
- /**
- * returns the fired timeband band, given a mouse move event
- *
- * @param e the mouse band
- * @return the timeband that was fired
- * @throws UnknownFiredElement thrown if we do not know which timeband was
- * fired
- */
- private Timeband getFiredBand(final MouseMoveEvent e) throws UnknownFiredElement {
- final EventTarget et = e.getNativeEvent().getEventTarget();
- final Element targetElement = et.cast();
+ for (final Timeband b : timebands) {
+ if (b.getBandDiv().isOrHasChild(targetElement)) {
+ return b;
+ }
+ }
- for (final Timeband b : timebands) {
- if (b.getBandDiv().isOrHasChild(targetElement)) {
- return b;
- }
- }
+ throw new UnknownFiredElement();
+ }
- throw new UnknownFiredElement();
- }
+ /**
+ * if the band corresponds to the correct timeband id, then set unit,
+ * otherwise revert back to the original state...
+ *
+ * @param band
+ * band
+ * @param timebandId
+ * timebandId
+ * @param unit
+ * unit
+ */
+ private void setUserInterestOnBand(final Timeband band, final int timebandId, final Unit unit) {
+ if (band.getId() == timebandId) {
+ band.setUnit(unit);
+ band.registerUserInterest(true);
+ } else {
+ band.resetOriginalUnit();
+ band.registerUserInterest(false);
+ }
+ }
- /**
- * if the band corresponds to the correct timeband id, then set unit,
- * otherwise revert back to the original state...
- *
- * @param band band
- * @param timebandId timebandId
- * @param unit unit
- */
- private void setUserInterestOnBand(final Timeband band, final int timebandId, final Unit unit) {
- if (band.getId() == timebandId) {
- band.setUnit(unit);
- band.registerUserInterest(true);
- } else {
- band.resetOriginalUnit();
- band.registerUserInterest(false);
- }
- }
-
}
Deleted: 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/HistoryModuleView.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,87 +0,0 @@
-package com.tyndalehouse.step.web.client.view;
-
-import com.google.gwt.user.client.ui.Composite;
-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;
-
-/**
- * The history module TODO: revamp this completely
- *
- * @author cjburrell
- *
- */
-public class HistoryModuleView extends Composite implements HistoryModulePresenter.Display {
-
- /**
- * an article
- */
- private final HTML article;
-
- /**
- * 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. "
- + "[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 "
- + "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]");
-
- // contents at the top
- contentsTable = new HtmlList(ListType.UNORDERED);
- contentsTable.addItem("Abijah, Yah is my father", null);
- contentsTable.addItem("Abijam, father of the sea", null);
- contentsTable.addItem("Abilene, the father of mourning", null);
-
- vp.add(contentsTable);
- vp.add(article);
- }
-
- 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);
- }
-
- public void startProcessing() {
- // TODO Auto-generated method stub
-
- }
-
- public void stopProcessing() {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted: 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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSelectorView.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,133 +0,0 @@
-package com.tyndalehouse.step.web.client.view;
-
-import java.util.List;
-
-import com.google.gwt.event.dom.client.HasChangeHandlers;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.ModuleSelectorPresenter;
-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;
-
- /**
- * a list of depths
- */
- private final SimpleListBox moduleDepth;
-
- /**
- * a list of sub modules, correlated to the list of modules
- */
- private final SimpleListBox subModule;
-
- /**
- * The default constructor
- */
- public ModuleSelectorView() {
- final FlowPanel p = new FlowPanel();
- initWidget(p);
-
- module = new SimpleListBox();
- moduleDepth = new SimpleListBox();
- subModule = new SimpleListBox();
-
- p.add(module);
- p.add(moduleDepth);
- p.add(subModule);
- }
-
- public String getSelectedModule() {
- // check that the module has been populated already!
- if (module.getItemCount() == 0) {
- return null;
- }
-
- return module.getValue(module.getSelectedIndex());
- }
-
- 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;
- }
- }
- }
-
-
- public String getSelectedSubModule() {
- if (subModule.getItemCount() == 0) {
- return null;
- }
- return subModule.getValue(subModule.getSelectedIndex());
- }
-
- public Widget asWidget() {
- return this;
- }
-
- public HasChangeHandlers getModuleChangeHandlers() {
- return module;
- }
-
- public HasChangeHandlers getModuleDepthChangeHandlers() {
- return moduleDepth;
- }
-
- public HasSource<List<String>> getModuleDepthSource() {
- return moduleDepth;
- }
-
- public HasSource<List<String>> getModuleSource() {
- return module;
- }
-
- public String getSelectedDepth() {
- if (moduleDepth.getItemCount() == 0) {
- return null;
- }
- return moduleDepth.getValue(moduleDepth.getSelectedIndex());
- }
-
-
-
- public HasChangeHandlers getSubModuleChangeHandlers() {
- return subModule;
- }
-
- public HasSource<List<String>> getSubModuleSource() {
- return subModule;
- }
-
-
- public void startProcessing() {
- // TODO Auto-generated method stub
-
- }
-
- public void stopProcessing() {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,95 +0,0 @@
-package com.tyndalehouse.step.web.client.view;
-
-import java.util.Collection;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HasValue;
-import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
-import com.google.gwt.user.client.ui.SuggestBox;
-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 {
- /**
- * 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() {
- final FlowPanel p = new FlowPanel();
- initWidget(p);
-
- oracle = new MultiWordSuggestOracle();
- reference = new SuggestBox(oracle);
- p.add(reference);
-
- // TODO: localise this
- search = new Button("Lookup");
- p.add(search);
-
- Log.debug("== Scripture Selector View initialiased");
- }
-
- public void addSuggestion(final String suggestion) {
- oracle.add(suggestion);
- }
-
- public void addSuggestions(final Collection<String> suggestions) {
- oracle.addAll(suggestions);
-
- }
-
- public Widget asWidget() {
- return this;
- }
-
- /**
- * @return the unvalidated biblical reference that is currently in the
- * textbox
- */
- public HasValue<String> getReference() {
- return reference;
- }
-
- /**
- * @return the search button on which to append listeners
- */
- public HasClickHandlers getSearch() {
- return search;
- }
-
- public void startProcessing() {
- // TODO Auto-generated method stub
-
- }
-
- public void stopProcessing() {
- // TODO Auto-generated method stub
-
- }
-
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -4,8 +4,6 @@
import java.util.List;
import java.util.SortedMap;
-import net.customware.gwt.presenter.client.EventBus;
-
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
@@ -46,7 +44,7 @@
/**
* the default event bus
*/
- private final EventBus eventBus;
+ // private final EventBus eventBus;
/**
* a list of VerseLabel (wrappers of bible text) that are currently being
@@ -78,8 +76,8 @@
* eventBus - //TODO: remove this
*/
// @Inject
- public ScriptureView(final EventBus eventBus) {
- this.eventBus = eventBus;
+ public ScriptureView(/* final EventBus eventBus */) {
+ // this.eventBus = eventBus;
final VerticalPanel vp = new VerticalPanel();
scriptureHolder = new FlowPanel();
lemmaWords = new ArrayList<VerseLabel>();
@@ -180,7 +178,7 @@
for (final TextualElement text : v.getVerseContent()) {
// check that text is not nullable
if (text.getText() != null) {
- vl = new VerseLabel(text.getText(), eventBus);
+ vl = new VerseLabel(text.getText() /* TODO eventBus */);
scriptureHolder.add(vl);
// then do specifics
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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -4,15 +4,12 @@
import java.util.List;
import java.util.Map;
-import net.customware.gwt.presenter.client.EventBus;
-
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.event.UserInterestInBandEvent;
import com.tyndalehouse.step.web.client.presenter.TimebandListPresenter;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
@@ -34,7 +31,7 @@
/**
* TODO: remove this event bus
*/
- private final EventBus eventBus;
+ // private final EventBus eventBus;
/**
* the vertical panel on which the checkboxes are added
@@ -48,8 +45,8 @@
* TODO: TO BE REMOVED
*/
// @Inject
- public TimebandListView(final EventBus eventBus) {
- this.eventBus = eventBus;
+ public TimebandListView(/* final EventBus eventBus */) {
+ // this.eventBus = eventBus;
initWidget(fp);
}
@@ -83,7 +80,10 @@
fp.add(cb);
cb.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
public void onValueChange(final ValueChangeEvent<Boolean> event) {
- eventBus.fireEvent(new UserInterestInBandEvent(band.getBandId(), event.getValue()));
+ // TODO
+ // eventBus.fireEvent(new
+ // UserInterestInBandEvent(band.getBandId(),
+ // event.getValue()));
}
});
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-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java 2010-06-12 16:31:04 UTC (rev 132)
@@ -1,7 +1,5 @@
package com.tyndalehouse.step.web.client.view;
-import net.customware.gwt.presenter.client.EventBus;
-
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
@@ -46,10 +44,10 @@
* remove event bus from here
*/
// @Inject
- public TimelineView(final 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);
+ timeline = new Timeline(/* eventBus */);
final VerticalPanel vp = new VerticalPanel();
final FlowPanel fp = new FlowPanel();
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml 2010-06-12 15:18:45 UTC (rev 131)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/step.gwt.xml 2010-06-12 16:31:04 UTC (rev 132)
@@ -8,7 +8,6 @@
<inherits name='com.mvp4g.Mvp4gModule' />
<inherits name='net.customware.gwt.dispatch.Dispatch' />
- <inherits name='net.customware.gwt.presenter.Presenter' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
More information about the Tynstep-svn
mailing list