public DateItem(String name, String title) { setName(name); setTitle(title); setAttribute("editorType", "DateItem"); }
private void changeYear(int i) { Date begin = (Date) this.fromDateItem.getValue(); Date end = (Date) this.toDateItem.getValue(); begin.setYear(begin.getYear() + i); end.setYear(end.getYear() + i); if (datesAreValid(begin.getTime(), end.getTime())) { this.fromDateItem.setValue(begin); this.toDateItem.setValue(end); fireDateChangedEvent(); } else { resetDatePicker(); } }
/** * When set to true (the default), use a single shared date-picker across all widgets that use one. When false, create a * new picker using the autoChild system. See {@link com.smartgwt.client.widgets.form.fields.DateItem#getPickerDefaults * picker} and {@link com.smartgwt.client.widgets.form.fields.DateItem#getPickerProperties pickerProperties} for details * on setting up an unshared picker. * * * @return Boolean */ public Boolean getUseSharedPicker() { return getAttributeAsBoolean("useSharedPicker"); }
lastEditItem.setDisabled(true); lastEditItem.setTitle(MESSAGES.searchFavouritesListWidgetLastChangeBy()); final DateItem lastEditDateItem = new DateItem(); lastEditDateItem.setDisabled(true); lastEditDateItem.setUseTextField(true); lastEditDateItem.setTitle(MESSAGES.searchFavouritesListWidgetLastChange()); form.setFields(nameItem, sharedItem, lastEditItem, lastEditDateItem); sharedItem.setValue(fav.isShared()); lastEditItem.setValue(fav.getLastChangeBy()); lastEditDateItem.setValue(fav.getLastChange()); editCritButton.setDisabled(!AttributeSearchPanel.canHandle(fav.getCriterion()) && !CombinedSearchPanel.canHandle(fav.getCriterion()));
this.fromDateItem.setTitle(i18n.from()); this.fromDateItem.setValidateOnChange(true); this.fromDateItem.setValidateOnExit(true); this.fromDateItem.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); this.toDateItem.setTitle(i18n.to()); this.toDateItem.setValidateOnChange(true); this.toDateItem.setValidateOnExit(true); this.toDateItem.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); this.fromDateItem.setValue(this.from); this.toDateItem.setValue(this.to);
public void onDatesChanged(DatesChangedEvent evt) { DataControlsTimeSeries.this.getFromDateItem().setValue(new Date(evt.getStart())); DataControlsTimeSeries.this.getToDateItem().setValue(new Date(evt.getEnd())); DataControlsTimeSeries.this.getFromTimeItem().setValue(new Date(evt.getStart())); DataControlsTimeSeries.this.getToTimeItem().setValue(new Date(evt.getEnd())); }
propBooleanValue.setVisible(true); } else if (type == PropertyDataTypes.DATE) { propDateValue.setTitle("Value (Date)"); propDateValue.setVisible(true); } else if (type == PropertyDataTypes.DECIMAL || type == PropertyDataTypes.DOUBLE) { propFloatValue.setTitle("Value ("+type.getTypeName()+")");
public static DateItem getOrCreateRef(JavaScriptObject jsObj) { if(jsObj == null) return null; RefDataClass obj = RefDataClass.getRef(jsObj); if(obj != null) { obj.setJsObj(jsObj); return (DateItem) obj; } else { return new DateItem(jsObj); } }
public void onClick(ClickEvent event) { Date begin = (Date) DataControlsTimeSeries.this.getFromDateItem().getValue(); Date end = (Date) DataControlsTimeSeries.this.getToDateItem().getValue(); begin = createDate(begin, DataControlsTimeSeries.this.getFromTimeItem().getDisplayValue()); end = createDate(end, DataControlsTimeSeries.this.getToTimeItem().getDisplayValue()); if (datesAreValid(begin.getTime(), end.getTime())) { DataControlsTimeSeries.this.getRefresh().setClicked(); DataControlsTimeSeries.this.getFromDateItem().blurItem(); DataControlsTimeSeries.this.getFromTimeItem().blurItem(); DataControlsTimeSeries.this.getToDateItem().blurItem(); DataControlsTimeSeries.this.getToTimeItem().blurItem(); long interval = end.getTime() - begin.getTime(); if (interval > DataControlsTimeSeries.this.currentInterval) { Toaster.getToasterInstance().addMessage(i18n.errorOverviewInterval()); DataControlsTimeSeries.this.getRefresh().setNotClicked(); LoaderManager.getInstance().stopLoadingAnimations(); return; } EventBus.getMainEventBus().fireEvent( new OverviewIntervalChangedEvent(DataControlsTimeSeries.this.currentInterval, DataControlsTimeSeries.this.currentIntervalType)); fireDateChangedEvent(); } else { DataControlsTimeSeries.this.getRefresh().setNotClicked(); LoaderManager.getInstance().stopLoadingAnimations(); } }
/** * If {@link com.smartgwt.client.widgets.form.fields.DateItem#getUseTextField useTextField} is <code>true</code> this * property governs the alignment of text within the text field. * * * @return Alignment * @see com.smartgwt.client.docs.Appearance Appearance overview and related methods */ public Alignment getTextAlign() { return EnumUtil.getEnum(Alignment.values(), getAttribute("textAlign")); }
/** * Default date to show in the date chooser. If this items value is currently unset, this property may be specified to set * a default date to highlight in the dateChooser for this item. If unset, the date chooser will highlight the current * date by default. Note that this has no effect if the item as a whole currently has a value - in that case the date * chooser will always highlight the current value for the item. * * * @return Returns the default date to display in the date chooser if this form items value is currently unset. <P> Default * implementation returns {@link com.smartgwt.client.widgets.form.fields.DateItem#getDefaultChooserDate defaultChooserDate} */ public java.util.Date getDefaultChooserDate() { return getAttributeAsDate("defaultChooserDate"); }
protected void resetDatePicker() { this.fromDateItem.setValue(new Date(TimeManager.getInst().getBegin())); this.toDateItem.setValue(new Date(TimeManager.getInst().getEnd())); String beg = DateTimeFormat.getFormat("HH:mm").format(new Date(TimeManager.getInst().getBegin())); String en = DateTimeFormat.getFormat("HH:mm").format(new Date(TimeManager.getInst().getEnd())); this.fromTimeItem.setValue(beg); this.toTimeItem.setValue(en); }
public void onClick(ClickEvent event) { Date begin = (Date) DataControlsTimeSeries.this.getFromDateItem().getValue(); Date end = (Date) DataControlsTimeSeries.this.getToDateItem().getValue(); DataControlsTimeSeries.this.getFromDateItem().blurItem(); DataControlsTimeSeries.this.getFromTimeItem().blurItem(); DataControlsTimeSeries.this.getToDateItem().blurItem(); DataControlsTimeSeries.this.getToTimeItem().blurItem();
/** * If showing date selectors rather than the date text field (so when <code>this.useTextField</code> is false), this * property allows customization of the order of the day, month and year selector fields. If unset these fields will * match the specified inputFormat for this item. <P> Note: selectors may be ommitted entirely by setting selectorFormat to * (for example) <code>"MD"</code>. In this case the value for the omitted selector will match the {@link * com.smartgwt.client.widgets.form.fields.DateItem#getDefaultValue defaultValue} specified for the item. For example, if * the selector format is "MD" (month and day only), the year comes from the Date specified as the defaultValue. * * * @return DateItemSelectorFormat */ public DateItemSelectorFormat getSelectorFormat() { return EnumUtil.getEnum(DateItemSelectorFormat.values(), getAttribute("selectorFormat")); }
/** * Maximum date the selectors will allow the user to pick. <P> See {@link * com.smartgwt.client.widgets.form.fields.DateItem#getStartDate startDate} for details on how this restriction works. * * * @return java.util.Date * @see com.smartgwt.client.docs.Appearance Appearance overview and related methods */ public java.util.Date getEndDate() { return getAttributeAsDate("endDate"); }
void addToDates(int i) { try { Date begin = (Date) this.fromDateItem.getValue(); Date end = (Date) this.toDateItem.getValue(); long beginMillis = begin.getTime(); long endMillis = end.getTime(); beginMillis += (i * 24 * 60 * 60 * 1000); endMillis += (i * 24 * 60 * 60 * 1000); begin.setTime(beginMillis); end.setTime(endMillis); if (datesAreValid(begin.getTime(), end.getTime())) { this.fromDateItem.setValue(begin); this.toDateItem.setValue(end); fireDateChangedEvent(); } else { resetDatePicker(); } } catch (Exception e) { GWT.log("time exception", e); } }
propBooleanValue.setValue(property.getBooleanValue()); } else if (type == PropertyDataTypes.DATE) { propDateValue.setValue(property.getDateValue()); } else if (type == PropertyDataTypes.DECIMAL) { propFloatValue.setValue(property.getDecimalValue().doubleValue());
/** * If {@link com.smartgwt.client.widgets.form.fields.DateItem#getUseTextField useTextField} is <code>true</code> this * property can be used to customize the format in which dates are displayed.<br> Should be set to a standard {@link * com.smartgwt.client.types.DateDisplayFormat} or a function which will return a formatted date string. <P> If unset, the * standard shortDate format as set up via Date.setShortDisplayFormat will be used. <P> <B>NOTE: you may need to update * the {@link com.smartgwt.client.widgets.form.fields.DateItem#getInputFormat inputFormat} to ensure the DateItem is able * to parse user-entered date strings back into Dates</B> * * * @return DateDisplayFormat * @see com.smartgwt.client.widgets.form.fields.DateItem#getInputFormat */ public DateDisplayFormat getDisplayFormat() { return EnumUtil.getEnum(DateDisplayFormat.values(), getAttribute("displayFormat")); }
/** * Should we show the date in a text field, or as 3 select boxes? * * * @return Boolean * @see com.smartgwt.client.docs.Basics Basics overview and related methods * @see <a href="http://www.smartclient.com/smartgwt/showcase/#grid_datatypes_date" target="examples">Date Example</a> */ public Boolean getUseTextField() { return getAttributeAsBoolean("useTextField"); }