DateCell(boolean isWeekend) { super(new Date()); cellStyle = css().day(); if (isWeekend) { cellStyle += " " + css().dayIsWeekend(); } getElement().setTabIndex(isFiller() ? -1 : 0); setAriaSelected(false); }
void update(Date current) { setEnabled(true); getValue().setTime(current.getTime()); String value = getModel().formatDayOfMonth(getValue()); setText(value); dateStyle = cellStyle; if (isFiller()) { getElement().setTabIndex(-1); dateStyle += " " + css().dayIsFiller(); } else { getElement().setTabIndex(0); String extraStyle = getDatePicker().getStyleOfDate(current); if (extraStyle != null) { dateStyle += " " + extraStyle; } } // We want to certify that all date styles have " " before and after // them for ease of adding to and replacing them. dateStyle += " "; updateStyle(); }
/** * Creates a new date picker. * * @param monthAndYearSelector the month selector * @param view the view * @param model the model */ protected DatePicker(MonthSelector monthAndYearSelector, CalendarView view, CalendarModel model) { this.model = model; this.monthAndYearSelector = monthAndYearSelector; monthAndYearSelector.setDatePicker(this); this.view = view; view.setDatePicker(this); view.setup(); monthAndYearSelector.setup(); this.setup(); setCurrentMonth(new Date()); addStyleToDates(css().dayIsToday(), new Date()); }
void update(Date current) { setEnabled(true); getValue().setTime(current.getTime()); String value = getModel().formatDayOfMonth(getValue()); setText(value); dateStyle = cellStyle; if (isFiller()) { getElement().setTabIndex(-1); dateStyle += " " + css().dayIsFiller(); } else { getElement().setTabIndex(0); String extraStyle = getDatePicker().getStyleOfDate(current); if (extraStyle != null) { dateStyle += " " + extraStyle; } } // We want to certify that all date styles have " " before and after // them for ease of adding to and replacing them. dateStyle += " "; updateStyle(); }
/** * Sets the {@link DatePicker}'s value. * * @param newValue the new value for this date picker * @param fireEvents should events be fired. */ public final void setValue(Date newValue, boolean fireEvents) { Date oldValue = value; if (oldValue != null) { removeStyleFromDates(css().dayIsValue(), oldValue); } value = CalendarUtil.copyDate(newValue); if (value != null) { addStyleToDates(css().dayIsValue(), value); } getView().setAriaSelectedCell(newValue); if (fireEvents) { DateChangeEvent.fireIfNotEqualDates(this, oldValue, newValue); } }
/** * Sets the {@link DatePicker}'s value. * * @param newValue the new value for this date picker * @param fireEvents should events be fired. */ public final void setValue(Date newValue, boolean fireEvents) { Date oldValue = value; if (oldValue != null) { removeStyleFromDates(css().dayIsValue(), oldValue); } value = CalendarUtil.copyDate(newValue); if (value != null) { addStyleToDates(css().dayIsValue(), value); } getView().setAriaSelectedCell(newValue); if (fireEvents) { DateChangeEvent.fireIfNotEqualDates(this, oldValue, newValue); } }
void update(Date current) { setEnabled(true); getValue().setTime(current.getTime()); String value = getModel().formatDayOfMonth(getValue()); setText(value); dateStyle = cellStyle; if (isFiller()) { getElement().setTabIndex(-1); dateStyle += " " + css().dayIsFiller(); } else { getElement().setTabIndex(0); String extraStyle = getDatePicker().getStyleOfDate(current); if (extraStyle != null) { dateStyle += " " + extraStyle; } } // We want to certify that all date styles have " " before and after // them for ease of adding to and replacing them. dateStyle += " "; updateStyle(); }
/** * Creates a new date picker. * * @param monthAndYearSelector the month selector * @param view the view * @param model the model */ protected DatePicker(MonthSelector monthAndYearSelector, CalendarView view, CalendarModel model) { this.model = model; this.monthAndYearSelector = monthAndYearSelector; monthAndYearSelector.setDatePicker(this); this.view = view; view.setDatePicker(this); view.setup(); monthAndYearSelector.setup(); this.setup(); setCurrentMonth(new Date()); addStyleToDates(css().dayIsToday(), new Date()); }
/** * Sets up the date picker. */ protected void setup() { /* * Use a table (VerticalPanel) to get shrink-to-fit behavior. Divs expand to * fill the available width, so we'd need to give it a size. */ VerticalPanel panel = new VerticalPanel(); initWidget(panel); setStyleName(panel.getElement(), css.datePicker()); setStyleName(css().datePicker()); panel.add(this.getMonthSelector()); panel.add(this.getView()); }
public String dayIsValueAndHighlighted() { return dayIsValue() + "AndHighlighted"; }
public String dayIsToday() { return day("Today"); }
public String dayIsHighlighted() { return day("Highlighted"); }
public String day(String dayModifier) { return day() + "Is" + dayModifier; }
public String dayIsValue() { return day("Value"); }
public String dayIsFiller() { return day("Filler"); }
public String day(String dayModifier) { return day() + "Is" + dayModifier; }
/** * Sets up the date picker. */ protected void setup() { /* * Use a table (VerticalPanel) to get shrink-to-fit behavior. Divs expand to * fill the available width, so we'd need to give it a size. */ VerticalPanel panel = new VerticalPanel(); initWidget(panel); setStyleName(panel.getElement(), css.datePicker()); setStyleName(css().datePicker()); panel.add(this.getMonthSelector()); panel.add(this.getView()); }
public String dayIsValue() { return day("Value"); }
public String dayIsFiller() { return day("Filler"); }
public String dayIsDisabled() { return day("Disabled"); }