But the problem here is the markupID. How can I get the proper markupID to the component at *construction* time, so that I don't have to construct the object from the interface method (it's actually not possible for me to do since I have a set of 4-5 dependant panels who's models are dependant on each other).
but you have the markup id. every component has it passed in to its constructor.
What I'm looking to avoid is circumstances where I need to spend 10-15 lines of code to wire up an anonymous class to handle component-swapping while keeping each component accessible to the outside world (if that makes any sense).
this makes no sense. you want to have two components, only one of them in the component hierarchy and the other one floating somewhere? this doesnt work. components have to be in the hierarchy where they belong. furthermore in wicket1.3 you will not be able to have a component outside of hierarchy because instead of add() you will pass in the parent into constructor.
the interface that takes the id in acts as a factory.
i guess you can try and better describe the usecase, maybe give a few specific examples because i am totally lost.
A component that can display itself, or a "No Items Selected" panel based on it's selection model
another idea you might want to try is a border. the border can have inside it the "alternate" component, and can wrap the regular component. by default the alternate is not visible. then when some condition occurs the border shows the alternate and callse setBorderBodyVisible(false) on itself that will hide whatever components are inside the border.
-Igor