[Tynstep-svn] r47 - in trunk/step-web-app: . src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline src/main/java/com/tyndalehouse/step/web/server/db

ChrisBurrell at crosswire.org ChrisBurrell at crosswire.org
Mon Dec 14 10:42:47 MST 2009


Author: ChrisBurrell
Date: 2009-12-14 10:42:47 -0700 (Mon, 14 Dec 2009)
New Revision: 47

Modified:
   trunk/step-web-app/build.xml
   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
Log:


Modified: trunk/step-web-app/build.xml
===================================================================
--- trunk/step-web-app/build.xml	2009-12-14 17:21:45 UTC (rev 46)
+++ trunk/step-web-app/build.xml	2009-12-14 17:42:47 UTC (rev 47)
@@ -37,7 +37,9 @@
     </javac>
 
   	<!-- update the subversion repository -->
-  	<exec command="svn update ~/trunk" />
+  	<exec>
+  		<arg value="svn update ~/trunk"/>	
+  	</exec>
   
   </target>
 

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-14 17:21:45 UTC (rev 46)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java	2009-12-14 17:42:47 UTC (rev 47)
@@ -75,36 +75,39 @@
 	}
 
 	public void handle(MouseMoveEvent e) {
-		// TODO: customize as a property?
-		TimeBand defaultTimeBand = timebands.get(0);
-		Unit defaultUnit = defaultTimeBand.getUnit();
-		int defaultPixelsPerUnit = defaultTimeBand.getPixelsPerUnit();
-
-		if (downStatus) {
-			// mouse is down so move the scroll bars on each timeband
-			// for each timeband, scroll a certain amount... This amount though
-			// is relative to the scales
-			// assume timeband 0 is the default
-			// at the same time we want to add some new scroll visible event to
-			// allow service layer to update
-			// the events shown if necessary on each timeband
-
-			for (TimeBand tb : timebands) {
-				tb.setScrollLeft(clientX, e.getClientX(), defaultUnit, defaultPixelsPerUnit);
-				//Log.debug("About to scroll: " + (clientX - e.getClientX()));
-
-				// TODO: decide whether we want to filter out some events here
-				// already
-				// to avoid having events flying all over the place...
-				// build the event here scrolling...
-				// TODO: use units here instead?
+		if(timebands.size() != 0) {
+			// TODO: customize as a property?
+			TimeBand defaultTimeBand = timebands.get(0);
+			Unit defaultUnit = defaultTimeBand.getUnit();
+			int defaultPixelsPerUnit = defaultTimeBand.getPixelsPerUnit();
+	
+			if (downStatus) {
+				// mouse is down so move the scroll bars on each timeband
+				// for each timeband, scroll a certain amount... This amount though
+				// is relative to the scales
+				// assume timeband 0 is the default
+				// at the same time we want to add some new scroll visible event to
+				// allow service layer to update
+				// the events shown if necessary on each timeband
+	
+				for (TimeBand tb : timebands) {
+					tb.setScrollLeft(clientX, e.getClientX(), defaultUnit, defaultPixelsPerUnit);
+					//Log.debug("About to scroll: " + (clientX - e.getClientX()));
+	
+					// TODO: decide whether we want to filter out some events here
+					// already
+					// to avoid having events flying all over the place...
+					// build the event here scrolling...
+					// TODO: use units here instead?
+				}
+	
+				// fire the event and let presenter decide how much of the event
+				// needs to be passed back to the server...
+				//TODO: this needs to  be fired also in the case of window resizing events
+				fireTimelineScrollEvent();
 			}
-
-			// fire the event and let presenter decide how much of the event
-			// needs to be passed back to the server...
-			//TODO: this needs to  be fired also in the case of window resizing events
-			fireTimelineScrollEvent();
-		}
+		} 
+		//ignore if no timebands, as it is not fully rendered
 	}
 
 	/**

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-14 17:21:45 UTC (rev 46)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/db/DbProvider.java	2009-12-14 17:42:47 UTC (rev 47)
@@ -10,7 +10,8 @@
 //db connections and gain performance
 public class DbProvider {
 	//TODO: shove this in a properties file
-	private static String dbConnectionString = "jdbc:derby:StepDB";
+	private static String dbConnectionString = "jdbc:derby:";
+	private static String defaultLocation = "StepDB";
 
 	//TODO: ensure that we can set in properties file dev or non dev environment
 	// and use appropriate connection pool as a result...
@@ -39,8 +40,12 @@
 		} 
 		
 		//TODO: not catching exceptions when database is opened by someone else
-		
-		return DriverManager.getConnection(dbConnectionString );
+		String sysDbLocation = System.getProperty("step.db.location");
+		if(sysDbLocation != null) {
+			return DriverManager.getConnection(dbConnectionString + sysDbLocation);
+		} else {
+			return DriverManager.getConnection(dbConnectionString + defaultLocation);
+		}
 	}
 
 	public static void finaliseConnection(Connection connection) throws SQLException {




More information about the Tynstep-svn mailing list