"MarkupNotFoundException: Can not determine Markup. Component is not yet connected to a parent." kind of tells you that perhaps you forgot to use the add() method?
Also see "How to do things in Wicket": https://cwiki.apache.org/WICKET/how-to-do-things-in-wicket.html More precisly "Control where HTML files are loaded from<https://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html> ": https://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html Is a little bit out of date, but it should give you the right ideas. You should also search this users list for past post such as: http://apache-wicket.1842946.n4.nabble.com/Advanced-Mounting-amp-Markup-Location-td3705032.html http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-and-panel-with-different-markup-location-td4651853.html etc. BTW, does it work when you place the markup in the expected default location next to your java classes? ~ Thank you, Paul Bors On Fri, Apr 26, 2013 at 10:48 AM, mazabel <[email protected]> wrote: > Hi, > > for certain pages I want to customize markup loading, so the markup is > loaded from another source instead of the standard file location. > > Given a method to obtain the markup, getMarkupFileFromSomewhereElse, this > should work as follows (explanation can be found here: > http://www.mkyong.com/wicket/how-do-change-the-html-file-location-wicket/ > ): > > public class MyApplication extends WebApplication { > > @Override > public void init() { > super.init(); > ... > getResourceSettings().setResourceStreamLocator(new > MyOwnStreamLocator()); > > } > > public class MyOwnStreamLocator extends ResourceStreamLocator > { > @Override > public IResourceStream locate(Class<?> clazz, String path) > { > File markUp = > getMarkupFileFromSomewhereElse(clazz); > IResourceStream is = new > FileResourceStream(markup); > IResourceStream standard = super.locate(clazz, > path); > > //return standard; //works always > return is; //works only if the desired markup does > not contain inherited > markup > } > } > } > > Even if is.getInputStream() gives exactly the same text as > standard.getInputStream(), this leads for any markup containing inheritance > from another markup to the following stacktrace: > > ERROR - MarkupFactory - Markup not found: Base markup of > inherited markup not found. Component class: my.package.HomePage. Enable > debug messages for > org.apache.wicket.core.util.resource.locator.ResourceStreamLocator to get a > list of all filenames tried. > org.apache.wicket.markup.MarkupNotFoundException: Base markup of inherited > markup not found. Component class: my.package.HomePage. Enable debug > messages for > org.apache.wicket.core.util.resource.locator.ResourceStreamLocator to get a > list of all filenames tried. > at > > org.apache.wicket.markup.loader.InheritedMarkupMarkupLoader.loadMarkup(InheritedMarkupMarkupLoader.java:71) > at > > org.apache.wicket.markup.loader.DefaultMarkupLoader.loadMarkup(DefaultMarkupLoader.java:52) > at > org.apache.wicket.markup.MarkupFactory.loadMarkup(MarkupFactory.java:412) > at > org.apache.wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:448) > ... > > ERROR - DefaultExceptionMapper - Unexpected error occurred > org.apache.wicket.markup.MarkupNotFoundException: Can not determine Markup. > Component is not yet connected to a parent. [Page class = > my.package.HomePage, id = 0, render count = 1] > at org.apache.wicket.Component.getMarkup(Component.java:736) > at org.apache.wicket.Component.internalRender(Component.java:2335) > at org.apache.wicket.Component.render(Component.java:2298) > at org.apache.wicket.Page.renderPage(Page.java:1010) > at > > org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:116) > ... > > > A bug in the markup itself may not be the problem since the input streams > of > both IResourceStreams contain the same text. Only difference is, the > IResourceStream generated by standard implementation works perfectly fine.. > > Wicket version is 6.7.0. > > Has anyone ever encountered this problem? Thank you in advance! > > Martin > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Overriding-markup-loading-results-in-errors-with-inheritance-tp4658319.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
