]> source.dussan.org Git - vaadin-framework.git/commitdiff
CalendarDemo -> com.itmill.toolkit.demo.reservation (#1016)
authorMarc Englund <marc.englund@itmill.com>
Mon, 22 Oct 2007 15:08:09 +0000 (15:08 +0000)
committerMarc Englund <marc.englund@itmill.com>
Mon, 22 Oct 2007 15:08:09 +0000 (15:08 +0000)
ICalendar bug fixed.

svn changeset:2580/svn branch:trunk

WebContent/WEB-INF/web.xml
src/com/itmill/toolkit/demo/CalendarDemo.java [deleted file]
src/com/itmill/toolkit/demo/reservation/CalendarDemo.java [new file with mode: 0644]
src/com/itmill/toolkit/demo/reservation/CalendarField.java
src/com/itmill/toolkit/terminal/gwt/client/ui/CalendarEntry.java
src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java
src/com/itmill/toolkit/ui/CalendarField.java [deleted file]

index c9dde12e940ebf565d14ad4d28c312fd6469a1a6..5d9601c1ece7cd9b3d2b9cc099443fa937860569 100644 (file)
     </init-param>\r
   </servlet>\r
   \r
+  <servlet>\r
+    <servlet-name>CalendarDemo</servlet-name>\r
+    <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>\r
+    <init-param>\r
+      <param-name>application</param-name>\r
+      <param-value>com.itmill.toolkit.demo.reservation.CalendarDemo</param-value>\r
+    </init-param>\r
+    <init-param>\r
+      <param-name>widgetset</param-name>\r
+      <param-value>com.itmill.toolkit.demo.reservation.gwt.WidgetSet</param-value>\r
+    </init-param>\r
+  </servlet>\r
+  \r
   <servlet>\r
     <servlet-name>SelectDemo</servlet-name>\r
     <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>\r
     </init-param>\r
   </servlet>\r
   \r
-  <servlet>\r
-    <servlet-name>CalendarDemo</servlet-name>\r
-    <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>\r
-    <init-param>\r
-      <param-name>application</param-name>\r
-      <param-value>com.itmill.toolkit.demo.CalendarDemo</param-value>\r
-    </init-param>\r
-  </servlet>\r
-\r
   <servlet>\r
     <servlet-name>TreeFilesystemContainer</servlet-name>\r
     <servlet-class>com.itmill.toolkit.terminal.gwt.server.ApplicationServlet</servlet-class>\r
     <url-pattern>/Reservr/*</url-pattern>\r
   </servlet-mapping>\r
   \r
+  <servlet-mapping>\r
+    <servlet-name>CalendarDemo</servlet-name>\r
+    <url-pattern>/CalendarDemo/*</url-pattern>\r
+  </servlet-mapping>\r
+\r
   <servlet-mapping>\r
     <servlet-name>SelectDemo</servlet-name>\r
     <url-pattern>/SelectDemo/*</url-pattern>\r
     <url-pattern>/QueryContainerDemo/*</url-pattern>\r
   </servlet-mapping>\r
   \r
-  <servlet-mapping>\r
-    <servlet-name>CalendarDemo</servlet-name>\r
-    <url-pattern>/CalendarDemo/*</url-pattern>\r
-  </servlet-mapping>\r
-\r
   <servlet-mapping>\r
     <servlet-name>TreeFilesystemContainer</servlet-name>\r
     <url-pattern>/TreeFilesystemContainer/*</url-pattern>\r
diff --git a/src/com/itmill/toolkit/demo/CalendarDemo.java b/src/com/itmill/toolkit/demo/CalendarDemo.java
deleted file mode 100644 (file)
index 49b3fb7..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.itmill.toolkit.demo;
-
-import java.sql.SQLException;
-import java.util.Date;
-
-import com.itmill.toolkit.data.Property.ValueChangeEvent;
-import com.itmill.toolkit.data.Property.ValueChangeListener;
-import com.itmill.toolkit.data.util.QueryContainer;
-import com.itmill.toolkit.demo.reservation.CalendarField;
-import com.itmill.toolkit.demo.util.SampleCalendarDatabase;
-import com.itmill.toolkit.ui.OrderedLayout;
-import com.itmill.toolkit.ui.Window;
-
-/**
- * This example shows how the CalendarField can use Containers. A QueryContainer
- * is used to bind SQL table rows to the calendar. Demonstrates: how to create
- * <code>com.itmill.toolkit.data.Container</code> and set it as datasource for
- * <code>com.itmill.toolkit.ui.Component.CalendarField</code>
- * 
- * @author IT Mill Ltd.
- * @since 4.0.0
- * 
- */
-public class CalendarDemo extends com.itmill.toolkit.Application {
-
-       // Database provided with sample data
-       private SampleCalendarDatabase sampleDatabase;
-
-       // The calendar UI component
-       private CalendarField from;
-       private CalendarField to;
-
-       /**
-        * Initialize Application. Demo components are added to main window.
-        */
-       public void init() {
-               Window main = new Window("Calendar demo");
-               setMainWindow(main);
-
-               main.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
-
-               // create the calendar component and add to layout
-               from = new CalendarField();
-               main.addComponent(from);
-               from.setResolution(CalendarField.RESOLUTION_HOUR);
-               from.setImmediate(true);
-
-               to = new CalendarField();
-               main.addComponent(to);
-               to.setResolution(CalendarField.RESOLUTION_HOUR);
-               to.setEnabled(false);
-               to.setImmediate(true);
-
-               from.addListener(new ValueChangeListener() {
-                       public void valueChange(ValueChangeEvent event) {
-                               Date fd = (Date) from.getValue();
-                               Date td = (Date) to.getValue();
-                               if (fd == null) {
-                                       to.setValue(null);
-                                       to.setEnabled(false);
-                                       return;
-                               } else {
-                                       to.setEnabled(true);
-                               }
-                               to.setMinimumDate(fd);
-                               if (td == null || td.before(fd)) {
-                                       to.setValue(fd);
-                               }
-                       }
-               });
-
-               // initialize the sample database and set as calendar datasource
-               sampleDatabase = new SampleCalendarDatabase();
-               initCalendars();
-
-               // Don't allow dates before today
-               from.setMinimumDate(new Date());
-
-       }
-
-       /**
-        * Populates table component with all rows from calendar table.
-        */
-       private void initCalendars() {
-               try {
-                       QueryContainer qc = new QueryContainer("SELECT * FROM "
-                                       + SampleCalendarDatabase.DB_TABLE_NAME, sampleDatabase
-                                       .getConnection());
-                       from.setContainerDataSource(qc);
-                       to.setContainerDataSource(qc);
-               } catch (SQLException e) {
-                       e.printStackTrace();
-               }
-
-               // Calendar will use the first date property as start if you do not
-               // explicitly specify the property id. Our start -property will be the
-               // first one, so it's intentionally left out.
-               // Start is the only mandatory property, but you'll probably want to
-               // specify title as well.
-               from.setItemEndPropertyId(SampleCalendarDatabase.PROPERTY_ID_END);
-               from.setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
-               from.setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
-
-               to.setItemEndPropertyId(SampleCalendarDatabase.PROPERTY_ID_END);
-               to.setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
-               to.setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
-
-       }
-
-}
diff --git a/src/com/itmill/toolkit/demo/reservation/CalendarDemo.java b/src/com/itmill/toolkit/demo/reservation/CalendarDemo.java
new file mode 100644 (file)
index 0000000..413e5a3
--- /dev/null
@@ -0,0 +1,112 @@
+package com.itmill.toolkit.demo.reservation;
+
+import java.sql.SQLException;
+import java.util.Calendar;
+import java.util.Date;
+
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.data.Property.ValueChangeListener;
+import com.itmill.toolkit.data.util.QueryContainer;
+import com.itmill.toolkit.demo.util.SampleCalendarDatabase;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Window;
+
+/**
+ * This example shows how the CalendarField can use Containers. A QueryContainer
+ * is used to bind SQL table rows to the calendar. Demonstrates: how to create
+ * <code>com.itmill.toolkit.data.Container</code> and set it as datasource for
+ * <code>com.itmill.toolkit.ui.Component.CalendarField</code>
+ * 
+ * @author IT Mill Ltd.
+ * @since 4.0.0
+ * 
+ */
+public class CalendarDemo extends com.itmill.toolkit.Application {
+
+       // Database provided with sample data
+       private SampleCalendarDatabase sampleDatabase;
+
+       // The calendar UI component
+       private CalendarField from;
+       private CalendarField to;
+
+       /**
+        * Initialize Application. Demo components are added to main window.
+        */
+       public void init() {
+               Window main = new Window("Calendar demo");
+               setMainWindow(main);
+
+               main.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
+
+               // create the calendar component and add to layout
+               from = new CalendarField();
+               main.addComponent(from);
+               from.setResolution(CalendarField.RESOLUTION_HOUR);
+               from.setImmediate(true);
+
+               
+               to = new CalendarField();
+               main.addComponent(to);
+               to.setResolution(CalendarField.RESOLUTION_HOUR);
+               to.setEnabled(false);
+               to.setImmediate(true);
+               
+               from.addListener(new ValueChangeListener() {
+                       public void valueChange(ValueChangeEvent event) {
+                               Date fd = (Date) from.getValue();
+                               Date td = (Date) to.getValue();
+                               if (fd == null) {
+                                       to.setValue(null);
+                                       to.setEnabled(false);
+                                       return;
+                               } else {
+                                       to.setEnabled(true);
+                               }
+                               to.setMinimumDate(fd);
+                               if (td == null || td.before(fd)) {
+                                       to.setValue(fd);
+                               }
+                       }
+               });
+               
+               // initialize the sample database and set as calendar datasource
+               sampleDatabase = new SampleCalendarDatabase();
+               
+               initCalendars();
+               
+               // Don't allow dates before today
+               from.setMinimumDate(Calendar.getInstance().getTime());
+
+       }
+
+       /**
+        * Populates table component with all rows from calendar table.
+        */
+       private void initCalendars() {
+               try {
+                       QueryContainer qc = new QueryContainer("SELECT * FROM "
+                                       + SampleCalendarDatabase.DB_TABLE_NAME, sampleDatabase
+                                       .getConnection());
+                       from.setContainerDataSource(qc);
+                       to.setContainerDataSource(qc);
+               } catch (SQLException e) {
+                       e.printStackTrace();
+               }
+/*
+               // Calendar will use the first date property as start if you do not
+               // explicitly specify the property id. Our start -property will be the
+               // first one, so it's intentionally left out.
+               // Start is the only mandatory property, but you'll probably want to
+               // specify title as well.
+               from.setItemEndPropertyId(SampleCalendarDatabase.PROPERTY_ID_END);
+               from.setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
+               from.setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
+
+               to.setItemEndPropertyId(SampleCalendarDatabase.PROPERTY_ID_END);
+               to.setItemTitlePropertyId(SampleCalendarDatabase.PROPERTY_ID_TITLE);
+               to.setItemNotimePropertyId(SampleCalendarDatabase.PROPERTY_ID_NOTIME);
+*/
+       }
+
+}
index 0dd0c4d94b18dfc516b76d7a5010789187a4dda0..a0c217e443b04222483a6b7be841af752547f0ae 100644 (file)
@@ -242,7 +242,7 @@ public class CalendarField extends DateField implements Container.Viewer {
                if (this.dataSource != null) {\r
                        target.startTag("items");\r
 \r
-                       // send one month now, the rest via lazyloading\r
+                       // TODO send one month now, the rest via lazyloading\r
                        int month = new Date().getMonth();\r
                        Object value = getValue();\r
                        if (value != null && value instanceof Date) {\r
@@ -268,14 +268,19 @@ public class CalendarField extends DateField implements Container.Viewer {
                                        }\r
                                }\r
 \r
+                               // TODO half-done lazyloading logic (hence broken)\r
+\r
                                if (start != null) {\r
                                        if ((start.getMonth() <= month || end.getMonth() >= month)) {\r
                                                target.startTag("item");\r
                                                // TODO different id?\r
                                                target.addAttribute("id", itemId.hashCode());\r
-                                               p = item.getItemProperty(this.itemStyleNamePropertyId);\r
-                                               String styleName = (String) p.getValue();\r
-                                               target.addAttribute("styleName", styleName);\r
+                                               if (this.itemStyleNamePropertyId != null) {\r
+                                                       p = item\r
+                                                                       .getItemProperty(this.itemStyleNamePropertyId);\r
+                                                       String styleName = (String) p.getValue();\r
+                                                       target.addAttribute("styleName", styleName);\r
+                                               }\r
                                                target.addAttribute("start", "" + start.getTime());\r
                                                if (end != start) {\r
                                                        target.addAttribute("end", "" + end.getTime());\r
index cebdee2b715fa437d5b5b573af114b0a4868588a..075f68cbf6e803330b6a77d09393271a0ef46b0b 100644 (file)
@@ -113,7 +113,9 @@ public class CalendarEntry {
                        }\r
                        s += " ";\r
                }\r
-               s += title;\r
+               if (title!=null) {\r
+                       s += title;\r
+               }\r
                return s;\r
        }\r
 \r
index 9afbb2cfbbf2146b13e700c6d438f21eccc26f59..ec429ac4b5aaeeb02db24039b34acb701ee83af1 100644 (file)
@@ -126,13 +126,18 @@ public class ICalendar extends IDateField {
                                d = entry.getEnd();\r
                                hours = (d.getDate() > date.getDate() ? 24 : d.getHours())\r
                                                - start;\r
+                               if (hours == 0) {\r
+                                       // We can't draw entries smaller than one\r
+                                       hours = 1;\r
+                               }\r
                        }\r
                        int col = currentCol;\r
                        if (col > 1) {\r
                                while (!this.hourTable.isCellPresent(start, col - 1))\r
                                        col--;\r
                        }\r
-                       this.hourTable.setHTML(start, col, "<span>" + entry.getTitle()\r
+                       this.hourTable.setHTML(start, col, "<span>"\r
+                                       + (entry.getTitle() != null ? entry.getTitle() : "&nbsp")\r
                                        + "</span>");\r
                        this.hourTable.getFlexCellFormatter().setRowSpan(start, col, hours);\r
                        this.hourTable.getFlexCellFormatter().setStyleName(start, col,\r
@@ -155,11 +160,15 @@ public class ICalendar extends IDateField {
 \r
                                }\r
                                tooltip += " (" + hours + "h) ";\r
-                               tooltip += entry.getTitle() + "\n ";\r
+                               if (entry.getTitle()!=null) {\r
+                                       tooltip += entry.getTitle() + "\n ";\r
+                               }\r
                        } else {\r
                                tooltip = entry.getStringForDate(entry.getEnd()) + "\n ";\r
                        }\r
-                       tooltip += "\"" + entry.getDescription() + "\"";\r
+                       if (entry.getDescription()!=null) {\r
+                               tooltip += "\"" + entry.getDescription() + "\"";\r
+                       }\r
                        DOM.setElementProperty(el, "title", tooltip);\r
 \r
                        currentCol++;\r
@@ -201,7 +210,12 @@ public class ICalendar extends IDateField {
                        Integer id = new Integer(item.getIntAttribute("id"));\r
                        long start = Long.parseLong(item.getStringAttribute("start"));\r
                        Date startDate = new Date(start);\r
-                       long end = Long.parseLong(item.getStringAttribute("end"));\r
+                       long end = -1;\r
+                       try {\r
+                               end = Long.parseLong(item.getStringAttribute("end"));\r
+                       } catch (Exception IGNORED) {\r
+                               // IGNORED attribute not required\r
+                       }\r
                        Date endDate = (end > 0 && end != start ? new Date(end) : new Date(\r
                                        start));\r
                        String title = item.getStringAttribute("title");\r
@@ -211,7 +225,7 @@ public class ICalendar extends IDateField {
                                        endDate, title, desc, notime);\r
 \r
                        // TODO should remove+readd if the same entry (id) is added again\r
-                       \r
+\r
                        for (Date d = entry.getStart(); d.getYear() <= entry.getEnd()\r
                                        .getYear()\r
                                        && d.getMonth() <= entry.getEnd().getYear()\r
@@ -228,8 +242,8 @@ public class ICalendar extends IDateField {
                }\r
 \r
                public List getEntries(Date date, int resolution) {\r
-                       List entries = (List) dates.get(date.getYear() + "" + date.getMonth() + ""\r
-                                       + date.getDate());\r
+                       List entries = (List) dates.get(date.getYear() + ""\r
+                                       + date.getMonth() + "" + date.getDate());\r
                        ArrayList res = new ArrayList();\r
                        if (entries == null) {\r
                                return res;\r
diff --git a/src/com/itmill/toolkit/ui/CalendarField.java b/src/com/itmill/toolkit/ui/CalendarField.java
deleted file mode 100644 (file)
index 67e82ea..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-package com.itmill.toolkit.ui;\r
-\r
-import java.util.Collection;\r
-import java.util.Date;\r
-import java.util.Iterator;\r
-\r
-import com.itmill.toolkit.data.Container;\r
-import com.itmill.toolkit.data.Item;\r
-import com.itmill.toolkit.data.Property;\r
-import com.itmill.toolkit.terminal.PaintException;\r
-import com.itmill.toolkit.terminal.PaintTarget;\r
-\r
-// TODO use Calendar\r
-// TODO lazyLoading\r
-// TODO check date limit when updating variables\r
-// TODO Allow item selection\r
-public class CalendarField extends DateField implements Container.Viewer {\r
-\r
-       private Date minDate;\r
-       private Date maxDate;\r
-\r
-       private Container dataSource;\r
-       private Object itemStyleNamePropertyId;\r
-       private Object itemStartPropertyId;\r
-       private Object itemEndPropertyId;\r
-       private Object itemTitlePropertyId;\r
-       private Object itemDescriptionPropertyId;\r
-       private Object itemNotimePropertyId;\r
-\r
-       public CalendarField() {\r
-               super();\r
-               init();\r
-       }\r
-\r
-       public CalendarField(Property dataSource) throws IllegalArgumentException {\r
-               super(dataSource);\r
-               init();\r
-       }\r
-\r
-       public CalendarField(String caption, Date value) {\r
-               super(caption, value);\r
-               init();\r
-       }\r
-\r
-       public CalendarField(String caption, Property dataSource) {\r
-               super(caption, dataSource);\r
-               init();\r
-       }\r
-\r
-       public CalendarField(String caption) {\r
-               super(caption);\r
-               init();\r
-       }\r
-\r
-       /*\r
-        * Gets the components UIDL tag string. Don't add a JavaDoc comment here, we\r
-        * use the default documentation from implemented interface.\r
-        */\r
-       public String getTag() {\r
-               return "calendarfield";\r
-       }\r
-\r
-       public void init() {\r
-               super.setResolution(RESOLUTION_HOUR);\r
-\r
-       }\r
-\r
-       /**\r
-        * Sets the resolution of the CalendarField. Only RESOLUTION_DAY and\r
-        * RESOLUTION_HOUR are supported.\r
-        * \r
-        * @param resolution\r
-        *            the resolution to set.\r
-        * @see com.itmill.toolkit.ui.DateField#setResolution(int)\r
-        */\r
-       public void setResolution(int resolution) {\r
-               if (resolution != RESOLUTION_DAY && resolution != RESOLUTION_HOUR) {\r
-                       throw new IllegalArgumentException();\r
-               }\r
-               super.setResolution(resolution);\r
-       }\r
-\r
-       public void setMinimumDate(Date date) {\r
-               this.minDate = date;\r
-               requestRepaint();\r
-       }\r
-\r
-       public Date getMinimumDate() {\r
-               return minDate;\r
-       }\r
-\r
-       public void setMaximumDate(Date date) {\r
-               this.maxDate = date;\r
-               requestRepaint();\r
-       }\r
-\r
-       public Date getMaximumDate() {\r
-               return maxDate;\r
-       }\r
-\r
-       public Container getContainerDataSource() {\r
-               return this.dataSource;\r
-       }\r
-\r
-       public void setContainerDataSource(Container newDataSource) {\r
-               if (newDataSource == null || checkDataSource(newDataSource)) {\r
-                       this.dataSource = newDataSource;\r
-               } else {\r
-                       // TODO error message\r
-                       throw new IllegalArgumentException();\r
-               }\r
-               requestRepaint();\r
-       }\r
-\r
-       private boolean checkDataSource(Container dataSource) {\r
-               /*\r
-                * if (!(dataSource instanceof Container.Sortable)) { // we really want\r
-                * the data source to be sortable return false; }\r
-                */\r
-               // Check old propertyIds\r
-               if (this.itemEndPropertyId != null) {\r
-                       Class c = dataSource.getType(this.itemEndPropertyId);\r
-                       if (!Date.class.isAssignableFrom(c)) {\r
-                               this.itemEndPropertyId = null;\r
-                       }\r
-               }\r
-               if (this.itemNotimePropertyId != null) {\r
-                       Class c = dataSource.getType(this.itemNotimePropertyId);\r
-                       if (!Boolean.class.isAssignableFrom(c)) {\r
-                               this.itemNotimePropertyId = null;\r
-                       }\r
-               }\r
-               if (this.itemStartPropertyId != null) {\r
-                       Class c = dataSource.getType(this.itemStartPropertyId);\r
-                       if (Date.class.isAssignableFrom(c)) {\r
-                               // All we _really_ need is one date\r
-                               return true;\r
-                       } else {\r
-                               this.itemStartPropertyId = null;\r
-                       }\r
-               }\r
-               // We need at least one Date\r
-               Collection ids = dataSource.getContainerPropertyIds();\r
-               for (Iterator it = ids.iterator(); it.hasNext();) {\r
-                       Object id = it.next();\r
-                       Class c = dataSource.getType(id);\r
-                       if (Date.class.isAssignableFrom(c)) {\r
-                               this.itemStartPropertyId = id;\r
-                               return true;\r
-                       }\r
-               }\r
-\r
-               return false;\r
-       }\r
-\r
-       public Object getItemStyleNamePropertyId() {\r
-               return itemStyleNamePropertyId;\r
-       }\r
-\r
-       public void setItemStyleNamePropertyId(Object propertyId) {\r
-               this.itemStyleNamePropertyId = propertyId;\r
-       }\r
-\r
-       public Object getItemStartPropertyId() {\r
-               return itemStartPropertyId;\r
-       }\r
-\r
-       public void setItemStartPropertyId(Object propertyId) {\r
-               // TODO nullcheck for property id\r
-               if (this.dataSource != null\r
-                               && !Date.class.isAssignableFrom(dataSource.getType(propertyId))) {\r
-                       // TODO error message\r
-                       throw new IllegalArgumentException();\r
-               }\r
-               this.itemStartPropertyId = propertyId;\r
-       }\r
-\r
-       public Object getItemEndPropertyId() {\r
-               return itemEndPropertyId;\r
-       }\r
-\r
-       public void setItemEndPropertyId(Object propertyId) {\r
-               // TODO nullcheck for property id\r
-               if (this.dataSource != null\r
-                               && !Date.class.isAssignableFrom(dataSource.getType(propertyId))) {\r
-                       // TODO error message\r
-                       throw new IllegalArgumentException();\r
-               }\r
-               this.itemEndPropertyId = propertyId;\r
-       }\r
-\r
-       public Object getItemTitlePropertyId() {\r
-               return itemTitlePropertyId;\r
-       }\r
-\r
-       public void setItemTitlePropertyId(Object propertyId) {\r
-               this.itemTitlePropertyId = propertyId;\r
-       }\r
-\r
-       public Object getItemDescriptionPropertyId() {\r
-               return itemDescriptionPropertyId;\r
-       }\r
-\r
-       public void setItemDescriptionPropertyId(Object propertyId) {\r
-               this.itemDescriptionPropertyId = propertyId;\r
-       }\r
-\r
-       public Object getitemNotimePropertyId() {\r
-               return itemNotimePropertyId;\r
-       }\r
-\r
-       public void setItemNotimePropertyId(Object propertyId) {\r
-               // TODO nullcheck for property id\r
-               if (this.dataSource != null\r
-                               && !Boolean.class.isAssignableFrom(dataSource\r
-                                               .getType(propertyId))) {\r
-                       // TODO error message\r
-                       throw new IllegalArgumentException();\r
-               }\r
-               this.itemNotimePropertyId = propertyId;\r
-       }\r
-\r
-       /**\r
-        * Paints the content of this component.\r
-        * \r
-        * @param target\r
-        *            the Paint Event.\r
-        * @throws PaintException\r
-        *             if the paint operation failed.\r
-        */\r
-       public void paintContent(PaintTarget target) throws PaintException {\r
-               super.paintContent(target);\r
-\r
-               if (this.minDate != null) {\r
-                       target.addAttribute("min", String.valueOf(this.minDate.getTime()));\r
-               }\r
-               if (this.maxDate != null) {\r
-                       target.addAttribute("max", String.valueOf(this.maxDate.getTime()));\r
-               }\r
-\r
-               if (this.dataSource != null) {\r
-                       target.startTag("items");\r
-\r
-                       // send one month now, the rest via lazyloading\r
-                       int month = new Date().getMonth();\r
-                       Object value = getValue();\r
-                       if (value != null && value instanceof Date) {\r
-                               month = ((Date) value).getMonth();\r
-                       }\r
-\r
-                       for (Iterator it = this.dataSource.getItemIds().iterator(); it\r
-                                       .hasNext();) {\r
-                               Object itemId = it.next();\r
-                               Item item = (Item) this.dataSource.getItem(itemId);\r
-                               Property p = item.getItemProperty(this.itemStartPropertyId);\r
-                               Date start = (Date) p.getValue();\r
-                               Date end = start; // assume same day\r
-                               if (this.itemEndPropertyId != null) {\r
-                                       p = item.getItemProperty(this.itemEndPropertyId);\r
-                                       end = (Date) p.getValue();\r
-                                       if (end == null) {\r
-                                               end = start;\r
-                                       } else if (end.before(start)) {\r
-                                               Date tmp = start;\r
-                                               start = end;\r
-                                               end = tmp;\r
-                                       }\r
-                               }\r
-\r
-                               if (start != null) {\r
-                                       if ((start.getMonth() <= month || end.getMonth() >= month)) {\r
-                                               target.startTag("item");\r
-                                               // TODO different id?\r
-                                               target.addAttribute("id", itemId.hashCode());\r
-                                               p = item.getItemProperty(this.itemStyleNamePropertyId);\r
-                                               String styleName = (String) p.getValue();\r
-                                               target.addAttribute("styleName", styleName);\r
-                                               target.addAttribute("start", "" + start.getTime());\r
-                                               if (end != start) {\r
-                                                       target.addAttribute("end", "" + end.getTime());\r
-                                               }\r
-                                               if (this.itemTitlePropertyId != null) {\r
-                                                       p = item.getItemProperty(this.itemTitlePropertyId);\r
-                                                       Object val = p.getValue();\r
-                                                       if (val != null) {\r
-                                                               target.addAttribute("title", val.toString());\r
-                                                       }\r
-                                               }\r
-                                               if (this.itemDescriptionPropertyId != null) {\r
-                                                       p = item\r
-                                                                       .getItemProperty(this.itemDescriptionPropertyId);\r
-                                                       Object val = p.getValue();\r
-                                                       if (val != null) {\r
-                                                               target.addAttribute("description", val\r
-                                                                               .toString());\r
-                                                       }\r
-                                               }\r
-                                               if (this.itemNotimePropertyId != null) {\r
-                                                       p = item.getItemProperty(this.itemNotimePropertyId);\r
-                                                       Object val = p.getValue();\r
-                                                       if (val != null) {\r
-                                                               target.addAttribute("notime", ((Boolean) val)\r
-                                                                               .booleanValue());\r
-                                                       }\r
-                                               }\r
-\r
-                                               target.endTag("item");\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       target.endTag("items");\r
-               }\r
-       }\r
-}\r