|
|
|
|
|
|
|
|
|
|
|
|
|
|
package com.vaadin.client.ui; |
|
|
package com.vaadin.client.ui; |
|
|
|
|
|
|
|
|
|
|
|
import static com.vaadin.client.DateTimeService.asTwoDigits; |
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
import com.google.gwt.aria.client.SelectedValue; |
|
|
import com.google.gwt.aria.client.SelectedValue; |
|
|
import com.google.gwt.dom.client.Element; |
|
|
import com.google.gwt.dom.client.Element; |
|
|
import com.google.gwt.dom.client.NativeEvent; |
|
|
import com.google.gwt.dom.client.NativeEvent; |
|
|
import com.google.gwt.dom.client.Style; |
|
|
|
|
|
import com.google.gwt.event.dom.client.BlurEvent; |
|
|
import com.google.gwt.event.dom.client.BlurEvent; |
|
|
import com.google.gwt.event.dom.client.BlurHandler; |
|
|
import com.google.gwt.event.dom.client.BlurHandler; |
|
|
import com.google.gwt.event.dom.client.ClickHandler; |
|
|
import com.google.gwt.event.dom.client.ClickHandler; |
|
|
|
|
|
|
|
|
import com.google.gwt.user.client.ui.FlexTable; |
|
|
import com.google.gwt.user.client.ui.FlexTable; |
|
|
import com.google.gwt.user.client.ui.InlineHTML; |
|
|
import com.google.gwt.user.client.ui.InlineHTML; |
|
|
import com.google.gwt.user.client.ui.Widget; |
|
|
import com.google.gwt.user.client.ui.Widget; |
|
|
import com.vaadin.client.BrowserInfo; |
|
|
|
|
|
import com.vaadin.client.DateTimeService; |
|
|
import com.vaadin.client.DateTimeService; |
|
|
import com.vaadin.client.WidgetUtil; |
|
|
import com.vaadin.client.WidgetUtil; |
|
|
import com.vaadin.client.ui.aria.AriaHelper; |
|
|
import com.vaadin.client.ui.aria.AriaHelper; |
|
|
import com.vaadin.shared.util.SharedUtil; |
|
|
import com.vaadin.shared.util.SharedUtil; |
|
|
|
|
|
|
|
|
import static com.vaadin.client.DateTimeService.asTwoDigits; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Abstract calendar panel to show and select a date using a resolution. The |
|
|
* Abstract calendar panel to show and select a date using a resolution. The |
|
|
* class is parameterized by the date resolution enumeration type. |
|
|
* class is parameterized by the date resolution enumeration type. |
|
|
|
|
|
|
|
|
* resolution of the calendar is changed and no date has been |
|
|
* resolution of the calendar is changed and no date has been |
|
|
* selected. |
|
|
* selected. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@SuppressWarnings("rawtypes") |
|
|
public void renderCalendar(boolean updateDate) { |
|
|
public void renderCalendar(boolean updateDate) { |
|
|
|
|
|
if (parent instanceof VAbstractPopupCalendar |
|
|
|
|
|
&& !((VAbstractPopupCalendar) parent).popup.isShowing()) { |
|
|
|
|
|
if (getDate() == null) { |
|
|
|
|
|
// no date set, cannot pre-render yet |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
// a popup that isn't open cannot possibly need a focus change event |
|
|
|
|
|
updateDate = false; |
|
|
|
|
|
} |
|
|
doRenderCalendar(updateDate); |
|
|
doRenderCalendar(updateDate); |
|
|
|
|
|
|
|
|
initialRenderDone = true; |
|
|
initialRenderDone = true; |
|
|
|
|
|
|
|
|
getDateField().getStylePrimaryName() + "-calendarpanel"); |
|
|
getDateField().getStylePrimaryName() + "-calendarpanel"); |
|
|
|
|
|
|
|
|
if (focusedDate == null) { |
|
|
if (focusedDate == null) { |
|
|
Date now = new Date(); |
|
|
|
|
|
|
|
|
Date date = getDate(); |
|
|
|
|
|
if (date == null) { |
|
|
|
|
|
date = new Date(); |
|
|
|
|
|
} |
|
|
// focusedDate must have zero hours, mins, secs, millisecs |
|
|
// focusedDate must have zero hours, mins, secs, millisecs |
|
|
focusedDate = new FocusedDate(now.getYear(), now.getMonth(), |
|
|
|
|
|
now.getDate()); |
|
|
|
|
|
displayedMonth = new FocusedDate(now.getYear(), now.getMonth(), 1); |
|
|
|
|
|
|
|
|
focusedDate = new FocusedDate(date.getYear(), date.getMonth(), |
|
|
|
|
|
date.getDate()); |
|
|
|
|
|
displayedMonth = new FocusedDate(date.getYear(), date.getMonth(), |
|
|
|
|
|
1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (updateDate && !isDay(getResolution()) |
|
|
if (updateDate && !isDay(getResolution()) |