[Tynstep-svn] r70 - in trunk/step-web-app: src/main/java/com/tyndalehouse/step/web/client/presenter src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers src/main/java/com/tyndalehouse/step/web/server/handler src/main/java/com/tyndalehouse/step/web/shared/beans src/main/resources/com/tyndalehouse/step/web/server/config war/css
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Sat Jan 9 09:52:42 MST 2010
Author: ChrisBurrell
Date: 2010-01-09 09:52:42 -0700 (Sat, 09 Jan 2010)
New Revision: 70
Added:
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/exceptions/UnknownFiredElement.java
Removed:
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeBand.java
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/toolkit/timeline/TapeTrack.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/TimeEventDescriptor.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/client/toolkit/timeline/components/Unit.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java
trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineBean.java
trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/config/environment.properties
trunk/step-web-app/war/css/step.css
Log:
updates to source code.
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 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/presenter/TimelinePresenter.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -19,7 +19,7 @@
import com.tyndalehouse.step.web.client.event.TimelineScrollEvent;
import com.tyndalehouse.step.web.client.eventhandler.ScriptureChangeEventHandler;
import com.tyndalehouse.step.web.client.eventhandler.TimelineScrollEventHandler;
-import com.tyndalehouse.step.web.client.toolkit.timeline.TimeBand;
+import com.tyndalehouse.step.web.client.toolkit.timeline.Timeband;
import com.tyndalehouse.step.web.client.toolkit.timeline.TimeEvent;
import com.tyndalehouse.step.web.client.toolkit.timeline.Timeline;
import com.tyndalehouse.step.web.client.toolkit.timeline.components.Unit;
@@ -108,7 +108,7 @@
int timebandId = ev.getTimelineId();
try {
- TimeBand correctBand = tl.getBand(timebandId);
+ Timeband correctBand = tl.getBand(timebandId);
correctBand.addEvent(new TimeEvent(ev.getEventId(), ev.getName(), ev.getFromDate(), ev.getToDate(),
correctBand));
} catch (TimeBandNotFoundException e) {
@@ -121,7 +121,7 @@
// and also resize the bands too
for (TimeBandVisibleDate tbvd : event.getTimebandVisibleDates()) {
try {
- TimeBand tb = tl.getBand(tbvd.getTimebandId());
+ Timeband tb = tl.getBand(tbvd.getTimebandId());
tb.adjustRequestedView(tbvd.getMinDate(), tbvd.getMaxDate());
tb.resizeBand();
} catch (TimeBandNotFoundException e) {
@@ -220,12 +220,12 @@
// we could avoid the copying here, since the timline bean
// is essentially what is needed, but nice to have it decoupled.
for (TimelineBean tb : setupData.getTimelines()) {
- TimeBand band = new TimeBand(timeline, tb.getTimelineId(), tb.getTimelineDescription());
+ Timeband band = new Timeband(timeline, tb.getTimelineId(), tb.getTimelineDescription());
// TODO: change the scale dynamically
band.setPixelsPerUnit(100);
//band.setHeight(400);
- band.setUnit(Unit.DECADE); //TODO: what if i want 8 years, or 25 years, etc.
+ band.setUnit(Unit.valueOf(tb.getUnit()));
// set the date to the middle of the band: TODO: again something
// that needs changing.
Modified: 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 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TapeTrack.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -87,7 +87,7 @@
* paints the timetrack on to the timeband
* @param band
*/
- public void paint(final TimeBand band) {
+ public void paint(final Timeband band) {
if(!isRendered) {
band.getBandDiv().appendChild(track);
isRendered = true;
Deleted: 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-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeBand.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -1,843 +0,0 @@
-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;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Widget;
-import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimebandRequestWindow;
-import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimelineConstants;
-import com.tyndalehouse.step.web.client.toolkit.timeline.components.Unit;
-import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.CannotDeleteEventException;
-import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.IncapableOfCalculatingRequestWindowException;
-import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.TimeConversionUtil;
-import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
-
-/**
- * The TimeBand object represents a section of the timeline that contains the
- * events. There are many timebands on the timeline. Timebands contain
- * TimeScales representing units as well as TapeTracks which contain the events
- * The events are logically held on the Timeband, but painted on the time track.
- *
- * @author CJBurrell
- */
-public class TimeBand extends Widget {
- /**
- * Id of the timeband
- */
- private int id;
-
- /**
- * Min date that the timeband is expected to paint
- */
- private long minDate;
-
- /**
- * Max date that the timeband is expected to paint
- */
- private long maxDate;
-
- /**
- * this contains all the events on the time band
- */
- private TreeMap<Integer, TimeEvent> events;
-
- /**
- * Determines the unit of the timeband and how to convert from/to
- * time/pixels
- */
- private Unit unit;
-
- /**
- * The DOM element containing all timeband elements
- */
- private Element bandDiv;
-
- /**
- * The timeband container which contains the bandDiv
- */
- private Element timebandContainer;
-
- /**
- * Number of pixels to be shown per unit
- */
- private int pixelsPerUnit;
-
- /**
- * this is the parent widget Timeline object
- */
- private final Timeline parent;
-
- /**
- * The current date that is shown
- */
- private long currentDate;
-
- /**
- * The current pixel on the timeband representing the current date (above)
- */
- private long currentDateX = 0;
-
- /**
- * Whether or not to show the scale band
- */
- private boolean showScale = true;
-
- /**
- * The last recorded mouse position on the mouse down event
- */
- private int mouseDownScrollLeft;
-
- /**
- * This indicates whether the band has been painted and is showing
- */
- private boolean isRendered = false;
-
- /**
- * This is the timescale visible on the timeband drawing lines across the
- * timebands for each unit
- */
- private TimeScale timescale;
-
- /**
- * this is the autohide option, which should hide the timeband if no events
- * are displayed
- */
- private boolean autoHide = true;
-
- /**
- * when this is set to true, then we can use the request window object to
- * determine whether or not we are showing all the events we are able to If
- * events can be deleted or moved to other timebands, it becomes difficult
- * to work out what the request window should be.
- */
- private boolean deletionsDisabled = true;
-
- /**
- * Each timeband is given a request window. This object is responsible of
- * working out how much to request from the server, so as not to flood it
- * with requests of stuff it already has
- */
- private TimebandRequestWindow requestWindow = null;
-
- // TODO:Derive this from a properties file? somehow? or database?
- /**
- * this describes how much of a unit needs to be visible before calling back
- * to the server
- */
- private double outstandingUnitFactor = 0.5;
-
- /**
- * This determines how much of a zoom is applied. For example a factor of
- * 0.25 changes the scale of 50 pixels per decade to (1 + 0.25) * 50 = 75
- * pixels
- */
- private double zoomFactor = 0.25;
-
- /**
- * The timeband description
- */
- private String description;
-
- /**
- * The list of tape tracks on this timeband.
- */
- private List<TapeTrack> tapeTracks;
-
- private boolean needsResizing = false;
-
- /**
- * To create a new timeband on the timeline
- *
- * @param parent
- * the timeline on which it is to be created
- * @param id
- * the id of the timeband
- * @param description
- * its description
- */
- public TimeBand(final Timeline parent, final int id, String description) {
- this.parent = parent;
- this.id = id;
- this.description = description;
-
- // set up collections
- events = new TreeMap<Integer, TimeEvent>();
- tapeTracks = new ArrayList<TapeTrack>();
-
- // set up page properties
- bandDiv = DOM.createDiv();
- timebandContainer = DOM.createDiv();
- bandDiv.setClassName("step-timeband");
- setElement(timebandContainer);
- }
-
- /**
- * Adds an event to the timeband, and therefore on to a random timetack. The
- * first available spot to minimize the space required.
- *
- * @param event
- */
- public void addEvent(TimeEvent event) {
- // need to check the event isn't already in our list:
- if (!events.containsKey(event.getId())) {
- events.put(event.getId(), event);
-
- if (isVisible()) {
- // Log.debug("Request to paint event triggered");
- addEventToTapeTrack(event);
- } else if (autoHide) {
- // well the band is not visible, so if the event is in the
- // visible section, then paint it
- if (isEventInVisibleSection(event)) {
- Log.debug("Adding event to hidden band: " + event.getDescription());
- El el = new El(timebandContainer);
- el.setDisplayed(true);
- addEventToTapeTrack(event);
- }
- }
- // otherwise, autoHide is set to false, so leave hidden
- }
- }
-
- public void addEventToTapeTrack(TimeEvent event) {
- int startIndex = showScale ? 1 : 0; // leaving room for the scale band
-
- // if event is added already, then exit
- if (event.isRendered()) {
- return;
- }
-
- while (startIndex < tapeTracks.size()) {
- // Log.debug("Trying to add " + event.getDescription() +
- // " to track " + startIndex);
- // try and add event to track
- if (tapeTracks.get(startIndex).addEvent(event)) {
- return;
- }
- startIndex++;
- }
-
- // Log.debug("Going to create a new tape track");
-
- // check that the event was added, otherwise add timetrack
- if (startIndex >= tapeTracks.size()) {
- // did not manage to add it to tracks. therefore, let's add another
- // one:
- TapeTrack t = addNewTapeTrack();
- t.addEvent(event);
- }
- }
-
- private TapeTrack addNewTapeTrack() {
- TapeTrack t = new TapeTrack();
- tapeTracks.add(t);
- t.paint(this);
-
- needsResizing = true;
-
- return t;
- }
-
- /**
- * Removes an event from the band
- *
- * @param id
- * the id of the event to be removed.
- * @throws CannotDeleteEventException
- * An event cannot be removed from a timeband.
- */
- public void removeEvent(final int id) throws CannotDeleteEventException {
- if (deletionsDisabled) {
- throw new CannotDeleteEventException("The event you are trying to delete (" + id + ") is on band set on" + "deletionsDisabled = true");
- }
-
- events.remove(id);
- // TODO: refresh the timeline dom
- }
-
- public TimeEvent getSingleEvent(final String eventId) {
- return events.get(eventId);
- }
-
- public long getMinVisibleDate() {
- return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft(), this);
- }
-
- public long getMaxVisibleDate() {
- int realClientWidth = timebandContainer.getClientWidth();
- // if this is not rendered properly yet, then we have no width:
- if (realClientWidth == 0) {
- // use the timeline width, perhaps we can take the parent width
- // instead...
- // this is important as it it could that the timline doesn't take
- // the full width
- realClientWidth = Window.getClientWidth();
- }
-
- return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft() + realClientWidth, this);
- }
-
- /**
- * Repaints the timeband
- *
- * @param top
- */
- protected void paint() {
- // Log.debug("Request to paint band id:" + getId() + " Current date: " +
- // getCurrentDate() + " Desc:" + getDescription());
- if (!isRendered) {
- addBandToUI();
- isRendered = true;
- }
-
- // show scale band?
- if (showScale) {
- // check if default time track has been added and add if not
- if (tapeTracks.size() == 0) {
- addNewTapeTrack();
- }
-
- if (timescale == null) {
- timescale = new TimeScale(this);
- }
- timescale.paint();
- }
-
- drawEvents();
-
- }
-
- /**
- * Draws event onto the band
- */
- private void drawEvents() {
- // get the events to paint themselves (they will decide whether or not
- // to
- // paint if they are already showing...
- for (TimeEvent te : events.values()) {
- addEventToTapeTrack(te);
- }
-
- //after adding events, call the resizing function.
- //It decides whether or not the band needs resizing, so no overhead
- resizeBand();
- }
-
- /**
- * Resizes bands dependant on how many bands are present.
- */
- public void resizeBand() {
- if(needsResizing) {
- // resize the timeband to take account of the number of timetracks
- new El(timebandContainer).setHeight(tapeTracks.size() * TimelineConstants.TAPE_TRACK_HEIGHT);
- needsResizing = false;
- }
- }
-
- /**
- * adds the band to the DOM
- */
- protected void addBandToUI() {
- El el = new El(timebandContainer);
- El gxtBandDiv = new El(bandDiv);
-
- // set display options, ie. auto hide
- if (autoHide && !hasVisibleEvents()) {
- el.setDisplayed(false);
- }
-
- parent.getTimelineContainer().appendChild(timebandContainer);
- timebandContainer.appendChild(bandDiv);
- addLabelToBand();
-
- el.setStyleName("step-timeband-container");
- gxtBandDiv.setHeight("100%");
- gxtBandDiv.setTop(0);
- }
-
- private void addLabelToBand() {
- Element timebandLabel = DOM.createDiv();
- El gxtTimebandLabel = new El(timebandLabel);
- gxtTimebandLabel.setStyleName("step-timeband-label", true);
- timebandLabel.setInnerText(description + "(" + id + ")");
- 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
- * @return true if the event is in the visible section
- */
- private boolean isEventInVisibleSection(TimeEvent event) {
- Long eventMinDate = event.getMinDate();
- Long eventMaxDate = event.getMaxDate(); // eventMaxDate can be null
- long minVisibleDate = getMinVisibleDate();
- long maxVisibleDate = getMaxVisibleDate();
-
- // output compare option:
- // DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy G");
-
- // Log.debug("Comparing ev(" +
- // dtf.format(new Date(eventMinDate)) + "," +
- // dtf.format(new Date(eventMaxDate)) + ") " +
- // "to band(" +
- // dtf.format(new Date(minVisibleDate)) + "," +
- // dtf.format(new Date(maxVisibleDate)) + ")");
-
- if ((eventMinDate >= minVisibleDate && eventMinDate <= maxVisibleDate)
- || (eventMaxDate != null && eventMaxDate >= minVisibleDate && eventMaxDate <= maxVisibleDate)
- || (eventMaxDate != null && eventMinDate <= minVisibleDate && eventMaxDate >= maxVisibleDate)) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks whether any of the already attached events are in the visible
- * section
- *
- * @return
- */
- private boolean hasVisibleEvents() {
- // first check count of events, this is because perhaps we are
- // initialising
- // and we don't have anything else to go on...
- if (events.size() == 0) {
- return false;
- }
-
- // check each event to see if they are in the visible section
- for (TimeEvent event : events.values()) {
- if (isEventInVisibleSection(event)) {
- return true;
- }
- }
- return false;
- }
-
- public void captureScrollLeft(MouseDownEvent e) {
- this.mouseDownScrollLeft = timebandContainer.getScrollLeft();
- }
-
- public void setScrollLeft(int previousClientX, int newClientX, Unit defaultUnit, int defaultPixelsPerUnit) {
- // we scroll, but we calculate the unit/scale factor first
- // say default is 1 Year
- // this one is 10 years
- // unit Factor = 0.1 so we scroll 10 times less pixels
- double unitFactor = (double) defaultUnit.getMilliseconds() / (double) unit.getMilliseconds();
-
- // now say instead unit factor is 1, ie. the same unit, but different
- // number of pixels
- // default is 50 pixels per year, this one is 25 pixels a year
- // so we want to scroll half
- double pixelFactor = (double) pixelsPerUnit / (double) defaultPixelsPerUnit;
- this.timebandContainer.setScrollLeft((int) (mouseDownScrollLeft + ((previousClientX - newClientX) * (unitFactor * pixelFactor))));
- }
-
- /**
- * This method is used to tell the Timeband that it now has all events
- * within the section: (x1,x2). We can then use this to ensure subsequent
- * requests don't request the same thing from the server, hence reducing
- * load between the server and the client and also reducing the load on the
- * server
- *
- * @param minDateRequested
- * the minimum date that was requested and retrieved from the
- * back-end
- * @param maxDate2
- * the maximum date that was requested and retrieved from the
- * back-end
- */
- public void adjustRequestedView(long minDateRequested, long maxDateRequested) {
- if (requestWindow == null) {
- requestWindow = new TimebandRequestWindow(minDateRequested, maxDateRequested);
- } else {
- requestWindow.adjustRange(minDateRequested, maxDateRequested);
- }
- }
-
- /**
- * Works out how much of the timeband is to be requested Ideally we should
- * TODO: this somewhere else.
- *
- * @return the visible section of the timeband
- * @throws IncapableOfCalculatingRequestWindowException
- * thrown if we are not in a position to calculate what the
- * remaining section is.
- */
- public TimeBandVisibleDate getOustandingTimebandPeriod() throws IncapableOfCalculatingRequestWindowException {
- long minVisibleDate = getMinVisibleDate();
- long maxVisibleDate = getMaxVisibleDate();
- long minimumDifference = (long) (unit.getMilliseconds() * outstandingUnitFactor);
-
- // the new requested bit depends on our request window
- if (requestWindow == null) {
- return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
- } else {
- // return only the portion that has changed (probably only one pixel
- // worth)! TODO later: ensure
- // we send requests when they are actually worth sending
- // -------|--------$------|-----$--------------------
- // mvd mrd Mvd Mrd
- long minReceivedDate = requestWindow.getMinDate();
- long maxReceivedDate = requestWindow.getMaxDate();
- boolean shiftedLeft = minVisibleDate < minReceivedDate;
- boolean shiftedRight = maxVisibleDate > maxReceivedDate;
-
- if (!shiftedLeft && !shiftedRight) {
- return TimeBandVisibleDate.getNoRequest();
- } else if (shiftedLeft && shiftedRight) {
- // in this case, it was probably a zoom, and so we need to
- // request both parts
- return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
- } else if (shiftedLeft) {
- // window could potentially have jumped, so there may be a gap
- // between maxVisibleDate and min, so take
- // check for gap first, and then decide
- // TODO: check here
- 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: 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) {
- return new TimeBandVisibleDate(id, minVisibleDate, minReceivedDate);
- } else {
- return TimeBandVisibleDate.getNoRequest();
- }
- }
- } else if (shiftedRight) {
- // same problem as above if
- if (minVisibleDate > maxReceivedDate) {
- 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) {
- return new TimeBandVisibleDate(id, maxReceivedDate, maxVisibleDate);
- } else {
- return TimeBandVisibleDate.getNoRequest();
- }
- }
- } else {
- // TODO: add the proper debug information to the exception
- throw new IncapableOfCalculatingRequestWindowException("Unable to calculate request window. It was shifted neither left, nor right");
- }
- }
- }
-
- /**
- * The way zooming works is that we recalculate the positions of all events
- * on the timeline
- */
- public void zoomOut() {
- // first change the zoom factor, then repaint events, and the timescale
- // lets just assume a default zoom factor for now
- // TODO: zoom in factor to be parameterised
- zoom(1 - zoomFactor);
-
- }
-
- /**
- * Zooms in
- */
- public void zoomIn() {
- zoom(1 + zoomFactor);
- }
-
- /**
- * Zooms out given a ratio
- *
- * @param zoomRatio
- * the given ratio to zoom in and out
- */
- private void zoom(double zoomRatio) {
- // TODO: somehow start with those events in the window (although for
- // zoomout, won't make a different
- // first change the scale
- pixelsPerUnit *= zoomRatio;
- adjustUnit();
- redrawBand();
- }
-
- /**
- * Gets the band to scroll to the current date
- */
- public void scrollToCurrentDate() {
- new El(timebandContainer).setScrollLeft((int) currentDateX);
- // Log.debug("Scroll left is " + timebandContainer.getScrollLeft());
- // Log.debug("Scroll left is " + new
- // El(timebandContainer).getScrollLeft());
- }
-
- /**
- * Resets the timeband and redraws it
- */
- public void redrawEmptyBand() {
- events.clear();
- redrawBand();
- }
-
- /**
- * Does not delete the events but redraws everything else.
- */
- public void redrawBand() {
- tapeTracks.clear();
-
- // use El to remove all children
- new El(bandDiv).removeChildren();
- resetAllEvents();
-
- timescale.repaint();
-
- requestWindow = null;
-
- drawEvents();
- }
-
- /**
- * Resets the rendered status on all events
- */
- private void resetAllEvents() {
- for (TimeEvent te : events.values()) {
- te.reset();
- }
- }
-
- /**
- * @return the showScale
- */
- public boolean isShowScale() {
- return showScale;
- }
-
- /**
- * @param showScale
- * the showScale to set
- */
- public void setShowScale(boolean showScale) {
- this.showScale = showScale;
- }
-
- /**
- * @return the bandDiv
- */
- public Element getBandDiv() {
- return bandDiv;
- }
-
- /**
- * @param bandDiv
- * the bandDiv to set
- */
- public void setBandDiv(Element bandDiv) {
- this.bandDiv = bandDiv;
- }
-
- /**
- * @return the pixelsPerUnit
- */
- public int getPixelsPerUnit() {
- return pixelsPerUnit;
- }
-
- /**
- * @param pixelsPerUnit
- * the pixelsPerUnit to set
- */
- public void setPixelsPerUnit(int pixelsPerUnit) {
- this.pixelsPerUnit = pixelsPerUnit;
- }
-
- /**
- * @return the id
- */
- public int getId() {
- return id;
- }
-
- /**
- * @param id
- * the id to set
- */
- public void setId(int id) {
- this.id = id;
- }
-
- /**
- * @return the minDate
- */
- public long getMinDate() {
- return minDate;
- }
-
- /**
- * @param minDate
- * the minDate to set
- */
- public void setMinDate(long minDate) {
- this.minDate = minDate;
- }
-
- /**
- * @return the maxDate
- */
- public long getMaxDate() {
- return maxDate;
- }
-
- /**
- * @return the unit
- */
- public Unit getUnit() {
- return unit;
- }
-
- /**
- * @param unit
- * the unit to set
- */
- public void setUnit(Unit unit) {
- this.unit = unit;
- }
-
- /**
- * @param maxDate
- * the maxDate to set
- */
- public void setMaxDate(long maxDate) {
- this.maxDate = maxDate;
- }
-
- /**
- * @return the events
- */
- public TreeMap<Integer, TimeEvent> getEvents() {
- return events;
- }
-
- 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...
-
- }
-
- /**
- * @return the currentDateX
- */
- public long getCurrentDateX() {
- return currentDateX;
- }
-
- /**
- * @param currentDateX
- * the currentDateX to set
- */
- public void setCurrentDateX(long currentDateX) {
- this.currentDateX = currentDateX;
- }
-
- /**
- * @return the currentDate
- */
- public long getCurrentDate() {
- return currentDate;
- }
-
- /**
- * @return the deletionsDisabled
- */
- public boolean isDeletionsDisabled() {
- return deletionsDisabled;
- }
-
- /**
- * @param deletionsDisabled
- * the deletionsDisabled to set
- */
- public void setDeletionsDisabled(boolean deletionsDisabled) {
- this.deletionsDisabled = deletionsDisabled;
- }
-
- /**
- * @param outstandingUnitFactor
- * the outstandingUnitFactor to set
- */
- public void setOutstandingUnitFactor(double outstandingUnitFactor) {
- this.outstandingUnitFactor = outstandingUnitFactor;
- }
-
- /**
- * @return the outstandingUnitFactor
- */
- public double getOutstandingUnitFactor() {
- return outstandingUnitFactor;
- }
-
- public boolean isRendered() {
- return isRendered;
- }
-
- /**
- * 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() {
- return zoomFactor;
- }
-
- /**
- * @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;
- }
-
- public int getSizeTapeTracks() {
- return tapeTracks.size();
- }
-}
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-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEvent.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -52,7 +52,7 @@
/**
* events can move from one timeband to another
*/
- private TimeBand currentTimeband;
+ private Timeband currentTimeband;
private boolean isRendered = false;
@@ -63,7 +63,7 @@
return isRendered;
}
- public TimeEvent(final int id, final String description, final Long minDate, final Long maxDate, final TimeBand tb) {
+ public TimeEvent(final int id, final String description, final Long minDate, final Long maxDate, final Timeband tb) {
this.id = id;
this.description = description;
this.minDate = minDate;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeEventDescriptor.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -57,8 +57,8 @@
El divWrapper = instance(tl).getDivWrapper();
divWrapper.setInnerHtml(te.getId() + " - " + te.getDescription());
divWrapper.setDisplayed(true);
- Log.debug("x: " + me.getX());
- Log.debug("y: " + me.getY());
+// Log.debug("x: " + me.getX());
+// Log.debug("y: " + me.getY());
divWrapper.setLeft(tl.getAbsoluteLeft() + me.getX());
divWrapper.setTop(tl.getAbsoluteTop() + me.getY() - TimelineConstants.SPACE_BELOW_POPUP);
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-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/TimeScale.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -10,7 +10,7 @@
public class TimeScale {
private boolean isRendered = false;
- private final TimeBand band;
+ private final Timeband band;
private Element scaleBand;
private HashMap<Integer, Element> paintedTimescaleBands;
@@ -19,7 +19,7 @@
*
* @param band
*/
- public TimeScale(final TimeBand band) {
+ public TimeScale(final Timeband band) {
this.band = band;
paintedTimescaleBands = new HashMap<Integer, Element>();
}
Added: 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 (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeband.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -0,0 +1,843 @@
+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;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Widget;
+import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimebandRequestWindow;
+import com.tyndalehouse.step.web.client.toolkit.timeline.components.TimelineConstants;
+import com.tyndalehouse.step.web.client.toolkit.timeline.components.Unit;
+import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.CannotDeleteEventException;
+import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.IncapableOfCalculatingRequestWindowException;
+import com.tyndalehouse.step.web.client.toolkit.timeline.helpers.TimeConversionUtil;
+import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
+
+/**
+ * The TimeBand object represents a section of the timeline that contains the
+ * events. There are many timebands on the timeline. Timebands contain
+ * TimeScales representing units as well as TapeTracks which contain the events
+ * The events are logically held on the Timeband, but painted on the time track.
+ *
+ * @author CJBurrell
+ */
+public class Timeband extends Widget {
+ /**
+ * Id of the timeband
+ */
+ private int id;
+
+ /**
+ * Min date that the timeband is expected to paint
+ */
+ private long minDate;
+
+ /**
+ * Max date that the timeband is expected to paint
+ */
+ private long maxDate;
+
+ /**
+ * this contains all the events on the time band
+ */
+ private TreeMap<Integer, TimeEvent> events;
+
+ /**
+ * Determines the unit of the timeband and how to convert from/to
+ * time/pixels
+ */
+ private Unit unit;
+
+ /**
+ * The DOM element containing all timeband elements
+ */
+ private Element bandDiv;
+
+ /**
+ * The timeband container which contains the bandDiv
+ */
+ private Element timebandContainer;
+
+ /**
+ * Number of pixels to be shown per unit
+ */
+ private int pixelsPerUnit;
+
+ /**
+ * this is the parent widget Timeline object
+ */
+ private final Timeline parent;
+
+ /**
+ * The current date that is shown
+ */
+ private long currentDate;
+
+ /**
+ * The current pixel on the timeband representing the current date (above)
+ */
+ private long currentDateX = 0;
+
+ /**
+ * Whether or not to show the scale band
+ */
+ private boolean showScale = true;
+
+ /**
+ * The last recorded mouse position on the mouse down event
+ */
+ private int mouseDownScrollLeft;
+
+ /**
+ * This indicates whether the band has been painted and is showing
+ */
+ private boolean isRendered = false;
+
+ /**
+ * This is the timescale visible on the timeband drawing lines across the
+ * timebands for each unit
+ */
+ private TimeScale timescale;
+
+ /**
+ * this is the autohide option, which should hide the timeband if no events
+ * are displayed
+ */
+ private boolean autoHide = true;
+
+ /**
+ * when this is set to true, then we can use the request window object to
+ * determine whether or not we are showing all the events we are able to If
+ * events can be deleted or moved to other timebands, it becomes difficult
+ * to work out what the request window should be.
+ */
+ private boolean deletionsDisabled = true;
+
+ /**
+ * Each timeband is given a request window. This object is responsible of
+ * working out how much to request from the server, so as not to flood it
+ * with requests of stuff it already has
+ */
+ private TimebandRequestWindow requestWindow = null;
+
+ // TODO:Derive this from a properties file? somehow? or database?
+ /**
+ * this describes how much of a unit needs to be visible before calling back
+ * to the server
+ */
+ private double outstandingUnitFactor = 0.5;
+
+ /**
+ * This determines how much of a zoom is applied. For example a factor of
+ * 0.25 changes the scale of 50 pixels per decade to (1 + 0.25) * 50 = 75
+ * pixels
+ */
+ private double zoomFactor = 0.25;
+
+ /**
+ * The timeband description
+ */
+ private String description;
+
+ /**
+ * The list of tape tracks on this timeband.
+ */
+ private List<TapeTrack> tapeTracks;
+
+ private boolean needsResizing = false;
+
+ /**
+ * To create a new timeband on the timeline
+ *
+ * @param parent
+ * the timeline on which it is to be created
+ * @param id
+ * the id of the timeband
+ * @param description
+ * its description
+ */
+ public Timeband(final Timeline parent, final int id, String description) {
+ this.parent = parent;
+ this.id = id;
+ this.description = description;
+
+ // set up collections
+ events = new TreeMap<Integer, TimeEvent>();
+ tapeTracks = new ArrayList<TapeTrack>();
+
+ // set up page properties
+ bandDiv = DOM.createDiv();
+ timebandContainer = DOM.createDiv();
+ bandDiv.setClassName("step-timeband");
+ setElement(timebandContainer);
+ }
+
+ /**
+ * Adds an event to the timeband, and therefore on to a random timetack. The
+ * first available spot to minimize the space required.
+ *
+ * @param event
+ */
+ public void addEvent(TimeEvent event) {
+ // need to check the event isn't already in our list:
+ if (!events.containsKey(event.getId())) {
+ events.put(event.getId(), event);
+
+ if (isVisible()) {
+ // Log.debug("Request to paint event triggered");
+ addEventToTapeTrack(event);
+ } else if (autoHide) {
+ // well the band is not visible, so if the event is in the
+ // visible section, then paint it
+ if (isEventInVisibleSection(event)) {
+ Log.debug("Adding event to hidden band: " + event.getDescription());
+ El el = new El(timebandContainer);
+ el.setDisplayed(true);
+ addEventToTapeTrack(event);
+ }
+ }
+ // otherwise, autoHide is set to false, so leave hidden
+ }
+ }
+
+ public void addEventToTapeTrack(TimeEvent event) {
+ int startIndex = showScale ? 1 : 0; // leaving room for the scale band
+
+ // if event is added already, then exit
+ if (event.isRendered()) {
+ return;
+ }
+
+ while (startIndex < tapeTracks.size()) {
+ // Log.debug("Trying to add " + event.getDescription() +
+ // " to track " + startIndex);
+ // try and add event to track
+ if (tapeTracks.get(startIndex).addEvent(event)) {
+ return;
+ }
+ startIndex++;
+ }
+
+ // Log.debug("Going to create a new tape track");
+
+ // check that the event was added, otherwise add timetrack
+ if (startIndex >= tapeTracks.size()) {
+ // did not manage to add it to tracks. therefore, let's add another
+ // one:
+ TapeTrack t = addNewTapeTrack();
+ t.addEvent(event);
+ }
+ }
+
+ private TapeTrack addNewTapeTrack() {
+ TapeTrack t = new TapeTrack();
+ tapeTracks.add(t);
+ t.paint(this);
+
+ needsResizing = true;
+
+ return t;
+ }
+
+ /**
+ * Removes an event from the band
+ *
+ * @param id
+ * the id of the event to be removed.
+ * @throws CannotDeleteEventException
+ * An event cannot be removed from a timeband.
+ */
+ public void removeEvent(final int id) throws CannotDeleteEventException {
+ if (deletionsDisabled) {
+ throw new CannotDeleteEventException("The event you are trying to delete (" + id + ") is on band set on" + "deletionsDisabled = true");
+ }
+
+ events.remove(id);
+ // TODO: refresh the timeline dom
+ }
+
+ public TimeEvent getSingleEvent(final String eventId) {
+ return events.get(eventId);
+ }
+
+ public long getMinVisibleDate() {
+ return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft(), this);
+ }
+
+ public long getMaxVisibleDate() {
+ int realClientWidth = timebandContainer.getClientWidth();
+ // if this is not rendered properly yet, then we have no width:
+ if (realClientWidth == 0) {
+ // use the timeline width, perhaps we can take the parent width
+ // instead...
+ // this is important as it it could that the timline doesn't take
+ // the full width
+ realClientWidth = Window.getClientWidth();
+ }
+
+ return TimeConversionUtil.pixelToTime(timebandContainer.getScrollLeft() + realClientWidth, this);
+ }
+
+ /**
+ * Repaints the timeband
+ *
+ * @param top
+ */
+ protected void paint() {
+ // Log.debug("Request to paint band id:" + getId() + " Current date: " +
+ // getCurrentDate() + " Desc:" + getDescription());
+ if (!isRendered) {
+ addBandToUI();
+ isRendered = true;
+ }
+
+ // show scale band?
+ if (showScale) {
+ // check if default time track has been added and add if not
+ if (tapeTracks.size() == 0) {
+ addNewTapeTrack();
+ }
+
+ if (timescale == null) {
+ timescale = new TimeScale(this);
+ }
+ timescale.paint();
+ }
+
+ drawEvents();
+
+ }
+
+ /**
+ * Draws event onto the band
+ */
+ private void drawEvents() {
+ // get the events to paint themselves (they will decide whether or not
+ // to
+ // paint if they are already showing...
+ for (TimeEvent te : events.values()) {
+ addEventToTapeTrack(te);
+ }
+
+ //after adding events, call the resizing function.
+ //It decides whether or not the band needs resizing, so no overhead
+ resizeBand();
+ }
+
+ /**
+ * Resizes bands dependant on how many bands are present.
+ */
+ public void resizeBand() {
+ if(needsResizing) {
+ // resize the timeband to take account of the number of timetracks
+ new El(timebandContainer).setHeight(tapeTracks.size() * TimelineConstants.TAPE_TRACK_HEIGHT);
+ needsResizing = false;
+ }
+ }
+
+ /**
+ * adds the band to the DOM
+ */
+ protected void addBandToUI() {
+ El el = new El(timebandContainer);
+ El gxtBandDiv = new El(bandDiv);
+
+ // set display options, ie. auto hide
+ if (autoHide && !hasVisibleEvents()) {
+ el.setDisplayed(false);
+ }
+
+ parent.getTimelineContainer().appendChild(timebandContainer);
+ timebandContainer.appendChild(bandDiv);
+ addLabelToBand();
+
+ el.setStyleName("step-timeband-container");
+ gxtBandDiv.setHeight("100%");
+ gxtBandDiv.setTop(0);
+ }
+
+ private void addLabelToBand() {
+ Element timebandLabel = DOM.createDiv();
+ El gxtTimebandLabel = new El(timebandLabel);
+ gxtTimebandLabel.setStyleName("step-timeband-label", true);
+ timebandLabel.setInnerText(description + "(" + id + ")");
+ 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
+ * @return true if the event is in the visible section
+ */
+ private boolean isEventInVisibleSection(TimeEvent event) {
+ Long eventMinDate = event.getMinDate();
+ Long eventMaxDate = event.getMaxDate(); // eventMaxDate can be null
+ long minVisibleDate = getMinVisibleDate();
+ long maxVisibleDate = getMaxVisibleDate();
+
+ // output compare option:
+ // DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy G");
+
+ // Log.debug("Comparing ev(" +
+ // dtf.format(new Date(eventMinDate)) + "," +
+ // dtf.format(new Date(eventMaxDate)) + ") " +
+ // "to band(" +
+ // dtf.format(new Date(minVisibleDate)) + "," +
+ // dtf.format(new Date(maxVisibleDate)) + ")");
+
+ if ((eventMinDate >= minVisibleDate && eventMinDate <= maxVisibleDate)
+ || (eventMaxDate != null && eventMaxDate >= minVisibleDate && eventMaxDate <= maxVisibleDate)
+ || (eventMaxDate != null && eventMinDate <= minVisibleDate && eventMaxDate >= maxVisibleDate)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether any of the already attached events are in the visible
+ * section
+ *
+ * @return
+ */
+ private boolean hasVisibleEvents() {
+ // first check count of events, this is because perhaps we are
+ // initialising
+ // and we don't have anything else to go on...
+ if (events.size() == 0) {
+ return false;
+ }
+
+ // check each event to see if they are in the visible section
+ for (TimeEvent event : events.values()) {
+ if (isEventInVisibleSection(event)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void captureScrollLeft(MouseDownEvent e) {
+ this.mouseDownScrollLeft = timebandContainer.getScrollLeft();
+ }
+
+ public void setScrollLeft(int previousClientX, int newClientX, Unit defaultUnit, int defaultPixelsPerUnit) {
+ // we scroll, but we calculate the unit/scale factor first
+ // say default is 1 Year
+ // this one is 10 years
+ // unit Factor = 0.1 so we scroll 10 times less pixels
+ double unitFactor = (double) defaultUnit.getMilliseconds() / (double) unit.getMilliseconds();
+
+ // now say instead unit factor is 1, ie. the same unit, but different
+ // number of pixels
+ // default is 50 pixels per year, this one is 25 pixels a year
+ // so we want to scroll half
+ double pixelFactor = (double) pixelsPerUnit / (double) defaultPixelsPerUnit;
+ this.timebandContainer.setScrollLeft((int) (mouseDownScrollLeft + ((previousClientX - newClientX) * (unitFactor * pixelFactor))));
+ }
+
+ /**
+ * This method is used to tell the Timeband that it now has all events
+ * within the section: (x1,x2). We can then use this to ensure subsequent
+ * requests don't request the same thing from the server, hence reducing
+ * load between the server and the client and also reducing the load on the
+ * server
+ *
+ * @param minDateRequested
+ * the minimum date that was requested and retrieved from the
+ * back-end
+ * @param maxDate2
+ * the maximum date that was requested and retrieved from the
+ * back-end
+ */
+ public void adjustRequestedView(long minDateRequested, long maxDateRequested) {
+ if (requestWindow == null) {
+ requestWindow = new TimebandRequestWindow(minDateRequested, maxDateRequested);
+ } else {
+ requestWindow.adjustRange(minDateRequested, maxDateRequested);
+ }
+ }
+
+ /**
+ * Works out how much of the timeband is to be requested Ideally we should
+ * TODO: this somewhere else.
+ *
+ * @return the visible section of the timeband
+ * @throws IncapableOfCalculatingRequestWindowException
+ * thrown if we are not in a position to calculate what the
+ * remaining section is.
+ */
+ public TimeBandVisibleDate getOustandingTimebandPeriod() throws IncapableOfCalculatingRequestWindowException {
+ long minVisibleDate = getMinVisibleDate();
+ long maxVisibleDate = getMaxVisibleDate();
+ long minimumDifference = (long) (unit.getMilliseconds() * outstandingUnitFactor);
+
+ // the new requested bit depends on our request window
+ if (requestWindow == null) {
+ return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
+ } else {
+ // return only the portion that has changed (probably only one pixel
+ // worth)! TODO later: ensure
+ // we send requests when they are actually worth sending
+ // -------|--------$------|-----$--------------------
+ // mvd mrd Mvd Mrd
+ long minReceivedDate = requestWindow.getMinDate();
+ long maxReceivedDate = requestWindow.getMaxDate();
+ boolean shiftedLeft = minVisibleDate < minReceivedDate;
+ boolean shiftedRight = maxVisibleDate > maxReceivedDate;
+
+ if (!shiftedLeft && !shiftedRight) {
+ return TimeBandVisibleDate.getNoRequest();
+ } else if (shiftedLeft && shiftedRight) {
+ // in this case, it was probably a zoom, and so we need to
+ // request both parts
+ return new TimeBandVisibleDate(id, minVisibleDate, maxVisibleDate);
+ } else if (shiftedLeft) {
+ // window could potentially have jumped, so there may be a gap
+ // between maxVisibleDate and min, so take
+ // check for gap first, and then decide
+ // TODO: check here
+ 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: 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) {
+ return new TimeBandVisibleDate(id, minVisibleDate, minReceivedDate);
+ } else {
+ return TimeBandVisibleDate.getNoRequest();
+ }
+ }
+ } else if (shiftedRight) {
+ // same problem as above if
+ if (minVisibleDate > maxReceivedDate) {
+ 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) {
+ return new TimeBandVisibleDate(id, maxReceivedDate, maxVisibleDate);
+ } else {
+ return TimeBandVisibleDate.getNoRequest();
+ }
+ }
+ } else {
+ // TODO: add the proper debug information to the exception
+ throw new IncapableOfCalculatingRequestWindowException("Unable to calculate request window. It was shifted neither left, nor right");
+ }
+ }
+ }
+
+ /**
+ * The way zooming works is that we recalculate the positions of all events
+ * on the timeline
+ */
+ public void zoomOut() {
+ // first change the zoom factor, then repaint events, and the timescale
+ // lets just assume a default zoom factor for now
+ // TODO: zoom in factor to be parameterised
+ zoom(1 - zoomFactor);
+
+ }
+
+ /**
+ * Zooms in
+ */
+ public void zoomIn() {
+ zoom(1 + zoomFactor);
+ }
+
+ /**
+ * Zooms out given a ratio
+ *
+ * @param zoomRatio
+ * the given ratio to zoom in and out
+ */
+ private void zoom(double zoomRatio) {
+ // TODO: somehow start with those events in the window (although for
+ // zoomout, won't make a different
+ // first change the scale
+ pixelsPerUnit *= zoomRatio;
+ adjustUnit();
+ redrawBand();
+ }
+
+ /**
+ * Gets the band to scroll to the current date
+ */
+ public void scrollToCurrentDate() {
+ new El(timebandContainer).setScrollLeft((int) currentDateX);
+ // Log.debug("Scroll left is " + timebandContainer.getScrollLeft());
+ // Log.debug("Scroll left is " + new
+ // El(timebandContainer).getScrollLeft());
+ }
+
+ /**
+ * Resets the timeband and redraws it
+ */
+ public void redrawEmptyBand() {
+ events.clear();
+ redrawBand();
+ }
+
+ /**
+ * Does not delete the events but redraws everything else.
+ */
+ public void redrawBand() {
+ tapeTracks.clear();
+
+ // use El to remove all children
+ new El(bandDiv).removeChildren();
+ resetAllEvents();
+
+ timescale.repaint();
+
+ requestWindow = null;
+
+ drawEvents();
+ }
+
+ /**
+ * Resets the rendered status on all events
+ */
+ private void resetAllEvents() {
+ for (TimeEvent te : events.values()) {
+ te.reset();
+ }
+ }
+
+ /**
+ * @return the showScale
+ */
+ public boolean isShowScale() {
+ return showScale;
+ }
+
+ /**
+ * @param showScale
+ * the showScale to set
+ */
+ public void setShowScale(boolean showScale) {
+ this.showScale = showScale;
+ }
+
+ /**
+ * @return the bandDiv
+ */
+ public Element getBandDiv() {
+ return bandDiv;
+ }
+
+ /**
+ * @param bandDiv
+ * the bandDiv to set
+ */
+ public void setBandDiv(Element bandDiv) {
+ this.bandDiv = bandDiv;
+ }
+
+ /**
+ * @return the pixelsPerUnit
+ */
+ public int getPixelsPerUnit() {
+ return pixelsPerUnit;
+ }
+
+ /**
+ * @param pixelsPerUnit
+ * the pixelsPerUnit to set
+ */
+ public void setPixelsPerUnit(int pixelsPerUnit) {
+ this.pixelsPerUnit = pixelsPerUnit;
+ }
+
+ /**
+ * @return the id
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the minDate
+ */
+ public long getMinDate() {
+ return minDate;
+ }
+
+ /**
+ * @param minDate
+ * the minDate to set
+ */
+ public void setMinDate(long minDate) {
+ this.minDate = minDate;
+ }
+
+ /**
+ * @return the maxDate
+ */
+ public long getMaxDate() {
+ return maxDate;
+ }
+
+ /**
+ * @return the unit
+ */
+ public Unit getUnit() {
+ return unit;
+ }
+
+ /**
+ * @param unit
+ * the unit to set
+ */
+ public void setUnit(Unit unit) {
+ this.unit = unit;
+ }
+
+ /**
+ * @param maxDate
+ * the maxDate to set
+ */
+ public void setMaxDate(long maxDate) {
+ this.maxDate = maxDate;
+ }
+
+ /**
+ * @return the events
+ */
+ public TreeMap<Integer, TimeEvent> getEvents() {
+ return events;
+ }
+
+ 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...
+
+ }
+
+ /**
+ * @return the currentDateX
+ */
+ public long getCurrentDateX() {
+ return currentDateX;
+ }
+
+ /**
+ * @param currentDateX
+ * the currentDateX to set
+ */
+ public void setCurrentDateX(long currentDateX) {
+ this.currentDateX = currentDateX;
+ }
+
+ /**
+ * @return the currentDate
+ */
+ public long getCurrentDate() {
+ return currentDate;
+ }
+
+ /**
+ * @return the deletionsDisabled
+ */
+ public boolean isDeletionsDisabled() {
+ return deletionsDisabled;
+ }
+
+ /**
+ * @param deletionsDisabled
+ * the deletionsDisabled to set
+ */
+ public void setDeletionsDisabled(boolean deletionsDisabled) {
+ this.deletionsDisabled = deletionsDisabled;
+ }
+
+ /**
+ * @param outstandingUnitFactor
+ * the outstandingUnitFactor to set
+ */
+ public void setOutstandingUnitFactor(double outstandingUnitFactor) {
+ this.outstandingUnitFactor = outstandingUnitFactor;
+ }
+
+ /**
+ * @return the outstandingUnitFactor
+ */
+ public double getOutstandingUnitFactor() {
+ return outstandingUnitFactor;
+ }
+
+ public boolean isRendered() {
+ return isRendered;
+ }
+
+ /**
+ * 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() {
+ return zoomFactor;
+ }
+
+ /**
+ * @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;
+ }
+
+ public int getSizeTapeTracks() {
+ return tapeTracks.size();
+ }
+}
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-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/Timeline.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -23,6 +23,7 @@
import com.tyndalehouse.step.web.client.toolkit.timeline.events.TimelineMouseHandler;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.IncapableOfCalculatingRequestWindowException;
import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.TimeBandNotFoundException;
+import com.tyndalehouse.step.web.client.toolkit.timeline.exceptions.UnknownFiredElement;
import com.tyndalehouse.step.web.shared.beans.TimeBandVisibleDate;
/**
@@ -34,7 +35,7 @@
*
*/
public class Timeline extends Widget {
- private List<TimeBand> timebands;
+ private List<Timeband> timebands;
private boolean isHorizontal;
private int width;
private int height;
@@ -48,7 +49,7 @@
public Timeline(EventBus eventBus) {
this.eventBus = eventBus;
- timebands = new ArrayList<TimeBand>();
+ timebands = new ArrayList<Timeband>();
timelineContainer = DOM.createDiv();
timelineContainer.setClassName("step-timeline-container");
@@ -93,7 +94,7 @@
//find out if moved over event:
//Log.debug("Scanning " + timebands.size() + " timebands");
- for(TimeBand band : timebands) {
+ for(Timeband band : timebands) {
//Log.debug("Scanning " + band.getEvents().size());
for(TimeEvent te : band.getEvents().values()) {
if(te.getEventDiv().isOrHasChild(targetElement)) {
@@ -112,12 +113,32 @@
handleMouseOverTimeEvent(e);
}
+ public Timeband getFiredBand(MouseMoveEvent e) throws UnknownFiredElement {
+ EventTarget et = e.getNativeEvent().getEventTarget();
+ Element targetElement = et.cast();
+
+ for(Timeband b : timebands) {
+ if(b.getBandDiv().isOrHasChild(targetElement)) {
+ return b;
+ }
+ }
+
+ throw new UnknownFiredElement();
+ }
+
public void handle(MouseMoveEvent e) {
if(timebands.size() != 0) {
// TODO: customize as a property?
- TimeBand defaultTimeBand = timebands.get(0);
- Unit defaultUnit = defaultTimeBand.getUnit();
- int defaultPixelsPerUnit = defaultTimeBand.getPixelsPerUnit();
+ Timeband firedBand;
+ try {
+ firedBand = getFiredBand(e);
+ } catch (UnknownFiredElement e1) {
+ Log.debug("Unknown element was fired");
+ firedBand = timebands.get(0);
+ }
+
+ Unit unit = firedBand.getUnit();
+ int pixelsPerUnit = firedBand.getPixelsPerUnit();
if (downStatus) {
// mouse is down so move the scroll bars on each timeband
@@ -128,8 +149,8 @@
// allow service layer to update
// the events shown if necessary on each timeband
- for (TimeBand tb : timebands) {
- tb.setScrollLeft(clientX, e.getClientX(), defaultUnit, defaultPixelsPerUnit);
+ for (Timeband tb : timebands) {
+ tb.setScrollLeft(clientX, e.getClientX(), unit, pixelsPerUnit);
//Log.debug("About to scroll: " + (clientX - e.getClientX()));
}
@@ -157,13 +178,14 @@
//calculate only those bits that need requesting! but at the same time
//we don't need to wait for the server to redraw timebands
- for (TimeBand tb : timebands) {
+ for (Timeband tb : timebands) {
try {
tb.paint(); //the timeband is rendered, and there are no new events,
//so apart from looping through the events which are already rendered
//we are only repainting the timescale
TimeBandVisibleDate tvd = tb.getOustandingTimebandPeriod();
+ //Log.debug("firing scroll " + tb.getDescription() + " " + tvd.getMinDate() + "," + tvd.getMaxDate());
if(!tvd.isNoRequest()) {
tse.addTimebandVisibleDate(tvd);
} else {
@@ -192,7 +214,7 @@
clientX = e.getClientX();
// capture scrollLeft on every timeband
- for (TimeBand tb : timebands) {
+ for (Timeband tb : timebands) {
tb.captureScrollLeft(e);
}
@@ -212,7 +234,7 @@
timelineDiv.appendChild(timelineContainer);
int relativeTop = 0;
- for (TimeBand tb : timebands) {
+ for (Timeband tb : timebands) {
tb.paint();
relativeTop += tb.getSizeTapeTracks() * TimelineConstants.TAPE_TRACK_HEIGHT;
}
@@ -224,7 +246,7 @@
}
}
- public synchronized void addBand(TimeBand band) {
+ public synchronized void addBand(Timeband band) {
timebands.add(band);
band.paint();
}
@@ -233,9 +255,9 @@
timebands.remove(bandId);
}
- public TimeBand getBand(final int bandId) throws TimeBandNotFoundException {
+ public Timeband getBand(final int bandId) throws TimeBandNotFoundException {
// do a linear search - we're not going to have lots of timebands
- for (TimeBand t : timebands) {
+ for (Timeband t : timebands) {
if (t.getId() == bandId) {
return t;
}
@@ -304,7 +326,7 @@
* Zooming is done on a band level, so delegate to timebands
*/
public void zoomIn() {
- for(TimeBand tb : timebands) {
+ for(Timeband tb : timebands) {
tb.zoomIn();
}
}
@@ -313,14 +335,14 @@
* Zooming is done on a band level, so delegate to timebands
*/
public void zoomOut() {
- for(TimeBand tb : timebands) {
+ for(Timeband tb : timebands) {
tb.zoomOut();
}
}
public void repaint(Long originDate) {
//remove all the timebands from the timeline widget
- for(TimeBand band : timebands) {
+ 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);
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Unit.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Unit.java 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/components/Unit.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -11,8 +11,8 @@
YEAR(365L * 24 * 3600 * 1000L, "yyyy G"),
DECADE(10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
CENTURY(10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G"),
- MILENIUM(10L * 10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G");
-
+ MILLENIUM(10L * 10L * 10L * 365L * 24 * 3600 * 1000L, "yyyy G");
+
private final long milliseconds;
private final DateTimeFormat format;
Added: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java (rev 0)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/exceptions/UnknownFiredElement.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -0,0 +1,10 @@
+package com.tyndalehouse.step.web.client.toolkit.timeline.exceptions;
+
+public class UnknownFiredElement extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -726869406002130223L;
+
+}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/client/toolkit/timeline/helpers/TimeConversionUtil.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -3,7 +3,7 @@
import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
-import com.tyndalehouse.step.web.client.toolkit.timeline.TimeBand;
+import com.tyndalehouse.step.web.client.toolkit.timeline.Timeband;
import com.tyndalehouse.step.web.client.toolkit.timeline.components.Unit;
public class TimeConversionUtil {
@@ -19,7 +19,7 @@
* @param pixelsPerUnit the number of pixels per unit
* @return the time of pixelPosition
*/
- public static long pixelToTime(long pixelPosition, TimeBand timeband) {
+ public static long pixelToTime(long pixelPosition, Timeband timeband) {
long currentDateX = timeband.getCurrentDateX();
long currentDate = timeband.getCurrentDate();
Unit unit = timeband.getUnit();
@@ -37,7 +37,7 @@
* @param timeband
* @return
*/
- public static int timeToPixel(final long eventDate, TimeBand currentTimeband) {
+ public static int timeToPixel(final long eventDate, Timeband currentTimeband) {
// here's what we start from
long millisecondPerUnit = currentTimeband.getUnit().getMilliseconds();
long pixelsPerUnit = currentTimeband.getPixelsPerUnit();
@@ -53,7 +53,7 @@
return (int) pixelValueOnBand;
}
- public static String formatPixelToTime(final long pixelPosition, TimeBand timeband) {
+ public static String formatPixelToTime(final long pixelPosition, Timeband timeband) {
return formatTime(pixelToTime(pixelPosition, timeband));
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineOriginForScriptureHandler.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -56,6 +56,9 @@
VerseRange range = passage.getRangeAt(0, RestrictionType.NONE);
int startVerseNo = range.getStart().getOrdinal();
int endVerseNo = range.getEnd().getOrdinal();
+
+ //probably at the same time, we want to figure out if any events are an importance
+ //band, and if so return the recommended unit
StringBuilder sql = new StringBuilder();
sql.append("select avg(ev.from_date) as ORIGIN from step.scripture_reference sr, step.event ev ");
@@ -65,7 +68,7 @@
sql.append("or (? < start_verse_id and ? > start_verse_id) "); //-- the query start is before the event start, but the end is after the event start
sql.append("or (? > end_verse_id and ? < end_verse_id)) "); //-- the end of the range is greater than event end, but the start is before the end
sql.append("and sr.TARGET_ID = ev.EVENT_ID");
-
+
//TODO: move all the prepared statements somewhere else so that
PreparedStatement ps = conn.prepareStatement(sql.toString());
int argPosition = 1;
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/server/handler/GetTimelineUISetupHandler.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -40,16 +40,14 @@
//TODO: remove all prepared statements and ensure they are made into
//singletons
- String sqlStatement = "select t.timeband_id, t.timeband_description, t.timeband_code, " +
- "min(e.FROM_DATE) as min_from_date, max(TO_DATE) as max_to_date, count(event_id) as event_count " +
- "from step.timeband t, step.event e " +
- "where t.timeband_id = e.timeband_id " +
- "group by t.timeband_id, t.timeband_description, t.timeband_code ";
+ String sqlStatement = "select t.timeband_id, t.timeband_description, t.timeband_code, t.timeband_unit " +
+ "from step.timeband t";
PreparedStatement ps = conn.prepareStatement(sqlStatement);
ResultSet rs = ps.executeQuery();
- //TODO: do we need to sort those somehow?
+ //TODO: do we need to sort those somehow? probably according
+ //to how they should show on screen
List<TimelineBean> timelines = new ArrayList<TimelineBean>();
//review this: perhaps we don't need to send all of this to the UI
@@ -58,9 +56,10 @@
rs.getInt("timeband_id"),
rs.getString("timeband_description"),
rs.getString("timeband_code"));
- tb.setMinDate(rs.getLong("min_from_date"));
- tb.setMaxDate(rs.getLong("max_to_date"));
- tb.setEventCount(rs.getInt("event_count"));
+ tb.setUnit(rs.getString("timeband_unit"));
+// tb.setMinDate(rs.getLong("min_from_date"));
+// tb.setMaxDate(rs.getLong("max_to_date"));
+// tb.setEventCount(rs.getInt("event_count"));
timelines.add(tb);
}
Modified: trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineBean.java
===================================================================
--- trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineBean.java 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/java/com/tyndalehouse/step/web/shared/beans/TimelineBean.java 2010-01-09 16:52:42 UTC (rev 70)
@@ -28,11 +28,9 @@
}
private String timelineDescription;
+ private String unit;
// private String timelineCode;
- private long minDate;
- private long maxDate;
- private int eventCount;
public TimelineBean() {
@@ -59,51 +57,63 @@
return timelineDescription;
}
- /**
- * @return the minDate
- */
- public long getMinDate() {
- return minDate;
+ public void setUnit(String unit) {
+ this.unit = unit;
+
}
/**
- * @param minDate the minDate to set
+ * @return the unit
*/
- public void setMinDate(long minDate) {
- this.minDate = minDate;
+ public String getUnit() {
+ return unit;
}
- /**
- * @return the maxDate
- */
- public long getMaxDate() {
- return maxDate;
- }
+// /**
+// * @return the minDate
+// */
+// public long getMinDate() {
+// return minDate;
+// }
+//
+// /**
+// * @param minDate the minDate to set
+// */
+// public void setMinDate(long minDate) {
+// this.minDate = minDate;
+// }
+//
+// /**
+// * @return the maxDate
+// */
+// public long getMaxDate() {
+// return maxDate;
+// }
+//
+// /**
+// * @param maxDate the maxDate to set
+// */
+// public void setMaxDate(long maxDate) {
+// this.maxDate = maxDate;
+// }
- /**
- * @param maxDate the maxDate to set
- */
- public void setMaxDate(long maxDate) {
- this.maxDate = maxDate;
- }
-
// /**
// * @return the timelineCode
// */
// public String getTimelineCode() {
// return timelineCode;
// }
-
- public void setEventCount(int eventCount) {
- this.eventCount = eventCount;
- }
-
- /**
- * @return the eventCount
- */
- public int getEventCount() {
- return eventCount;
- }
+//
+// public void setEventCount(int eventCount) {
+// this.eventCount = eventCount;
+// }
+//
+// /**
+// * @return the eventCount
+// */
+// public int getEventCount() {
+// return eventCount;
+// }
}
Modified: trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/config/environment.properties
===================================================================
--- trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/config/environment.properties 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/src/main/resources/com/tyndalehouse/step/web/server/config/environment.properties 2010-01-09 16:52:42 UTC (rev 70)
@@ -1,2 +1,4 @@
+#db.driver=org.apache.derby.jdbc.ClientDriver
+#connection.string=jdbc:derby://localhost:1999/d:\\STEPSVN\\step-web-app\\war\\StepDB
db.driver=org.apache.derby.jdbc.ClientDriver
connection.string=jdbc:derby://localhost:1999/d:\\STEPSVN\\step-web-app\\war\\StepDB
Modified: trunk/step-web-app/war/css/step.css
===================================================================
--- trunk/step-web-app/war/css/step.css 2009-12-29 19:43:58 UTC (rev 69)
+++ trunk/step-web-app/war/css/step.css 2010-01-09 16:52:42 UTC (rev 70)
@@ -7,7 +7,7 @@
****************************************************************************/
.step-timeline {
clear:both;
- border: 1px solid green;
+ /* border: 1px solid green; */
font-size: 10px;
font-family: Tahoma;
@@ -23,7 +23,7 @@
.step-timeband-container {
width: 100%;
- background-color: transparent;
+ background-color: AliceBlue;
overflow: hidden;
position: relative;
/* border: 1px solid red; */
@@ -33,19 +33,21 @@
.step-timeband {
width: 64000px;
clear:both;
- border: 1px solid gold;
+ border: 1px solid darkgrey;
+ border-top: 2px solid lightgrey;
background-color: transparent;
position: absolute;
display: list-item;
list-style-type: none;
z-index: 100;
+
/* height: 100%; */
}
.step-timeband-label {
position: absolute;
left: 0px;
- bottom: 0px;
+ bottom: 0px;
}
@@ -96,7 +98,8 @@
.step-time-duration-label {
display: inline;
- margin-top: 5px;
+ margin-top: 5px;
+ padding-top:4px;
}
.step-scale-band div {
@@ -128,7 +131,7 @@
height: 20px; /* TODO: to shove in properties file if they are possible? */
width: 100%;
position: relative;
- border-bottom: 1px solid red;
+ /* border-bottom: 1px solid red; DEBUG */
z-index: 110;
}
More information about the Tynstep-svn
mailing list