use of com.vaadin.server.ExternalResource in project VaadinUtils by rlsutton1.
the class JasperReportLayout method createScheduleButton.
private void createScheduleButton(String buttonHeight, HorizontalLayout buttonContainer) {
scheduleButton = new Button();
Resource scheduleButtonIcon = reportProperties.getScheduleButtonIconResource();
if (scheduleButtonIcon == null) {
scheduleButtonIcon = new ExternalResource("images/seanau/Call Calendar_32.png");
}
// JpaBaseDao<ReportEmailScheduleEntity, Long> dao =
// JpaBaseDao.getGenericDao(ReportEmailScheduleEntity.class);
// Long count =
// dao.getCount(ReportEmailScheduleEntity_.JasperReportPropertiesClassName,
// reportProperties.getReportClass().getCanonicalName());
//
// ScheduleIconBuilder iconBuilder = new ScheduleIconBuilder();
//
// String baseIconFileName = "Call Calendar_32";
// String path =
// VaadinServlet.getCurrent().getServletContext().getRealPath("templates/images/seanau/");
//
// // HACK: scoutmaster stores images in a different directory so if the
// // images isn't found in the above templates directory
// // then search in the /images/seanau director.
// if (path == null || !new File(path).exists())
// {
// path =
// VaadinServlet.getCurrent().getServletContext().getRealPath("/images/seanau/");
// }
// String targetFileName = baseIconFileName + "-" + count + ".png";
// iconBuilder.buildLogo(count.intValue(), new File(path),
// baseIconFileName + ".png", targetFileName);
// scheduleButton.setIcon(new ExternalResource("images/seanau/" +
// targetFileName));
scheduleButton.setIcon(scheduleButtonIcon);
scheduleButton.setDescription("Schedule");
scheduleButton.setWidth("" + BUTTON_WIDTH);
scheduleButton.setHeight(buttonHeight);
scheduleButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
scheduleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
scheduleButton.addClickListener(new ClickEventLogged.ClickListener() {
private static final long serialVersionUID = 7207441556779172217L;
@Override
public void clicked(ClickEvent event) {
new JasperReportSchedulerWindow(reportProperties, builder.getReportParameters());
}
});
buttonContainer.addComponent(scheduleButton);
}
use of com.vaadin.server.ExternalResource in project VaadinUtils by rlsutton1.
the class JasperReportLayout method createFavouriteButton.
private void createFavouriteButton(String buttonHeight, HorizontalLayout buttonContainer) {
favouriteButton = new Button();
Resource favouriteButtonIcon = reportProperties.getFavouriteButtonIconResource();
if (favouriteButtonIcon == null) {
favouriteButtonIcon = new ExternalResource("images/favourite.png");
}
favouriteButton.setDescription("Favourite");
favouriteButton.setIcon(favouriteButtonIcon);
favouriteButton.setWidth("" + BUTTON_WIDTH);
favouriteButton.setDisableOnClick(true);
favouriteButton.setHeight(buttonHeight);
favouriteButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
favouriteButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
favouriteButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
new InputDialog(UI.getCurrent(), "Save Favourite", "Provide a name for the faviourite", new Recipient() {
@Override
public boolean onOK(String input) {
if (StringUtils.length(input) >= 500) {
Notification.show("The name must be less than 500 characters", Type.ERROR_MESSAGE);
return false;
}
Collection<ReportParameter<?>> params = builder.getReportParameters();
ReportSave reportSave = new ReportSave();
reportSave.setReportClass(reportProperties.getReportClass().getName());
reportSave.setUserDescription(input);
reportSave.setUser(reportProperties.getUsername());
reportSave.setSaveType(SaveType.FAVOURITES);
for (ReportParameter<?> param : params) {
for (String pname : param.getParameterNames()) {
if (StringUtils.isNotBlank(param.getLabel(pname))) {
ReportSaveParameter reportSaveparam = new ReportSaveParameter();
reportSaveparam.setParameterName(param.getLabel(pname));
reportSaveparam.setTextualRepresentation(param.getDisplayValue(pname));
reportSaveparam.setParameterValue(param.getValue(pname).toString());
reportSaveparam.setMetaData(param.getSaveMetaData());
reportSaveparam.setMetaDataComment(param.getMetaDataComment());
reportSave.addParameter(reportSaveparam);
JpaBaseDao.getEntityManager().persist(reportSaveparam);
}
}
}
JpaBaseDao.getEntityManager().persist(reportSave);
return true;
}
@Override
public boolean onCancel() {
return true;
}
});
}
});
buttonContainer.addComponent(favouriteButton);
}
use of com.vaadin.server.ExternalResource in project cuba by cuba-platform.
the class WebRelativePathResource method createResource.
@Override
protected void createResource() {
try {
URL context = new URL(ControllerUtils.getLocationWithoutParams());
resource = new ExternalResource(new URL(context, path));
} catch (MalformedURLException e) {
throw new RuntimeException("Can't create RelativePathResource", e);
}
}
use of com.vaadin.server.ExternalResource in project cuba by cuba-platform.
the class WebUrlResource method createResource.
@Override
protected void createResource() {
resource = new ExternalResource(url);
((ExternalResource) resource).setMIMEType(mimeType);
}
use of com.vaadin.server.ExternalResource in project v-leaflet by mstahv.
the class SimpleMarkerTest method getTestComponent.
@Override
public Component getTestComponent() {
leafletMap = new LMap();
LTileLayer pk = new LTileLayer();
pk.setUrl("http://{s}.kartat.kapsi.fi/peruskartta/{z}/{x}/{y}.png");
pk.setAttributionString("Maanmittauslaitos, hosted by kartat.kapsi.fi");
pk.setMaxZoom(18);
pk.setSubDomains("tile2");
pk.setDetectRetina(true);
leafletMap.addBaseLayer(pk, "Peruskartta");
leafletMap.setCenter(60.4525, 22.301);
leafletMap.setZoomLevel(15);
lMarker = new LMarker(60.4525, 22.301);
lMarker.addStyleName("specialstyle");
lMarker.setIcon(new ExternalResource("http://leafletjs.com/examples/custom-icons/leaf-red.png"));
lMarker.setIconAnchor(new Point(22, 94));
lMarker.setPopup("Popupstring");
leafletMap.addComponent(lMarker);
lMarker.openPopup();
LMarker another = new LMarker(60.4525, 22.303);
another.addClickListener(new LeafletClickListener() {
@Override
public void onClick(LeafletClickEvent event) {
Notification.show("Another marker was clicke.");
}
});
leafletMap.addComponent(another);
return leafletMap;
}
Aggregations