com.smartgwt.client.widgets.form.fields.DateItem Java Examples

The following examples show how to use com.smartgwt.client.widgets.form.fields.DateItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewIssueEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DateItem createDateFrom(String fName, DateRangeValidator dateRangeValidator) {
    DateItem dateStart = new DateItem(fName, i18n.NewIssueEditor_dateFrom_Title());
    dateStart.setTooltip(i18n.NewIssueEditor_dateFrom_Hint());
    dateStart.setUseTextField(true);
    dateStart.setRequired(true);
    dateStart.setStartDate(new Date(1900 - 1900, 1, 1));
    dateStart.addChangedHandler((event) -> {
        Date min = dateStart.getValueAsDate();
        Date max = null;
        if (min != null) {
            max = CalendarUtil.copyDate(min);
            max.setMonth(11);
            max.setDate(31);
        }
        dateRangeValidator.setMin(min);
        dateRangeValidator.setMax(max);
    });
    return dateStart;
}
 
Example #2
Source File: DownloadTicketDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setAlign(Alignment.LEFT);
	form.setNumCols(4);

	SelectItem type = ItemFactory.newAliasTypeSelector();
	type.setName("type");
	type.setValue("");
	type.setEndRow(true);
	type.setColSpan(4);
	type.setWrapTitle(false);

	DateItem date = ItemFactory.newDateItem("date", I18N.message("expireson"));
	date.setEndRow(true);
	date.setColSpan(4);
	date.setWrapTitle(false);

	SpinnerItem maxDownloads = ItemFactory.newSpinnerItem("maxDownloads", I18N.message("maxdownloads"),
			(Integer) null);
	maxDownloads.setEndRow(true);
	maxDownloads.setColSpan(4);
	maxDownloads.setWrapTitle(false);
	maxDownloads.setRequired(false);
	maxDownloads.setMin(0);

	SpinnerItem duedateTimeItem = ItemFactory.newSpinnerItem("duedateNumber", I18N.message("expiresin"), 24);
	duedateTimeItem.setWrapTitle(false);
	duedateTimeItem.setDefaultValue(24);
	duedateTimeItem.setMin(0);
	SelectItem duedateTime = ItemFactory.newDueTimeSelector("duedateTime", "");
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("hour", I18N.message("hours"));
	map.put("day", I18N.message("ddays"));
	duedateTime.setValueMap(map);
	duedateTime.setValue("hour");

	form.setItems(type, duedateTimeItem, duedateTime, date, maxDownloads);
}
 
Example #3
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new DateItem.
 * 
 * @param name The item name (mandatory)
 * @param title The item title (optional)
 * 
 * @return the new item
 */
public static DateItem newDateItem(String name, String title) {
	DateItem date = new DateItem(filterItemName(name));
	if (title != null)
		date.setTitle(I18N.message(title));
	else
		date.setShowTitle(false);
	return date;
}
 
Example #4
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public DateItem getDateFormItem(Field f, String lang) {
        DateItem item = new DateItem(f.getName(), f.getTitle(activeLocale));
        item.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
        item.setUseTextField(true);
//        item.setEnforceDate(true);
        return item;
    }
 
Example #5
Source File: NewIssueEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createForm() {
    DataSource ds = new DataSource();
    ds.setClientOnly(true);
    DataSourceIntegerField fDays = new DataSourceIntegerField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DAYS_INCLUDED_PARAM);
    fDays.setMultiple(true);
    DataSourceDateField fDateFrom = new DataSourceDateField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DATE_FROM_PARAM);
    DataSourceDateField fDateTo = new DataSourceDateField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_DATE_TO_PARAM);
    DataSourceIntegerField fPartNumberFrom = new DataSourceIntegerField(
            DigitalObjectResourceApi.DIGITALOBJECT_SERIES_PARTNUMBER_FROM_PARAM);
    ds.setFields(fDateFrom, fDateTo, fDays, fPartNumberFrom);

    DynamicForm df = new DynamicForm();
    df.setWidth(200);
    df.setItemHoverWidth(200);
    df.setWrapItemTitles(false);
    df.setSaveOnEnter(true);

    IntegerItem partNumberStart = createPartName(fPartNumberFrom.getName());

    DateRangeValidator dateRangeValidator = new DateRangeValidator();
    DateItem dateStart = createDateFrom(fDateFrom.getName(), dateRangeValidator);

    DateItem dateEnd = new DateItem(fDateTo.getName(), i18n.NewIssueEditor_dateTo_Title());
    dateEnd.setTooltip(i18n.NewIssueEditor_dateTo_Hint());
    dateEnd.setUseTextField(true);
    dateEnd.setValidators(dateRangeValidator);
    dateEnd.setStartDate(new Date(1900 - 1900, 1, 1));

    SelectItem issueDays = createDayChooser(fDays.getName());

    df.setDataSource(ds, partNumberStart, dateStart, dateEnd, issueDays);
    return df;
}
 
Example #6
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public DateItem getFromDateItem() {
    return this.fromDateItem;
}
 
Example #7
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public DateItem getToDateItem() {
    return this.toDateItem;
}
 
Example #8
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * Creates a new DateItem for the Extended AttributesDS.
 * 
 * @param name The item name (mandatory)
 * @param title The item title
 * 
 * @return the new item
 */
public static DateItem newDateItemForAttribute(String name, String title) {
	// We cannot use spaces in items name
	String itemName = "_" + name.replaceAll(" ", Constants.BLANK_PLACEHOLDER);
	final DateItem date = new DateItem(itemName);
	date.setTitle(title);
	return date;
}