Re: Test with IMarkupResourceStreamProvider and using IMarkupResourceStreamProvider for input

2016-03-30 Thread Martin Grigorov
Hi,

On Wed, Mar 30, 2016 at 11:08 AM, andre seame  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 = "Panel markup";
> StringResourceStream resourceStream = new
> StringResourceStream(markup);
> return resourceStream;
> }
> }
> I get :
> Last cause: Expected to find  in associated markup file.
> Markup: 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 = " my dynamic
> code ";
> 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 :  />";
>
> 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:
> 
> , index = 1,
> current =  '' (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.
>
>


Test with IMarkupResourceStreamProvider and using IMarkupResourceStreamProvider for input

2016-03-30 Thread andre seame
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 = "Panel markup";
StringResourceStream resourceStream = new 
StringResourceStream(markup);
return resourceStream;
}
}
I get :
Last cause: Expected to find  in associated markup file. Markup: 
org.apache.wicket.util.resource.StringResourceStream@761796f3:

Misunderstanding or bug in documentation?

2°) If I change the markup to: String markup = " my dynamic code 
";
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 : ";

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: 

, index = 1, current =  
'' (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.