extend NonCachingImage instead

-igor


On 9/7/07, fero <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> I have a Panel with some images (charts generated with jfreechart) and a
> datatable. This Panel is in AjaxTabbedPanel and every time it is accessed
> data table is evaluated and charts renewed. But only table is updated and
> charts stay the same (they are loaded from cache), they are reloaded only
> by
> pressing CTRL-F5. How to make them update automatically?
>
> Code:
> ***********************Panel with charts and table***********************
>
>         public CelkoveEmisiePanel(String id, Collection celkoveEmisie) {
>                 super(id);
>                 add(emisieTable(celkoveEmisie));
>
>                 JFreeChartImage poplatkyChart = new
> JFreeChartImage("chart1",
> pieChart(createDatasetPoplatky(celkoveEmisie),"Poplatky"), 300, 300);
>                 poplatkyChart.setOutputMarkupId(true);
>                 add(poplatkyChart);
>
>                 JFreeChartImage mnozstvoChart = new
> JFreeChartImage("chart2",
> pieChart(createDatasetMnozstvo(celkoveEmisie),"Vypúšťané množstvo"), 300,
> 300);
>                 mnozstvoChart.setOutputMarkupId(true);
>                 add(mnozstvoChart);
>         }
>
>
> *******JFreeChartImage from
> http://cwiki.apache.org/WICKET/jfreechart-and-wicket-example.html*****
>
> public class JFreeChartImage extends Image {
>
>     private int width;
>     private int height;
>
>         public JFreeChartImage(String id, JFreeChart chart, int width, int
> height){
>                 super(id, new Model(chart));
>                 this.width = width;
>                 this.height = height;
>         }
>
>     protected Resource getImageResource() {
>         return new DynamicImageResource(){
>
>                         protected byte[] getImageData() {
>                         JFreeChart chart = (JFreeChart)getModelObject();
>                         return toImageData(chart.createBufferedImage(width,
> height));
>                         }
>
>                     protected void setHeaders(WebResponse response) {
>                         if (isCacheable()) {
>                             super.setHeaders(response);
>                         } else {
>                             response.setHeader("Pragma", "no-cache");
>                             response.setHeader("Cache-Control",
> "no-cache");
>                             response.setDateHeader("Expires", 0);
>                         }
>                     }
>         };
>     }
>
> }
> --
> View this message in context:
> http://www.nabble.com/Disable-loading-image-from-browser-cache-tf4402977.html#a12560615
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to