aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-10-16 14:43:41 +0000
committerMarc Englund <marc.englund@itmill.com>2007-10-16 14:43:41 +0000
commit810de1f5969aef286f541743aa9ffdee5f5aa580 (patch)
treeedd30cb482d114c4e5087b5c8793eb046c46a339
parent46f9a1578f1ef73dc03be9160b52885d95532689 (diff)
downloadvaadin-framework-810de1f5969aef286f541743aa9ffdee5f5aa580.tar.gz
vaadin-framework-810de1f5969aef286f541743aa9ffdee5f5aa580.zip
Generate reservations, styles
svn changeset:2529/svn branch:trunk
-rw-r--r--WebContent/ITMILL/themes/reservr/styles.css2
-rw-r--r--src/com/itmill/toolkit/demo/reservation/ReservationApplication.java7
-rw-r--r--src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java1
-rw-r--r--src/com/itmill/toolkit/demo/reservation/SampleDB.java43
4 files changed, 51 insertions, 2 deletions
diff --git a/WebContent/ITMILL/themes/reservr/styles.css b/WebContent/ITMILL/themes/reservr/styles.css
index a2b059a765..6bf615f486 100644
--- a/WebContent/ITMILL/themes/reservr/styles.css
+++ b/WebContent/ITMILL/themes/reservr/styles.css
@@ -64,7 +64,7 @@ textarea.i-textfield {
background: none;
font-weight: bold;
}
-.i-button-selected-link {
+#itmtk-ajax-window .i-button-selected-link {
border: 0px;
text-align: left;
text-decoration: none;
diff --git a/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java b/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
index 112d47a46d..5e6f57abd3 100644
--- a/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
+++ b/src/com/itmill/toolkit/demo/reservation/ReservationApplication.java
@@ -50,12 +50,14 @@ public class ReservationApplication extends Application {
db = new SampleDB(true);
db.generateResources();
db.generateDemoUser();
+ db.generateReservations();
Window mainWindow = new Window("Reservr");
setMainWindow(mainWindow);
setTheme("reservr");
TabSheet mainTabs = new TabSheet();
+ mainTabs.addStyleName(TabSheet.STYLE_NO_PADDING);
mainWindow.addComponent(mainTabs);
OrderedLayout reservationTab = new OrderedLayout();
@@ -70,6 +72,7 @@ public class ReservationApplication extends Application {
Panel reservationPanel = new Panel("Reservation", new OrderedLayout(
OrderedLayout.ORIENTATION_HORIZONTAL));
+ reservationPanel.setStyle("light");
reservationTab.addComponent(reservationPanel);
OrderedLayout infoLayout = new OrderedLayout();
@@ -109,7 +112,8 @@ public class ReservationApplication extends Application {
initCalendarFieldPropertyIds(reservedFrom);
reservationPanel.addComponent(reservedFrom);
- Label arrowLabel = new Label("»");
+ Label arrowLabel = new Label("&raquo;");
+ arrowLabel.setContentMode(Label.CONTENT_XHTML);
arrowLabel.setStyle("arrow");
reservationPanel.addComponent(arrowLabel);
@@ -166,6 +170,7 @@ public class ReservationApplication extends Application {
initCalendarFieldPropertyIds(allCalendar);
allLayout.addComponent(allCalendar);
allTable = new Table();
+ allTable.setWidth(700);
allTable.setColumnCollapsingAllowed(true);
allTable.setColumnReorderingAllowed(true);
allLayout.addComponent(allTable);
diff --git a/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java b/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java
index 8593336b42..69da622ef4 100644
--- a/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java
+++ b/src/com/itmill/toolkit/demo/reservation/ResourceSelectorPanel.java
@@ -22,6 +22,7 @@ public class ResourceSelectorPanel extends Panel implements
public ResourceSelectorPanel(String caption) {
super(caption, new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
+ setStyle("light");
}
public void setResourceContainer(Container resources) {
diff --git a/src/com/itmill/toolkit/demo/reservation/SampleDB.java b/src/com/itmill/toolkit/demo/reservation/SampleDB.java
index cffebc5d71..7f2225eee1 100644
--- a/src/com/itmill/toolkit/demo/reservation/SampleDB.java
+++ b/src/com/itmill/toolkit/demo/reservation/SampleDB.java
@@ -6,6 +6,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -373,6 +375,47 @@ public class SampleDB {
}
}
+ public void generateReservations() {
+ int days = 10;
+ String descriptions[] = {
+ "Picking up guests from airport",
+ "Sightseeing with the guests",
+ "Moving new servers from A to B",
+ "Shopping",
+ "Customer meeting",
+ "Guests arriving at harbour",
+ "Moving furniture",
+ "Taking guests to see town"
+ };
+ Container cat = getCategories();
+ Collection cIds = cat.getItemIds();
+ for (Iterator it = cIds.iterator(); it.hasNext();) {
+ Object id = it.next();
+ Item ci = cat.getItem(id);
+ String c = (String)ci.getItemProperty(Resource.PROPERTY_ID_CATEGORY).getValue();
+ Container resources = getResources(c);
+ Collection rIds = resources.getItemIds();
+ Calendar cal = Calendar.getInstance();
+ //cal.add(Calendar.DAY_OF_MONTH, -days);
+ for (int i = 0;i<days;i++) {
+ for (Iterator rit = rIds.iterator();rit.hasNext();) {
+ Object rid = rit.next();
+ Item resource = resources.getItem(rid);
+ int s = 6+(int)Math.round(Math.random() * 10.0);
+ int e = s + (int)Math.round(Math.random() * 4.0);
+ Date start = new Date(cal.getTimeInMillis());
+ start.setHours(s);
+ Date end = new Date(cal.getTimeInMillis());
+ start.setHours(e);
+ addReservation(resource, 0, start, end, descriptions[(int)Math.floor(Math.random()*descriptions.length)]);
+ break;
+ }
+ cal.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ }
+
+ }
+
public void generateResources() {
Object[][] resources = {