Search in sources :

Example 16 with ExternalResource

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);
}
Also used : JasperReportSchedulerWindow(au.com.vaadinutils.jasper.scheduler.JasperReportSchedulerWindow) ClickEventLogged(au.com.vaadinutils.listener.ClickEventLogged) Button(com.vaadin.ui.Button) ClickEvent(com.vaadin.ui.Button.ClickEvent) ExternalResource(com.vaadin.server.ExternalResource) StreamResource(com.vaadin.server.StreamResource) Resource(com.vaadin.server.Resource) ExternalResource(com.vaadin.server.ExternalResource)

Example 17 with ExternalResource

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);
}
Also used : InputDialog(au.com.vaadinutils.editors.InputDialog) ReportParameter(au.com.vaadinutils.jasper.parameter.ReportParameter) ClickEvent(com.vaadin.ui.Button.ClickEvent) ExternalResource(com.vaadin.server.ExternalResource) StreamResource(com.vaadin.server.StreamResource) Resource(com.vaadin.server.Resource) Recipient(au.com.vaadinutils.editors.Recipient) ExternalResource(com.vaadin.server.ExternalResource) Button(com.vaadin.ui.Button) ClickListener(com.vaadin.ui.Button.ClickListener) ReportSave(au.com.vaadinutils.jasper.scheduler.entities.ReportSave) ReportSaveParameter(au.com.vaadinutils.jasper.scheduler.entities.ReportSaveParameter)

Example 18 with ExternalResource

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);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ExternalResource(com.vaadin.server.ExternalResource) URL(java.net.URL)

Example 19 with ExternalResource

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);
}
Also used : ExternalResource(com.vaadin.server.ExternalResource)

Example 20 with ExternalResource

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;
}
Also used : LeafletClickEvent(org.vaadin.addon.leaflet.LeafletClickEvent) LMap(org.vaadin.addon.leaflet.LMap) LTileLayer(org.vaadin.addon.leaflet.LTileLayer) LeafletClickListener(org.vaadin.addon.leaflet.LeafletClickListener) Point(org.vaadin.addon.leaflet.shared.Point) LMarker(org.vaadin.addon.leaflet.LMarker) ExternalResource(com.vaadin.server.ExternalResource)

Aggregations

ExternalResource (com.vaadin.server.ExternalResource)43 Link (com.vaadin.ui.Link)24 VerticalLayout (com.vaadin.ui.VerticalLayout)18 Label (com.vaadin.ui.Label)13 PostConstruct (javax.annotation.PostConstruct)11 Button (com.vaadin.ui.Button)8 HorizontalLayout (com.vaadin.ui.HorizontalLayout)7 Resource (com.vaadin.server.Resource)5 Point (org.vaadin.addon.leaflet.shared.Point)5 StreamResource (com.vaadin.server.StreamResource)4 BrowserFrame (com.vaadin.ui.BrowserFrame)4 ClickEvent (com.vaadin.ui.Button.ClickEvent)4 LMap (org.vaadin.addon.leaflet.LMap)3 Bounds (org.vaadin.addon.leaflet.shared.Bounds)3 ReportSave (au.com.vaadinutils.jasper.scheduler.entities.ReportSave)2 ReportSaveParameter (au.com.vaadinutils.jasper.scheduler.entities.ReportSaveParameter)2 ClickEventLogged (au.com.vaadinutils.listener.ClickEventLogged)2 ComboBox (com.vaadin.ui.ComboBox)2 TextField (com.vaadin.ui.TextField)2 HashMap (java.util.HashMap)2