Johan Compagner wrote: > > But if it traverses and then call wrapOnAssignment on the first one it > finds > what do all the chained models do then? Why are they there? Because > from that moment on those chained are completel gone. They could even be > gc'ed > So this only works if getObject from them are doing nothing more then > calling getObject from chained. >
Couldn't you then call setChainedModel on the "parent" of the IComponentAssignedModel passing in the model returned from wrapOnAssignment? Or would that be to intrusive/destructive on the original model? Johan Compagner wrote: > > What you could do is let all your chained models also implement > IComponentAssignedModel > Are you proposing that I implement the interface and delegate to the first IComponentAssignedModel in my chain? What if I don't have an IComponentAssignedModel in my chain? I'll play with that idea and see what happens. Does this seem like the right approach to adding sorting capabilities to a model? Chuck johan On 11/6/07, ChuckDeal <[EMAIL PROTECTED]> wrote: > > > I have DropDownChoice objects where I want the choices model to be sorted. > The choices come from a database (using a HibernateListModel from > databinder) but I am unable to perform the sort on the database side, it > must be done on the server after the results are returned (due to the > nature > of the sort function). Previously, I had extended the HibernateListModel > to > make a SortableHibernateListModel, which worked very well. However, That > style of adding features gets cumbersome as you try to add new features > in. > For instance, next was a FilterableHibernateListModel (that also wanted to > sort). > > So, I tried another approach whereby I would chain the operations > together. > So, I created a SortingModel that implements the IChainingModel interface > and then stuck the HibernateListModel inside of it. And that still > worked. > But, in another place, the model that I put into the SortingModel > (IChainingModel) is an impl of IComponentAssignedModel. The problem is > that > when assigning choices to a DropDownChoice, it calls Component.wrap which > specifically looks for IComponentAssignedModel models, and if found, calls > wrapOnAssignment(). However, in my case, wrap will see the SortingModel > not > the IComponentAssignedModel and therefore not operate as it did > previosuly. > > I'm looking for some feedback here... > Should wrap() be updated to traverse the IChainingModel chain until it > finds > an IComponentAssignedModel or exhausts the chain? > > Should I find a different method of adding sort capabilities on top of a > Model? > > What other options do I have? > > Thanks, > Chuck -- View this message in context: http://www.nabble.com/Component.wrap-and-IChainingModel-tf4759201.html#a13610846 Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]