本文整理汇总了Java中com.google.gwt.user.datepicker.client.DateBox类的典型用法代码示例。如果您正苦于以下问题:Java DateBox类的具体用法?Java DateBox怎么用?Java DateBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DateBox类属于com.google.gwt.user.datepicker.client包,在下文中一共展示了DateBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
private void init(String value, int maxLength) {
if (maxLength > 0) {
addErrorValidator(new StringMaxLengthValidator(maxLength));
}
addWarningValidator(new StringDateLocalValidator());
try {
dateBox.setValue(onmsFormater.parseStrict(value));
} catch (IllegalArgumentException e) {
dateBox.getTextBox().setText(value);
}
inititalValue = value;
dateBox.setFormat(new DateBox.DefaultFormat(localFormater));
dateBox.getTextBox().addFocusHandler(this);
dateBox.getTextBox().addChangeHandler(this);
dateBox.getTextBox().addMouseUpHandler(this);
dateBox.getTextBox().addKeyUpHandler(this);
dateBox.addValueChangeHandler(this);
dateBox.setStyleName("dateBox");
dateBox.setSize("300px", "18px");
panel.add(dateBox);
}
示例2: setDateBoxFormat
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
/**
* Sets the date format in multiple date-picker widgets
* @param fmt the date format as a {@link DefaultFormat} instance
* @param boxes the {@link DateBox} widgets
*/
public static void setDateBoxFormat(final DateBox.Format fmt,final DateBox... boxes) {
DateBox.Format theFmt = fmt == null ? new DateBox.DefaultFormat() : fmt;
if (boxes != null) {
for (DateBox box : boxes) {
box.setFormat(theFmt);
}
}
}
示例3: setFormatPattern
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public void setFormatPattern(String aValue) {
formatPattern = aValue;
if (formatPattern != null)
formatPattern = WidgetsUtils.convertDateFormatString(formatPattern);
DateTimeFormat dtFormat = formatPattern != null ? DateTimeFormat.getFormat(formatPattern) : DateTimeFormat.getFormat("dd.MM.yyyy");
setFormat(new DateBox.DefaultFormat(dtFormat));
}
示例4: setFormat
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public void setFormat(String aValue) {
format = aValue;
if (format != null)
format = WidgetsUtils.convertDateFormatString(format);
DateTimeFormat dtFormat = format != null ? DateTimeFormat.getFormat(format) : DateTimeFormat.getFormat("dd.MM.yyyy");
((DateTimeBox) decorated).setFormat(new DateBox.DefaultFormat(dtFormat));
}
示例5: UTCDateBoxImplHtml4
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public UTCDateBoxImplHtml4() {
handlerManager = new HandlerManager(this);
datebox = new DateBox();
datebox.addValueChangeHandler(new ValueChangeHandler<Date>() {
@Override
public void onValueChange(ValueChangeEvent<Date> event) {
// pass this event onto our handlers after converting
// the value
fireValueChangeEvent(UTCDateBox.date2utc(event.getValue()));
}
});
}
示例6: createFieldWidget
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
@Override
protected boolean createFieldWidget() {
field = new DateBox(new DatePicker(), null, new DefaultFormat(DateTimeFormat.getFormat("dd.MM.yyyy")));
field.getDatePicker().getElement().getStyle().setZIndex(40);
// new DatePicker(), null, GWT.create(DefaultFormat.class)
// field.addValueChangeHandler(getVCHandler());
field.getTextBox().addValueChangeHandler(getVCHandler());
Style fieldStyle = field.getElement().getStyle();
fieldStyle.setWidth(100, Unit.PCT);
fieldStyle.setHeight(26, Unit.PX);
fieldStyle.setPaddingLeft(3, Unit.PX);
fieldStyle.setColor("#575A5F !important");
fieldStyle.setFontSize(11, Unit.PX);
fieldStyle.setProperty("fontFamily", "Verdana, Arial, Helvetica, sans-serif");
fieldStyle.setProperty("borderTop", "1px solid #CCC");
fieldStyle.setProperty("borderRight", "1px solid #999");
fieldStyle.setProperty("borderBottom", "1px solid #999");
fieldStyle.setProperty("borderLeft", "1px solid #999");
// fieldStyle.setProperty("border", "2px #C9D5E0 inset");
fieldStyle.setProperty("boxSizing", "border-box");
fieldStyle.setProperty("WebkitBoxSizing", "border-box");
fieldStyle.setProperty("MozBoxSizing", "border-box");
return true;
// field.getFormat()
// field.setStylePrimaryName("StringViewTextBox");
}
示例7: create
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
@Override
public Widget create(Session session, Column column) {
DateBox dateBox = new DateBox();
String pattern = (String) column.getEditor().getAttribute(DateEditor.FORMAT);
if (pattern != null) {
dateBox.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat(pattern)));
}
return dateBox;
}
示例8: parse
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
/** Adds support for some human readable dates ("1d ago", "10:30"). */
@Override
public Date parse(final DateBox box,
final String text,
final boolean report_error) {
if (text.endsWith(" ago")) { // "1d ago" and such
int interval;
final int lastchar = text.length() - 5;
try {
interval = Integer.parseInt(text.substring(0, lastchar));
} catch (NumberFormatException e) {
setError(box);
return null;
}
if (interval <= 0) {
setError(box);
return null;
}
switch (text.charAt(lastchar)) {
case 's': break; // seconds
case 'm': interval *= 60; break; // minutes
case 'h': interval *= 3600; break; // hours
case 'd': interval *= 3600 * 24; break; // days
case 'w': interval *= 3600 * 24 * 7; break; // weeks
case 'y': interval *= 3600 * 24 * 365; break; // years
}
final Date d = new Date();
d.setTime(d.getTime() - interval * 1000);
return d;
} else if (text.length() == 5) { // "HH:MM"
try {
return HHMM_FORMAT.parse(text);
} catch (IllegalArgumentException ignored) {
setError(box);
return null;
}
}
return super.parse(box, text, report_error);
}
示例9: DateLocalizationExample
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public DateLocalizationExample()
{
super( "Date Localization" );
DateLocalizationStrings strings = GWT.create( DateLocalizationStrings.class );
this.label = new Label();
this.label.setText( strings.defaultDaysMessage() );
this.add(new Label(strings.selectString()));
final DateLocalizationMessages messages = GWT.create( DateLocalizationMessages.class );
DateBox dateBox = new DateBox();
dateBox.setFormat( new DateBox.DefaultFormat( DateTimeFormat.getLongDateFormat()) );
Date date = new Date();
CalendarUtil.addMonthsToDate( date, -29 * 12 );
dateBox.setValue( date );
dateBox.addValueChangeHandler( new ValueChangeHandler<Date>() {
public void onValueChange( ValueChangeEvent<Date> e )
{
long days = CalendarUtil.getDaysBetween(e.getValue(), new Date() );
label.setText( messages.daysMessage( days ) );
}
});
this.add( dateBox );
this.add( label );
}
示例10: create
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
@Override
public Widget create()
{
DatePicker datePicker = new DatePicker();
DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(this.dmDateBox.format);
DateBox dateBox = new DateBox(datePicker,
new Date(this.dmDateBox.timestamp),
new DateBox.DefaultFormat(dateTimeFormat));
this.dmDateBox.dateBox = dateBox;
this.dmDateBox.timestamp = 0;
return dateBox;
}
示例11: getProgStartDate
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public DateBox getProgStartDate(){
return progStartDate;
}
示例12: getProgEndDate
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public DateBox getProgEndDate(){
return progEndDate;
}
示例13: getDataStartDate
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public DateBox getDataStartDate(){
return dataStartDate;
}
示例14: getDataEndDate
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
public DateBox getDataEndDate(){
return dataEndDate;
}
示例15: init
import com.google.gwt.user.datepicker.client.DateBox; //导入依赖的package包/类
/**
* UI Initialization
*/
protected void init() {
this.setSize("850px", "400px");
this.setGlassEnabled(true);
this.setModal(true);
desc.setText(desc.getText()+" Job Id - "+bdaJobId);
closeButton.setSize("10px", "10px");
closeButton.setStyleName("closebtn");
VerticalPanel topPanel = new VerticalPanel(); //Outermost vertical panel
topPanel.add(closeButton);
topPanel.setCellHeight(closeButton, "13px");
topPanel.setStyleName("vpanel");
desc.setStyleName("popupTitle");
topPanel.add(desc);
topPanel.setCellHeight(desc, "30px");
HorizontalPanel optPanel = new HorizontalPanel(); //Operation panel(include search, batch delete.etc)
optPanel.addStyleName("run-history-optPanel");
DateTimeFormat pickerFormat = DateTimeFormat.getFormat("yyyy-MM-dd");
startTimeBox.setFormat(new DateBox.DefaultFormat(pickerFormat));
startTimeBox.getDatePicker().addStyleName("run-history-datepicker-popup");
endTimeBox.setFormat(new DateBox.DefaultFormat(pickerFormat));
endTimeBox.getDatePicker().addStyleName("run-history-datepicker-popup");
searchBtn.removeStyleName("gwt-Button");
searchBtn.addStyleName("run-history-search-button");
//The initial time is set to 2016-1-1
endTime = new Date();
DateTimeFormat tmpFormatter = DateTimeFormat.getFormat("yyyy-MM-dd");
startTime = tmpFormatter.parse("2016-01-01");
selectAllChkBox.setVisible(false);
batchDelBtn.removeStyleName("gwt-Button");
batchDelBtn.addStyleName("run-history-batch-del-button");
optPanel.add(startTimeLabel);
optPanel.add(startTimeBox);
optPanel.add(endTimeLabel);
optPanel.add(endTimeBox);
optPanel.add(searchBtn);
if(isExample && !AppController.power.equals("111")) //Example job only can be deleted by administrator privileges
{}
else
optPanel.add(batchDelBtn);
optPanel.add(selectAllChkBox);
runHistoryGrid.addStyleName("run-history-table"); //Data view
runHistoryGrid.addStyleName("table-striped");
runHistoryGrid.addStyleName("table-hover");
runHistoryGrid.resize(rowNum, colNum);
for(int i=0;i<colNum;i++)
{
runHistoryGrid.setText(0, i, columns[i]);
}
initGridData();
topPanel.add(optPanel);
topPanel.add(runHistoryGrid);
VerticalPanel bottomPanel = new VerticalPanel(); //Paging control
bottomPanel.add(pageGrid);
bottomPanel.addStyleName("run-history-bottomPanel");
VerticalPanel panel = new VerticalPanel();
panel.add(topPanel);
panel.add(bottomPanel);
this.add(panel);
this.setStyleName("loading_container");
}