Example usage for org.apache.wicket.markup.html.image NonCachingImage setOutputMarkupPlaceholderTag

List of usage examples for org.apache.wicket.markup.html.image NonCachingImage setOutputMarkupPlaceholderTag

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.image NonCachingImage setOutputMarkupPlaceholderTag.

Prototype

public final Component setOutputMarkupPlaceholderTag(final boolean outputTag) 

Source Link

Document

Render a placeholder tag when the component is not visible.

Usage

From source file:org.sakaiproject.sitestats.tool.wicket.components.AjaxLazyLoadImage.java

License:Educational Community License

private Image createImage(final String id, final byte[] imageData) {
    NonCachingImage chartImage = new NonCachingImage(id) {
        private static final long serialVersionUID = 1L;

        @Override/*from   ww w.  ja  va 2 s  .  c  o  m*/
        protected IResource getImageResource() {
            return new DynamicImageResource() {
                private static final long serialVersionUID = 1L;

                @Override
                protected byte[] getImageData(IResource.Attributes attributes) {
                    return imageData;
                }

                // adapted from https://cwiki.apache.org/confluence/display/WICKET/JFreeChart+and+wicket+example
                @Override
                protected void configureResponse(AbstractResource.ResourceResponse response,
                        IResource.Attributes attributes) {
                    super.configureResponse(response, attributes);

                    response.setCacheDuration(Duration.NONE);
                    response.setCacheScope(CacheScope.PRIVATE);
                }
            };
        }
    };
    chartImage.setOutputMarkupId(true);
    chartImage.setOutputMarkupPlaceholderTag(true);
    return chartImage;
}