Are there any guidelines written up on building reusable components in Wicket?  Other than that one typically uses a Panel?

 

For example, I’ve decided that I need a panel that contains a DatePicker attached to a textbox, with a descriptive label and a secondary label to print warnings when an inappropriate date is selected (because this will appear on most all of my pages).

 

I’d like to retain the flexibility of assigning the date-textbox a model upon use of my panel, and to give the user the option of making something happen whenever the user changes the date.  For hours I’ve been sitting here, feeling like an idiot because I couldn’t figure out how to do this seemingly simple thing.

 

Maybe I should define a specialized model type or interface for my Panel, so that each component inside could be instantiated with a PropertyModel based on the Panel’s model.  (Here, I’m talking about the object containing the actual unwrapped data – not another version of IModel).  Then I could override the Date-TextBox’s “wantChangeNotifications()” and “onModelChanged()” methods to defer to those methods of the containing Panel -- which users of my Panel may override.

 

Is this the way to do it?

 

I’ve read so much about the ease of abstraction in Wicket because one has all of Java’s object-orientation at one’s disposal, but it’s certainly not obvious to me how to take advantage of it.

Reply via email to