Using the calendar sample I added a button to show a print preview of the calendar. When the button is pressed I get an empty raster of the day or week view (month view works!), without any of the events:
I'm using GWT 2.3 and SmartGWT 2.5
Code:
/*
* Smart GWT (GWT for SmartClient)
* Copyright 2008 and beyond, Isomorphic Software, Inc.
*
* Smart GWT is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation. Smart GWT is also
* available under typical commercial license terms - see
* http://smartclient.com/license
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package smartgwtcalendar.client;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceDateTimeField;
import com.smartgwt.client.data.fields.DataSourceSequenceField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.calendar.Calendar;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
public class SmartGWTCalendar implements EntryPoint {
@Override
public void onModuleLoad() {
DataSource eventDS = new DataSource();
DataSourceSequenceField eventIdField = new DataSourceSequenceField("eventId");
eventIdField.setPrimaryKey(true);
DataSourceTextField nameField = new DataSourceTextField("name");
DataSourceTextField descField = new DataSourceTextField("description");
DataSourceDateTimeField startDateField = new DataSourceDateTimeField("startDate");
DataSourceDateTimeField endDateField = new DataSourceDateTimeField("endDate");
eventDS.setFields(eventIdField, nameField, descField, startDateField, endDateField);
eventDS.setClientOnly(true);
eventDS.setTestData(CalendarData.getRecords());
final Calendar calendar = new Calendar();
calendar.setDataSource(eventDS);
calendar.setAutoFetchData(true);
calendar.setCanDragEvents(false);
calendar.setCanDragResize(false);
IButton printButton = new IButton("Print");
printButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Canvas.showPrintPreview(calendar);
}
});
VLayout layout = new VLayout();
layout.setSize("100%", "100%");
layout.addMember(printButton);
layout.addMember(calendar);
layout.draw();
}
}
Comment