com.google.gwt.user.datepicker.client.DatePicker类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中com.google.gwt.user.datepicker.client.DatePicker类的一些代码示例,展示了DatePicker类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DatePicker类的具体详情如下:
包路径:com.google.gwt.user.datepicker.client.DatePicker
类名称:DatePicker

DatePicker介绍

[英]Standard GWT date picker.

CSS Style Rules

  • .gwt-DatePicker { }
  • .datePickerMonthSelector { the month selector widget }
  • .datePickerMonth { the month in the month selector widget }
  • .datePickerYear { the year in the month selector widget }
  • .datePickerPreviousButton { the previous month button }
  • .datePickerNextButton { the next month button }
  • .datePickerPreviousYearButton { the previous year button }
  • .datePickerNextYearButton { the next year button }
  • .datePickerDays { the portion of the picker that shows the days }
  • .datePickerWeekdayLabel { the label over weekdays }
  • .datePickerWeekendLabel { the label over weekends }
  • .datePickerDay { a single day }
  • .datePickerDayIsToday { today's date }
  • .datePickerDayIsWeekend { a weekend day }
  • .datePickerDayIsFiller { a day in another month }
  • .datePickerDayIsValue { the selected day }
  • .datePickerDayIsDisabled { a disabled day }
  • .datePickerDayIsHighlighted { the currently highlighted day }
  • .datePickerDayIsValueAndHighlighted { the highlighted day if it is also selected }

Example

com.google.gwt.examples.DatePickerExample
[中]标准GWT日期选择器。
####CSS样式规则

  • .gwt日期选择器{}
  • .datePickerMonthSelector{月份选择器小部件}
  • .datePickerMonth{月份选择器小部件中的月份}
  • .datePickerYear{月份选择器小部件中的年份}
  • .datePickerPreviousButton{上个月按钮}
  • .DatePickerNext按钮{下个月按钮}
  • .datePickerPreviousYearButton{上一年按钮}
  • .datePickerNextYearButton{下一年按钮}
  • .datePickerDays{选择器中显示日期的部分}
  • .datePickerWeekdayLabel{工作日的标签}
  • .datePickerWeekendLabel{周末标签}
  • .datePickerDay{一天}
  • .datePickerDayIsToday{今天的日期}
  • .datePickerDayIsWeekend{一个周末}
  • .datePickerDayIsFiller{另一个月的一天}
  • .datePickerDayIsValue{所选日期}
  • .DatePickerDay已禁用{禁用的一天}
  • .datePickerDayIsHighlighted{当前突出显示的日期}
  • .datePickerDayIsValueAndHighlighted{如果还选择了突出显示的日期}
    ####范例
    通用域名格式。谷歌。gwt。例子。日期选择器示例

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

this.renderer = renderer;
this.datePicker = new DatePicker();
this.panel = new PopupPanel(true, true) {
 @Override
datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
 public void onValueChange(ValueChangeEvent<Date> event) {

代码示例来源:origin: com.google.gwt/gwt-servlet

public void setValue(Date date, boolean fireEvents) {
 setValue(picker.getValue(), date, fireEvents, true);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private void setValue(Date oldDate, Date date, boolean fireEvents, boolean updateText) {
 if (date != null) {
  picker.setCurrentMonth(date);
 }
 picker.setValue(date, false);
 
 if (updateText) {
  format.reset(this, false);
  box.setText(getFormat().format(this, date));
 }
 
 if (fireEvents) {
  DateChangeEvent.fireIfNotEqualDates(this, oldDate, date);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Sets a visible date to be enabled or disabled. This is only set until the
 * next time the DatePicker is refreshed.
 */
public final void setTransientEnabledOnDates(boolean enabled, Date date) {
 assert isDateVisible(date) : date + " must be visible";
 getView().setEnabledOnDate(enabled, date);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Refreshes all components of this date picker.
 */
protected final void refreshAll() {
 highlighted = null;
 getModel().refresh();
 getView().refresh();
 getMonthSelector().refresh();
 if (isAttached()) {
  ShowRangeEvent.fire(this, getFirstDate(), getLastDate());
 }
 getView().setAriaSelectedCell(value);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Adds a show range handler and immediately activate the handler on the
 * current view.
 *
 * @param handler the handler
 * @return the handler registration
 */
public HandlerRegistration addShowRangeHandlerAndFire(
  ShowRangeHandler<Date> handler) {
 ShowRangeEvent<Date> event = new ShowRangeEvent<Date>(
   getView().getFirstDate(), getView().getLastDate()) {
 };
 handler.onShowRange(event);
 return addShowRangeHandler(handler);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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());
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Create a date box with a new {@link DatePicker}.
 */
public DateBox() {
 this(new DatePicker(), null, DEFAULT_FORMAT);
}

代码示例来源:origin: com.asayama.docs.gwt.angular.examples/GwtWidgets

private DatePicker createDatePicker() {
  DatePicker datePicker = new DatePicker();
  datePicker.setValue(new Date(), false);
  datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
    public void onValueChange(ValueChangeEvent<Date> event) {
      Date date = event.getValue();
      shout("You selected " + date);
    }
  });
  return datePicker;
}

代码示例来源:origin: org.kuali.student.core/ks-common-ui

public void onKeyUp(KeyUpEvent event) {
  String dateText = dateField.getText();
  if(!isDeleteOrBackspaceKey(event.getNativeKeyCode())){
    if(dateText.length() == 2){
      dateField.setText(dateText + "/");
      String current = df.format(currentDate);
      Date newDate = df.parse(dateField.getText()+ "01" + current.substring(5));
      picker.setCurrentMonth(newDate);
    }
    else if(dateText.length() == 5){
      dateField.setText(dateText + "/");
      String current = df.format(currentDate);
      Date newDate = df.parse(dateField.getText() + current.substring(6));
      dateField.setText(df.format(newDate).substring(0, 6));
      picker.setCurrentMonth(newDate);
      picker.setValue(newDate, false);
    }
    else if(dateText.length() == 10){
      Date newDate = df.parse(dateField.getText());
      picker.setCurrentMonth(newDate);
      picker.setValue(newDate, false);
      selectedDate = picker.getValue();
    }
  }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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());
}

代码示例来源:origin: org.jboss.errai/errai-widgets

public boolean edit(WSGrid.WSCell element) {
 wsCellReference = element;
 editCellReference = this;
 datePicker.setValue(date);
 datePicker.setCurrentMonth(date);
 Style s = datePicker.getElement().getStyle();
 int left = (element.getAbsoluteLeft() + element.getOffsetWidth() - 20);
 if ((left + datePicker.getOffsetWidth()) > Window.getClientHeight()) {
  left = Window.getClientHeight() - datePicker.getOffsetHeight();
 }
 s.setProperty("left", left + "px");
 s.setProperty("top", (element.getAbsoluteTop() + element.getOffsetHeight()) + "px");
 datePicker.setVisible(true);
 return true;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Sets the {@link DatePicker}'s value.
 *
 * @param newValue the new value
 */
public final void setValue(Date newValue) {
 setValue(newValue, false);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Parses the current date box's value and shows that date.
 */
public void showDatePicker() {
 Date current = parseDate(false);
 if (current == null) {
  current = new Date();
 }
 picker.setCurrentMonth(current);
 popup.showRelativeTo(this);
}

代码示例来源:origin: org.kie.guvnor/guvnor-commons-ui

public HandlerRegistration addValueChangeHandler( ValueChangeHandler<Date> handler ) {
  return datePicker.addValueChangeHandler( handler );
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Set the number of years to display in the years selection dropdown. The range of years will be
 * centered on the selected date.
 */
public void setVisibleYearCount(int numberOfYears) {
 if (numberOfYears <= 0) {
  throw new IllegalArgumentException("The number of years to display must be positive");
 }
 visibleYearCount = numberOfYears;
 getMonthSelector().refresh();
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

@Override
public void onClick(ClickEvent event) {
  if (event.getSource() == okButton) {
    Date value = calendarWidget.getValue();
    if (resolution == Resolution.MONTH) {
      value = calendarWidget.getCurrentMonth();
    } else if (resolution == Resolution.TIME) {
      value = trySetTimeFromTimeBoxText(value);
    }
    ValueChangeEvent.fire(CalendarOverlay.this, value);
    this.hide();
  } else if (event.getSource() == cancelButton) {
    this.hide(false);
  }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Sets a group of visible dates to be enabled or disabled. This is only set
 * until the next time the DatePicker is refreshed.
 */
public final void setTransientEnabledOnDates(boolean enabled,
  Iterable<Date> dates) {
 for (Date d : dates) {
  setTransientEnabledOnDates(enabled, d);
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public HandlerRegistration addShowRangeHandler(ShowRangeHandler<Date> handler) {
 return addHandler(handler, ShowRangeEvent.getType());
}

相关文章