aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-10-15 14:03:20 +0000
committerMarc Englund <marc.englund@itmill.com>2007-10-15 14:03:20 +0000
commit8c965fbb38fce9e2bea5c5a9b097d8f71af77d94 (patch)
tree88956bd4cae3b2aff92bc3618ee8edea78dfcdcc /src
parent54e91c229fb7b346f7d42056e320f837eb25bb28 (diff)
downloadvaadin-framework-8c965fbb38fce9e2bea5c5a9b097d8f71af77d94.tar.gz
vaadin-framework-8c965fbb38fce9e2bea5c5a9b097d8f71af77d94.zip
reservr usability
svn changeset:2516/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/demo/reservation/ReservationApplication.java21
-rw-r--r--src/com/itmill/toolkit/demo/reservation/SampleDB.java16
-rw-r--r--src/com/itmill/toolkit/demo/reservation/gwt/public/reservr/styles.css1
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java22
4 files changed, 40 insertions, 20 deletions
diff --git a/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java b/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
index 3c7ec1a031..112d47a46d 100644
--- a/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
+++ b/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
@@ -78,18 +78,19 @@ public class ReservationApplication extends Application {
resourceName.setCaption("Choose resource");
infoLayout.addComponent(resourceName);
description = new TextField();
- description.setColumns(47);
+ description.setColumns(45);
description.setRows(5);
infoLayout.addComponent(description);
reservationButton = new Button("Make reservation", this,
"makeReservation");
infoLayout.addComponent(reservationButton);
- statusLabel = new Label();
+ statusLabel = new Label("");
+ statusLabel.setCaption("");
infoLayout.addComponent(statusLabel);
map = new GoogleMap();
- map.setWidth(330);
- map.setHeight(270);
+ map.setWidth(325);
+ map.setHeight(210);
map.setItemMarkerHtmlPropertyId(SampleDB.Resource.PROPERTY_ID_NAME);
map.setItemMarkerXPropertyId(SampleDB.Resource.PROPERTY_ID_LOCATIONX);
map.setItemMarkerYPropertyId(SampleDB.Resource.PROPERTY_ID_LOCATIONY);
@@ -101,17 +102,21 @@ public class ReservationApplication extends Application {
from.set(Calendar.MINUTE, 0);
from.set(Calendar.SECOND, 0);
from.set(Calendar.MILLISECOND, 0);
- reservedFrom = new CalendarField("From »");
+ reservedFrom = new CalendarField("From");
reservedFrom.setMinimumDate(from.getTime());
reservedFrom.setValue(from.getTime());
reservedFrom.setImmediate(true);
initCalendarFieldPropertyIds(reservedFrom);
reservationPanel.addComponent(reservedFrom);
+ Label arrowLabel = new Label("»");
+ arrowLabel.setStyle("arrow");
+ reservationPanel.addComponent(arrowLabel);
+
Calendar to = Calendar.getInstance();
to.setTime(from.getTime());
to.add(Calendar.MILLISECOND, (int) DEFAULT_GAP_MILLIS);
- reservedTo = new CalendarField("» To");
+ reservedTo = new CalendarField("To");
reservedTo.setMinimumDate(to.getTime());
reservedTo.setValue(to.getTime());
reservedTo.setImmediate(true);
@@ -294,8 +299,8 @@ public class ReservationApplication extends Application {
}
private void resetStatus() {
- statusLabel.setCaption(null);
- statusLabel.setValue(null);
+ statusLabel.setCaption("");
+ statusLabel.setValue("");
}
public void selectedResourcesChanged(
diff --git a/src/com/itmill/toolkit/demo/reservation/SampleDB.java b/src/com/itmill/toolkit/demo/reservation/SampleDB.java
index 3c617323dd..cffebc5d71 100644
--- a/src/com/itmill/toolkit/demo/reservation/SampleDB.java
+++ b/src/com/itmill/toolkit/demo/reservation/SampleDB.java
@@ -408,18 +408,18 @@ public class SampleDB {
{ "12", "12 Ford Fusion", "Keys from infodesk.",
"Silicon Valley", new Double(37.365028),
new Double(-121.922654) },
- { "13", "13 Ford Mustang", "GT Cal Special. Keys from guard.",
- "Silicon Valley", new Double(37.403812),
- new Double(-121.977425) },
- { "14", "14 Ford Focus", "Keys from guard.",
- "Silicon Valley", new Double(37.403812),
- new Double(-121.977425) },
- { "15", "15 Land Rover", "Keys from infodesk.",
+ { "13", "13 Land Rover", "Keys from infodesk.",
"Silicon Valley", new Double(37.365028),
new Double(-121.922654) },
- { "16", "16 Land Rover", "Keys from infodesk.",
+ { "14", "14 Land Rover", "Keys from infodesk.",
"Silicon Valley", new Double(37.365028),
new Double(-121.922654) },
+ { "15", "15 Ford Mustang", "GT Cal Special. Keys from guard.",
+ "Silicon Valley", new Double(37.403812),
+ new Double(-121.977425) },
+ { "16", "16 Ford Focus", "Keys from guard.",
+ "Silicon Valley", new Double(37.403812),
+ new Double(-121.977425) },
// Paris
{ "17", "17 Peugeot 308", "Keys from infodesk.", "Paris",
new Double(48.844756), new Double(2.372784) },
diff --git a/src/com/itmill/toolkit/demo/reservation/gwt/public/reservr/styles.css b/src/com/itmill/toolkit/demo/reservation/gwt/public/reservr/styles.css
index bde033b103..defaefb0ca 100644
--- a/src/com/itmill/toolkit/demo/reservation/gwt/public/reservr/styles.css
+++ b/src/com/itmill/toolkit/demo/reservation/gwt/public/reservr/styles.css
@@ -3,7 +3,6 @@
/* Entrycalendar styles */
.i-datefield-entrycalendar-hours {
height: auto;
- xoverflow: auto;
}
.i-datefield-entrycalendar-hours table {
width: auto;
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java
index e6a8770d24..8ba19ab790 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java
@@ -78,12 +78,14 @@ public class ICalendar extends IDateField {
}
protected void buildDayView(Date date) {
+ boolean firstRender = true;
if (this.hourPanel == null) {
this.hourPanel = new SimplePanel();
this.hourPanel.setStyleName(CLASSNAME + "-hours");
this.calPanel.getFlexCellFormatter().setColSpan(8, 0, 7);
this.calPanel.setWidget(8, 0, this.hourPanel);
} else {
+ firstRender = false;
this.hourPanel.clear();
}
this.hourTable = new FlexTable();
@@ -142,14 +144,15 @@ public class ICalendar extends IDateField {
}
Element el = this.hourTable.getFlexCellFormatter().getElement(
start, col);
-
+
String tooltip;
if (DateTimeService.isSameDay(entry.getStart(), entry.getEnd())) {
tooltip = (start < 10 ? "0" : "") + start + ":00";
if (this.dts.isTwelveHourClock()) {
String ampm = (start < 12 ? "am" : "pm");
- tooltip = (start <= 12 ? start : start - 12) + ":00 " + ampm;
-
+ tooltip = (start <= 12 ? start : start - 12) + ":00 "
+ + ampm;
+
}
tooltip += " (" + hours + "h) ";
tooltip += entry.getTitle() + "\n ";
@@ -162,8 +165,21 @@ public class ICalendar extends IDateField {
currentCol++;
}
+ // int hour = new Date().getHours()+1; // scroll to current hour
+ int hour = this.date.getHours() + 1; // scroll to selected hour
+ int h1 = (int) this.hourPanel.getOffsetHeight() / 2;
+ int oh = this.hourTable.getOffsetHeight();
+ int h2 = (int) (hour / 24.0 * oh);
+ int scrollTop = (int) h2 - h1;
+ Element el = this.hourPanel.getElement();
+ setScrollTop(el, scrollTop);
+
}
+ private native void setScrollTop(Element el, int scrollTop) /*-{
+ el.scrollTop = scrollTop;
+ }-*/;
+
private class HourTableListener implements TableListener {
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {