Hi, On Wed, Mar 30, 2016 at 11:08 AM, andre seame <andre1...@hotmail.fr> wrote:
> Hello, > > 1°) According the advices of this mailing list, I try to use > IMarkupResourceStreamProvider as described in > > https://ci.apache.org/projects/wicket/guide/7.x/guide/single.html#advanced_5 > > When using something like: > > public class AutoMarkupGenPanel extends Panel implements > IMarkupResourceStreamProvider > { > public AutoMarkupGenPanel(String id, IModel<?> model) > { > super(id, model); > } > > @Override > public IResourceStream getMarkupResourceStream(MarkupContainer > container, > Class<?> containerClass) > { > String markup = "<div>Panel markup</div>"; > StringResourceStream resourceStream = new > StringResourceStream(markup); > return resourceStream; > } > } > I get : > Last cause: Expected to find <wicket:panel> in associated markup file. > Markup: org.apache.wicket.util.resource.StringResourceStream@761796f3 > <mailto:org.apache.wicket.util.resource.StringResourceStream@761796f3>: > > Misunderstanding or bug in documentation? > Bug in the documentation. > > 2°) If I change the markup to: String markup = "<wicket:panel> my dynamic > code </wicket:panel>"; > It is OK. > > If I declare class AutoMarkupGenPanel extends Panel as class > AutoMarkupGenPanel extends Label, it does not work. It seems just as > getMarkupResourceStream is not called. > Label is not MarkupContainer, it is a WebComponent. So it depends on its parent to provide its markup. It is a bit confusing, I see, but this is how it works. > > > 3°) I want to have is : <input wicket:id="dateTo" type="text/> > > The markup I use in my AutoMarkupGenPanel is > String markup = "<wicket:panel><input wicket:id=\""+key+"\" > /></wicket:panel>"; > > It fails: > > Root cause: > > Unable to find component with id 'dateTo' in [InputText [Component id = > after]] > Expected: > 'filterForm:tableWithFilterForm:topToolbars:toolbars:3:headers:6:header:panel:after:dateTo'. > Found with similar names: 'filterForm:dateTo' > It seems you add the Panel directly to the "filterForm", while you should add it much deeper in its hierarchy. > MarkupStream: [markup = > org.apache.wicket.util.resource.StringResourceStream@3055f58b: > <wicket:panel><input wicket:id="dateTo" /></wicket:panel> > <wicket:panel><input wicket:id="dateTo"/></wicket:panel>, index = 1, > current = '<input wicket:id="dateTo"/>' (line 0, column 0)] > at > org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526) > > Is it possible to use IMarkupResourceStreamProvider in this use case ? > > > Thanks for any idea or pointers. > > PHL. > >