private ImageUrlService imageUrlService = new ImageUrlServiceImpl();
public PrintPreferencesCanvas(MapWidget mapWidget) {
this.mapWidget = mapWidget;
// tab set
TabSet tabs = new TabSet();
tabs.setWidth(PrintingLayout.printPreferencesWidth);
tabs.setHeight(PrintingLayout.printPreferencesHeight);
// create the one and only tab pane
Tab mainPreferences = new Tab();
mainPreferences.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(PrintingLayout.printPreferencesResolutionWidth);
rasterDpiSlider.setHeight(PrintingLayout.printPreferencesResolutionHeight);
rasterDpiSlider.setMinValue(72);
rasterDpiSlider.setMaxValue(600);
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() + EXTENSION);
// progress indicator
barIcon = new FormItemIcon();
barIcon.setHeight(PrintingLayout.iconWaitHeight);
barIcon.setWidth(PrintingLayout.iconWaitWidth);
StaticTextItem statusText = new StaticTextItem(MESSAGES.printPrefsStatus());
statusText.setIcons(barIcon);
barIcon.setSrc(PrintingLayout.iconWaitBlank);
// download type
downloadTypeGroup = new RadioGroupItem();
downloadTypeGroup.setName(DOWNLOAD_TYPE);
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);
mainPreferences.setPane(form);
tabs.setTabs(mainPreferences);
IButton printButton = new IButton();
printButton.setTitle(MESSAGES.printPrefsPrint());
printButton.addClickHandler(new ClickHandler() {