[Tynstep-svn] r38 - in trunk/step-web-app: . .settings compiler_lib src/main/java/com/tyndalehouse/step/web src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline src/main/java/com/tyndalehouse/step/web/public src/main/java/com/tyndalehouse/step/web/server/db src/main/java/com/tyndalehouse/step/web/server/guice src/main/test/com/tyndalehouse/step/tests/server war/WEB-INF/lib war/css

ChrisBurrell at crosswire.org ChrisBurrell at crosswire.org
Sat Dec 12 15:06:30 MST 2009


Author: ChrisBurrell
Date: 2009-12-12 15:06:30 -0700 (Sat, 12 Dec 2009)
New Revision: 38

Added:
   trunk/step-web-app/.settings/com.google.appengine.eclipse.core.prefs
   trunk/step-web-app/.settings/com.google.gdt.eclipse.core.prefs
   trunk/step-web-app/Copy of build.xml
   trunk/step-web-app/build.properties
   trunk/step-web-app/build.xml
   trunk/step-web-app/compiler_lib/
   trunk/step-web-app/compiler_lib/gwt-dev.jar
   trunk/step-web-app/compiler_lib/gwt-user.jar
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/public/step/
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/stepwebapp.gwt.xml
   trunk/step-web-app/war/WEB-INF/lib/gwt-log-3.0.0.jar
   trunk/step-web-app/war/WEB-INF/lib/gwt-servlet.jar
   trunk/step-web-app/war/WEB-INF/lib/gwt-servlet.jar.svntmp
Removed:
   trunk/step-web-app/src/main/test/com/tyndalehouse/step/tests/server/TimelineUISetupHandlerTest.java
   trunk/step-web-app/war/WEB-INF/lib/gwt-log-2.6.2.jar
Modified:
   trunk/step-web-app/.classpath
   trunk/step-web-app/.settings/com.google.gwt.eclipse.core.prefs
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeBand.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/DbProvider.java
   trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java
   trunk/step-web-app/war/css/step.css
Log:
updates to build scripts

Modified: trunk/step-web-app/.classpath
===================================================================
--- trunk/step-web-app/.classpath	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/.classpath	2009-12-12 22:06:30 UTC (rev 38)
@@ -3,13 +3,11 @@
 	<classpathentry kind="src" path="src/main/java"/>
 	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="src" path="src/main/test"/>
-	<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/aopalliance.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/guice-2.0.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/guice-servlet-2.0.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-dispatch-1.0.0-SNAPSHOT.jar"/>
-	<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-log-2.6.2.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-presenter-1.0.0-SNAPSHOT.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/log4j.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/jdom-1.0.jar"/>
@@ -19,8 +17,10 @@
 	<classpathentry kind="lib" path="war/WEB-INF/lib/derby.jar" sourcepath="D:/STEP/db-derby-10.5.3.0-src/db-derby-10.5.3.0-src/java"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/gin.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/commons-dbutils-1.3.jar" sourcepath="D:/STEPSVN/StepSharedLibraries/lib/commons-dbutils-1.2-sources.jar"/>
+	<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-log-3.0.0.jar"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/gxt.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+	<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT (2)"/>
 	<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet.jar"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
 	<classpathentry kind="output" path="war/WEB-INF/classes"/>
 </classpath>

Added: trunk/step-web-app/.settings/com.google.appengine.eclipse.core.prefs
===================================================================
--- trunk/step-web-app/.settings/com.google.appengine.eclipse.core.prefs	                        (rev 0)
+++ trunk/step-web-app/.settings/com.google.appengine.eclipse.core.prefs	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,3 @@
+#Sat Dec 12 17:02:49 GMT 2009
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=

Added: trunk/step-web-app/.settings/com.google.gdt.eclipse.core.prefs
===================================================================
--- trunk/step-web-app/.settings/com.google.gdt.eclipse.core.prefs	                        (rev 0)
+++ trunk/step-web-app/.settings/com.google.gdt.eclipse.core.prefs	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,3 @@
+#Sat Dec 12 17:02:49 GMT 2009
+eclipse.preferences.version=1
+jarsExcludedFromWebInfLib=

Modified: trunk/step-web-app/.settings/com.google.gwt.eclipse.core.prefs
===================================================================
--- trunk/step-web-app/.settings/com.google.gwt.eclipse.core.prefs	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/.settings/com.google.gwt.eclipse.core.prefs	2009-12-12 22:06:30 UTC (rev 38)
@@ -1,4 +1,5 @@
-#Tue Sep 29 19:31:44 BST 2009
+#Sat Dec 12 17:46:56 GMT 2009
 eclipse.preferences.version=1
-filesCopiedToWebInfLib=gwt-servlet.jar
-gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48L2d3dC1jb21waWxlLXNldHRpbmdzPg\=\=
+entryPointModules=
+filesCopiedToWebInfLib=
+gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy1kcmFmdENvbXBpbGVdXT48L2V4dHJhLWFyZ3M+PHZtLWFyZ3M+PCFbQ0RBVEFbLVhteDUxMm1dXT48L3ZtLWFyZ3M+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\=

Added: trunk/step-web-app/Copy of build.xml
===================================================================
--- trunk/step-web-app/Copy of build.xml	                        (rev 0)
+++ trunk/step-web-app/Copy of build.xml	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,55 @@
+<?xml version="1.0" ?>
+<project default="clean-build">
+	<property name="lib.dir" value="war/WEB-INF/lib" />
+	<property name="output.dir" value="build" />
+	<property name="output.web.dir" value="${output.dir}/www" />
+	<property name="gwt.dir" value="compiler_lib" />
+	<property name="package" value="com.tyndalehouse.step.web" />
+	<property name="module" value="stepwebapp" />
+
+	<path id="classpath">
+		<fileset dir="${lib.dir}" includes="**/*.jar" />
+		<fileset dir="${gwt.dir}" includes="**/*.jar" />
+	</path>
+
+	<path id="src">
+		<fileset dir="src" includes="**/*.java" />
+	</path>
+	
+	<target name="clean">
+		<delete dir="${output.dir}" />
+	</target>
+
+	<target name="compile" depends="" description="Compiling web-app">
+		<mkdir dir="${output.dir}" />
+		<javac srcdir="src" destdir="${output.dir}" classpathref="classpath">
+		</javac>
+	</target>
+
+
+	<target name="compile-gwt" depends="">
+		<java
+			failonerror="true" 
+			fork="true" 
+			classname="com.google.gwt.dev.Compiler"
+			>
+		      <classpath>
+		        <pathelement location="src/main/java"/>
+		        <path refid="classpath"/>
+		      </classpath>
+			
+			<jvmarg value="-Xmx256M"/>
+			<arg value="com.tyndalehouse.step.web.stepwebapp"/>
+
+		</java>
+
+		<!--		
+		<copy todir="${classes.dir}">
+            <fileset dir="${src.data.dir}" />
+            <fileset dir="${src.sql.dir}" />
+        </copy>
+        -->
+	</target>
+
+	<target name="clean-build" depends="compile-gwt" />
+</project>
\ No newline at end of file

Added: trunk/step-web-app/build.properties
===================================================================
--- trunk/step-web-app/build.properties	                        (rev 0)
+++ trunk/step-web-app/build.properties	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,11 @@
+gwt.dir=compiler_lib
+junit.dir={path-to-junit3}
+junit.jar=${junit.dir}/junit.jar
+tomcat.dir=../../public_html
+servlet-api.jar=${tomcat.dir}/common/lib/servlet-api.jar
+
+module=stepwebapp
+package=com.tyndalehouse.step.web
+test=*
+url=http://localhost:8080/${ant.project.name}/${package}.${module}/${module}.html
+war=${module}.war
\ No newline at end of file

Added: trunk/step-web-app/build.xml
===================================================================
--- trunk/step-web-app/build.xml	                        (rev 0)
+++ trunk/step-web-app/build.xml	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="${module}" default="deploy" basedir=".">
+
+  <property environment="env"/>
+  <property file="build.properties"/>
+
+  <path id="classpath">
+    <pathelement location="build"/>
+    <fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
+  	<pathelement location="src/main/java"/>
+  	
+    <pathelement location="${gwt.dir}/gwt-user.jar"/>
+    <pathelement location="${gwt.dir}/gwt-dev.jar"/>
+
+  	<!-- next line is platform-specific -->
+    <!-- <pathelement location="${gwt.dir}/gwt-dev-mac.jar"/> -->
+    <pathelement location="${gwt.dir}/gwt-servlet.jar"/>
+    <!-- <pathelement location="${junit.jar}"/> -->
+    <pathelement location="${servlet-api.jar}"/>
+  </path>
+  
+  <target name="clean" depends="clean.test"
+   description="deletes all generated files">
+    <delete dir=".gwt-cache"/> <!-- generated by GWT -->
+    <delete dir="build"/> <!-- generated by the prepare target -->
+    <delete dir="tomcat"/> <!-- generated by GWT -->
+  </target>
+
+  <target name="clean.test" description="deletes all generated test files">
+    <delete dir="test"/>
+  </target>
+
+  <target name="compile" depends="prepare"
+    description="compiles Java source files to bytecode">  	
+    <javac srcdir="src" destdir="build"
+      classpathref="classpath" debug="true">
+    </javac>
+
+  	<!-- update the subversion repository -->
+  	<exec command="svn update ~/trunk" />
+  
+  </target>
+
+  <target name="compile.gwt" depends="compile"
+    description="compiles Java source files to JavaScript">
+    <!-- Consider adding -Xms256m -Xmx512m to improve performance. -->
+    <java classname="com.google.gwt.dev.Compiler"
+      classpathref="classpath" fork="true">
+      <arg line="-war build/www"/>
+      <arg line="-style OBFUSCATE"/>
+      <arg value="${package}.${module}"/>
+    </java>
+  </target>
+	
+	<!-- compile, compile.gwt -->
+  <target name="deploy" depends="compile.gwt" 
+    description="deploys the war file to Tomcat">
+
+  	<delete includeemptydirs="true">
+  		<fileset dir="${tomcat.dir}" includes="**/*" defaultexcludes="no"/>
+  	</delete>
+  	
+  	<copy todir="${tomcat.dir}/WEB-INF/classes">
+		<fileset dir="build/com" />
+	</copy>
+  	
+  	<copy todir="${tomcat.dir}">
+  		<fileset dir="build/www/step" />	
+  	</copy>
+
+ 	<copy todir="${tomcat.dir}/WEB-INF/lib">
+  		<fileset dir="war/WEB-INF/lib" includes="**/*.jar" />
+  	</copy>
+
+ 	<copy todir="${tomcat.dir}/WEB-INF/">
+  		<fileset dir="war/WEB-INF/lib" includes="web.xml" />
+  	</copy>
+  </target>
+
+	
+  <target name="hosted" depends="compile"
+    description="runs the application in hosted mode">
+    <java classname="com.google.gwt.dev.GWTShell"
+      classpathref="classpath" fork="true">
+      <!-- next line is only for Mac OS X -->
+      <jvmarg value="-XstartOnFirstThread"/>
+      <arg line="-out ./www"/>
+      <arg line="${package}.${module}/${module}.html"/>
+    </java>
+  </target>
+
+  <target name="prepare" description="creates output directories">
+    <mkdir dir="build/www"/>
+  </target>
+
+  <target name="undeploy" description="undeploys the web app. from Tomcat">
+    <delete dir="${tomcat.dir}/webapps/${ant.project.name}"/>
+    <delete file="${tomcat.dir}/webapps/${war}"/>
+  </target>
+  
+  <target name="war" depends="compile, compile.gwt"
+    description="builds the war file">
+    <delete file="build/${war}"/>
+    <war warfile="build/${war}" webxml="web.xml" >
+      <!-- bytecode from your Java code -->
+      <classes dir="build" includes="**/*.class"/>
+      <!-- generated HTML/JavaScript plus your CSS -->
+      <fileset dir="build/www"/>
+      <!-- supplied JAR -->
+      <lib file="${gwt.dir}/gwt-servlet.jar"/>
+    </war>
+  </target>
+	
+	
+  <target name="test" depends="clean.test,compile"
+    description="runs all JUnit tests">
+    <mkdir dir="test"/>
+    <junit fork="yes" printsummary="yes">
+      <!-- next line is only for Mac OS X -->
+      <jvmarg value="-XstartOnFirstThread"/>
+      <classpath refid="classpath"/>
+      <batchtest todir="test">
+        <fileset dir="src" includes="**/${test}Test.java"/>
+      </batchtest>
+      <formatter type="xml"/>
+    </junit>
+    <junitreport toDir="test">
+      <fileset dir="test"/>
+      <report format="frames" todir="test"/>
+    </junitreport>
+    <exec os="Windows" executable="cmd.exe">
+      <arg line="/c start test/index.html"/>
+    </exec>
+    <exec os="Mac OS X" executable="open">
+      <arg line="-a /Applications/Safari.app test/index.html"/>
+    </exec>
+  </target>
+</project>
\ No newline at end of file

Added: trunk/step-web-app/compiler_lib/gwt-dev.jar
===================================================================
(Binary files differ)


Property changes on: trunk/step-web-app/compiler_lib/gwt-dev.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/step-web-app/compiler_lib/gwt-user.jar
===================================================================
(Binary files differ)


Property changes on: trunk/step-web-app/compiler_lib/gwt-user.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java	                        (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,37 @@
+package com.tyndalehouse.step.web.client.toolkit.timeline;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * A tape track is the track on which events are painted.
+ * The events are contained by the TimeBand as that's where they logically reside.
+ * However, they are painted on the timetracks.
+ * @author cjburrell
+ *
+ */
+public class TapeTrack extends Widget {
+	private Element track;
+	
+	/**
+	 * The following variable defines the earliest spot
+	 * at which an event can be painted
+	 */
+	private int earliestPaintOpportunity;
+	
+	/**
+	 * The following spot defines the latest spot
+	 * at which an event needs to be finished
+	 * if it is to be painted on this track
+	 */
+	private int latestPaintOpportunity;
+	
+	public TapeTrack() {
+		track = DOM.createDiv();
+	}
+	
+	public boolean canPaintAt(int pixel, int width) {
+		return pixel > latestPaintOpportunity || pixel+width +1 < earliestPaintOpportunity;
+	}
+}

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeBand.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeBand.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeBand.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -1,7 +1,10 @@
 package com.tyndalehouse.step.web.client.toolkit.timeline;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.TreeMap;
 
+import com.allen_sauer.gwt.log.client.Log;
 import com.extjs.gxt.ui.client.core.El;
 import com.google.gwt.event.dom.client.MouseDownEvent;
 import com.google.gwt.user.client.DOM;
@@ -91,23 +94,26 @@
 	 * (1 + 0.25) * 50 = 75 pixels
 	 */
 	private double zoomFactor = 0.25;
+	private String description;
 	
-	public TimeBand(final Timeline parent, final int id) {
+	private List<TapeTrack> tapeTracks;
+	
+	
+	public TimeBand(final Timeline parent, final int id, String description) {
 		this.parent = parent;
 		this.id = id;
+		this.description = description;
 
 		events = new TreeMap<Integer, TimeEvent>();
 		bandDiv = DOM.createDiv();
 		timebandContainer = DOM.createDiv();
 
-		initDivProperties();
+		bandDiv.setClassName("step-timeband");
 		setElement(timebandContainer);
+		
+		tapeTracks = new ArrayList<TapeTrack>();
 	}
 
-	protected void initDivProperties() {
-		bandDiv.setClassName("step-timeband");
-	}
-
 	/**
 	 * @return the showScale
 	 */
@@ -232,7 +238,7 @@
 				// well the band is not visible, so if the event is in the
 				// visible section, then paint it
 				if (isEventInVisibleSection(event)) {
-					//Log.debug("Displaying container and requesting paint");
+					Log.debug("Adding event to hidden band: " + event.getDescription());
 					El el = new El(timebandContainer);
 					el.setDisplayed(true);
 					event.paint();
@@ -285,7 +291,7 @@
 	}
 
 	protected void paint(int top) {
-		//Log.debug("Request to paint band id:" + getId() + " Current date: " + getCurrentDate());
+		Log.debug("Request to paint band id:" + getId() + " Current date: " + getCurrentDate() + " Desc:" + getDescription());
 		if (!isRendered) {
 			addBandToUI(top);
 			isRendered = true;
@@ -318,6 +324,8 @@
 		
 		parent.getTimelineContainer().appendChild(timebandContainer);
 		timebandContainer.appendChild(bandDiv);
+		
+		addLabelToBand();		
 
 		el.setStyleName("step-timeband-container");
 		el.setHeight(getHeight());
@@ -327,6 +335,14 @@
 		gxtBandDiv.setTop(0);
 	}
 
+	private void addLabelToBand() {
+		Element timebandLabel = DOM.createDiv();
+		El gxtTimebandLabel = new El(timebandLabel);
+		gxtTimebandLabel.setStyleName("step-timeband-label", true);
+		timebandLabel.setInnerText(description);
+		timebandContainer.appendChild(timebandLabel);
+	}
+
 	/**
 	 * Tells the caller whether the event is in the visible section of the div on the browser.
 	 * @param event the event to be tested
@@ -379,6 +395,10 @@
 
 	public void setCurrentDate(long currentDate) {
 		this.currentDate = currentDate;
+		
+		//if we're changing the date, then everything on the band is going to be wrong, so
+		//get rid of it...
+		
 	}
 
 	/**
@@ -497,9 +517,9 @@
 				if(maxVisibleDate < minReceivedDate) {
 					//we have issues here, as we're either going to have to remember about all the already painted stuff
 					//or we're going to have to clear down the band first.
-					//TODO:
-					throw new IncapableOfCalculatingRequestWindowException("You cannot yet scroll so fast as to have the max window " +
-							"be before the min requested");
+					//TODO: at the moment we reset, but ideally, remember what's been painted or clear down band.					
+					requestWindow = null;
+					return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
 				} else {
 					//the max is greater than the minimum so we return
 					if(minReceivedDate - minVisibleDate > minimumDifference) {
@@ -511,8 +531,8 @@
 			} else if(shiftedRight) {
 				//same problem as above if
 				if(minVisibleDate > maxReceivedDate) {
-					throw new IncapableOfCalculatingRequestWindowException("You cannot yet scroll so fast as to have the min window " +
-							"end up further than the max requested");
+					requestWindow = null;
+					return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
 				} else {
 					//in particular check that the gap between maxReceivedDate and maxVisibleDate is enough
 					if(maxVisibleDate - maxReceivedDate > minimumDifference) {
@@ -574,16 +594,33 @@
 		//for now however, let's do it simply
 		pixelsPerUnit *= zoomRatio;
 	
+		//do a sensible check...
+		adjustUnit();
+		
+		repaint();
+	}
+
+	
+	
+	private void repaint() {
 		//TODO: the timescale should technically be in charge of the unit
 		//logically speaking, let's start with the timescale
-		timescale.repaint(zoomRatio);
+		timescale.repaint();
 		
 		for(TimeEvent te : events.values()) {
-			te.repaint(zoomRatio);
-		}		
+			te.repaint();
+		}				
 	}
 
 	/**
+	 * TODO: The idea is to adjust depending on how many pixels constitutes a unit
+	 * so that we can easily zoom in and out and have the units repainted properly
+	 */
+	private void adjustUnit() {
+		
+	}
+
+	/**
 	 * @return the zoomFactor
 	 */
 	public double getZoomFactor() {
@@ -591,9 +628,32 @@
 	}
 
 	/**
+	 * @return the description
+	 */
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * @param description the description to set
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	/**
 	 * @param zoomFactor the zoomFactor to set
 	 */
 	public void setZoomFactor(double zoomFactor) {
 		this.zoomFactor = zoomFactor;
 	}
+
+	//not sure if this should be part of setCurrentDate
+	public void scrollToCurrentDate() {
+		//TODO: fix this here...
+		new El(timebandContainer).setScrollLeft((int) currentDateX);
+		Log.debug("Scroll left is " + timebandContainer.getScrollLeft());
+		Log.debug("Scroll left is " + new El(timebandContainer).getScrollLeft());
+		
+	}
 }

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -256,10 +256,29 @@
 		this.maxDate = maxDate;
 	}
 
-	public void repaint(double zoomRatio) {
-		El element = new El(this.eventDiv);
-		element.setLeft((int) (element.getLeft() * zoomRatio));
-		element.setWidth((int) (element.getWidth() * zoomRatio));
+	/**
+	 * Again we could do something clever here, but for now, 
+	 * let's just remove the event and paint it on again.
+	 * @param zoomRatio
+	 */
+	public void repaint() {
+		currentTimeBand.getBandDiv().removeChild(eventDiv);
+		isRendered = false;
+		paint();
+		
+//		El element = new El(eventDiv);
+//		element.setLeft((int) (element.getLeft() * zoomRatio));
+//
+//		//reposition label
+//		El gxtLabel = new El(label);
+//		gxtLabel.setLeft((int) (gxtLabel.getLeft() * zoomRatio));
+//		
+//		if(maxDate != null) {
+//			element.setWidth((int) (element.getWidth() * zoomRatio));
+//			El gxtIcon = new El(icon);
+//			gxtIcon.setWidth((int) (gxtIcon.getWidth() * zoomRatio));
+//		} else {
+//		}
 	}
 
 }

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -11,7 +11,7 @@
 	private boolean isRendered = false;
 	private final TimeBand band;
 	private Element scaleBand;
-	HashMap<Integer, Element> paintedTimescaleBands;
+	private HashMap<Integer, Element> paintedTimescaleBands;	
 	
 	/**
 	 * A timescale is attached to a timeband
@@ -31,11 +31,12 @@
 		if(!band.isRendered()) {
 			return;
 		}
-//	TODO: this is taking too long and rendering for inexitant bands.
-		//disable logging to see if that matters so much at the moment
-		//bearing in mind we will be having less bands over all anyway
+
+		//if rendered already? skip!
 		if (!isRendered) {
 			scaleBand = DOM.createDiv();
+			paintedTimescaleBands.clear();	//reset in case we're in a zoom
+			
 			El gxtScaleBand = new El(scaleBand);
 			band.getBandDiv().appendChild(scaleBand);
 			gxtScaleBand.setStyleName("step-scale-band", true);
@@ -49,7 +50,7 @@
 	private void paintVisibleScale() {
 		long visibleLeft = band.getMinVisibleDate();
 		long visibleRight = band.getMaxVisibleDate();
-
+				
 		// TODO: change this at some point
 		Unit unit = band.getUnit();
 
@@ -73,9 +74,17 @@
 		for (long ii = 0; ii < numberOfVisibleSegments+1; ii++) {
 			//check segment not already drawn...
 			Integer key = new Integer(relativeLeft);
-			//this bit below needs to be syncrhonised, ie.
+			Integer keyMinus1 = new Integer(relativeLeft-1);
+			Integer keyPlus1 = new Integer(relativeLeft+1);
 			
-			if (!paintedTimescaleBands.containsKey(key)) {
+
+			//due to rounding errors, we need to check 1 below key and 1 above too
+			//TODO: instead of relying on time for drawing these, draw the first one,
+			//then rely on intervals. Saves computations for storage.
+			if (!paintedTimescaleBands.containsKey(key) && 
+				!paintedTimescaleBands.containsKey(keyPlus1) &&
+				!paintedTimescaleBands.containsKey(keyMinus1)
+				) {
 				Element un = DOM.createDiv();
 				El gxtUn = new El(un);
 				gxtUn.setWidth(pixelsPerUnit);
@@ -85,6 +94,7 @@
 
 				// set left position:
 				gxtUn.setLeft(relativeLeft);
+				gxtUn.setTop(0); // if this is laid out after events, then 0 makes sure it lines up to the top
 				gxtUn.setHeight("100%");
 
 				paintedTimescaleBands.put(key, un);
@@ -97,15 +107,37 @@
 	
 	/**
 	 * The easy way is to get rid of everything and repaint
-	 * The slightly more clever way is to actually repaint the existing dom elements. Let's go for more
-	 * clever way for now. It uses more memory though, however, we can try both eventually if need be.
+	 * The slightly more clever way is to actually repaint the existing dom elements. It uses more memory though, however, we can try both eventually if need be.
 	 */
-	public void repaint(double zoomRatio) {
-		for(Element tsu : paintedTimescaleBands.values()) {
-			El element = new El(tsu);
-			element.setLeft((int) (element.getLeft() * zoomRatio));
-			
-			//TODO: HERE once repainted need to update all the keys too, the text on the dates and all that
-		}
+	public void repaint() {
+		//remove oneself first
+		band.getBandDiv().removeChild(scaleBand);
+		isRendered = false;
+		paint();
+		
+		//temporary store for all the new keys. we can't remove
+		//while iterating, nor do we want to replace existing keys
+//		HashMap<Integer, Integer> oldToNewKeyMap = new HashMap<Integer, Integer>();
+//		
+//		for(Element tsu : paintedTimescaleBands.values()) {
+//			El element = new El(tsu);
+//			int previousLeft = element.getLeft();
+//			int newLeft = (int) (previousLeft * zoomRatio);
+//			element.setLeft(newLeft);
+//			element.setWidth(band.getPixelsPerUnit());
+//			
+//			//add to the old to new key map
+//			oldToNewKeyMap.put(new Integer(previousLeft), new Integer(newLeft));
+//		}
+//		
+//		//make a copy of the old HashMap
+//		HashMap<Integer, Element> copyOfPaintedTimescaleBands = new HashMap<Integer, Element>(); 
+//		copyOfPaintedTimescaleBands.putAll(copyOfPaintedTimescaleBands);
+//	
+//		//clear and repopulate with new keys
+//		paintedTimescaleBands.clear();
+//		for(Integer k : oldToNewKeyMap.keySet()) {
+//			paintedTimescaleBands.put(oldToNewKeyMap.get(k), copyOfPaintedTimescaleBands.get(k));
+//		}
 	}
 }

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -184,6 +184,8 @@
 			// timeline
 			new El(timelineDiv).setHeight(relativeTop);
 			isRendered = true;
+			
+			//finally scroll to the correct location
 		}
 	}
 
@@ -280,4 +282,16 @@
 			tb.zoomOut();
 		}		
 	}
+
+	public void repaint(Long originDate) {
+		//remove all the timebands from the timeline widget
+		for(TimeBand band : timebands) {
+			band.setCurrentDate(originDate); //one of the events in Jesus' life
+			//TODO: parameterize this depending on the length of the band
+			band.setCurrentDateX(32000);
+			band.scrollToCurrentDate();
+		}
+
+		fireTimelineScrollEvent();	
+	}
 }

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/DbProvider.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/DbProvider.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/DbProvider.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -36,7 +36,10 @@
 		} catch (ClassNotFoundException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
-		}
+		} 
+		
+		//TODO: not catching exceptions when database is opened by someone else
+		
 		return DriverManager.getConnection(dbConnectionString );
 	}
 

Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/guice/ServerModule.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -11,6 +11,7 @@
 import com.tyndalehouse.step.web.server.handler.GetCurrentBibleTextHandler;
 import com.tyndalehouse.step.web.server.handler.GetEventsForDateRangeHandler;
 import com.tyndalehouse.step.web.server.handler.GetModuleRefDataHandler;
+import com.tyndalehouse.step.web.server.handler.GetTimelineOriginForScriptureHandler;
 import com.tyndalehouse.step.web.server.handler.GetTimelineUISetupHandler;
 
 /**
@@ -27,6 +28,8 @@
 		bindHandler(GetModuleRefDataHandler.class);
 		bindHandler(GetEventsForDateRangeHandler.class);
 		bindHandler(GetTimelineUISetupHandler.class);
+		bindHandler(GetTimelineOriginForScriptureHandler.class);
+
 		bind(Log.class).toProvider(LogProvider.class).in(Singleton.class);
 		bind(RefDataDbCommand.class).in(Singleton.class);
 	

Copied: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/stepwebapp.gwt.xml (from rev 33, trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/StepWebApp.gwt.xml)
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/stepwebapp.gwt.xml	                        (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/stepwebapp.gwt.xml	2009-12-12 22:06:30 UTC (rev 38)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
+<module rename-to='step'>
+ <!-- Inherit the core Web Toolkit stuff.                        -->
+ <inherits name="com.google.gwt.user.User" />
+ <inherits name="com.google.gwt.inject.Inject" />
+ <inherits name='net.customware.gwt.dispatch.Dispatch' />
+ <inherits name='net.customware.gwt.presenter.Presenter' />
+
+
+ <!-- Inherit the default GWT style sheet.  You can change       -->
+ <!-- the theme of your GWT application by uncommenting          -->
+ <!-- any one of the following lines.                            -->
+ <inherits name='com.google.gwt.user.theme.standard.Standard' />
+ <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
+ <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->
+
+ <!-- Specify the app entry point class.                         -->
+ <entry-point class='com.tyndalehouse.step.web.client.StepEntryPoint' />
+
+ <!-- Add gwt-log support, default level `OFF` - check for 
+      extended property 'log_level' to see if this is overridden -->
+ <inherits name="com.allen_sauer.gwt.log.gwt-log-OFF" />
+
+<!-- including GWT-EXT for timeline module -->
+<inherits name='com.google.gwt.json.JSON'/>
+<inherits name='com.extjs.gxt.ui.GXT'/>
+
+ <!-- Also compile Logger at `INFO` level -->
+ <extend-property name="log_level" values="DEBUG" />
+ <set-property name="log_level" value="DEBUG" />
+ 
+ <!-- Turn off the floating logger - output will be shown in the 
+   hosted mode console -->
+ <set-property name="log_DivLogger" value="DISABLED" />
+ 
+ 
+ <source path="shared" />
+ <source path="client" />
+
+<!--   <stylesheet src="js/api/ext/resources/css/ext-all.css" /> -->
+<stylesheet src="gwtext/css/gxt-all.css" />
+
+
+<!--  DEV MODE SETTINGS -->
+
+ 
+</module>


Property changes on: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/stepwebapp.gwt.xml
___________________________________________________________________
Added: svn:mergeinfo
   + 

Deleted: trunk/step-web-app/src/main/test/com/tyndalehouse/step/tests/server/TimelineUISetupHandlerTest.java
===================================================================
--- trunk/step-web-app/src/main/test/com/tyndalehouse/step/tests/server/TimelineUISetupHandlerTest.java	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/src/main/test/com/tyndalehouse/step/tests/server/TimelineUISetupHandlerTest.java	2009-12-12 22:06:30 UTC (rev 38)
@@ -1,7 +0,0 @@
-package com.tyndalehouse.step.tests.server;
-
-import junit.framework.TestCase;
-
-public class TimelineUISetupHandlerTest extends TestCase {
-
-}

Deleted: trunk/step-web-app/war/WEB-INF/lib/gwt-log-2.6.2.jar
===================================================================
(Binary files differ)

Added: trunk/step-web-app/war/WEB-INF/lib/gwt-log-3.0.0.jar
===================================================================
(Binary files differ)


Property changes on: trunk/step-web-app/war/WEB-INF/lib/gwt-log-3.0.0.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/step-web-app/war/WEB-INF/lib/gwt-servlet.jar
===================================================================
(Binary files differ)


Property changes on: trunk/step-web-app/war/WEB-INF/lib/gwt-servlet.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/step-web-app/war/WEB-INF/lib/gwt-servlet.jar.svntmp
===================================================================
(Binary files differ)


Property changes on: trunk/step-web-app/war/WEB-INF/lib/gwt-servlet.jar.svntmp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: trunk/step-web-app/war/css/step.css
===================================================================
--- trunk/step-web-app/war/css/step.css	2009-12-12 17:16:05 UTC (rev 37)
+++ trunk/step-web-app/war/css/step.css	2009-12-12 22:06:30 UTC (rev 38)
@@ -56,6 +56,11 @@
 	/* height: 100%; */
 
 }
+.step-timeband-label {
+	position: absolute;
+	left: 0px;
+	bottom: 0px;	
+}
 
 
 .step-time-event {
@@ -73,13 +78,13 @@
 	margin-right: 0px;
 	margin-left: 0px;
 	margin-bottom: 1px;
-	
+
 	list-style-type: none;
 }
 
 .step-timeline-pointInTime {
 	display:inline;
-	background-image: url("/step/images/blue-circle.png");
+	background-image: url("/step/step/images/blue-circle.png");
 	width: 10px;
 	border: none;
 	background-repeat: no-repeat;
@@ -87,7 +92,7 @@
 }
 
 .step-time-point-in-time-label {
-	background-image: url("/step/images/blue-circle.png");
+	background-image: url("/step/step/images/blue-circle.png");
 	display:inline;
 	background-repeat: no-repeat;
 	background-position: left;
@@ -104,7 +109,7 @@
 }
 
 .step-time-duration-label {
-	
+	display: inline;	
 }
 
 .step-scale-band div {




More information about the Tynstep-svn mailing list