wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andre seame <andre1...@hotmail.fr>
Subject Test with IMarkupResourceStreamProvider and using IMarkupResourceStreamProvider for input
Date Wed, 30 Mar 2016 09:08:47 GMT
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?

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.


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'
 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.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message