please see the other thread Juergen
On 6/24/07, Matej Knopp <[EMAIL PROTECTED]> wrote: > But add(HeaderContributor.forCss()) does not modify component tag. It > affects header contribution. Header contribution and component tag > modifications are two different things. > > page.add(HeaderContributor.forCss()) works as long as we don't have > that check that throws exception when you add behavior to page. > > -Matej > > On 6/24/07, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: > > Jan - in the other thread - quite rightly pointed out that > > HeaderContribution does work on pages. It only does not work if a > > component is attached to <html>. What makes <html> different is that > > it must partially be rendered befor the <head> section. Why exactly "a > > component starts rendering before the <head> tag" causes the problem I > > don't know yet. > > > > Juergen > > > > On 6/24/07, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: > > > All behaviors are invoked from Component.onComponentTag(). When a web > > > page renders it does not call onComponentTag() for the page, as the > > > page as no associated markup tag. > > > > > > That means, though you can do add(HeaderContributor.forCss()) (assume > > > you are adding to a page) nothing will happen. The CSS will not be > > > added to the <head> section and you will not get any warning etc.. > > > Instead you may use any other component on your page. > > > > > > I agree that throwing an exception is not the preferred solution, but > > > at least it give users a hint that they are doing something that > > > currently doesn't work. I thought this is better than nothing while we > > > could discuss a much better solution for the problem. > > > > > > Using <html>: > > > - means we need to create yet another auto-component (automatically > > > assign a wicket:id; automatically create an associated > > > WebMarkupContainer - which will need some special behavior to be > > > invisible/transparent for users - and of course at runtime you need to > > > execute it. We already had discusions on how to reduce the number of > > > auto components. > > > - do we need to change all relevant WebPage methods to refer to that > > > component? Or only for adding behaviors (e.g. > > > getHtmlComponent().add(behavior). By sometime referring to that that > > > html component and sometimes not, are we not creating yet another > > > inconsistency (or magic). > > > > > > I was thinking of using the <body> component which already is > > > automatically created. BUT it only make sense for HeaderContributors. > > > <html> make more sense for AMs which realy modify an attribute (e.g. > > > lang). > > > > > > >I know onComponentTag doesn't make sense, but that's IMHO not valid > > > >reason to forbid header contribution as well. > > > > > > I agree but would be a suitable technical solution: > > > E.g. keep throwing an exception for IBhavior and implement > > > public void WebPage.add(HeaderContributor contrib) > > > { > > > getBodyContainer().add(contrib) > > > } > > > > > > lets discuss the pros and cons of all alternatives in order to find > > > the best solution for Wicket and all its users. > > > > > > Juergen > > > > > > On 6/24/07, Matej Knopp <[EMAIL PROTECTED]> wrote: > > > > Arrgh. Discard my previous reply. This is wrong. Why shouldn't I be > > > > able to do header contribution on behavior attached to a page? This > > > > doesn't make sense! > > > > > > > > I know onComponentTag doesn't make sense, but that's IMHO not valid > > > > reason to forbid header contribution as well. > > > > > > > > -Matej > > > > > > > > > > > > On 6/24/07, Jonathan Locke <[EMAIL PROTECTED]> wrote: > > > > > > > > > > my code which does this: > > > > > > > > > > add(HeaderContributor.forCss(CSS)); > > > > > > > > > > now throws the following exception. my web page needs to contribute > > > > > CSS to > > > > > the header. i'm wondering, why can't i do it this way anymore (it > > > > > seems > > > > > like WebPage is a component like any other and my code did work fine > > > > > before > > > > > this exception)? and what's the best alternative? thanks! > > > > > > > > > > Caused by: org.apache.wicket.WicketRuntimeException: You can > > > > > not > > > > > attach behaviors onto WebPages. Web pages do require a markup file > > > > > but no > > > > > specific tag to attach the page to. This is why behaviors such as > > > > > HeaderContributor for example don't work if attached to a WebPage. > > > > > Please > > > > > attach the behavior to any other of your components. > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > View this message in context: > > > > > http://www.nabble.com/cannot-add-CSS-to-web-page--tf3970619.html#a11270671 > > > > > Sent from the Wicket - User mailing list archive at Nabble.com. > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > This SF.net email is sponsored by DB2 Express > > > > > Download DB2 Express C - the FREE version of DB2 express and take > > > > > control of your XML. No limits. Just data. Click to get it now. > > > > > http://sourceforge.net/powerbar/db2/ > > > > > _______________________________________________ > > > > > Wicket-user mailing list > > > > > Wicket-user@lists.sourceforge.net > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > This SF.net email is sponsored by DB2 Express > > > > Download DB2 Express C - the FREE version of DB2 express and take > > > > control of your XML. No limits. Just data. Click to get it now. > > > > http://sourceforge.net/powerbar/db2/ > > > > _______________________________________________ > > > > Wicket-user mailing list > > > > Wicket-user@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user