private MapWidget mapWidget;
public PrintPreferencesCanvas(MapWidget mapWidget) {
this.mapWidget = mapWidget;
// tab set
TabSet tabs = new TabSet();
tabs.setWidth(400);
tabs.setHeight(330);
// create the one and only tab pane
Tab mainPrefs = new Tab();
mainPrefs.setTitle(messages.printPrefsChoose());
// create the form
DynamicForm form = new DynamicForm();
// title
titleItem = new TextItem();
titleItem.setName("title");
titleItem.setTitle(messages.printPrefsTitleText());
// size
sizeItem = new SelectItem();
sizeItem.setName("size");
sizeItem.setTitle(messages.printPrefsSize());
sizeItem.setValueMap(PageSize.getAllNames());
sizeItem.setValue(PageSize.A4.getName());
// orientation
orientationGroup = new RadioGroupItem();
orientationGroup.setName("orientation");
orientationGroup.setTitle(messages.printPrefsOrientation());
LinkedHashMap<String, String> orientations = new LinkedHashMap<String, String>();
orientations.put("landscape", messages.printPrefsLandscape());
orientations.put("portrait", messages.printPrefsPortrait());
orientationGroup.setValueMap(orientations);
orientationGroup.setVertical(false);
orientationGroup.setValue("landscape");
// raster dpi slider
rasterDpiSlider = new SliderItem();
rasterDpiSlider.setTitle(messages.printPrefsRasterDPI());
rasterDpiSlider.setWidth(250);
rasterDpiSlider.setHeight(30);
rasterDpiSlider.setMinValue(72);
rasterDpiSlider.setMaxValue(500);
rasterDpiSlider.setNumValues(5);
// north arrow
arrowCheckbox = new CheckboxItem();
arrowCheckbox.setValue(true);
arrowCheckbox.setTitle(messages.printPrefsWithArrow());
// scale bar
scaleBarCheckbox = new CheckboxItem();
scaleBarCheckbox.setValue(true);
scaleBarCheckbox.setTitle(messages.printPrefsWithScaleBar());
// filename
fileNameItem = new TextItem();
fileNameItem.setName("filename");
fileNameItem.setTitle(messages.printPrefsFileName());
fileNameItem.setValue(mapWidget.getMapModel().getMapInfo().getId() + ".pdf");
// progress indicator
barIcon = new FormItemIcon();
barIcon.setHeight(15);
barIcon.setWidth(214);
statusText = new StaticTextItem(messages.printPrefsStatus());
statusText.setIcons(barIcon);
barIcon.setSrc("[ISOMORPHIC]/geomajas/plugin/printing/pleasewait-blank.gif");
// download type
downloadTypeGroup = new RadioGroupItem();
downloadTypeGroup.setName("downloadType");
downloadTypeGroup.setTitle(messages.printPrefsDownloadType());
LinkedHashMap<String, String> types = new LinkedHashMap<String, String>();
types.put("save", messages.printPrefsSaveAsFile());
types.put("open", messages.printPrefsOpenInBrowserWindow());
downloadTypeGroup.setValueMap(types);
downloadTypeGroup.setVertical(false);
downloadTypeGroup.setValue("save");
form.setFields(titleItem, sizeItem, orientationGroup, arrowCheckbox, scaleBarCheckbox, rasterDpiSlider,
fileNameItem, downloadTypeGroup, statusText);
mainPrefs.setPane(form);
tabs.setTabs(mainPrefs);
IButton printButton = new IButton();
printButton.setTitle(messages.printPrefsPrint());
printButton.addClickHandler(new ClickHandler() {