本文整理了Java中com.google.gwt.user.datepicker.client.DatePicker
类的一些代码示例,展示了DatePicker
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DatePicker
类的具体详情如下:
包路径:com.google.gwt.user.datepicker.client.DatePicker
类名称:DatePicker
[英]Standard GWT date picker.
com.google.gwt.examples.DatePickerExample
[中]标准GWT日期选择器。
####CSS样式规则
代码示例来源: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());
}
内容来源于网络,如有侵权,请联系作者删除!