I am very new to Wicket (just getting started really) and I find the documentation to be very disappointing, and the framework complex. I love the concept and am attracted by the potential power and reuse of the component architecture especially the promise of rapidly extending and creating custom components.
For my first custom component I wanted to modify a TextField to do some things my project does ALL THE TIME like showing a textbox as plain text when it is disabled. I want to override the onRender(MarkupStream) to write out just text when the control is disabled instead of writing a disabled textbox.
Seems simple enough so I wrote the following in my new TextField:
The renderNext() was something that the javadoc didn't make clear was part of the implied onRender contract, but I found a brief online reference to and it solved on exception, but now that field throws an exception when run saying it wasn't in the hierarchy when it is disabled.
If I call the super.onRender() everything works fine, but as soon as I try to put out HTML that is not adding to what the super wants to render, the thing breaks. Clearly there is more to the implied contract of the onRender() than the docs are saying. This ought to be so easy, but is very frustrating.
Note: I know I could replace the TextField with a Label, this was meant to be a proof of concept where I can modify the HTML written by a component thus demonstrating how 'easy' it is to make a component do anything we want in the page.
Am I going about the idea of subclassing the Component incorrectly? What must the onRender() do to conform to the mysterious undocumented contract?
Else you're right. The documentation sucks quite much for a beginner. I can recommend the book "Wicket in Action" which really rocks. After reading that book you can solve 90% of your problems with the reference library (https://cwiki.apache.org/WICKET/reference-library.html) and/or a quick search on the mailing list (which is very responsive and helpful).