[Tynstep-svn] r158 - in trunk/step-web-app/src/main/java/com/tyndalehouse/step/web: . client client/bundles client/bundles/css client/event client/eventhandler client/presenter client/presenter/display client/service client/toolkit client/toolkit/data client/toolkit/scripture client/toolkit/widgets client/view client/view/handlers server/jsword/com
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Sat Jul 31 02:18:28 MST 2010
Author: ChrisBurrell
Date: 2010-07-31 02:18:27 -0700 (Sat, 31 Jul 2010)
New Revision: 158
Added:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/StepResources.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Layout.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Passage.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/BookmarkDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/FilterResultsDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ModuleSideBarDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/PassagePresenterDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScripturePresenterDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScriptureSelectorDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/StepDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimebandListDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimelineDisplay.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/data/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/data/SideBarModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownComposite.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/DecoratedComposite.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/HighlightableLabel.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonComposite.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/VerseLabel.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasClickAndHighlightHandlers.java
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/gin/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/service/refdata/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.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/widgets/BibleVersionsDropDownWidget.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/jsword/com/tyndalehouse/
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/
Modified:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/PassagePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimebandListPresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/InlinePanel.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/PassageView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java
Log:
commiting fix to remove unecessary compile files causing assembler to overwrite gwtp compilation
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/StepEntryPoint.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,7 +5,7 @@
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
import com.mvp4g.client.Mvp4gModule;
-import com.tyndalehouse.step.web.client.gin.StepInjector;
+import com.tyndalehouse.step.web.client.framework.gin.StepInjector;
/**
* Entry point to the one and only application page
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/StepResources.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/StepResources.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/StepResources.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,42 @@
+package com.tyndalehouse.step.web.client.bundles;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+import com.tyndalehouse.step.web.client.bundles.css.Layout;
+import com.tyndalehouse.step.web.client.bundles.css.Passage;
+
+public interface StepResources extends ClientBundle {
+ public static final StepResources RESOURCES = GWT.create(StepResources.class);
+
+ @Source("com/tyndalehouse/step/web/client/sidebar/people.png")
+ ImageResource peopleModule();
+
+ @Source("com/tyndalehouse/step/web/client/sidebar/globe.png")
+ ImageResource geographyModule();
+
+ @Source("com/tyndalehouse/step/web/client/sidebar/search.png")
+ ImageResource searchModule();
+
+ @Source("com/tyndalehouse/step/web/client/sidebar/language.png")
+ ImageResource languageModule();
+
+ @Source("com/tyndalehouse/step/web/client/sidebar/books.png")
+ ImageResource literatureModule();
+
+ @Source("com/tyndalehouse/step/web/client/sidebar/history.png")
+ ImageResource historyModule();
+
+ @Source("com/tyndalehouse/step/web/client/toolkit/options.png")
+ ImageResource options();
+
+ @Source("com/tyndalehouse/step/web/client/toolkit/options-over.png")
+ ImageResource optionsOver();
+
+ @Source("com/tyndalehouse/step/web/client/css/layout.css")
+ Layout layout();
+
+ @Source("com/tyndalehouse/step/web/client/css/passage.css")
+ Passage passage();
+
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Layout.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Layout.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Layout.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,11 @@
+package com.tyndalehouse.step.web.client.bundles.css;
+
+import com.google.gwt.resources.client.CssResource;
+
+public interface Layout extends CssResource {
+ String inlinePanel();
+
+ String floatRight();
+
+ String floatLeft();
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Passage.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Passage.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/bundles/css/Passage.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,25 @@
+package com.tyndalehouse.step.web.client.bundles.css;
+
+import com.google.gwt.resources.client.CssResource;
+
+public interface Passage extends CssResource {
+
+ String lineBreak();
+
+ String title();
+
+ String quote();
+
+ String versePanel();
+
+ String transChange();
+
+ String word();
+
+ String verseNumber();
+
+ String lemma();
+
+ String highlight();
+
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/DictionaryDefinitionFoundEvent.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -8,9 +8,9 @@
* responded with a dictionary definition and different parts of the system may
* require notification of it.
*
- * @author cjburrell
- *
+ * @author cjburrell TODO remove when implemented elsewhere
*/
+ at Deprecated
public class DictionaryDefinitionFoundEvent extends GwtEvent<DictionaryDefinitionFoundHandler> {
/**
* The default Type Handler Type is parameterized by the handler type in
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimebandListUpdateRequiredEvent.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -10,9 +10,9 @@
* Event signalling that the timebands have been changed and an update is
* required from any component keeping track of counts
*
- * @author cjburrell
- *
+ * @author cjburrell TODO remove when implemented elsewhere
*/
+ at Deprecated
public class TimebandListUpdateRequiredEvent extends GwtEvent<TimebandListUpdateRequiredEventHandler> {
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/TimelineScrollEvent.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -11,9 +11,9 @@
* Event signalling the timeline has been scrolled. This event contains the list
* of timebands, and the portions of those that need updating
*
- * @author cjburrell
- *
+ * @author cjburrell TODO remove when implemented elsewhere
*/
+ at Deprecated
public class TimelineScrollEvent extends GwtEvent<TimelineScrollEventHandler> {
/**
* The default Type Handler Type is parameterized by the handler type in
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/event/UserInterestInBandEvent.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -6,9 +6,9 @@
/**
* Event signalling the user is interested or not interested in a new timeband
*
- * @author cjburrell
- *
+ * @author cjburrell TODO remove when implemented elsewhere
*/
+ at Deprecated
public class UserInterestInBandEvent extends GwtEvent<UserInterestInBandEventHandler> {
/**
* The default Type Handler Type is parameterized by the handler type in
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/DictionaryDefinitionFoundHandler.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,11 +5,13 @@
/**
* This contract is relevant to any handler who wants to be notified when a
- * definition was looked up from the server
+ * definition was looked up from the server TODO remove when implemented
+ * elsewhere
*
* @author cjburrell
*
*/
+ at Deprecated
public interface DictionaryDefinitionFoundHandler extends EventHandler {
/**
* This method is fired when a dictionary definition has been looked up from
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimebandListUpdateRequiredEventHandler.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,11 +5,12 @@
/**
* Contract for handlers requiring notification of updates to the number of
- * events on the timebands
+ * events on the timebands TODO: remove when implemented elsewhere
*
* @author cjburrell
*
*/
+ at Deprecated
public interface TimebandListUpdateRequiredEventHandler extends EventHandler {
/**
* This is fired when new events are added to the timeband, or when events
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/TimelineScrollEventHandler.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,11 +5,12 @@
/**
* Contract for handlers wanting to be alerted when the timeline is being
- * scrolled
+ * scrolled TODO remove when implemented elsewhere
*
* @author cjburrell
*
*/
+ at Deprecated
public interface TimelineScrollEventHandler extends EventHandler {
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/eventhandler/UserInterestInBandEventHandler.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,11 +5,12 @@
/**
* Contract for handlers requiring notifications of timebands being
- * selected/unselected
+ * selected/unselected TODO remove ehwne implemented elsewhere
*
* @author cjburrell
*
*/
+ at Deprecated
public interface UserInterestInBandEventHandler extends EventHandler {
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/BookmarkPresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -15,12 +15,12 @@
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.ScripturePresenterPosition;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.presenter.display.BookmarkDisplay;
import com.tyndalehouse.step.web.client.toolkit.handlers.BookmarkHandler;
import com.tyndalehouse.step.web.client.view.BookmarkView;
@Presenter(view = BookmarkView.class)
-public class BookmarkPresenter extends BasePresenter<BookmarkPresenter.Display, StepEventBus> {
+public class BookmarkPresenter extends BasePresenter<BookmarkDisplay, StepEventBus> {
/** IMPROVEMENT make bookmark capacity a user setting */
private static final int BOOKMARK_CAPACITY = 20;
/**
@@ -29,29 +29,6 @@
* */
private final List<String> currentBookmarks = new ArrayList<String>();
- /** contact with the sidebar view */
- public interface Display extends StepViewInterface {
-
- /**
- * adds a bookmark to the view display
- *
- * @param shortNameReference
- * short name reference for e.g. Matt 1:1
- * @param referenceShortName
- * the
- * @param displayOptions
- */
- BookmarkHandler addBookmark(String shortNameReference);
-
- /**
- * removes the bookmark stored at index
- *
- * @param index
- * index of the bookmark to be removed
- */
- void removeBookmark(int index);
- }
-
/**
* scripture changed successfully, so add it to the bookmarks
*
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/FilterResultsPresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -6,21 +6,14 @@
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.framework.StepViewInterface;
-import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
+import com.tyndalehouse.step.web.client.presenter.display.FilterResultsDisplay;
+import com.tyndalehouse.step.web.client.toolkit.data.SideBarModule;
import com.tyndalehouse.step.web.client.view.FilterResultsView;
@Presenter(view = FilterResultsView.class)
-public class FilterResultsPresenter extends BasePresenter<FilterResultsPresenter.Display, StepEventBus> {
+public class FilterResultsPresenter extends BasePresenter<FilterResultsDisplay, StepEventBus> {
private final DispatchAsync dispatcher;
- /**
- * Interface for the Version Selector Module View
- */
- public interface Display extends StepViewInterface {
-
- }
-
@Inject
FilterResultsPresenter(final DispatchAsync dispatcher) {
this.dispatcher = dispatcher;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ModuleSideBarPresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -2,34 +2,14 @@
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.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.framework.StepViewInterface;
-import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
+import com.tyndalehouse.step.web.client.presenter.display.ModuleSideBarDisplay;
import com.tyndalehouse.step.web.client.view.ModuleSideBarView;
@Presenter(view = ModuleSideBarView.class)
-public class ModuleSideBarPresenter extends BasePresenter<ModuleSideBarPresenter.Display, StepEventBus> {
- /** contact with the sidebar view */
- public interface Display extends StepViewInterface {
- HasClickHandlers getGeography();
-
- HasClickHandlers getHistory();
-
- HasClickHandlers getLanguage();
-
- HasClickHandlers getPeople();
-
- HasClickHandlers getSearch();
-
- HasClickHandlers getLiterature();
-
- SideBarModule getSelectedModule();
-
- }
-
+public class ModuleSideBarPresenter extends BasePresenter<ModuleSideBarDisplay, StepEventBus> {
/**
* fires the start of the module side bar. Should register events to alert
* when the module has changed. This in turn should fire off changes in the
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/PassagePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/PassagePresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/PassagePresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,29 +1,35 @@
package com.tyndalehouse.step.web.client.presenter;
-import static com.tyndalehouse.step.web.client.common.OsisUtils.getVerseNumberFromOsisId;
-import static com.tyndalehouse.step.web.client.common.StringUtils.isNotEmpty;
+import static com.tyndalehouse.step.web.client.framework.utils.OsisUtils.getVerseNumberFromOsisId;
+import static com.tyndalehouse.step.web.client.framework.utils.StringUtils.isNotEmpty;
import static com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions.VERSE_NUMBERS;
import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.LEMMA;
import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.OSIS_ID;
import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.VERSE;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import net.customware.gwt.dispatch.client.DispatchAsync;
import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.presenter.display.PassagePresenterDisplay;
import com.tyndalehouse.step.web.client.toolkit.handlers.OptionEvent;
import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
import com.tyndalehouse.step.web.client.view.PassageView;
+import com.tyndalehouse.step.web.client.view.handlers.HasClickAndHighlightHandlers;
import com.tyndalehouse.step.web.shared.command.GetCurrentBibleTextCommand;
import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
import com.tyndalehouse.step.web.shared.result.GetCurrentBibleTextResult;
@@ -32,83 +38,20 @@
import com.tyndalehouse.step.web.shared.scripture.PassageElement;
@Presenter(view = PassageView.class, multiple = true)
-public class PassagePresenter extends BasePresenter<PassagePresenter.Display, StepEventBus> {
+public class PassagePresenter extends BasePresenter<PassagePresenterDisplay, StepEventBus> {
private final DispatchAsync dispatcher;
- /**
- * contract for passage views
- *
- * @author CJBurrell
- *
- */
- public interface Display extends StepViewInterface {
- /** empties the passage view */
- void clearPassage();
-
- /** creates a verse */
- void createVerse();
-
- /** creates a portion of text on the view */
- void createText(String text);
-
- /** creates a line break */
- void createLineBreak();
-
- /** creates a quote on the passage */
- void createQuote(String text);
-
- /** creates a translator's change */
- void createTransChange(String text);
-
- /** creates a title */
- void createTitle(String text);
-
- /**
- * creates a verse number
- *
- * @param verseNumber
- * the verse number
- * */
- void createVerseNumber(String verseNumber);
-
- /**
- * creates a lemma on the view
- *
- * @param lemma
- * the lemma
- */
-
- void createLemmaTag(String lemma);
-
- /**
- * action to highlight portions of the biblical text that are tagged
- * with a lemma
- *
- * @param lemmas
- * lemmas to look for in the presented biblical text.
- */
- void highlight(List<String> lemmas);
-
- /**
- * adds a handler to the button that switches options
- *
- * @param optionHandler
- * @return
- */
- HandlerRegistration addOptionHandler(OptionHandler optionHandler);
-
- /**
- * gets the current list of selected options
- *
- * @return
- */
- Map<String, ScriptureDisplayOptions> getSelectedOptions();
- }
-
/** The currently displayed passage */
private Passage passage;
/**
+ * This map contains a list of all highlight widgets, keyed by their lemmas.
+ * Since each lemma can be associated with multiple words, we associate it
+ * with a list of them.
+ * */
+ private final Map<String, List<HasClickAndHighlightHandlers>> highlightableWords = new HashMap<String, List<HasClickAndHighlightHandlers>>();
+
+ /**
* default constructor
*
* @param dispatcher
@@ -241,7 +184,8 @@
break;
case WORD:
case TEXT:
- view.createText(getText(passageElement));
+ final HasClickAndHighlightHandlers wordHandler = view.createText(getText(passageElement));
+
if (selectedOptions.containsKey(ScriptureDisplayOptions.SHOW_LEMMAS.name())) {
final String lemmaAttribute = passageElement.getAttribute(OsisElementType.LEMMA);
if (lemmaAttribute != null) {
@@ -250,7 +194,14 @@
final String[] lemmas = lemmaAttribute.split(" ");
for (int ii = 0; ii < lemmas.length; ii++) {
view.createLemmaTag(lemmas[ii].replaceAll("strong:", ""));
+ addHighlitableWord(lemmas[ii], wordHandler);
}
+
+ wordHandler.addClickHandler(new ClickHandler() {
+ public void onClick(final ClickEvent clickEvent) {
+ getEventBus().highlightWords(lemmas);
+ }
+ });
}
}
break;
@@ -277,6 +228,43 @@
}
/**
+ * safely adds a word to the highlightable map
+ *
+ * @param lemma
+ * the lemma associated to the word = the key of the map
+ * @param wordHandler
+ * a word which can be highlighted
+ */
+ void addHighlitableWord(final String lemma, final HasClickAndHighlightHandlers wordHandler) {
+ List<HasClickAndHighlightHandlers> words = this.highlightableWords.get(lemma);
+ if (words == null) {
+ words = new ArrayList<HasClickAndHighlightHandlers>();
+ this.highlightableWords.put(lemma, words);
+ }
+ words.add(wordHandler);
+ }
+
+ /**
+ * highlights all the words in the highlightable map
+ *
+ * @param lemmas
+ * the list of lemmas associated with the clicked word
+ */
+ public void onHighlightWords(final String[] lemmas) {
+ final Set<String> lemmaSet = new HashSet<String>();
+ for (final String lemma : lemmas) {
+ lemmaSet.add(lemma);
+ }
+
+ for (final Entry<String, List<HasClickAndHighlightHandlers>> words : highlightableWords.entrySet()) {
+ final boolean highlightableList = lemmaSet.contains(words.getKey());
+ for (final HasClickAndHighlightHandlers w : words.getValue()) {
+ w.highlight(highlightableList);
+ }
+ }
+ }
+
+ /**
* renders a quote on the passage view
*
* @param passageElement
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScripturePresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -7,7 +7,6 @@
import net.customware.gwt.dispatch.client.DispatchAsync;
import com.allen_sauer.gwt.log.client.Log;
-import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -17,7 +16,7 @@
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.ScripturePresenterPosition;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.presenter.display.ScripturePresenterDisplay;
import com.tyndalehouse.step.web.client.view.ScriptureView;
import com.tyndalehouse.step.web.shared.command.GetAvailableBibleVersionsCommand;
import com.tyndalehouse.step.web.shared.result.GetAvailableBibleVersionsResult;
@@ -35,46 +34,8 @@
// everything else...
@Presenter(view = ScriptureView.class, multiple = true)
-public class ScripturePresenter extends BasePresenter<ScripturePresenter.Display, StepEventBus> {
+public class ScripturePresenter extends BasePresenter<ScripturePresenterDisplay, StepEventBus> {
- /**
- * Description of the view for presenting scripture to the user
- *
- * @author cjburrell
- *
- */
- public interface Display extends StepViewInterface {
- // IMPROVEMENT: move methods for options button into its own widget, and
- // same for version selector, all on the same child event bus
- /**
- * adds a version to the display
- *
- * @param contentType
- * the type of content this is, for example Bible
- * @param language
- * the language
- * @param versionInitials
- * the initials of the version
- * @param versionName
- * the version name
- */
- void addVersion(String contentType, String language, String versionInitials, String versionName);
-
- /**
- * the version selector widget
- *
- * @return the handler to register events to
- */
- HasSelectionHandlers<TreeItem> getVersionSelector();
-
- /**
- * @return the initials of the current bible version
- */
- String getCurrentlySelectedVersion();
-
- void setScriptureHolder(StepViewInterface view);
- }
-
/** default asynchronous dispatcher */
private final DispatchAsync dispatcher;
/**
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/ScriptureSelectorPresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,33 +5,17 @@
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.HasText;
import com.google.inject.Inject;
import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
-import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.presenter.display.ScriptureSelectorDisplay;
import com.tyndalehouse.step.web.client.view.ScriptureSelectorView;
@Presenter(view = ScriptureSelectorView.class, multiple = true)
-public class ScriptureSelectorPresenter extends BasePresenter<ScriptureSelectorPresenter.Display, StepEventBus> {
+public class ScriptureSelectorPresenter extends BasePresenter<ScriptureSelectorDisplay, StepEventBus> {
private final DispatchAsync dispatcher;
- /** contact with the sidebar view */
- public interface Display extends StepViewInterface {
-
- /** returns the component that can be clicked */
- HasClickHandlers getSelectReferenceButton();
-
- /** returns the current reference, as typed in the box */
- HasText getScriptureReference();
-
- /** enabled or disables components in the view */
- void setEnabled(boolean enabled);
-
- }
-
@Inject
ScriptureSelectorPresenter(final DispatchAsync dispatcher) {
this.dispatcher = dispatcher;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/StepPresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -9,7 +9,9 @@
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
import com.tyndalehouse.step.web.client.framework.StepViewInterface;
-import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
+import com.tyndalehouse.step.web.client.presenter.display.ScriptureSelectorDisplay;
+import com.tyndalehouse.step.web.client.presenter.display.StepDisplay;
+import com.tyndalehouse.step.web.client.toolkit.data.SideBarModule;
import com.tyndalehouse.step.web.client.view.StepView;
/**
@@ -22,34 +24,8 @@
*
*/
@Presenter(view = StepView.class)
-public class StepPresenter extends BasePresenter<StepPresenter.Display, StepEventBus> {
+public class StepPresenter extends BasePresenter<StepDisplay, StepEventBus> {
- /**
- * The contract with the Step View, the main layout of Step
- *
- * @author cjburrell
- *
- */
- public interface Display extends StepViewInterface {
- void setSideBar(StepViewInterface w);
-
- void setTopLeftPanel(StepViewInterface w);
-
- void setTopRightPanel(StepViewInterface w);
-
- void setLeftColumn(StepViewInterface w);
-
- void setRightColumn(StepViewInterface w);
-
- void setFilterPanel(StepViewInterface w);
-
- void setCenterPanel(StepViewInterface w);
-
- void setFilterPanelVisible(boolean visible);
-
- void reLay();
- }
-
public void onStart() {
final ScripturePresenter leftHandler = eventBus.addHandler(ScripturePresenter.class);
leftHandler.setScripturePresenterPosition(LEFT);
@@ -61,7 +37,7 @@
view.setRightColumn(rightHandler.getView());
view.setTopLeftPanel(eventBus.addHandler(ScriptureSelectorPresenter.class).getView());
- final ScriptureSelectorPresenter.Display rightScriptureSelector = eventBus.addHandler(
+ final ScriptureSelectorDisplay rightScriptureSelector = eventBus.addHandler(
ScriptureSelectorPresenter.class).getView();
view.setTopRightPanel(rightScriptureSelector);
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-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimebandListPresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,6 +5,7 @@
import com.mvp4g.client.presenter.BasePresenter;
import com.tyndalehouse.step.web.client.event.TimebandListUpdateRequiredEvent;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.presenter.display.TimebandListDisplay;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
/**
@@ -19,25 +20,9 @@
// TODO: refactor to ensure events get captured and dealt with in the presenter,
// rather than in the view.
-public class TimebandListPresenter extends BasePresenter<TimebandListPresenter.Display, StepEventBus> {
+public class TimebandListPresenter extends BasePresenter<TimebandListDisplay, StepEventBus> {
/**
- * Contract with any TimebandList view
- *
- * @author cjburrell
- *
- */
- public interface Display {
- /**
- * This method updates the list displayed with the latest statistics
- *
- * @param stats
- * statistics to be sent to the view for update
- */
- void updateList(List<CurrentBandStats> stats);
- }
-
- /**
* Default constructor, injected with Gin
*
* @param display
@@ -47,7 +32,7 @@
*/
// TODO
// @Inject
- public TimebandListPresenter(final TimebandListPresenter.Display display) {
+ public TimebandListPresenter(final TimebandListDisplay display) {
// bind();
}
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-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -5,13 +5,13 @@
import net.customware.gwt.dispatch.client.DispatchAsync;
import com.allen_sauer.gwt.log.client.Log;
-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.TimelineScrollEvent;
import com.tyndalehouse.step.web.client.framework.StepEventBus;
+import com.tyndalehouse.step.web.client.presenter.display.TimelineDisplay;
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;
@@ -42,32 +42,8 @@
// as well, really ought to rewrite parts of it to remove the logic from the
// display component
@Presenter(view = TimelineView.class)
-public class TimelinePresenter extends BasePresenter<TimelinePresenter.Display, StepEventBus> {
+public class TimelinePresenter extends BasePresenter<TimelineDisplay, StepEventBus> {
/**
- * the view contract for the timeline module
- *
- * @author cjburrell
- *
- */
- public interface Display {
-
- /**
- * @return the timeline module
- */
- Timeline getTimeline();
-
- /**
- * @return the zoom in Button
- */
- HasClickHandlers getZoomIn();
-
- /**
- * @return The zoom out button
- */
- HasClickHandlers getZoomOut();
- }
-
- /**
* The dispatcher for requests to the server
*/
private final DispatchAsync dispatcher;
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/BookmarkDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/BookmarkDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/BookmarkDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,27 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.toolkit.handlers.BookmarkHandler;
+
+/** contact with the sidebar view */
+public interface BookmarkDisplay extends StepViewInterface {
+
+ /**
+ * adds a bookmark to the view display
+ *
+ * @param shortNameReference
+ * short name reference for e.g. Matt 1:1
+ * @param referenceShortName
+ * the
+ * @param displayOptions
+ */
+ BookmarkHandler addBookmark(String shortNameReference);
+
+ /**
+ * removes the bookmark stored at index
+ *
+ * @param index
+ * index of the bookmark to be removed
+ */
+ void removeBookmark(int index);
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/FilterResultsDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/FilterResultsDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/FilterResultsDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,10 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+
+/**
+ * Interface for the Version Selector Module View
+ */
+public interface FilterResultsDisplay extends StepViewInterface {
+
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ModuleSideBarDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ModuleSideBarDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ModuleSideBarDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,23 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.toolkit.data.SideBarModule;
+
+/** contact with the sidebar view */
+public interface ModuleSideBarDisplay extends StepViewInterface {
+ HasClickHandlers getGeography();
+
+ HasClickHandlers getHistory();
+
+ HasClickHandlers getLanguage();
+
+ HasClickHandlers getPeople();
+
+ HasClickHandlers getSearch();
+
+ HasClickHandlers getLiterature();
+
+ SideBarModule getSelectedModule();
+
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/PassagePresenterDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/PassagePresenterDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/PassagePresenterDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,70 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import java.util.Map;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
+import com.tyndalehouse.step.web.client.view.handlers.HasClickAndHighlightHandlers;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
+
+/**
+ * contract for passage views
+ *
+ * @author CJBurrell
+ *
+ */
+public interface PassagePresenterDisplay extends StepViewInterface {
+ /** empties the passage view */
+ void clearPassage();
+
+ /** creates a verse */
+ void createVerse();
+
+ /** creates a portion of text on the view */
+ HasClickAndHighlightHandlers createText(String text);
+
+ /** creates a line break */
+ void createLineBreak();
+
+ /** creates a quote on the passage */
+ void createQuote(String text);
+
+ /** creates a translator's change */
+ void createTransChange(String text);
+
+ /** creates a title */
+ void createTitle(String text);
+
+ /**
+ * creates a verse number
+ *
+ * @param verseNumber
+ * the verse number
+ * */
+ void createVerseNumber(String verseNumber);
+
+ /**
+ * creates a lemma on the view
+ *
+ * @param lemma
+ * the lemma
+ */
+
+ void createLemmaTag(String lemma);
+
+ /**
+ * adds a handler to the button that switches options
+ *
+ * @param optionHandler
+ * @return
+ */
+ HandlerRegistration addOptionHandler(OptionHandler optionHandler);
+
+ /**
+ * gets the current list of selected options
+ *
+ * @return
+ */
+ Map<String, ScriptureDisplayOptions> getSelectedOptions();
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScripturePresenterDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScripturePresenterDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScripturePresenterDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,43 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.google.gwt.event.logical.shared.HasSelectionHandlers;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+
+/**
+ * Description of the view for presenting scripture to the user
+ *
+ * @author cjburrell
+ *
+ */
+public interface ScripturePresenterDisplay extends StepViewInterface {
+ // IMPROVEMENT: move methods for options button into its own widget, and
+ // same for version selector, all on the same child event bus
+ /**
+ * adds a version to the display
+ *
+ * @param contentType
+ * the type of content this is, for example Bible
+ * @param language
+ * the language
+ * @param versionInitials
+ * the initials of the version
+ * @param versionName
+ * the version name
+ */
+ void addVersion(String contentType, String language, String versionInitials, String versionName);
+
+ /**
+ * the version selector widget
+ *
+ * @return the handler to register events to
+ */
+ HasSelectionHandlers<TreeItem> getVersionSelector();
+
+ /**
+ * @return the initials of the current bible version
+ */
+ String getCurrentlySelectedVersion();
+
+ void setScriptureHolder(StepViewInterface view);
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScriptureSelectorDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScriptureSelectorDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/ScriptureSelectorDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,19 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.user.client.ui.HasText;
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+
+/** contact with the sidebar view */
+public interface ScriptureSelectorDisplay extends StepViewInterface {
+
+ /** returns the component that can be clicked */
+ HasClickHandlers getSelectReferenceButton();
+
+ /** returns the current reference, as typed in the box */
+ HasText getScriptureReference();
+
+ /** enabled or disables components in the view */
+ void setEnabled(boolean enabled);
+
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/StepDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/StepDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/StepDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,29 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.tyndalehouse.step.web.client.framework.StepViewInterface;
+
+/**
+ * The contract with the Step View, the main layout of Step
+ *
+ * @author cjburrell
+ *
+ */
+public interface StepDisplay extends StepViewInterface {
+ void setSideBar(StepViewInterface w);
+
+ void setTopLeftPanel(StepViewInterface w);
+
+ void setTopRightPanel(StepViewInterface w);
+
+ void setLeftColumn(StepViewInterface w);
+
+ void setRightColumn(StepViewInterface w);
+
+ void setFilterPanel(StepViewInterface w);
+
+ void setCenterPanel(StepViewInterface w);
+
+ void setFilterPanelVisible(boolean visible);
+
+ void reLay();
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimebandListDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimebandListDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimebandListDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,21 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import java.util.List;
+
+import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
+
+/**
+ * Contract with any TimebandList view
+ *
+ * @author cjburrell
+ *
+ */
+public interface TimebandListDisplay {
+ /**
+ * This method updates the list displayed with the latest statistics
+ *
+ * @param stats
+ * statistics to be sent to the view for update
+ */
+ void updateList(List<CurrentBandStats> stats);
+}
\ No newline at end of file
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimelineDisplay.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimelineDisplay.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/display/TimelineDisplay.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,28 @@
+package com.tyndalehouse.step.web.client.presenter.display;
+
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.tyndalehouse.step.web.client.toolkit.timeline.Timeline;
+
+/**
+ * the view contract for the timeline module
+ *
+ * @author cjburrell
+ *
+ */
+public interface TimelineDisplay {
+
+ /**
+ * @return the timeline module
+ */
+ Timeline getTimeline();
+
+ /**
+ * @return the zoom in Button
+ */
+ HasClickHandlers getZoomIn();
+
+ /**
+ * @return The zoom out button
+ */
+ HasClickHandlers getZoomOut();
+}
\ No newline at end of file
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,46 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit;
-
-import static com.tyndalehouse.step.web.client.toolkit.DecoratorUtils.removePadding;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.DecoratorPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * Automatically decorates the panel
- *
- * @author CJBurrell
- *
- */
-public class DecoratedComposite extends Composite {
- /**
- * The main component in the composite
- */
- private Widget mainWidget;
-
- @Override
- protected void initWidget(final Widget mainWidget) {
- this.mainWidget = mainWidget;
-
- final DecoratorPanel dp = new DecoratorPanel();
- dp.add(mainWidget);
- super.initWidget(dp);
- }
-
- @Override
- public void setWidth(final String width) {
- super.setWidth(width);
- if (mainWidget != null) {
- mainWidget.setWidth(removePadding(width));
- }
- }
-
- @Override
- public void setHeight(final String height) {
- super.setHeight(height);
- if (mainWidget != null) {
- mainWidget.setHeight(removePadding(height));
- }
- }
-
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratorUtils.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,37 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit;
-
-import static java.lang.Integer.valueOf;
-
-public class DecoratorUtils {
- /** The string representation of a pixel */
- private static final String PIXEL_UNIT = "px";
- /** default padding to assign */
- private final static int DECORATOR_PADDING = 10;
-
- /**
- * hiding implementation
- */
- private DecoratorUtils() {
- }
-
- /**
- * removes the last part of the dimension and adjusts
- *
- * @param dimension
- * dimension to be adjusted for padding
- * @return the new dimension
- */
- public static String removePadding(final String dimension) {
- if (dimension.endsWith(PIXEL_UNIT)) {
- final int dim = valueOf(dimension.substring(0, dimension.length() - 2));
- return String.valueOf(dim - DECORATOR_PADDING) + PIXEL_UNIT;
- }
- return dimension;
- }
-
- /** removes padding based on a double **/
- public static double removePadding(final double dimension) {
- return dimension - DECORATOR_PADDING;
- }
-
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HasSource.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -4,11 +4,14 @@
* Indicates that the view (generally) has got a source, a dropdown list for
* e.g.) and can be set
*
+ * TODO: remove class
+ *
* @author cjburrell
*
* @param <T>
* The type of data it is expecting
*/
+ at Deprecated
public interface HasSource<T> {
/**
* Clears the source, i.e. resets to an empty list
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/HtmlList.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -12,9 +12,11 @@
/**
* A HTML list, taken partially from the web This can be ordered or unordered
+ * TODO remove class
*
* @author cjburrell
*/
+ at Deprecated
public class HtmlList extends Widget {
/**
* Two types of list, ordered or undered
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SideBarModule.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,18 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit;
-
-public enum SideBarModule {
- /** the geography module */
- GEOGRAPHY,
- /** the history module */
- HISTORY,
- /** the language module */
- LANGUAGE,
- /** the people module */
- PEOPLE,
- /** the search module */
- SEARCH,
- /** the literature module */
- LITERATURE,
- /** no module selected */
- NONE,
-}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SimpleListBox.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -8,9 +8,9 @@
* An extension to the GWT ListBox, mainly to allow the setSource method
* exposure, and hide implementation details of the ListBox from the presenter
*
- * @author cjburrell
- *
+ * @author cjburrell TODO remove if not used
*/
+ at Deprecated
public class SimpleListBox extends ListBox implements HasSource<List<String>> {
public void clearSource() {
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/SourceListBox.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -7,10 +7,12 @@
/**
* Similar to @see {@link SimpleListBox}, but the source is given as a HashMap
+ * TODO remove class
*
* @author cjburrell
*
*/
+ at Deprecated
public class SourceListBox extends ListBox implements HasSource<SortedMap<String, String>> {
public void clearSource() {
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/StepComposite.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,32 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit;
-
-import static java.lang.String.valueOf;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.DecoratorPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.shared.InternalException;
-
-/**
- * Exposing extra functionality to do allow dynamic resizing
- *
- * @author CJBurrell
- *
- */
-public class StepComposite extends Composite {
- private final static int DECORATOR_PADDING = 10;
-
- public void setDecoratingPanelChildSize(final int width, final int height) {
- // main widget for composite:
- final Widget w = this.getWidget();
- if (w instanceof DecoratorPanel) {
- final DecoratorPanel parentPanel = (DecoratorPanel) w;
- final Widget childPanel = parentPanel.getWidget();
- childPanel.setWidth(valueOf(width - StepComposite.DECORATOR_PADDING) + "px");
- childPanel.setHeight(valueOf(height - StepComposite.DECORATOR_PADDING) + "px");
- return;
- }
-
- throw new InternalException("Trying to set the size of a panel which is not contained in a DecoratorPanel");
- }
-}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/data/SideBarModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/data/SideBarModule.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/data/SideBarModule.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,18 @@
+package com.tyndalehouse.step.web.client.toolkit.data;
+
+public enum SideBarModule {
+ /** the geography module */
+ GEOGRAPHY,
+ /** the history module */
+ HISTORY,
+ /** the language module */
+ LANGUAGE,
+ /** the people module */
+ PEOPLE,
+ /** the search module */
+ SEARCH,
+ /** the literature module */
+ LITERATURE,
+ /** no module selected */
+ NONE,
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/ScriptureDisplayConstants.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,22 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit.scripture;
-
-/**
- * Scripture display module constants
- *
- * @author cjburrell
- *
- */
-public final class ScriptureDisplayConstants {
-
- /**
- * To emphasis text in the module, for e.g. when a user clicks on a word
- */
- public static final String EMPHASISE = "scripture-emphasise";
-
- /**
- * making constructor private
- */
- private ScriptureDisplayConstants() {
-
- }
-}
Deleted: 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-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/scripture/VerseLabel.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,134 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit.scripture;
-
-import java.util.List;
-
-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;
-
-/**
- * Composite wrapper around a portion of scriptural text. The wrapper contains
- * data retrieved from the server such as lemmas (Strong numbers), morphological
- * data and an alternative word in the case of an interlinear
- *
- * @author cjburrell
- *
- */
-public class VerseLabel extends Composite {
- /**
- * 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;
-
- /**
- * Flow panel for display
- */
- private final FlowPanel fp;
-
- /**
- * 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;
-
- /**
- * 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 /* TODO , final EventBus eventBus */) {
- fp = new FlowPanel();
-
- // 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);
-
- // this.eventBus = eventBus;
- }
-
- /**
- * @return the lemma
- */
- public List<String> getLemma() {
- return lemmas;
- }
-
- /**
- * @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;
- }
-
- alternativeWord = new Label(originalWord);
- fp.add(alternativeWord);
- }
-
- /**
- * @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() {
-
- 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;
- }
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownComposite.java (from rev 155, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownComposite.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownComposite.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,335 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import java.util.Iterator;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyUpEvent;
+import com.google.gwt.event.dom.client.KeyUpHandler;
+import com.google.gwt.event.logical.shared.HasSelectionHandlers;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.tyndalehouse.step.web.client.view.internal.Area;
+import com.tyndalehouse.step.web.client.view.internal.Version;
+
+/**
+ * displays a dropdown with a filter box
+ *
+ * @author CJBurrell
+ *
+ */
+// TODO: go through application removing anonymous inner classes from GWT code
+// since memory footprint
+public class BibleVersionsDropDownComposite extends Composite {
+ private static final String INITIAL_TEXT = "Please enter a bible version name";
+ protected FlowPanel bibleVersionPanel = new FlowPanel();
+ private final TextBox filterBox = new TextBox();
+ private final Tree bibleVersions = new Tree();
+ private final PopupPanel popup = new PopupPanel();
+
+ public BibleVersionsDropDownComposite() {
+ final ScrollPanel versionScroll = new ScrollPanel();
+ versionScroll.setHeight("85%");
+ versionScroll.add(bibleVersions);
+ bibleVersionPanel.add(filterBox);
+
+ popup.add(versionScroll);
+ popup.setAutoHideEnabled(true);
+ popup.addAutoHidePartner(bibleVersions.getElement());
+ popup.setStylePrimaryName("popupBibleVersions");
+
+ // bibleVersionPanel.add(versionScroll);
+
+ addHandlersForFilterBox();
+ addHandlersForTree();
+ addStyles();
+ setSuggestionsVisible(false);
+
+ filterBox.setText(INITIAL_TEXT);
+ initWidget(bibleVersionPanel);
+ }
+
+ /**
+ * adds styles to the components
+ */
+ private void addStyles() {
+ filterBox.addStyleName("prompt");
+ bibleVersionPanel.addStyleName("bibleVersionsDropDown");
+ }
+
+ private final KeyUpHandler typingFilterHandler = new KeyUpHandler() {
+ public void onKeyUp(final KeyUpEvent keyUp) {
+ if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
+ setSuggestionsVisible(false);
+ } else if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
+ // check for single item showing:
+ selectVersionIfAvailable();
+ } else if (!keyUp.isAnyModifierKeyDown()) {
+ setSuggestionsVisible(true);
+ refilterTree();
+ }
+ }
+ };
+
+ private void selectVersionIfAvailable() {
+ final String selectedVersion = this.filterBox.getText();
+ final Iterator<TreeItem> treeIterator = bibleVersions.treeItemIterator();
+ while (treeIterator.hasNext()) {
+ final TreeItem nextItem = treeIterator.next();
+ final Object userObject = nextItem.getUserObject();
+ if (userObject instanceof Version) {
+ final Version v = (Version) userObject;
+ if (v.getInitials().equalsIgnoreCase(selectedVersion) || v.getName().equalsIgnoreCase(selectedVersion)) {
+ bibleVersions.setSelectedItem(nextItem);
+ return;
+ }
+ }
+ }
+ }
+
+ /**
+ * adds the default handlers for the filter box
+ */
+ private void addHandlersForFilterBox() {
+ filterBox.addKeyUpHandler(typingFilterHandler);
+
+ filterBox.addFocusHandler(new FocusHandler() {
+ public void onFocus(final FocusEvent focusEvent) {
+ if (filterBox.getStyleName().contains("prompt")) {
+ filterBox.setText("");
+ filterBox.removeStyleName("prompt");
+ }
+
+ // show the tree
+ setSuggestionsVisible(true);
+ }
+ });
+
+ // TODO: make textbox into widget
+ filterBox.addBlurHandler(new BlurHandler() {
+ public void onBlur(final BlurEvent event) {
+ if (filterBox.getText().length() == 0) {
+ filterBox.setText(INITIAL_TEXT);
+ if (!filterBox.getStyleName().contains("prompt")) {
+ filterBox.addStyleName("prompt");
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * sets whether the suggestions should be visible
+ *
+ * @param visible
+ * true to show the suggestions from the tree
+ */
+ private void setSuggestionsVisible(final boolean visible) {
+ if (visible) {
+ popup.setPopupPositionAndShow(new PositionCallback() {
+
+ public void setPosition(final int offsetWidth, final int offsetHeight) {
+ popup.setPopupPosition(filterBox.getAbsoluteLeft(), filterBox.getAbsoluteTop()
+ + filterBox.getOffsetHeight());
+ popup.setWidth(filterBox.getOffsetWidth() + "px");
+ }
+ });
+ } else {
+ popup.hide();
+ }
+
+ // bibleVersions.addStyleName(visible ? "visible" : "invisible");
+ // bibleVersions.removeStyleName(!visible ? "visible" : "invisible");
+ }
+
+ /**
+ * adds handlers for tree
+ */
+ private void addHandlersForTree() {
+ bibleVersions.addKeyUpHandler(typingFilterHandler);
+ bibleVersions.addSelectionHandler(new SelectionHandler<TreeItem>() {
+ public void onSelection(final SelectionEvent<TreeItem> selectionEvent) {
+ if (selectionEvent.getSelectedItem().getChildCount() == 0) {
+ // on selection we close the tree and set the selected
+ // version
+ filterBox.setText(bibleVersions.getSelectedItem().getText());
+ setSuggestionsVisible(false);
+ }
+ }
+ });
+
+ bibleVersions.addFocusHandler(new FocusHandler() {
+ public void onFocus(final FocusEvent arg0) {
+ setSuggestionsVisible(true);
+ }
+ });
+ }
+
+ /**
+ * filters through the tree
+ */
+ protected void refilterTree() {
+ for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
+ filterTreeItem(bibleVersions.getItem(ii), filterBox.getText().toLowerCase());
+ }
+
+ hideEmptyParents();
+ }
+
+ /**
+ * Hide parents where there are no children
+ */
+ private void hideEmptyParents() {
+ for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
+ final TreeItem parentLevelItem = bibleVersions.getItem(ii);
+ // we ignore first level elements, only hide ones below for now
+
+ for (int jj = 0; jj < parentLevelItem.getChildCount(); jj++) {
+ final TreeItem child = parentLevelItem.getChild(jj);
+ if (!hasVisibleChildren(child)) {
+ child.setVisible(false);
+ } else {
+ child.setVisible(true);
+ }
+ }
+ }
+ }
+
+ /**
+ * returns the number of visible children
+ *
+ * @param node
+ * to be evaluated for number of visible children
+ * @return
+ */
+ private boolean hasVisibleChildren(final TreeItem node) {
+ if (node.getChildCount() == 0) {
+ return false;
+ }
+ for (int ii = 0; ii < node.getChildCount(); ii++) {
+ // first work out whether
+
+ if (node.getChild(ii).isVisible()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * filters tree items and their children
+ *
+ * @param item
+ * item to be filtered
+ * @param text
+ * the text currently in the box
+ */
+ private void filterTreeItem(final TreeItem item, final String text) {
+ // check for leaf node
+ if (item.getChildCount() == 0) {
+ // then filter
+ // Area node = (Area) item.getUserObject();
+ final Object o = item.getUserObject();
+ if (item.getText().toLowerCase().startsWith(text)
+ || (o instanceof Version && ((Version) o).getInitials().toLowerCase().startsWith(text))) {
+ item.setVisible(true);
+ item.setState(true);
+ item.getParentItem().setState(true);
+ item.getParentItem().getParentItem().setState(true);
+ } else {
+ item.setVisible(false);
+ }
+ } else {
+ for (int ii = 0; ii < item.getChildCount(); ii++) {
+ filterTreeItem(item.getChild(ii), text);
+ }
+ }
+ }
+
+ /**
+ * TODO: do work off the DOM for performance? adds a version to the tree...
+ */
+ public void addVersion(final String area, final String language, final String versionInitials,
+ final String versionName) {
+ // look for area first
+ for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
+ final TreeItem item = bibleVersions.getItem(ii);
+ if (item.getText().equals(area)) {
+ // now get the language
+ createLanguageVersionTreeSection(language, versionInitials, versionName, item);
+ return;
+ }
+ }
+
+ // create the whole area field
+ final Area areaParent = new Area(area);
+ final TreeItem areaItem = new TreeItem(area);
+ areaItem.setUserObject(areaParent);
+ bibleVersions.addItem(areaItem);
+
+ createLanguageVersionTreeSection(language, versionInitials, versionName, areaItem);
+ }
+
+ /**
+ * creates the language and version node in the tree
+ *
+ * @param language
+ * language to be added to the tree
+ * @param versionInitials
+ * initials of the bible versions
+ * @param versionName
+ * version name as in jsword
+ * @param item
+ * parent item
+ */
+ private void createLanguageVersionTreeSection(final String language, final String versionInitials,
+ final String versionName, final TreeItem item) {
+ final TreeItem languageParent = findItem(item, language);
+ final TreeItem version = new TreeItem(versionName);
+ version.setUserObject(new Version(versionInitials, language));
+ languageParent.addItem(version);
+ }
+
+ private TreeItem findItem(final TreeItem parent, final String language) {
+ for (int ii = 0; ii < parent.getChildCount(); ii++) {
+ final TreeItem child = parent.getChild(ii);
+ final Area area = (Area) child.getUserObject();
+ if (area.getName().equals(language)) {
+ return child;
+ }
+ }
+
+ final TreeItem newChild = new TreeItem(language);
+ newChild.setUserObject(new Area(language));
+ parent.addItem(newChild);
+ return newChild;
+ }
+
+ // TODO can this be tested?
+ public HasSelectionHandlers<TreeItem> getVersionSelectorHandler() {
+ return bibleVersions;
+ // return filterBox;
+ }
+
+ public String getCurrentlySelectedVersion() {
+ final TreeItem selectedItem = bibleVersions.getSelectedItem();
+ if (!(selectedItem == null)) {
+ final Area area = (Area) selectedItem.getUserObject();
+ if (area != null && area instanceof Version) {
+ return ((Version) area).getInitials();
+ }
+ }
+ return null;
+ }
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/BibleVersionsDropDownWidget.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,335 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit.widgets;
-
-import java.util.Iterator;
-
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.event.logical.shared.HasSelectionHandlers;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeItem;
-import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
-import com.tyndalehouse.step.web.client.view.internal.Area;
-import com.tyndalehouse.step.web.client.view.internal.Version;
-
-/**
- * displays a dropdown with a filter box
- *
- * @author CJBurrell
- *
- */
-// TODO: go through application removing anonymous inner classes from GWT code
-// since memory footprint
-public class BibleVersionsDropDownWidget extends Composite {
- private static final String INITIAL_TEXT = "Please enter a bible version name";
- protected FlowPanel bibleVersionPanel = new FlowPanel();
- private final TextBox filterBox = new TextBox();
- private final Tree bibleVersions = new Tree();
- private final PopupPanel popup = new PopupPanel();
-
- public BibleVersionsDropDownWidget() {
- final ScrollPanel versionScroll = new ScrollPanel();
- versionScroll.setHeight("85%");
- versionScroll.add(bibleVersions);
- bibleVersionPanel.add(filterBox);
-
- popup.add(versionScroll);
- popup.setAutoHideEnabled(true);
- popup.addAutoHidePartner(bibleVersions.getElement());
- popup.setStylePrimaryName("popupBibleVersions");
-
- // bibleVersionPanel.add(versionScroll);
-
- addHandlersForFilterBox();
- addHandlersForTree();
- addStyles();
- setSuggestionsVisible(false);
-
- filterBox.setText(INITIAL_TEXT);
- initWidget(bibleVersionPanel);
- }
-
- /**
- * adds styles to the components
- */
- private void addStyles() {
- filterBox.addStyleName("prompt");
- bibleVersionPanel.addStyleName("bibleVersionsDropDown");
- }
-
- private final KeyUpHandler typingFilterHandler = new KeyUpHandler() {
- public void onKeyUp(final KeyUpEvent keyUp) {
- if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
- setSuggestionsVisible(false);
- } else if (keyUp.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
- // check for single item showing:
- selectVersionIfAvailable();
- } else if (!keyUp.isAnyModifierKeyDown()) {
- setSuggestionsVisible(true);
- refilterTree();
- }
- }
- };
-
- private void selectVersionIfAvailable() {
- final String selectedVersion = this.filterBox.getText();
- final Iterator<TreeItem> treeIterator = bibleVersions.treeItemIterator();
- while (treeIterator.hasNext()) {
- final TreeItem nextItem = treeIterator.next();
- final Object userObject = nextItem.getUserObject();
- if (userObject instanceof Version) {
- final Version v = (Version) userObject;
- if (v.getInitials().equalsIgnoreCase(selectedVersion) || v.getName().equalsIgnoreCase(selectedVersion)) {
- bibleVersions.setSelectedItem(nextItem);
- return;
- }
- }
- }
- }
-
- /**
- * adds the default handlers for the filter box
- */
- private void addHandlersForFilterBox() {
- filterBox.addKeyUpHandler(typingFilterHandler);
-
- filterBox.addFocusHandler(new FocusHandler() {
- public void onFocus(final FocusEvent focusEvent) {
- if (filterBox.getStyleName().contains("prompt")) {
- filterBox.setText("");
- filterBox.removeStyleName("prompt");
- }
-
- // show the tree
- setSuggestionsVisible(true);
- }
- });
-
- // TODO: make textbox into widget
- filterBox.addBlurHandler(new BlurHandler() {
- public void onBlur(final BlurEvent event) {
- if (filterBox.getText().length() == 0) {
- filterBox.setText(INITIAL_TEXT);
- if (!filterBox.getStyleName().contains("prompt")) {
- filterBox.addStyleName("prompt");
- }
- }
- }
- });
- }
-
- /**
- * sets whether the suggestions should be visible
- *
- * @param visible
- * true to show the suggestions from the tree
- */
- private void setSuggestionsVisible(final boolean visible) {
- if (visible) {
- popup.setPopupPositionAndShow(new PositionCallback() {
-
- public void setPosition(final int offsetWidth, final int offsetHeight) {
- popup.setPopupPosition(filterBox.getAbsoluteLeft(), filterBox.getAbsoluteTop()
- + filterBox.getOffsetHeight());
- popup.setWidth(filterBox.getOffsetWidth() + "px");
- }
- });
- } else {
- popup.hide();
- }
-
- // bibleVersions.addStyleName(visible ? "visible" : "invisible");
- // bibleVersions.removeStyleName(!visible ? "visible" : "invisible");
- }
-
- /**
- * adds handlers for tree
- */
- private void addHandlersForTree() {
- bibleVersions.addKeyUpHandler(typingFilterHandler);
- bibleVersions.addSelectionHandler(new SelectionHandler<TreeItem>() {
- public void onSelection(final SelectionEvent<TreeItem> selectionEvent) {
- if (selectionEvent.getSelectedItem().getChildCount() == 0) {
- // on selection we close the tree and set the selected
- // version
- filterBox.setText(bibleVersions.getSelectedItem().getText());
- setSuggestionsVisible(false);
- }
- }
- });
-
- bibleVersions.addFocusHandler(new FocusHandler() {
- public void onFocus(final FocusEvent arg0) {
- setSuggestionsVisible(true);
- }
- });
- }
-
- /**
- * filters through the tree
- */
- protected void refilterTree() {
- for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
- filterTreeItem(bibleVersions.getItem(ii), filterBox.getText().toLowerCase());
- }
-
- hideEmptyParents();
- }
-
- /**
- * Hide parents where there are no children
- */
- private void hideEmptyParents() {
- for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
- final TreeItem parentLevelItem = bibleVersions.getItem(ii);
- // we ignore first level elements, only hide ones below for now
-
- for (int jj = 0; jj < parentLevelItem.getChildCount(); jj++) {
- final TreeItem child = parentLevelItem.getChild(jj);
- if (!hasVisibleChildren(child)) {
- child.setVisible(false);
- } else {
- child.setVisible(true);
- }
- }
- }
- }
-
- /**
- * returns the number of visible children
- *
- * @param node
- * to be evaluated for number of visible children
- * @return
- */
- private boolean hasVisibleChildren(final TreeItem node) {
- if (node.getChildCount() == 0) {
- return false;
- }
- for (int ii = 0; ii < node.getChildCount(); ii++) {
- // first work out whether
-
- if (node.getChild(ii).isVisible()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * filters tree items and their children
- *
- * @param item
- * item to be filtered
- * @param text
- * the text currently in the box
- */
- private void filterTreeItem(final TreeItem item, final String text) {
- // check for leaf node
- if (item.getChildCount() == 0) {
- // then filter
- // Area node = (Area) item.getUserObject();
- final Object o = item.getUserObject();
- if (item.getText().toLowerCase().startsWith(text)
- || (o instanceof Version && ((Version) o).getInitials().toLowerCase().startsWith(text))) {
- item.setVisible(true);
- item.setState(true);
- item.getParentItem().setState(true);
- item.getParentItem().getParentItem().setState(true);
- } else {
- item.setVisible(false);
- }
- } else {
- for (int ii = 0; ii < item.getChildCount(); ii++) {
- filterTreeItem(item.getChild(ii), text);
- }
- }
- }
-
- /**
- * TODO: do work off the DOM for performance? adds a version to the tree...
- */
- public void addVersion(final String area, final String language, final String versionInitials,
- final String versionName) {
- // look for area first
- for (int ii = 0; ii < bibleVersions.getItemCount(); ii++) {
- final TreeItem item = bibleVersions.getItem(ii);
- if (item.getText().equals(area)) {
- // now get the language
- createLanguageVersionTreeSection(language, versionInitials, versionName, item);
- return;
- }
- }
-
- // create the whole area field
- final Area areaParent = new Area(area);
- final TreeItem areaItem = new TreeItem(area);
- areaItem.setUserObject(areaParent);
- bibleVersions.addItem(areaItem);
-
- createLanguageVersionTreeSection(language, versionInitials, versionName, areaItem);
- }
-
- /**
- * creates the language and version node in the tree
- *
- * @param language
- * language to be added to the tree
- * @param versionInitials
- * initials of the bible versions
- * @param versionName
- * version name as in jsword
- * @param item
- * parent item
- */
- private void createLanguageVersionTreeSection(final String language, final String versionInitials,
- final String versionName, final TreeItem item) {
- final TreeItem languageParent = findItem(item, language);
- final TreeItem version = new TreeItem(versionName);
- version.setUserObject(new Version(versionInitials, language));
- languageParent.addItem(version);
- }
-
- private TreeItem findItem(final TreeItem parent, final String language) {
- for (int ii = 0; ii < parent.getChildCount(); ii++) {
- final TreeItem child = parent.getChild(ii);
- final Area area = (Area) child.getUserObject();
- if (area.getName().equals(language)) {
- return child;
- }
- }
-
- final TreeItem newChild = new TreeItem(language);
- newChild.setUserObject(new Area(language));
- parent.addItem(newChild);
- return newChild;
- }
-
- // TODO can this be tested?
- public HasSelectionHandlers<TreeItem> getVersionSelectorHandler() {
- return bibleVersions;
- // return filterBox;
- }
-
- public String getCurrentlySelectedVersion() {
- final TreeItem selectedItem = bibleVersions.getSelectedItem();
- if (!(selectedItem == null)) {
- final Area area = (Area) selectedItem.getUserObject();
- if (area != null && area instanceof Version) {
- return ((Version) area).getInitials();
- }
- }
- return null;
- }
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/DecoratedComposite.java (from rev 150, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/DecoratedComposite.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/DecoratedComposite.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/DecoratedComposite.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,46 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import static com.tyndalehouse.step.web.client.framework.utils.DecoratorUtils.removePadding;
+
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Automatically decorates the panel
+ *
+ * @author CJBurrell
+ *
+ */
+public class DecoratedComposite extends Composite {
+ /**
+ * The main component in the composite
+ */
+ private Widget mainWidget;
+
+ @Override
+ protected void initWidget(final Widget mainWidget) {
+ this.mainWidget = mainWidget;
+
+ final DecoratorPanel dp = new DecoratorPanel();
+ dp.add(mainWidget);
+ super.initWidget(dp);
+ }
+
+ @Override
+ public void setWidth(final String width) {
+ super.setWidth(width);
+ if (mainWidget != null) {
+ mainWidget.setWidth(removePadding(width));
+ }
+ }
+
+ @Override
+ public void setHeight(final String height) {
+ super.setHeight(height);
+ if (mainWidget != null) {
+ mainWidget.setHeight(removePadding(height));
+ }
+ }
+
+}
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/HighlightableLabel.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/HighlightableLabel.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/HighlightableLabel.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,17 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import static com.tyndalehouse.step.web.client.bundles.StepResources.RESOURCES;
+
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.tyndalehouse.step.web.client.view.handlers.HasClickAndHighlightHandlers;
+
+public class HighlightableLabel extends InlineLabel implements HasClickAndHighlightHandlers {
+
+ public void highlight(final boolean show) {
+ if (show) {
+ this.addStyleName(RESOURCES.passage().highlight());
+ } else {
+ this.removeStyleName(RESOURCES.passage().highlight());
+ }
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/InlinePanel.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/InlinePanel.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/InlinePanel.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,6 +1,6 @@
package com.tyndalehouse.step.web.client.toolkit.widgets;
-import static com.tyndalehouse.step.web.client.framework.StepResources.RESOURCES;
+import static com.tyndalehouse.step.web.client.bundles.StepResources.RESOURCES;
import com.google.gwt.user.client.ui.FlowPanel;
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonComposite.java (from rev 153, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonComposite.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonComposite.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,153 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import static com.tyndalehouse.step.web.client.bundles.StepResources.RESOURCES;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOutHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.HandlerManager;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.RadioButton;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.tyndalehouse.step.web.client.toolkit.handlers.HasOptionsHandler;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionEvent;
+import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
+import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
+
+public class OptionsButtonComposite extends Composite implements HasOptionsHandler {
+ final private InlinePanel holder = new InlinePanel();
+ final private PopupPanel menu = new PopupPanel(false);
+ private final Image image;
+ private final HandlerManager handlerManager = new HandlerManager(this);
+ private final Map<String, ScriptureDisplayOptions> selectedOptions = new HashMap<String, ScriptureDisplayOptions>();
+
+ static {
+ RESOURCES.layout().ensureInjected();
+ }
+
+ private final ValueChangeHandler<Boolean> valueChangeHandler = new ValueChangeHandler<Boolean>() {
+ public void onValueChange(final ValueChangeEvent<Boolean> valueChangeEvent) {
+ final CheckBox option = (CheckBox) valueChangeEvent.getSource();
+ final Boolean checked = valueChangeEvent.getValue();
+ final String key = option.getName();
+ final ScriptureDisplayOptions scriptureDisplayOption = ScriptureDisplayOptions.getByKeyName(key);
+ if (checked.booleanValue()) {
+ selectedOptions.put(key, scriptureDisplayOption);
+ } else {
+ selectedOptions.remove(key);
+ }
+
+ // IMPROVEMENT we assume for now that a tick in the box always adds
+ // information to the screen
+ handlerManager.fireEvent(new OptionEvent(scriptureDisplayOption, checked.booleanValue()));
+ menu.hide();
+ }
+ };
+
+ /**
+ * creates an options button
+ */
+ public OptionsButtonComposite() {
+ holder.addStyleName(RESOURCES.layout().floatRight());
+ image = new Image(RESOURCES.options());
+ holder.add(image);
+ holder.addStyleName("optionsButton");
+ initImageHandlers();
+ initWidget(holder);
+ }
+
+ private void initImageHandlers() {
+ image.addClickHandler(new ClickHandler() {
+ public void onClick(final ClickEvent clickEvent) {
+ switchVisibility();
+ }
+
+ });
+
+ image.addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(final MouseOutEvent arg0) {
+ image.setResource(RESOURCES.options());
+ }
+ });
+
+ image.addMouseOverHandler(new MouseOverHandler() {
+ public void onMouseOver(final MouseOverEvent arg0) {
+ image.setResource(RESOURCES.optionsOver());
+ }
+ });
+ }
+
+ private void switchVisibility() {
+ if (menu.isShowing()) {
+ menu.hide();
+ } else {
+ menu.setPopupPositionAndShow(new PositionCallback() {
+ public void setPosition(final int arg0, final int arg1) {
+ menu.setPopupPosition(image.getAbsoluteLeft() + image.getOffsetWidth() / 2 - menu.getOffsetWidth(),
+ image.getAbsoluteTop() + image.getOffsetHeight() / 2);
+ }
+ });
+ }
+ }
+
+ private void setupMenu() {
+ // TODO: look to see if we can something with GWT Inject/Gin to inject
+ // menus in...
+ final VerticalPanel vp = new VerticalPanel();
+ menu.add(vp);
+ menu.setGlassEnabled(false);
+ final ScriptureDisplayOptions[] scriptureDisplayOptions = ScriptureDisplayOptions.getScriptureDisplayOptions();
+
+ for (final ScriptureDisplayOptions option : scriptureDisplayOptions) {
+
+ CheckBox menuItem;
+ if (option.getGroup() != null) {
+ menuItem = new RadioButton(option.getKey(), option.getDisplayValue());
+ } else {
+ menuItem = new CheckBox(option.getDisplayValue());
+ menuItem.setName(option.getKey());
+ }
+
+ if (option.isDefaultOption()) {
+ menuItem.setValue(option.isDefaultOption());
+
+ }
+
+ if (option.isDefaultOption()) {
+ selectedOptions.put(option.getKey(), option);
+ }
+ vp.add(menuItem);
+ menuItem.addValueChangeHandler(valueChangeHandler);
+ }
+
+ menu.hide();
+ menu.addStyleName("optionsButtonMenu");
+ }
+
+ @Override
+ protected void onLoad() {
+ super.onLoad();
+ setupMenu();
+ }
+
+ public HandlerRegistration addOptionHandler(final OptionHandler handler) {
+ return this.handlerManager.addHandler(OptionEvent.getType(), handler);
+ }
+
+ public Map<String, ScriptureDisplayOptions> getSelectedOptions() {
+ return selectedOptions;
+ }
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/OptionsButtonWidget.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,153 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit.widgets;
-
-import static com.tyndalehouse.step.web.client.framework.StepResources.RESOURCES;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOutHandler;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.dom.client.MouseOverHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.HandlerManager;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.RadioButton;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
-import com.tyndalehouse.step.web.client.toolkit.handlers.HasOptionsHandler;
-import com.tyndalehouse.step.web.client.toolkit.handlers.OptionEvent;
-import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
-import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
-
-public class OptionsButtonWidget extends Composite implements HasOptionsHandler {
- final private InlinePanel holder = new InlinePanel();
- final private PopupPanel menu = new PopupPanel(false);
- private final Image image;
- private final HandlerManager handlerManager = new HandlerManager(this);
- private final Map<String, ScriptureDisplayOptions> selectedOptions = new HashMap<String, ScriptureDisplayOptions>();
-
- static {
- RESOURCES.layout().ensureInjected();
- }
-
- private final ValueChangeHandler<Boolean> valueChangeHandler = new ValueChangeHandler<Boolean>() {
- public void onValueChange(final ValueChangeEvent<Boolean> valueChangeEvent) {
- final CheckBox option = (CheckBox) valueChangeEvent.getSource();
- final Boolean checked = valueChangeEvent.getValue();
- final String key = option.getName();
- final ScriptureDisplayOptions scriptureDisplayOption = ScriptureDisplayOptions.getByKeyName(key);
- if (checked.booleanValue()) {
- selectedOptions.put(key, scriptureDisplayOption);
- } else {
- selectedOptions.remove(key);
- }
-
- // IMPROVEMENT we assume for now that a tick in the box always adds
- // information to the screen
- handlerManager.fireEvent(new OptionEvent(scriptureDisplayOption, checked.booleanValue()));
- menu.hide();
- }
- };
-
- /**
- * creates an options button
- */
- public OptionsButtonWidget() {
- holder.addStyleName(RESOURCES.layout().floatRight());
- image = new Image(RESOURCES.options());
- holder.add(image);
- holder.addStyleName("optionsButton");
- initImageHandlers();
- initWidget(holder);
- }
-
- private void initImageHandlers() {
- image.addClickHandler(new ClickHandler() {
- public void onClick(final ClickEvent clickEvent) {
- switchVisibility();
- }
-
- });
-
- image.addMouseOutHandler(new MouseOutHandler() {
- public void onMouseOut(final MouseOutEvent arg0) {
- image.setResource(RESOURCES.options());
- }
- });
-
- image.addMouseOverHandler(new MouseOverHandler() {
- public void onMouseOver(final MouseOverEvent arg0) {
- image.setResource(RESOURCES.optionsOver());
- }
- });
- }
-
- private void switchVisibility() {
- if (menu.isShowing()) {
- menu.hide();
- } else {
- menu.setPopupPositionAndShow(new PositionCallback() {
- public void setPosition(final int arg0, final int arg1) {
- menu.setPopupPosition(image.getAbsoluteLeft() + image.getOffsetWidth() / 2 - menu.getOffsetWidth(),
- image.getAbsoluteTop() + image.getOffsetHeight() / 2);
- }
- });
- }
- }
-
- private void setupMenu() {
- // TODO: look to see if we can something with GWT Inject/Gin to inject
- // menus in...
- final VerticalPanel vp = new VerticalPanel();
- menu.add(vp);
- menu.setGlassEnabled(false);
- final ScriptureDisplayOptions[] scriptureDisplayOptions = ScriptureDisplayOptions.getScriptureDisplayOptions();
-
- for (final ScriptureDisplayOptions option : scriptureDisplayOptions) {
-
- CheckBox menuItem;
- if (option.getGroup() != null) {
- menuItem = new RadioButton(option.getKey(), option.getDisplayValue());
- } else {
- menuItem = new CheckBox(option.getDisplayValue());
- menuItem.setName(option.getKey());
- }
-
- if (option.isDefaultOption()) {
- menuItem.setValue(option.isDefaultOption());
-
- }
-
- if (option.isDefaultOption()) {
- selectedOptions.put(option.getKey(), option);
- }
- vp.add(menuItem);
- menuItem.addValueChangeHandler(valueChangeHandler);
- }
-
- menu.hide();
- menu.addStyleName("optionsButtonMenu");
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- setupMenu();
- }
-
- public HandlerRegistration addOptionHandler(final OptionHandler handler) {
- return this.handlerManager.addHandler(OptionEvent.getType(), handler);
- }
-
- public Map<String, ScriptureDisplayOptions> getSelectedOptions() {
- return selectedOptions;
- }
-}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/PassageElementWidget.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,181 +0,0 @@
-package com.tyndalehouse.step.web.client.toolkit.widgets;
-
-import static com.tyndalehouse.step.web.client.common.OsisUtils.getVerseNumberFromOsisId;
-import static com.tyndalehouse.step.web.client.common.StringUtils.isNotEmpty;
-import static com.tyndalehouse.step.web.client.framework.StepResources.RESOURCES;
-import static com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions.VERSE_NUMBERS;
-import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.OSIS_ID;
-import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.TITLE;
-import static com.tyndalehouse.step.web.shared.scripture.OsisElementType.VERSE;
-
-import java.util.List;
-import java.util.Map;
-
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.InsertPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.framework.Passage;
-import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
-import com.tyndalehouse.step.web.shared.scripture.OsisElementType;
-import com.tyndalehouse.step.web.shared.scripture.PassageElement;
-
-/**
- * this widget represents a part of a scripture passage, whether that be a
- * verse, a title, etc. It is in charge of the rendering. IMPROVEMENT It is
- * designed at the moment, to only be creatable once, and therefore, any changes
- * in options, should cause each PassageElementWidget to be destroyed and
- * recreated from scratch
- *
- * @author CJBurrell
- *
- */
-// IMPROVEMENT in true likeness of MVP, the model should not be passed to the
-// view, and therefore we should remove
-// the models from here. The presenter instead should be doing the logic, and
-// asking different types of elements to be created
-public class PassageElementWidget extends Widget {
- static {
- RESOURCES.passage().ensureInjected();
- }
-
- public PassageElementWidget(final PassageElement passageElement, final Map<String, ScriptureDisplayOptions> options) {
- final Passage passageCss = RESOURCES.passage();
- // switch (passageElement.getTypeOfElement()) {
- // case TITLE:
- // setElementAsLabel(passageElement, passageCss.title(), new Label());
- // break;
- // case VERSE:
- // addChildren(passageElement, passageCss.versePanel(), options);
- // break;
- // case WORD:
- // case TEXT:
- // setElementAsLabel(passageElement, passageCss.word(), new
- // InlineLabel());
- // break;
- // case LINE_BREAK:
- // final Label lineBreak = new Label();
- // lineBreak.addStyleName(passageCss.lineBreak());
- // setElement(lineBreak.getElement());
- // break;
- // case QUOTE:
- // // if quote has children, then render those instead
- // if (passageElement.getNumChildren() != 0) {
- // addChildren(passageElement, passageCss.quotePanel(), options);
- // } else {
- // final String markerAttribute =
- // passageElement.getAttribute(OsisElementType.MARKER);
- // if (markerAttribute != null) {
- // setElementAsLabel(null, passageCss.quotePanel(), new
- // InlineLabel(markerAttribute));
- // } else {
- // setElementAsLabel(passageElement, passageCss.quotePanel(), new
- // InlineLabel());
- // }
- // }
- // break;
- // case TRANS_CHANGE:
- // setElementAsLabel(passageElement, passageCss.transChange(), new
- // InlineLabel());
- // break;
- // default:
- // Log.warn("Unrendered element of type: " +
- // passageElement.getTypeOfElement());
- // setElement(new FlowPanel().getElement());
- // break;
- // }
- }
-
- /**
- * adds a verse number to the start of the panel
- *
- * @param versePanel
- * the container panel in which to add the verse number
- * @param passageElement
- * the passage element containing information about the verse
- * number
- * @param options
- * the options, defining whether or not we have a verse number to
- * display
- */
- private void addVerseNumber(final InsertPanel versePanel, final PassageElement passageElement,
- final Map<String, ScriptureDisplayOptions> options) {
- final String osisIdAttribute = passageElement.getAttribute(OSIS_ID);
- if (options.containsKey(VERSE_NUMBERS.name())) {
- // then we show the verse numbers
- final InlineLabel verseNumber = new InlineLabel(getVerseNumberFromOsisId(osisIdAttribute));
- verseNumber.addStyleName(RESOURCES.passage().verseNumber());
- versePanel.add(verseNumber);
- }
- }
-
- /**
- * adds children to a panel
- *
- * @param passageElement
- * parent element for which to add all the children
- * @param parentPanelStyleName
- * style to apply to the flow panel that gets created
- * @param options
- * the list of options to be applied to this scripture display
- * @return the panel on which elements have been added
- * */
- private InsertPanel addChildren(final PassageElement passageElement, final String parentPanelStyleName,
- final Map<String, ScriptureDisplayOptions> options) {
- // for each child, go and create children for them
- final List<PassageElement> children = passageElement.getChildren();
- final InlinePanel containerPanel = new InlinePanel();
- setElement(containerPanel.getElement());
-
- if (isNotEmpty(parentPanelStyleName)) {
- containerPanel.addStyleName(parentPanelStyleName);
- }
-
- boolean verseNumberInserted = false;
- for (final PassageElement child : children) {
- // for verse numbers, we insert after a title
- if (VERSE.equals(passageElement.getTypeOfElement()) && !verseNumberInserted
- && !TITLE.equals(child.getTypeOfElement())) {
- addVerseNumber(containerPanel, passageElement, options);
- verseNumberInserted = true;
- }
- containerPanel.add(new PassageElementWidget(child, options));
- }
- return containerPanel;
- }
-
- /**
- * sets the widget's element to be a label
- *
- * @param passageElement
- * the element to scan
- * @param style
- * the style to set
- */
- private void setElementAsLabel(final PassageElement passageElement, final String style, final Label label) {
- styleLabel(passageElement, style, label);
- super.setElement(label.getElement());
- }
-
- /**
- * crates a label and returns it
- *
- * @param passageElement
- * the element to use as the basis
- * @param style
- * the style to set on the element
- * @return the label
- */
- private void styleLabel(final PassageElement passageElement, final String style, final Label label) {
- if (passageElement != null) {
- final PassageElement textNode = OsisElementType.TEXT.equals(passageElement.getTypeOfElement()) ? passageElement
- : passageElement.getFirstChild();
-
- if (textNode != null) {
- final String text = textNode.getAttribute(OsisElementType.TEXT);
- label.setText(text);
- }
- }
- label.addStyleName(style);
- }
-}
Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/VerseLabel.java (from rev 150, 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/widgets/VerseLabel.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/widgets/VerseLabel.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,135 @@
+package com.tyndalehouse.step.web.client.toolkit.widgets;
+
+import java.util.List;
+
+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;
+
+/**
+ * Composite wrapper around a portion of scriptural text. The wrapper contains
+ * data retrieved from the server such as lemmas (Strong numbers), morphological
+ * data and an alternative word in the case of an interlinear
+ *
+ * @author cjburrell TODO remove
+ *
+ */
+ at Deprecated
+public class VerseLabel extends Composite {
+ /**
+ * 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;
+
+ /**
+ * Flow panel for display
+ */
+ private final FlowPanel fp;
+
+ /**
+ * 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;
+
+ /**
+ * 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 /* TODO , final EventBus eventBus */) {
+ fp = new FlowPanel();
+
+ // 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);
+
+ // this.eventBus = eventBus;
+ }
+
+ /**
+ * @return the lemma
+ */
+ public List<String> getLemma() {
+ return lemmas;
+ }
+
+ /**
+ * @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;
+ }
+
+ alternativeWord = new Label(originalWord);
+ fp.add(alternativeWord);
+ }
+
+ /**
+ * @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() {
+
+ 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;
+ }
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/BookmarkView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,6 +1,6 @@
package com.tyndalehouse.step.web.client.view;
-import static com.tyndalehouse.step.web.client.framework.StepResources.RESOURCES;
+import static com.tyndalehouse.step.web.client.bundles.StepResources.RESOURCES;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Anchor;
@@ -8,12 +8,12 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.BookmarkPresenter;
-import com.tyndalehouse.step.web.client.toolkit.DecoratedComposite;
+import com.tyndalehouse.step.web.client.presenter.display.BookmarkDisplay;
import com.tyndalehouse.step.web.client.toolkit.handlers.BookmarkHandler;
import com.tyndalehouse.step.web.client.toolkit.handlers.BookmarkHandlerImpl;
+import com.tyndalehouse.step.web.client.toolkit.widgets.DecoratedComposite;
-public class BookmarkView extends DecoratedComposite implements BookmarkPresenter.Display {
+public class BookmarkView extends DecoratedComposite implements BookmarkDisplay {
static {
RESOURCES.passage().ensureInjected();
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/FilterResultsView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -6,10 +6,10 @@
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.FilterResultsPresenter.Display;
-import com.tyndalehouse.step.web.client.toolkit.DecoratedComposite;
+import com.tyndalehouse.step.web.client.presenter.display.FilterResultsDisplay;
+import com.tyndalehouse.step.web.client.toolkit.widgets.DecoratedComposite;
-public class FilterResultsView extends DecoratedComposite implements Display {
+public class FilterResultsView extends DecoratedComposite implements FilterResultsDisplay {
interface FilterResultsUiBinder extends UiBinder<Widget, FilterResultsView> {
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ModuleSideBarView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -12,10 +12,10 @@
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.ModuleSideBarPresenter.Display;
-import com.tyndalehouse.step.web.client.toolkit.SideBarModule;
+import com.tyndalehouse.step.web.client.presenter.display.ModuleSideBarDisplay;
+import com.tyndalehouse.step.web.client.toolkit.data.SideBarModule;
-public class ModuleSideBarView extends Composite implements Display {
+public class ModuleSideBarView extends Composite implements ModuleSideBarDisplay {
interface ModuleSideBarUiBinder extends UiBinder<Widget, ModuleSideBarView> {
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/PassageView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/PassageView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/PassageView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,6 +1,6 @@
package com.tyndalehouse.step.web.client.view;
-import static com.tyndalehouse.step.web.client.framework.StepResources.RESOURCES;
+import static com.tyndalehouse.step.web.client.bundles.StepResources.RESOURCES;
import java.util.ArrayList;
import java.util.List;
@@ -13,17 +13,24 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.PassagePresenter.Display;
+import com.tyndalehouse.step.web.client.presenter.display.PassagePresenterDisplay;
import com.tyndalehouse.step.web.client.toolkit.handlers.OptionHandler;
-import com.tyndalehouse.step.web.client.toolkit.scripture.ScriptureDisplayConstants;
-import com.tyndalehouse.step.web.client.toolkit.scripture.VerseLabel;
-import com.tyndalehouse.step.web.client.toolkit.widgets.OptionsButtonWidget;
+import com.tyndalehouse.step.web.client.toolkit.widgets.HighlightableLabel;
+import com.tyndalehouse.step.web.client.toolkit.widgets.OptionsButtonComposite;
+import com.tyndalehouse.step.web.client.toolkit.widgets.VerseLabel;
+import com.tyndalehouse.step.web.client.view.handlers.HasClickAndHighlightHandlers;
import com.tyndalehouse.step.web.shared.common.ScriptureDisplayOptions;
-import com.tyndalehouse.step.web.shared.scripture.Passage;
-//TODO: let online mvp4g people know that error message is misleading, and could
-// be that view is not implementing the interface
-public class PassageView extends Composite implements Display {
+/**
+ * This view is responsible for rendered a biblical/osis passage on to the web
+ * page It creates elements such as words, titles, etc. For words, it returns
+ * handlers for the user to be able to click on them. This is for words
+ * containing lemmas only.
+ *
+ * @author CJBurrell
+ *
+ */
+public class PassageView extends Composite implements PassagePresenterDisplay {
/**
* a list of VerseLabel (wrappers of bible text) that are currently being
* displayed and contain lemmas
@@ -40,10 +47,8 @@
private final Label passageTitle = new Label();
private final Panel passageHolder = new FlowPanel();
private final Panel mainPassage = new FlowPanel();
- private final OptionsButtonWidget optionsButtonWidget = new OptionsButtonWidget();
+ private final OptionsButtonComposite optionsButtonWidget = new OptionsButtonComposite();
- private Passage logicalPassage;
-
public PassageView() {
initWidget(passageHolder);
passageHolder.add(optionsButtonWidget);
@@ -58,24 +63,24 @@
}
- /**
- * highlights a particular word in a passage, according to the lemmas that
- * are similar
- *
- * @param lemmaList
- * the list of lemmas to highlight in the passage
- */
- public void highlight(final List<String> lemmaList) {
- for (final VerseLabel vl : lemmaWords) {
- for (final String l : lemmaList) {
- if (vl.getLemma().contains(l)) {
- vl.setStyleName(ScriptureDisplayConstants.EMPHASISE);
- } else {
- vl.removeStyleName(ScriptureDisplayConstants.EMPHASISE);
- }
- }
- }
- }
+ // /**
+ // * highlights a particular word in a passage, according to the lemmas that
+ // * are similar
+ // *
+ // * @param lemmaList
+ // * the list of lemmas to highlight in the passage
+ // */
+ // public void highlight(final List<String> lemmaList) {
+ // for (final VerseLabel vl : lemmaWords) {
+ // for (final String l : lemmaList) {
+ // if (vl.getLemma().contains(l)) {
+ // vl.setStyleName(ScriptureDisplayConstants.EMPHASISE);
+ // } else {
+ // vl.removeStyleName(ScriptureDisplayConstants.EMPHASISE);
+ // }
+ // }
+ // }
+ // }
/**
* adds an option handler to the round button containing various display
@@ -99,24 +104,10 @@
}
/**
- * @return the logicalPassage
- */
- public Passage getLogicalPassage() {
- return logicalPassage;
- }
-
- // /**
- // * relays the passage where the options may potentially have changed
- // */
- // public void refreshPassage() {
- // setPassage(this.logicalPassage);
- // }
-
- /**
* displays a line break
*/
public void createLineBreak() {
- this.createLabel("", RESOURCES.passage().word(), false);
+ this.createLabel("", RESOURCES.passage().word(), new Label());
}
/**
@@ -126,7 +117,7 @@
* the text to be displayed
*/
public void createQuote(final String text) {
- this.createLabel(text, RESOURCES.passage().quote(), true);
+ this.createLabel(text, RESOURCES.passage().quote(), new InlineLabel());
}
/**
@@ -135,8 +126,10 @@
* @param text
* the text to be displayed
*/
- public void createText(final String text) {
- this.createLabel(text, RESOURCES.passage().word(), true);
+ public HasClickAndHighlightHandlers createText(final String text) {
+ final HighlightableLabel label = new HighlightableLabel();
+ this.createLabel(text, RESOURCES.passage().word(), label);
+ return label;
}
/**
@@ -146,7 +139,7 @@
* the text to be displayed
*/
public void createTitle(final String text) {
- this.createLabel(text, RESOURCES.passage().title(), false);
+ this.createLabel(text, RESOURCES.passage().title(), new Label());
}
/**
@@ -156,7 +149,7 @@
* the text to be displayed
*/
public void createTransChange(final String text) {
- this.createLabel(text, RESOURCES.passage().transChange(), true);
+ this.createLabel(text, RESOURCES.passage().transChange(), new InlineLabel());
}
/**
@@ -166,11 +159,11 @@
* verse number
*/
public void createVerseNumber(final String verseNumber) {
- this.createLabel(verseNumber, RESOURCES.passage().verseNumber(), true);
+ this.createLabel(verseNumber, RESOURCES.passage().verseNumber(), new InlineLabel());
}
public void createLemmaTag(final String lemma) {
- this.createLabel(lemma, RESOURCES.passage().lemma(), true);
+ this.createLabel(lemma, RESOURCES.passage().lemma(), new InlineLabel());
}
public void createVerse() {
@@ -183,15 +176,19 @@
* the text to be displayed
* @param style
* the style to set on the element
- * @paramt inline true if the label created should be inline
+ * @param label
+ * TODO
*
*/
- void createLabel(final String text, final String style, final boolean inline) {
- final Label l = inline ? new InlineLabel(text) : new Label(text);
- l.addStyleName(style);
- mainPassage.add(l);
+ void createLabel(final String text, final String style, final Label label) {
+ label.setText(text);
+ label.addStyleName(style);
+ mainPassage.add(label);
}
+ /**
+ * empties the current passage
+ */
public void clearPassage() {
this.mainPassage.clear();
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureSelectorView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -16,9 +16,9 @@
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.ScriptureSelectorPresenter;
+import com.tyndalehouse.step.web.client.presenter.display.ScriptureSelectorDisplay;
-public class ScriptureSelectorView extends Composite implements ScriptureSelectorPresenter.Display {
+public class ScriptureSelectorView extends Composite implements ScriptureSelectorDisplay {
interface Binder extends UiBinder<Widget, ScriptureSelectorView> {
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/ScriptureView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,6 +1,6 @@
package com.tyndalehouse.step.web.client.view;
-import static com.tyndalehouse.step.web.client.toolkit.DecoratorUtils.removePadding;
+import static com.tyndalehouse.step.web.client.framework.utils.DecoratorUtils.removePadding;
import java.util.List;
import java.util.SortedMap;
@@ -13,9 +13,9 @@
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.framework.StepViewInterface;
-import com.tyndalehouse.step.web.client.presenter.ScripturePresenter;
+import com.tyndalehouse.step.web.client.presenter.display.ScripturePresenterDisplay;
import com.tyndalehouse.step.web.client.toolkit.HasSource;
-import com.tyndalehouse.step.web.client.toolkit.widgets.BibleVersionsDropDownWidget;
+import com.tyndalehouse.step.web.client.toolkit.widgets.BibleVersionsDropDownComposite;
//TODO raise with GWT team
//Exception in thread "Code server for step from Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.458.1 Safari/534.3 on http://127.0.0.1:8888/step/Step.html?gwt.codesvr=127.0.0.1:9997 @ yaSWT9{.XcgS-P&%" java.lang.NullPointerException
@@ -34,7 +34,7 @@
* @author cjburrell
*
*/
-public class ScriptureView extends Composite implements ScripturePresenter.Display {
+public class ScriptureView extends Composite implements ScripturePresenterDisplay {
/** where the top of the scripture holder should be placed */
private static final int SCRIPTURE_HOLDER_TOP = 20;
@@ -43,7 +43,7 @@
* the elements on this panel
*/
private Widget scriptureHolder;
- private final BibleVersionsDropDownWidget bibleVersionsDropDown = new BibleVersionsDropDownWidget();
+ private final BibleVersionsDropDownComposite bibleVersionsDropDown = new BibleVersionsDropDownComposite();
private final AbsolutePanel scripturePanel = new AbsolutePanel();
private final DecoratorPanel decorator = new DecoratorPanel();
@@ -129,6 +129,7 @@
return null;
}
+ @Deprecated
public HasSource<SortedMap<String, String>> getSource() {
// TODO Auto-generated method stub
return null;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/StepView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -14,7 +14,7 @@
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.tyndalehouse.step.web.client.framework.StepViewInterface;
-import com.tyndalehouse.step.web.client.presenter.StepPresenter;
+import com.tyndalehouse.step.web.client.presenter.display.StepDisplay;
/**
* This View sets up the many different views and the layout of the Step
@@ -23,7 +23,7 @@
* @author cjburrell
*
*/
-public class StepView extends Composite implements StepPresenter.Display {
+public class StepView extends Composite implements StepDisplay {
private static final String VISIBLE = "visible";
private static final String INVISIBLE = "invisible";
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-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimebandListView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -10,7 +10,7 @@
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.presenter.TimebandListPresenter;
+import com.tyndalehouse.step.web.client.presenter.display.TimebandListDisplay;
import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.CurrentBandStats;
/**
@@ -22,7 +22,7 @@
* @author cjburrell
*
*/
-public class TimebandListView extends Composite implements TimebandListPresenter.Display {
+public class TimebandListView extends Composite implements TimebandListDisplay {
/**
* the map of checkboxes displayed on the page
*/
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-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/TimelineView.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -6,7 +6,7 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.presenter.TimelinePresenter;
+import com.tyndalehouse.step.web.client.presenter.display.TimelineDisplay;
import com.tyndalehouse.step.web.client.toolkit.timeline.Timeline;
/**
@@ -20,7 +20,7 @@
* @author cjburrell
*
*/
-public class TimelineView extends Composite implements TimelinePresenter.Display {
+public class TimelineView extends Composite implements TimelineDisplay {
/**
* The timeline component
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasClickAndHighlightHandlers.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasClickAndHighlightHandlers.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/HasClickAndHighlightHandlers.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -0,0 +1,11 @@
+package com.tyndalehouse.step.web.client.view.handlers;
+
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.event.shared.HandlerRegistration;
+
+public interface HasClickAndHighlightHandlers extends HasClickHandlers {
+ HandlerRegistration addClickHandler(ClickHandler arg0);
+
+ void highlight(boolean show);
+}
Deleted: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java 2010-07-31 09:15:08 UTC (rev 157)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/view/handlers/StepSplitButton.java 2010-07-31 09:18:27 UTC (rev 158)
@@ -1,17 +0,0 @@
-package com.tyndalehouse.step.web.client.view.handlers;
-
-import com.extjs.gxt.ui.client.widget.button.SplitButton;
-
-public class StepSplitButton extends SplitButton implements HasSelectionHandler {
-
- /**
- * calling the parent
- *
- * @param label
- * label to be put on the button
- */
- public StepSplitButton(final String label) {
- super(label);
- }
-
-}
More information about the Tynstep-svn
mailing list