Bugs item #1525881, was opened at 2006-07-20 15:30
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1525881&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 2.0
Status: Open
Resolution: None
Priority: 5
Submitted By: Eelco Hillenius (eelco12)
Assigned to: Nobody/Anonymous (nobody)
Summary: model signature with wrapped models changes

Initial Comment:
Say, we have a model like this:

public class MenuRowModel extends
AbstractDetachableAssignmentAwareModel<List<MenuItem>>

which has an extra method:

 public boolean isPartOfCurrentSelection(Page
currentPage, MenuItem menuItem)


This:

        public String getItemCSSClass(MenuItem menuItem,
MenuRow menuRow)
        {
                MenuRowModel rowModel = (MenuRowModel)menuRow.getModel();
                boolean active =
(rowModel.isPartOfCurrentSelection(menuRow.getPage(),
menuItem));

Will fail with a ClassCastException, because the model
gets wrapped by the component it is set on because the
model implements IAssignmentAware.


There are hacks and workarounds possible for this, but
actually when you look at the code, it's something I'd
expect an average user to understand.

There probably is a way out if we use byte code
engineering for wrapping models (take special care of
final), e.g. utilizing CGLIB (which has an Apache
licence and is used by various Apache projects).

I think getting models 100% right is so important for
Wicket, it is worth the extra dependency.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1525881&group_id=119783

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to