package com.test.miniDateRange.client;

import java.util.LinkedHashMap;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.data.DateRange;
import com.smartgwt.client.data.RelativeDate;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.MiniDateRangeItem;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class TestMiniDateRangeItem implements EntryPoint {

    public void onModuleLoad() {
        DynamicForm form = new DynamicForm();
        MiniDateRangeItem miniDateRange = new MiniDateRangeItem("miniDateRange", "Mini Date Range Item");
        LinkedHashMap<String, Object> data = new LinkedHashMap<String, Object>();

        DateRange dateRange = new DateRange();
        dateRange.setRelativeStartDate(RelativeDate.TODAY);
        dateRange.setRelativeEndDate(RelativeDate.TOMORROW);

        data.put("miniDateRange", dateRange);

        form.setItems(miniDateRange);
        form.setValues(data);
        RootPanel.get("dateRange").add(form);
    }
}
