Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
Regarding the markupException, the example I posted was flawed, must be: return Markup.of(wicket:panelit works/wicket:panel); But that is not relevant to my report. The example on github had this fixed. Any other ideas / somewhat clean workaround? SHould I open a JIRA issue on this, or two? On

Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
So debugging a bit, I find that I get hit by the PanelMarkupSourcingStrategy. It seems it throws away the body markup in favcor of the associated Markup. So I could advance one step by extending WebMarkupContainer instead of Panel. I notice that when extending Panel, getMarkup() is being called 3

Re: Programmatic Markup with fallback

2014-09-16 Thread Andrea Del Bene
Hi, I didn't dig to much into the code, but keep in mind that you are disabling markup caching in your example. This might explain why getMarkup is called three times. Anyway, in your specific case it might be better not to implement IMarkupCacheKeyProvider and IMarkupResourceStreamProvider,

Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
So, I have a working solution like this: public class CustomMarkupFallbackMarkupContainer extends WebMarkupContainer implements IMarkupCacheKeyProvider { public CustomMarkupFallbackMarkupContainer(String id, IModelString model) {super(id, model);} @Override public IMarkupFragment

Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
I forgot to mention, for my solution to work, the associated markup file must not have tags outside the wicket:panel tags: wicket:panel Fallback works! /wicket:panel as opposed to ?xml version=1.0 encoding=UTF-8? html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org;

Re: Programmatic Markup with fallback

2014-09-16 Thread Thibault Kruse
I realize now using the wicket:panel tag only works with panels, so maybe the wicket way to go would be to have a raw markup file without the xmlns declaration. I don't know. In any case, I preferred to use a panel with a complete html file like for any other panel, so I had to circumvent the

Re: Programmatic Markup with fallback

2014-09-16 Thread Andrea Del Bene
Hi, I've found a simple solution delegating markup providing to DefaultMarkupResourceStreamProvider: public class CustomMarkupFallback2Panel extends Panel implements IMarkupCacheKeyProvider, IMarkupResourceStreamProvider { private final DefaultMarkupResourceStreamProvider

Programmatic Markup with fallback

2014-09-15 Thread Thibault Kruse
Hi, I am trying to create a wicket panel that renders markup from some remote source, but if fetching fails, renders some fallback markup. I want to achieve this with minimal code. I tried two approaches one based on overriding getMarkup(), one based on

Re: Programmatic Markup with fallback

2014-09-15 Thread Sven Meier
Hi, which Wicket version? The first approach leads to a MarkupException here with Wicket 1.6.x. Regards Sven On 09/15/2014 07:37 PM, Thibault Kruse wrote: Hi, I am trying to create a wicket panel that renders markup from some remote source, but if fetching fails, renders some fallback

Re: Programmatic Markup with fallback

2014-09-15 Thread Thibault Kruse
Sorry, this was wicket 1.6.16 and 1.6.17. Here is a quickstart, to reproduce both cases some comments have to be switched: https://github.com/tkruse/custommarkup On Mon, Sep 15, 2014 at 7:50 PM, Sven Meier s...@meiers.net wrote: Hi, which Wicket version? The first approach leads to a