okay, so i've looked into this downcast issue a bit more and i just don't see a way to remove it offhand. it's completely special purpose with little probability of being generalized. and in general, borders are very special purpose containers because they completely change the way that rendering occurs. but polymorphic extension is of no help here because a container with arbitrary html in it cannot render itself simply by rendering its tags in order. when border tags occur, markup merging has to occur for the container to render itself... and since we are rendering an /arbitrary/ container, there is no available border object at that time! you /have/ to search the component hierarchy to find it.
it's possible there's a better, less convoluted implementation for all this, but i spent a week on this problem and didn't see it.
the way borders work right now is that they are extremely special purpose, convoluted and intimately involved with their superclass Container. the main problem with borders is that they involve not only container nesting, but also different associated markup rendered in recursive shells. because of the way the markup nests (as well as the components!), borders simply cannot be rendered in the same way as any other component. as the container renders tags with renderNext, if it runs into a wicket-[body] tag, that special placeholder acts like some kind of wierd recursive pop instruction causing tags to be temporarily rendered from the nearest enclosing border component (yes, that's right! wicket does NOT simply render a container by rendering its component tree as is! to support borders, it switches back and forth recursively between different associated markup files). still more special magic is involved to make these borders nest arbitrarily! it took me several days to get this logic right, btw... so don't expect to understand it in an hour or two!
anyway, the rendering is not top to bottom in a border. it's:
1. skip past header to wicket-[border] marker tag
2. render up to wicket-[body] tag
3. skip wicket-[body] tag
4. recursively render the body of the nearest enclosing border component in the current container's hierarchy (including it's nested borders!)
5. render up to close of wicket-[border] marker
yes, this means that borders can contain borders and that containers can nest borders. basically, it's a recursive text merge operation.
although downcasts are generally bad, this one is very hidden and very special purpose. if anyone can explain what is going to go wrong with this in the future though, i'm like ross perot: all ears!
i think a more likely thing is that there ought to be some thought to adding an extension point for [xyz] tags. but that seems like it can wait till 1.1 unless someone sees a problem there...
to wrap up here... the docs explain border nesting fairly well in terms of concepts :
---- (from Border.java) ----
A border component has associated markup which is drawn and determines placement of any markup and/or components nested within the border component.
The portion of the border's associated markup file which is to be used in rendering the border is denoted by a tag (of any type) with a component name of "[border]". The children of the border component instance are then inserted into this markup at the first tag named "[body]" in the border's associated markup.
For example, if a border's associated markup looked like this:
<html> <body> <span componentName = "[border]"> First <span componentName = "[body]"/> Last </span> </body> </html>
And the border was used on a page like this:
<html> <body> <span componentName = "myBorder"> Middle </span> </body> </html>
Then the resulting HTML would look like this:
<html> <body> <span componentName = "[border]"> First Middle Last </span> </body> </html>
In other words, the body of the myBorder component is substituted into the border's associated markup at the position indicated by the "[body]" component.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
