protected void print() {
startProgress();
PrintGetTemplateRequest request = new PrintGetTemplateRequest();
imageUrlService.makeRasterizable(mapWidget);
DefaultTemplateBuilder builder = new DefaultTemplateBuilder();
builder.setApplicationId(mapWidget.getApplicationId());
builder.setMapModel(mapWidget.getMapModel());
builder.setMarginX((int) PrintingLayout.templateMarginX);
builder.setMarginY((int) PrintingLayout.templateMarginY);
PageSize size = PageSize.getByName((String) sizeItem.getValue());
if (LANDSCAPE.equals(orientationGroup.getValue())) {
builder.setPageHeight(size.getWidth());
builder.setPageWidth(size.getHeight());
} else {
builder.setPageHeight(size.getHeight());
builder.setPageWidth(size.getWidth());
}
builder.setTitleText((String) titleItem.getValue());
builder.setWithArrow((Boolean) arrowCheckbox.getValue());
builder.setWithScaleBar((Boolean) scaleBarCheckbox.getValue());
builder.setRasterDpi((Integer) rasterDpiSlider.getValue());
PrintTemplateInfo template = builder.buildTemplate();
request.setTemplate(template);
final GwtCommand command = new GwtCommand(PrintGetTemplateRequest.COMMAND);
command.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<PrintGetTemplateResponse>() {