ok its embarassing to have to post the answers to your questions, heh but
this is one is for less fortunate:

In my application I could pass the Class of the MarkupContainer (rather than
the class that loads the markup)

        /**
         * The {@link 
DefaultMarkupResourceStreamProvider#getMarkupResourceStream};
derives the path 
         * from the "Class<?> containerClass" and passes it to the {@link
IResourceStreamLocator#locate} method.<br />
         * It also passes the MarkupContainer class to the {@link
IResourceStreamLocator#locate} method. This class is useless in our case,
         * and there is more value in getting the actual "Class<?> 
containerClass".
Simple swap which class is passed to the locate mothod.
         */
        protected void tweakMarkupCacheStreamProvider() {
                getMarkupSettings().setMarkupCache(new MarkupCache(this) {
                        private IMarkupResourceStreamProvider 
markupResourceStreamProvider;
                        
                        /**
                         * Get the markup resource stream provider to be used
                         * 
                         * @param container
                         *            The MarkupContainer requesting the markup 
resource stream
                         * @return IMarkupResourceStreamProvider
                         */
                        protected IMarkupResourceStreamProvider 
getMarkupResourceStreamProvider(
                                final MarkupContainer container)
                        {
                                if (container instanceof 
IMarkupResourceStreamProvider)
                                {
                                        return 
(IMarkupResourceStreamProvider)container;
                                }

                                if (markupResourceStreamProvider == null)
                                {
                                        /*
                                         * Most of the code of the original 
{@link
DefaultMarkupResourceStreamProvider} is untouched,
                                         * except the line that calls the 
locate(...) method!
                                         */
                                        markupResourceStreamProvider = new
DefaultMarkupResourceStreamProvider() {
                                                public IResourceStream 
getMarkupResourceStream(final MarkupContainer
container, Class<?> containerClass)
                                                {
                                                        ...
                                                        ...
                                                        //container.getClass() 
replaced with containerClass below :::
                                                        IResourceStream 
resourceStream = locator.locate(containerClass, path,
style, locale, ext); 
                                                        ...
                                                        ...
                                                }                               
                
                                        };
                                }
                                return markupResourceStreamProvider;
                        }                       
                });
        }


Request to the Developers ::
One particularly disturbing thing I've seen in certain wicket components
(maybe an oversight); is that if you dont have POJO style getter() &
setter() on your components; then non final variables should be declared
"protected" not private. There is no point providing overriding methods that
use private variables, to which the child class has no access.

thanks


-----
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Advanced-Mounting-Markup-Location-tp3705032p3705848.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]

Reply via email to