Hi Jeremy,

I think the most important things a wicket programmer should know relate to building their own set of resuable components. Here are my top ten on that theme:

1. Build a reusable set of components tailored for your business domain.

2. Solve a few problems then push up the common functionality into an AbstractBaseComponent class where the other uses are subclasses.

3. Or externalize the component setup choices through an interface and keep the class non-abstract. Then the callers setup an implementation of the interface for each case. The interface would control things like show/hide on no results or enable/disable certain fields, basically any choice that is useful to externalize.

4. Understand how extending FormComponentPanel<BusinessObject> can hide complexity and provide improved form validation options.

e.g. We have a query application and the form builds the Task to be executed. We have a filter that contains List<VariableFilter>filters and each Variable Fitler is itself a List<String>optionsList.

Creating a custom Form component at each layer we can be assured that the complicated elements at each level have been validated properly before the task is submitted. Since the top level submit need only deal with the objects being assembled into the task, their internals are assured to be valid.

5. convertInput needs to setConvertedInput(new BusinessObject()) and this is what the validators run against. Only when they pass does the modelObject = convertedInput.

6. Build separate class files for custom Models and Columns (no dynamic inner classes) since any IDE can easily handle the separation and because having them separate enables more reuse.

7. Know how repeaters like ListView and DataTable work and internalize them within your own panels to hide their complexity from the callers of your panel.

8. Know how to emit javascript to the browser both as one off and in terms of a custom DOM object for your application. Especially important is how to write this javascript so that it will scale. i.e. the panel can be used more than once per page.

9. Understand wicket serialization, typically with the experience of having your spring container with some big data store write out to disk on each page change. A versioned page with ajax and this case is the most fun. And how @SpringBean creates serializable proxies that prevent this. But also how getting an inner object from the @SpringBean proxy will leave you open to the same cascading serialization issue.

10. Understand how to layer models to traverse the BusinessObject graph to access certain fields. Don't use PropertyModels in production instead layer models to access the fields of interest.

e.g. new BusinessAccountModel (IModel<BusinessAccount>backingModel, Type.ACCT_NUMBER) to create the get/set pair for the account number from the backing model. I can image the backing model being a LoadableDetachableModel<BusinessAccount>() that loads the account data from the database.

See: https://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-WrappedObjectModels

Regards,

Mike




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to