Re: overriding getAssociatedMarkupStream
wow !! this wicket is sooo cool :) I did exactly what you suggested and it works like a charm. public IResourceStream getMarkupResourceStream(MarkupContainer container, Class containerClass) { if (html == null) { final DefaultMarkupResourceStreamProvider markupResourceStreamProvider = new DefaultMarkupResourceStreamProvider(); return markupResourceStreamProvider.getMarkupResourceStream(container, containerClass); } else { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); // The following line is the line that caused the problem of non inserted header contributers //MarkupResourceStream m = new MarkupResourceStream(myhtml); // The following is the fix return new MarkupResourceStream(myhtml, new ContainerInfo(container), containerClass); } } // In order to keep in my cache the real markup, here is what I did public String getCacheKey(MarkupContainer container, Class containerClass) { if (html == null) { DefaultMarkupCacheKeyProvider cacheKeyProvider = new DefaultMarkupCacheKeyProvider(); return cacheKeyProvider.getCacheKey(container, containerClass); } else { return null; } } Thanks Igor On Wed, May 14, 2008 at 5:29 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: if you do not want the markup to be cached you have to also implement IMarkupCacheKeyProvider. returning null from getcachekey will prevent wicket from caching the markup. -igor On Wed, May 14, 2008 at 5:42 AM, Eyal Golan [EMAIL PROTECTED] wrote: Hi, I tried implementing the IMarkupResourceStreamProvider in my web page: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class containerClass) { if (html != null) { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); MarkupResourceStream m = new MarkupResourceStream(myhtml); return m; } else { final DefaultMarkupResourceStreamProvider markupResourceStreamProvider = new DefaultMarkupResourceStreamProvider(); return markupResourceStreamProvider.getMarkupResourceStream(container, containerClass); } } (html is a class member that may or may not be available) It did not work: 1. The Cache keeps the last html markup, so if I open this page once WITH html != null I get what I want (but with the same problem. look at next note). If then I open the page and the html IS null, the cache returns the earlier page. So this approach is no good. 2. In any case, HeaderContributers that are on components that in the page are not added to the output markup. Are the 2 lines: StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); MarkupResourceStream m = new MarkupResourceStream(myhtml); The problem ? Thanks On Thu, May 8, 2008 at 6:41 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: you shouldnt be overriding that method, try implementing IMarkupResourceStreamProvider instead. -igor On Tue, May 6, 2008 at 11:20 PM, Eyal Golan [EMAIL PROTECTED] wrote: ok, maybe I wasn't clear enough. The simple question is, why the add(HeaderContributor.forCss...)); is not added to the output markup when I override getAssociatedMarkupStream? Thanks On Tue, May 6, 2008 at 4:08 PM, Eyal Golan [EMAIL PROTECTED] wrote: Hi all, We have this method: @Override public MarkupStream getAssociatedMarkupStream(final boolean throwException) { if(html != null) { return GUIUtis.getMarkupStream(this, html); } return super.getAssociatedMarkupStream(throwException); } and: static public MarkupStream getMarkupStream(Page page,String htmlText){ try { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(htmlText)); MarkupResourceStream m = new MarkupResourceStream(myhtml); Markup myMarkup = page.getApplication().getMarkupSettings().getMarkupParserFactory().newMarkupParser(m).parse(); MarkupStream markupStream = new MarkupStream(myMarkup); return markupStream; } catch (Exception ex) { throw new RuntimeException(Fail to parse markup:\n+htmlText); } } The problem: When the html is not null (and we enter GUIUtis.getMarkupStream), css that where added using HeaderContributer are not added to the output HTML markup. I have something like this in a component:
Re: overriding getAssociatedMarkupStream
Hi, I tried implementing the IMarkupResourceStreamProvider in my web page: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class containerClass) { if (html != null) { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); MarkupResourceStream m = new MarkupResourceStream(myhtml); return m; } else { final DefaultMarkupResourceStreamProvider markupResourceStreamProvider = new DefaultMarkupResourceStreamProvider(); return markupResourceStreamProvider.getMarkupResourceStream(container, containerClass); } } (html is a class member that may or may not be available) It did not work: 1. The Cache keeps the last html markup, so if I open this page once WITH html != null I get what I want (but with the same problem. look at next note). If then I open the page and the html IS null, the cache returns the earlier page. So this approach is no good. 2. In any case, HeaderContributers that are on components that in the page are not added to the output markup. Are the 2 lines: StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); MarkupResourceStream m = new MarkupResourceStream(myhtml); The problem ? Thanks On Thu, May 8, 2008 at 6:41 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: you shouldnt be overriding that method, try implementing IMarkupResourceStreamProvider instead. -igor On Tue, May 6, 2008 at 11:20 PM, Eyal Golan [EMAIL PROTECTED] wrote: ok, maybe I wasn't clear enough. The simple question is, why the add(HeaderContributor.forCss...)); is not added to the output markup when I override getAssociatedMarkupStream? Thanks On Tue, May 6, 2008 at 4:08 PM, Eyal Golan [EMAIL PROTECTED] wrote: Hi all, We have this method: @Override public MarkupStream getAssociatedMarkupStream(final boolean throwException) { if(html != null) { return GUIUtis.getMarkupStream(this, html); } return super.getAssociatedMarkupStream(throwException); } and: static public MarkupStream getMarkupStream(Page page,String htmlText){ try { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(htmlText)); MarkupResourceStream m = new MarkupResourceStream(myhtml); Markup myMarkup = page.getApplication().getMarkupSettings().getMarkupParserFactory().newMarkupParser(m).parse(); MarkupStream markupStream = new MarkupStream(myMarkup); return markupStream; } catch (Exception ex) { throw new RuntimeException(Fail to parse markup:\n+htmlText); } } The problem: When the html is not null (and we enter GUIUtis.getMarkupStream), css that where added using HeaderContributer are not added to the output HTML markup. I have something like this in a component: add(HeaderContributor.forCss(EurekifyButton.class, EurekifyButton.css)); The css is missing. I can't change the usage of getAssociatedMarkupStream to use variation or something like this. any thought? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/
Re: overriding getAssociatedMarkupStream
if you do not want the markup to be cached you have to also implement IMarkupCacheKeyProvider. returning null from getcachekey will prevent wicket from caching the markup. -igor On Wed, May 14, 2008 at 5:42 AM, Eyal Golan [EMAIL PROTECTED] wrote: Hi, I tried implementing the IMarkupResourceStreamProvider in my web page: public IResourceStream getMarkupResourceStream(MarkupContainer container, Class containerClass) { if (html != null) { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); MarkupResourceStream m = new MarkupResourceStream(myhtml); return m; } else { final DefaultMarkupResourceStreamProvider markupResourceStreamProvider = new DefaultMarkupResourceStreamProvider(); return markupResourceStreamProvider.getMarkupResourceStream(container, containerClass); } } (html is a class member that may or may not be available) It did not work: 1. The Cache keeps the last html markup, so if I open this page once WITH html != null I get what I want (but with the same problem. look at next note). If then I open the page and the html IS null, the cache returns the earlier page. So this approach is no good. 2. In any case, HeaderContributers that are on components that in the page are not added to the output markup. Are the 2 lines: StringResourceStream myhtml = new StringResourceStream(new StringBuilder(html)); MarkupResourceStream m = new MarkupResourceStream(myhtml); The problem ? Thanks On Thu, May 8, 2008 at 6:41 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: you shouldnt be overriding that method, try implementing IMarkupResourceStreamProvider instead. -igor On Tue, May 6, 2008 at 11:20 PM, Eyal Golan [EMAIL PROTECTED] wrote: ok, maybe I wasn't clear enough. The simple question is, why the add(HeaderContributor.forCss...)); is not added to the output markup when I override getAssociatedMarkupStream? Thanks On Tue, May 6, 2008 at 4:08 PM, Eyal Golan [EMAIL PROTECTED] wrote: Hi all, We have this method: @Override public MarkupStream getAssociatedMarkupStream(final boolean throwException) { if(html != null) { return GUIUtis.getMarkupStream(this, html); } return super.getAssociatedMarkupStream(throwException); } and: static public MarkupStream getMarkupStream(Page page,String htmlText){ try { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(htmlText)); MarkupResourceStream m = new MarkupResourceStream(myhtml); Markup myMarkup = page.getApplication().getMarkupSettings().getMarkupParserFactory().newMarkupParser(m).parse(); MarkupStream markupStream = new MarkupStream(myMarkup); return markupStream; } catch (Exception ex) { throw new RuntimeException(Fail to parse markup:\n+htmlText); } } The problem: When the html is not null (and we enter GUIUtis.getMarkupStream), css that where added using HeaderContributer are not added to the output HTML markup. I have something like this in a component: add(HeaderContributor.forCss(EurekifyButton.class, EurekifyButton.css)); The css is missing. I can't change the usage of getAssociatedMarkupStream to use variation or something like this. any thought? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: overriding getAssociatedMarkupStream
ok, maybe I wasn't clear enough. The simple question is, why the add(HeaderContributor.forCss...)); is not added to the output markup when I override getAssociatedMarkupStream? Thanks On Tue, May 6, 2008 at 4:08 PM, Eyal Golan [EMAIL PROTECTED] wrote: Hi all, We have this method: @Override public MarkupStream getAssociatedMarkupStream(final boolean throwException) { if(html != null) { return GUIUtis.getMarkupStream(this, html); } return super.getAssociatedMarkupStream(throwException); } and: static public MarkupStream getMarkupStream(Page page,String htmlText){ try { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(htmlText)); MarkupResourceStream m = new MarkupResourceStream(myhtml); Markup myMarkup = page.getApplication().getMarkupSettings().getMarkupParserFactory().newMarkupParser(m).parse(); MarkupStream markupStream = new MarkupStream(myMarkup); return markupStream; } catch (Exception ex) { throw new RuntimeException(Fail to parse markup:\n+htmlText); } } The problem: When the html is not null (and we enter GUIUtis.getMarkupStream), css that where added using HeaderContributer are not added to the output HTML markup. I have something like this in a component: add(HeaderContributor.forCss(EurekifyButton.class, EurekifyButton.css)); The css is missing. I can't change the usage of getAssociatedMarkupStream to use variation or something like this. any thought? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/
Re: overriding getAssociatedMarkupStream
you shouldnt be overriding that method, try implementing IMarkupResourceStreamProvider instead. -igor On Tue, May 6, 2008 at 11:20 PM, Eyal Golan [EMAIL PROTECTED] wrote: ok, maybe I wasn't clear enough. The simple question is, why the add(HeaderContributor.forCss...)); is not added to the output markup when I override getAssociatedMarkupStream? Thanks On Tue, May 6, 2008 at 4:08 PM, Eyal Golan [EMAIL PROTECTED] wrote: Hi all, We have this method: @Override public MarkupStream getAssociatedMarkupStream(final boolean throwException) { if(html != null) { return GUIUtis.getMarkupStream(this, html); } return super.getAssociatedMarkupStream(throwException); } and: static public MarkupStream getMarkupStream(Page page,String htmlText){ try { StringResourceStream myhtml = new StringResourceStream(new StringBuilder(htmlText)); MarkupResourceStream m = new MarkupResourceStream(myhtml); Markup myMarkup = page.getApplication().getMarkupSettings().getMarkupParserFactory().newMarkupParser(m).parse(); MarkupStream markupStream = new MarkupStream(myMarkup); return markupStream; } catch (Exception ex) { throw new RuntimeException(Fail to parse markup:\n+htmlText); } } The problem: When the html is not null (and we enter GUIUtis.getMarkupStream), css that where added using HeaderContributer are not added to the output HTML markup. I have something like this in a component: add(HeaderContributor.forCss(EurekifyButton.class, EurekifyButton.css)); The css is missing. I can't change the usage of getAssociatedMarkupStream to use variation or something like this. any thought? -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ -- Eyal Golan [EMAIL PROTECTED] Visit: http://jvdrums.sourceforge.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]