Revision: 30
Author:
loic.be...@zenika.com
Date: Tue Jan 26 09:03:05 2010
Log: add compatibility with GWT 2.0
http://code.google.com/p/gwt-datepicker/source/detail?r=30
Added:
/trunk/war
/trunk/war/DatePickerModule.html
/trunk/war/WEB-INF
/trunk/war/WEB-INF/lib
/trunk/war/WEB-INF/lib/gwt-servlet.jar
/trunk/war/WEB-INF/web.xml
Deleted:
/trunk/src/org/zenika/widget/public/DatePickerModule.html
Modified:
/trunk/src/org/zenika/widget/DatePickerModule.gwt.xml
/trunk/src/org/zenika/widget/client/DatePickerModule.java
/trunk/src/org/zenika/widget/client/datePicker/DatePicker.java
/trunk/src/org/zenika/widget/client/datePicker/PopupCalendar.java
/trunk/src/org/zenika/widget/client/util/DateLocale.java
/trunk/src/org/zenika/widget/client/util/DateLocale_.java
/trunk/src/org/zenika/widget/client/util/DateLocale_en_GB.java
/trunk/src/org/zenika/widget/client/util/DateLocale_en_UK.java
/trunk/src/org/zenika/widget/client/util/DateLocale_fr.java
/trunk/src/org/zenika/widget/client/util/DateLocale_fr_CA.java
/trunk/src/org/zenika/widget/client/util/DateLocale_fr_CH.java
/trunk/src/org/zenika/widget/client/util/DateLocale_fr_FR.java
/trunk/src/org/zenika/widget/client/util/DateLocale_hu_HU.java
/trunk/src/org/zenika/widget/client/util/DateLocale_it_CH.java
/trunk/src/org/zenika/widget/client/util/DateLocale_it_IT.java
/trunk/src/org/zenika/widget/client/util/DateLocale_pl_PL.java
/trunk/src/org/zenika/widget/client/util/DateLocale_pt_PT.java
/trunk/src/org/zenika/widget/client/util/DateUtil.java
=======================================
--- /dev/null
+++ /trunk/war/DatePickerModule.html Tue Jan 26 09:03:05 2010
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
+<!-- above set at the top of the file will set -->
+<!-- the browser's rendering engine into -->
+<!-- "Quirks Mode". Replacing this declaration -->
+<!-- with a "Standards Mode" doctype is supported, -->
+<!-- but may lead to some differences in layout. -->
+
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+
+ <!-- -->
+ <!-- Any title is fine -->
+ <!-- -->
+ <title>Wrapper HTML for DatePickerModule</title>
+
+ <!-- -->
+ <!-- Use normal html, such as style -->
+ <!-- -->
+ <style>
+ body,td,a,div,.p {
+ font-family: arial, sans-serif
+ }
+
+ div,td {
+ color: #000000
+ }
+
+ a:link,.w,.w a:link {
+ color: #0000cc
+ }
+
+ a:visited {
+ color: #551a8b
+ }
+
+ a:active {
+ color: #ff0000
+ }
+ </style>
+
+ <!-- -->
+ <!-- This script loads your compiled module. -->
+ <!-- If you add any GWT meta tags, they must -->
+ <!-- be added before this line. -->
+ <!-- -->
+ <script type="text/javascript" language="javascript"
src="gwt_datepicker/gwt_datepicker.nocache.js"></script>
+
+ </head>
+
+
+ <!-- -->
+ <!-- The body can have arbitrary html, or -->
+ <!-- you can leave the body empty if you want -->
+ <!-- to create a completely dynamic UI. -->
+ <!--
+ <body>
+
+ <!-- OPTIONAL: include this if you want history support -->
+ <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position:absolute;width:0;height:0;border:0"></iframe>
+
+ <!-- RECOMMENDED if your web app will not function without JavaScript
enabled -->
+ <noscript>
+ <div style="width: 22em; position: absolute; left: 50%; margin-left:
-11em; color: red; background-color: white; border: 1px solid red; padding:
4px; font-family: sans-serif">
+ Your web browser must have JavaScript enabled
+ in order for this application to display correctly.
+ </div>
+ </noscript>
+
+ <h1> DatePicker demo </h1>
+
+ <div id="datepicker"> </div>
+
+ <br>
+ <a> For this demo, many locales are managed : fr, fr_FR, fr_CA, en_US
(by default)
+ en_GB, en_UK, it_IT... To change the locale, add "locale=" and the
locale at the end of the demo URL.
+ (for example: URL?locale=fr)</a>
+ <br>
+ <br>
+ <a> Don't forget to uncomment locale in DatePickerModule.gwt.xml and
code in DatePickerModule.java
+ to display an internationalized datePicker. </a>
+ </body>
+</html>
=======================================
--- /dev/null
+++ /trunk/war/WEB-INF/lib/gwt-servlet.jar Tue Jan 26 09:03:05 2010
File is too large to display a diff.
=======================================
--- /dev/null
+++ /trunk/war/WEB-INF/web.xml Tue Jan 26 09:03:05 2010
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "
http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+ <!-- Servlets -->
+
+ <!-- Default page to serve -->
+ <welcome-file-list>
+ <welcome-file>DatePickerModule.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
=======================================
--- /trunk/src/org/zenika/widget/public/DatePickerModule.html Tue Jul 22
08:30:21 2008
+++ /dev/null
@@ -1,69 +0,0 @@
-<html>
- <head>
-
- <!-- -->
- <!-- Any title is fine -->
- <!-- -->
- <title>Wrapper HTML for DatePickerModule</title>
-
- <!-- -->
- <!-- Use normal html, such as style -->
- <!-- -->
- <style>
- body,td,a,div,.p {
- font-family: arial, sans-serif
- }
-
- div,td {
- color: #000000
- }
-
- a:link,.w,.w a:link {
- color: #0000cc
- }
-
- a:visited {
- color: #551a8b
- }
-
- a:active {
- color: #ff0000
- }
- </style>
-
- <!-- -->
- <!-- This script loads your compiled module. -->
- <!-- If you add any GWT meta tags, they must -->
- <!-- be added before this line. -->
- <!-- -->
- <script language='javascript'
- src='org.zenika.widget.DatePickerModule.nocache.js'></script>
-
-</head>
-
-
-<!-- -->
-<!-- The body can have arbitrary html, or -->
-<!-- you can leave the body empty if you want -->
-<!-- to create a completely dynamic ui -->
-<!-- -->
-<body>
-
-
- <!-- OPTIONAL: include this if you want history support -->
- <iframe src="javascript:''" id="__gwt_historyFrame"
- style="width: 0; height: 0; border: 0"></iframe>
- <h1> DatePicker demo </h1>
-
- <div id="datepicker"> </div>
-
- <br>
- <a> For this demo, many locales are managed : fr, fr_FR, fr_CA, en_US (by
default)
- en_GB, en_UK, it_IT... To change the locale, add "locale=" and the
locale at the end of the demo URL.
- (for example: URL?locale=fr)</a>
- <br>
- <br>
- <a> Don't forget to uncomment locale in DatePickerModule.gwt.xml and code
in DatePickerModule.java
- to display an internationalized datePicker. </a>
-</body>
-</html>
=======================================
--- /trunk/src/org/zenika/widget/DatePickerModule.gwt.xml Wed Aug 13
02:51:04 2008
+++ /trunk/src/org/zenika/widget/DatePickerModule.gwt.xml Tue Jan 26
09:03:05 2010
@@ -1,18 +1,24 @@
-<module>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<module rename-to="gwt_datepicker">
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
+ <!-- Inherit the default GWT style sheet. You can change -->
+ <!-- the theme of your GWT application by uncommenting -->
+ <!-- any one of the following lines. -->
+ <inherits name='com.google.gwt.user.theme.standard.Standard'/>
+ <!-- <inherits name='
com.google.gwt.user.theme.chrome.Chrome'/> -->
+ <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Specify the app entry point class. -->
<entry-point class='org.zenika.widget.client.DatePickerModule'/>
<stylesheet src="DatePickerStyle.css" />
-
- <inherits name="com.google.gwt.i18n.I18N"/>
-
- <!-- Managed Locale, uncomment for demo or if not declared in root
module. -->
- <!-- <extend_property name="locale" values="fr"/>
+
+ <!-- Managed Locale -->
+ <extend_property name="locale" values="fr"/>
<extend_property name="locale" values="fr_FR"/>
<extend-property name="locale" values="fr_CA"/>
<extend-property name="locale" values="fr_CH"/>
@@ -25,6 +31,8 @@
<extend-property name="locale" values="it_CH"/>
<extend-property name="locale" values="pl_PL"/>
<extend-property name="locale" values="pt_PT"/>
- <extend-property name="locale" values="pt_BR"/> -->
+ <extend-property name="locale" values="pt_BR"/>
+
+ <source path='client'/>
</module>
=======================================
--- /trunk/src/org/zenika/widget/client/DatePickerModule.java Tue Jul 22
08:30:21 2008
+++ /trunk/src/org/zenika/widget/client/DatePickerModule.java Tue Jan 26
09:03:05 2010
@@ -4,6 +4,8 @@
/**
* Entry point classes define <code>onModuleLoad()</code>.
+ *
+ * @author Zenika
*/
public class DatePickerModule implements EntryPoint {
@@ -13,6 +15,7 @@
public void onModuleLoad() {
// uncomment for demo
// DatePicker datePicker = new DatePicker("blue");
+ // datePicker.setYoungestDate(new Date());
// RootPanel.get("datepicker").add(datePicker);
}
}
=======================================
--- /trunk/src/org/zenika/widget/client/datePicker/DatePicker.java Tue Aug
12 09:19:17 2008
+++ /trunk/src/org/zenika/widget/client/datePicker/DatePicker.java Tue Jan
26 09:03:05 2010
@@ -1,39 +1,42 @@
package org.zenika.widget.client.datePicker;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import org.zenika.widget.client.util.DateUtil;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.ChangeListener;
-import com.google.gwt.user.client.ui.ChangeListenerCollection;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.KeyboardListener;
import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
/**
- * Main class of the DatePicker. It extends the TextBox widget and manages
a Date object.
- * When it is clicked, it opens a PopupCalendar on which we can select a
new date. <br>
- * Example of use : <br>
+ * Main class of the DatePicker. It extends the TextBox widget and manages
a
+ * Date object. When it is clicked, it opens a PopupCalendar on which we
can
+ * select a new date. <br>
+ * Example of use : <br>
* <code>
* DatePicker datePicker = new DatePicker();<br>
* RootPanel.get().add(datePicker);<br>
- * </code>
- * You can specify a theme (see the CSS file DatePickerStyle.css) and
- * the date to initialize the date picker.
- * Enjoy xD
+ * </code> You can specify a theme (see the CSS file DatePickerStyle.css)
and
+ * the date to initialize the date picker. Enjoy xD
*
- * Modified later by James to include change listening
- * @author Nicolas Wetzel (
nicolas...@zenika.com)
- * @author Jean-Philippe Dournel
- * @author Loïc Bertholet
+ * @author Zenika
+ * @author Loïc Bertholet - Zenika
* @author James Heggs (
jhe...@axonbirch.com)
*
*/
-public class DatePicker extends TextBox implements ClickListener,
ChangeListener, KeyboardListener {
+public class DatePicker extends TextBox implements ClickHandler,
ChangeHandler,
+ KeyPressHandler {
private PopupCalendar popup;
private Date selectedDate;
@@ -42,13 +45,13 @@
// the youngest date that can be selected
private Date youngestDate;
private DateTimeFormat dateFormatter;
-
- private ChangeListenerCollection changeListeners;
-
+
+ private List<ChangeHandler> changeHandlers;
+
{
dateFormatter = DateUtil.getDateTimeFormat();
popup = new PopupCalendar(this);
- changeListeners = new ChangeListenerCollection();
+ changeHandlers = new ArrayList<ChangeHandler>();
}
/**
@@ -57,36 +60,43 @@
*/
public DatePicker() {
super();
- setText("");
- sinkEvents(Event.ONCHANGE | Event.ONKEYPRESS);
- addClickListener(this);
- addChangeListener(this);
- addKeyboardListener(this);
+ setText("");
+ // sinkEvents(Event.ONCHANGE | Event.ONKEYPRESS);
+ addClickHandler(this);
+ addChangeHandler(this);
+ addKeyPressHandler(this);
}
/**
* Create a DatePicker which show a specific Date.
- * @param selectedDate Date to show
+ *
+ * @param selectedDate
+ * Date to show
*/
public DatePicker(Date selectedDate) {
this();
this.selectedDate = selectedDate;
synchronizeFromDate();
}
-
+
/**
* Create a DatePicker which uses a specific theme.
- * @param theme Theme name
+ *
+ * @param theme
+ * Theme name
*/
public DatePicker(String theme) {
this();
setTheme(theme);
}
-
+
/**
* Create a DatePicker which specifics date and theme.
- * @param selectedDate Date to show
- * @param theme Theme name
+ *
+ * @param selectedDate
+ * Date to show
+ * @param theme
+ * Theme name
*/
public DatePicker(Date selectedDate, String theme) {
this(selectedDate);
@@ -95,6 +105,7 @@
/**
* Return the Date contained in the DatePicker.
+ *
* @return The Date
*/
public Date getSelectedDate() {
@@ -103,6 +114,7 @@
/**
* Set the Date of the datePicker and synchronize it with the display.
+ *
* @param value
*/
public void setSelectedDate(Date value) {
@@ -110,11 +122,12 @@
synchronizeFromDate();
- changeListeners.fireChange(this);
+ fireChange();
}
/**
* Return the theme name.
+ *
* @return Theme name
*/
public String getTheme() {
@@ -123,7 +136,9 @@
/**
* Set the theme name.
- * @param theme Theme name
+ *
+ * @param theme
+ * Theme name
*/
public void setTheme(String theme) {
popup.setTheme(theme);
@@ -143,52 +158,39 @@
}
super.onBrowserEvent(event);
}
-
+
/**
- * @see
com.google.gwt.user.client.ui.ClickListener#onClick(com.google.gwt.user.client.ui.Widget)
+ * @see ClickHandler#onClick(ClickEvent)
*/
- public void onClick(Widget sender) {
+ public void onClick(ClickEvent event) {
showPopup();
}
/**
- * @see
com.google.gwt.user.client.ui.ChangeListener#onChange(com.google.gwt.user.client.ui.Widget)
+ * @see ChangeHandler#onChange(ChangeEvent)
*/
- public void onChange(Widget sender) {
+ public void onChange(ChangeEvent event) {
parseDate();
}
/**
- * @see
com.google.gwt.user.client.ui.KeyboardListener#onKeyPress(com.google.gwt.user.client.ui.Widget,
- * char, int)
+ * @see KeyPressHandler#onKeyPress(KeyPressEvent)
*/
- public void onKeyPress(Widget sender, char keyCode, int modifiers) {
+ public void onKeyPress(KeyPressEvent event) {
+ int keyCode = event.getNativeEvent().getKeyCode();
switch (keyCode) {
- case KEY_ENTER:
+ case KeyCodes.KEY_ENTER:
parseDate();
showPopup();
break;
- case KEY_ESCAPE:
+ case KeyCodes.KEY_ESCAPE:
if (popup.isVisible())
popup.hidePopupCalendar();
break;
default:
break;
}
- }
-
- /**
- * @see
com.google.gwt.user.client.ui.KeyboardListener#onKeyDown(com.google.gwt.user.client.ui.Widget,
char, int)
- */
- public void onKeyDown(Widget sender, char keyCode, int modifiers) {
- // Nothing to do
- }
-
- /**
- * @see
com.google.gwt.user.client.ui.KeyboardListener#onKeyUp(com.google.gwt.user.client.ui.Widget,
char, int)
- */
- public void onKeyUp(Widget sender, char keyCode, int modifiers) {
- // Nothing to do
+
}
/**
@@ -209,23 +211,33 @@
if (this.selectedDate != null) {
popup.setDisplayedMonth(this.selectedDate);
}
- popup.setPopupPosition(this.getAbsoluteLeft()+150,
this.getAbsoluteTop());
+ popup.setPopupPosition(this.getAbsoluteLeft() + 150, this
+ .getAbsoluteTop());
popup.displayMonth();
doAfterShowPopup(popup);
}
-
+
/**
* Call when the calendar pop-up is shown. Can be overwritten.
+ *
* @param popup
*/
protected void doAfterShowPopup(PopupCalendar popup) {
// nothing special to do
-
- // popup position can be updated so that it is displayed "above" the
TexrBox
- // popup.setPopupPosition(popup.getPopupLeft(), popup.getPopupTop() -
150);
-
- // there is also a known bug if the DatePicker is in a modal MyGWT Dialog
- // DOM.setIntStyleAttribute(popup.getElement(), "zIndex",
MyDOM.getZIndex());
+
+ /*
+ * popup position can be updated so that it is displayed "above" the
+ * TextBox
+ */
+ // popup.setPopupPosition(popup.getPopupLeft(), popup.getPopupTop() -
+ // 150);
+
+ /*
+ * there is also a known bug if the DatePicker is in a modal MyGWT
+ * Dialog - it may be deprecated
+ */
+ // DOM.setIntStyleAttribute(popup.getElement(), "zIndex",
+ // MyDOM.getZIndex());
// Element p = DOM.getParent(popup.getElement());
// int index = DOM.getChildIndex(p, popup.getElement());
// p = DOM.getChild(p, --index);
@@ -249,7 +261,7 @@
}
synchronizeFromDate();
}
-
+
/**
* Return true if the selectedDay is between datepicker's interval dates.
*
@@ -262,7 +274,8 @@
return false;
if (this.getYoungestDate() != null
- && !DateUtil.addDays(selectedDay, 1).after(this.getYoungestDate()))
+ && !DateUtil.addDays(selectedDay, 1).after(
+ this.getYoungestDate()))
return false;
return true;
@@ -283,25 +296,28 @@
public void setYoungestDate(Date youngestDate) {
this.youngestDate = youngestDate;
}
-
+
/**
- * @see
com.google.gwt.user.client.ui.TextBoxBase#addChangeListener(com.google.gwt.user.client.ui.ChangeListener)
+ * @see
com.google.gwt.user.client.ui.TextBoxBase#addChangeHandler(ChangeHandler)
*/
- public void addChangeListener(ChangeListener listener) {
- super.addChangeListener(listener);
- if (changeListeners == null) {
- changeListeners = new ChangeListenerCollection();
- }
- changeListeners.add(listener);
+ @Override
+ public HandlerRegistration addChangeHandler(ChangeHandler handler) {
+ HandlerRegistration handlerRegistration = super
+ .addChangeHandler(handler);
+ if (changeHandlers == null) {
+ changeHandlers = new ArrayList<ChangeHandler>();
+ }
+ changeHandlers.add(handler);
+ return handlerRegistration;
}
/**
- * @see
com.google.gwt.user.client.ui.TextBoxBase#removeChangeListener(com.google.gwt.user.client.ui.ChangeListener)
+ * Warns {@link ChangeHandler} from {@link #changeHandlers} that a change
+ * happened without giving a {@link ChangeEvent}.
*/
- public void removeChangeListener(ChangeListener listener) {
- super.removeChangeListener(listener);
- if (changeListeners != null) {
- changeListeners.remove(listener);
+ protected void fireChange() {
+ for (ChangeHandler changeHandler : changeHandlers) {
+ changeHandler.onChange(null);
}
}
=======================================
--- /trunk/src/org/zenika/widget/client/datePicker/PopupCalendar.java Thu
Jul 10 05:28:27 2008
+++ /trunk/src/org/zenika/widget/client/datePicker/PopupCalendar.java Tue
Jan 26 09:03:05 2010
@@ -4,20 +4,19 @@
import org.zenika.widget.client.util.DateUtil;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.SourcesTableEvents;
-import com.google.gwt.user.client.ui.TableListener;
import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.HTMLTable.Cell;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
/**
@@ -25,8 +24,8 @@
* select a date. It is localizable thanks to the DateTimerFormat class(GWT
* class) and the DateLocale class.
*
- * @author Nicolas Wetzel (
nicolas...@zenika.com)
- * @author Jean-Philippe Dournel
+ * @author Zenika
+ * @author Loïc Bertholet - Zenika
*/
public class PopupCalendar extends PopupPanel {
@@ -69,9 +68,10 @@
drawWeekLine(panel);
drawDayGrid(panel);
}
-
+
/**
* Return the month displayed by the PopupCalendar.
+ *
* @return a Date pointing to the month
*/
public Date getDisplayedMonth() {
@@ -80,14 +80,17 @@
/**
* Set the month which is display by the PopupCalendar.
- * @param displayedMonth The Date to display
+ *
+ * @param displayedMonth
+ * The Date to display
*/
public void setDisplayedMonth(Date displayedMonth) {
this.displayedMonth = displayedMonth;
}
-
+
/**
* Return the theme used by the PopupCalendar.
+ *
* @return Name of the theme
*/
public String getTheme() {
@@ -96,12 +99,14 @@
/**
* Set the theme used by the PopupCalendar.
- * @param theme Name of the theme
+ *
+ * @param theme
+ * Name of the theme
*/
public void setTheme(String theme) {
this.theme = theme;
this.setStyleName(theme + "-date-picker");
- }
+ }
/**
* Refresh the PopupCalendar and show it.
@@ -120,9 +125,9 @@
}
/**
- * This method is destined to be used by the DatePicker in case of focus
lost.
- * It creates a delay before the popup hides to allows the popup to catch
- * a click and eventually update the Date of the DatePicker.
+ * This method is destined to be used by the DatePicker in case of focus
+ * lost. It creates a delay before the popup hides to allows the popup to
+ * catch a click and eventually update the Date of the DatePicker.
*/
public void hidePopupCalendar() {
DeferredCommand.addCommand(new Command() {
@@ -155,16 +160,17 @@
CellFormatter monthCellFormatter = monthLine.getCellFormatter();
Label previousYear = new Label("«");
- previousYear.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
+ previousYear.addClickHandler(new ClickHandler() {
+
+ public void onClick(ClickEvent event) {
leave = false;
PopupCalendar.this.changeMonth(-12);
}
});
monthLine.setWidget(0, 0, previousYear);
Label previousMonth = new Label("‹");
- previousMonth.addClickListener(new ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget sender) {
+ previousMonth.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
leave = false;
PopupCalendar.this.changeMonth(-1);
};
@@ -172,23 +178,23 @@
monthLine.setWidget(0, 1, previousMonth);
monthCellFormatter.setWidth(0, 2, "60%");
currentMonth = new Label();
- currentMonth.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
+ currentMonth.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
leave = false;
}
});
monthLine.setWidget(0, 2, currentMonth);
Label nextMonth = new Label("›");
- nextMonth.addClickListener(new ClickListener() {
- public void onClick(com.google.gwt.user.client.ui.Widget sender) {
+ nextMonth.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
leave = false;
PopupCalendar.this.changeMonth(1);
};
});
monthLine.setWidget(0, 3, nextMonth);
Label nextYear = new Label("»");
- nextYear.addClickListener(new ClickListener() {
- public void onClick(Widget sender) {
+ nextYear.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
leave = false;
PopupCalendar.this.changeMonth(12);
}
@@ -219,39 +225,46 @@
/**
* Display the grid which contains the days. When a day is clicked, it
* updates the Date contained in the DatePicker.
+ *
* @param panel
* The panel contained in the popup
*/
private void drawDayGrid(Panel panel) {
- this.daysGrid.addTableListener(new TableListener() {
- public void onCellClicked(SourcesTableEvents sender, int row,
- int cell) {
+ this.daysGrid.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ Cell cell = daysGrid.getCellForEvent(event);
+ int rowIndex = cell.getRowIndex();
+ int cellIndex = cell.getCellIndex();
Date selectedDay = DateUtil.addDays(
- getDaysGridOrigin(displayedMonth), row * 7 + cell);
+ getDaysGridOrigin(displayedMonth), rowIndex * 7
+ + cellIndex);
if (datePicker.canBeSelected(selectedDay)) {
datePicker.setSelectedDate(selectedDay);
datePicker.synchronizeFromDate();
PopupCalendar.this.hide();
leave = true;
}
- };
+ }
});
+
daysGrid.setStyleName(theme + "-" + "day-grid");
panel.add(daysGrid);
}
-
+
/**
* Update the Label which shows the displayed month (in the month line).
*/
private void drawLabelMoisAnnee() {
- currentMonth
- .setText(monthFormat.format(this.displayedMonth).toLowerCase());
+ currentMonth.setText(monthFormat.format(this.displayedMonth)
+ .toLowerCase());
}
/**
- * Draw the days into the days grid. Days drawn are the days of the
displayed month
- * and few days after and before the displayed month.
- * @param displayedMonth Date of the displayed month
+ * Draw the days into the days grid. Days drawn are the days of the
+ * displayed month and few days after and before the displayed month.
+ *
+ * @param displayedMonth
+ * Date of the displayed month
*/
private void drawDaysGridContent(Date displayedMonth) {
CellFormatter cfJours = daysGrid.getCellFormatter();
@@ -268,14 +281,15 @@
cfJours.removeStyleName(i, j, theme + "-" + "week-end");
cfJours.removeStyleName(i, j, theme + "-"
+ "current-month-week-end");
- cfJours.removeStyleName(i, j, theme + "-"
- + "cant-be-selected");
-
+ cfJours.removeStyleName(i, j, theme + "-" + "cant-be-selected");
+
if (!datePicker.canBeSelected(cursor))
- cfJours.addStyleName(i, j, theme + "-"
+ cfJours
+ .addStyleName(i, j, theme + "-"
+ "cant-be-selected");
else if (datePicker.getSelectedDate() != null
- && DateUtil.areEquals(datePicker.getSelectedDate(), cursor))
+ && DateUtil.areEquals(datePicker.getSelectedDate(),
+ cursor))
if (displayedMonth.getMonth() == cursor.getMonth())
cfJours.addStyleName(i, j, theme + "-"
+ "current-month-selected");
@@ -300,7 +314,9 @@
/**
* Change the displayed month.
- * @param i Number of month to add to the displayed month
+ *
+ * @param i
+ * Number of month to add to the displayed month
*/
protected void changeMonth(int i) {
this.displayedMonth = DateUtil.addMonths(this.displayedMonth, i);
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale.java Thu Sep 20
05:52:13 2007
+++ /trunk/src/org/zenika/widget/client/util/DateLocale.java Tue Jan 26
09:03:05 2010
@@ -8,7 +8,7 @@
* of the DateTimeFormat of GWT. It adds the support of the days order
* which is not the same in all countries.
* It uses the Localizable interface. See GWT documentation for more
detail.
- * @author Jean-Philippe Dournel
+ * @author Zenika
*
*/
public interface DateLocale extends Localizable{
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_.java Thu Sep 20
05:52:13 2007
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_.java Tue Jan 26
09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for US.
- * @author Jean-Philippe Dournel
+ * @author Zenika
*
*/
public class DateLocale_ implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_en_GB.java Thu Sep
20 05:52:13 2007
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_en_GB.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for UK.
- * @author Jean-Philippe Dournel
+ * @author Zenika
*
*/
public class DateLocale_en_GB implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_en_UK.java Wed Jun
4 11:33:09 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_en_UK.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for UK.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_en_UK implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_fr.java Thu Sep 20
05:52:13 2007
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_fr.java Tue Jan 26
09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for France.
- * @author Jean-Philippe Dournel
+ * @author Zenika
*
*/
public class DateLocale_fr implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_fr_CA.java Thu Sep
20 05:52:13 2007
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_fr_CA.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for french-speaking Canada.
- * @author Jean-Philippe Dournel
+ * @author Zenika
*
*/
public class DateLocale_fr_CA implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_fr_CH.java Fri Jun
20 03:36:02 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_fr_CH.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for french-speaking Swiss.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_fr_CH implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_fr_FR.java Wed Jun
4 11:33:09 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_fr_FR.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for France.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_fr_FR implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_hu_HU.java Fri Jun
20 03:36:02 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_hu_HU.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for Hungary.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_hu_HU implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_it_CH.java Fri Jun
20 03:36:02 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_it_CH.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for italian-speaking Swiss.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_it_CH implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_it_IT.java Wed Jun
4 11:33:09 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_it_IT.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for Italy.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_it_IT implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_pl_PL.java Fri Jun
20 03:36:02 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_pl_PL.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for Poland.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_pl_PL implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateLocale_pt_PT.java Fri Jun
20 03:36:02 2008
+++ /trunk/src/org/zenika/widget/client/util/DateLocale_pt_PT.java Tue Jan
26 09:03:05 2010
@@ -4,7 +4,7 @@
/**
* DateLocale implementation for Portugal.
- * @author Loïc Bertholet
+ * @author Loïc Bertholet - Zenika
*
*/
public class DateLocale_pt_PT implements DateLocale {
=======================================
--- /trunk/src/org/zenika/widget/client/util/DateUtil.java Thu Sep 20
05:52:13 2007
+++ /trunk/src/org/zenika/widget/client/util/DateUtil.java Tue Jan 26
09:03:05 2010
@@ -8,8 +8,7 @@
/**
* Utility class which ease the use of Date classes with the DatePicker.
*
- * @author Nicolas Wetzel (
nicolas...@zenika.com)
- * @author Jean-Philippe Dournel
+ * @author Zenika
*
*/
public class DateUtil {