com.google.gwt.user.datepicker.client.DatePicker.setCurrentMonth()方法的使用及代码示例

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

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

DatePicker.setCurrentMonth介绍

[英]Sets the date picker to show the given month, use #getFirstDate()and #getLastDate() to access the exact date range the date picker chose to display.

A datepicker may show days not in the current month. It must show all days in the current month.
[中]设置日期选择器以显示给定月份,使用#getFirstDate()和#getLastDate()访问日期选择器选择显示的确切日期范围。
日期选择器可能会显示不在当前月份的日期。它必须显示当前月份的所有天数。

代码示例

代码示例来源: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: 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: 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

@Override
public void onSelected(boolean selected) {
 if (selected) {
  getDatePicker().setValue(getValue(), true);
  if (isFiller()) {
   getDatePicker().setCurrentMonth(getValue());
  }
 }
 updateStyle();
}

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

@Override
 protected void onEnterKeyDown(Context context, Element parent, Date value,
   NativeEvent event, ValueUpdater<Date> valueUpdater) {
  this.lastKey = context.getKey();
  this.lastParent = parent;
  this.lastValue = value;
  this.lastIndex = context.getIndex();
  this.lastColumn = context.getColumn();
  this.valueUpdater = valueUpdater;

  Date viewData = getViewData(lastKey);
  Date date = (viewData == null) ? lastValue : viewData;
  datePicker.setCurrentMonth(date);
  datePicker.setValue(date);
  panel.setPopupPositionAndShow(new PositionCallback() {
   public void setPosition(int offsetWidth, int offsetHeight) {
    panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX,
      lastParent.getAbsoluteTop() + offsetY);
   }
  });
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * 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: net.wetheinter/gwt-user

/**
 * 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: de.esoco/gewt

/***************************************
 * Sets the month to be displayed by the date picker of this instance.
 *
 * @param rDate A date of the new month to be displayed
 */
public void setMonth(Date rDate)
{
  if (rDate != null)
  {
    getDateWidget().getDatePicker().setCurrentMonth(rDate);
  }
}

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

public void setDate(Date date) {
  calendarWidget.setValue(date, false);
  calendarWidget.setCurrentMonth(date);
  if (resolution == Resolution.TIME) {
    timeBox.setText(timeOnlyFormat.format(date));
  }
}

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

public void setValue(Date date){
  if(null==date){
    dateField.setText("");
  }else{
    dateField.setText(df.format(date));
    picker.setCurrentMonth(date);
    picker.setValue(date, false);
    selectedDate = date;
  }
}

代码示例来源: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.vaadin.external.gwt/gwt-user

/**
 * 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: net.wetheinter/gwt-user

/**
 * 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: com.vaadin.external.gwt/gwt-user

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: net.wetheinter/gwt-user

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.vaadin.external.gwt/gwt-user

@Override
public void onSelected(boolean selected) {
 if (selected) {
  getDatePicker().setValue(getValue(), true);
  if (isFiller()) {
   getDatePicker().setCurrentMonth(getValue());
  }
 }
 updateStyle();
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public void onSelected(boolean selected) {
 if (selected) {
  getDatePicker().setValue(getValue(), true);
  if (isFiller()) {
   getDatePicker().setCurrentMonth(getValue());
  }
 }
 updateStyle();
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
 protected void onEnterKeyDown(Context context, Element parent, Date value,
   NativeEvent event, ValueUpdater<Date> valueUpdater) {
  this.lastKey = context.getKey();
  this.lastParent = parent;
  this.lastValue = value;
  this.lastIndex = context.getIndex();
  this.lastColumn = context.getColumn();
  this.valueUpdater = valueUpdater;

  Date viewData = getViewData(lastKey);
  Date date = (viewData == null) ? lastValue : viewData;
  datePicker.setCurrentMonth(date);
  datePicker.setValue(date);
  panel.setPopupPositionAndShow(new PositionCallback() {
   public void setPosition(int offsetWidth, int offsetHeight) {
    panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX,
      lastParent.getAbsoluteTop() + offsetY);
   }
  });
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
 protected void onEnterKeyDown(Context context, Element parent, Date value,
   NativeEvent event, ValueUpdater<Date> valueUpdater) {
  this.lastKey = context.getKey();
  this.lastParent = parent;
  this.lastValue = value;
  this.lastIndex = context.getIndex();
  this.lastColumn = context.getColumn();
  this.valueUpdater = valueUpdater;

  Date viewData = getViewData(lastKey);
  Date date = (viewData == null) ? lastValue : viewData;
  datePicker.setCurrentMonth(date);
  datePicker.setValue(date);
  panel.setPopupPositionAndShow(new PositionCallback() {
   public void setPosition(int offsetWidth, int offsetHeight) {
    panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX,
      lastParent.getAbsoluteTop() + offsetY);
   }
  });
 }
}

代码示例来源: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;
}

相关文章