t is the type of a list element, see below

class listmanager<t> extends panel {
 public listmanager(string id, imodel<t> entries) {
    add(new form("form") { onsubmit() {
listmanager.this.getmodelobject().add(someentry);}}
    add(new listview<t>("list", entries){});

   ^ wont compile because you cant assign imodel<t> to imodel<?
extends list<? extends t>> so we have to cast???

-igor

On Fri, Mar 13, 2009 at 8:59 AM, James Carman
<[email protected]> wrote:
> T has to be a list of some sort in this case and you would want to
> convey that in your API.  Are you wanting T to be the element type
> here or the list type itself.  I'm really having a hard time following
> what you're trying to do here.  What type parameter are you passing
> into your listview?
>
> On Fri, Mar 13, 2009 at 11:53 AM, Igor Vaynberg <[email protected]> 
> wrote:
>> the problem remains.
>>
>> lets say we change listview to take imodel<? extends List<? extends T>>
>>
>> i want to do something like this:
>>
>> class listmanger<t> extends panel {
>>  public listmanager(string id, imodel<t> entries) {
>>     addformtoaddtems();
>>     add(new listview("list", entities));
>>    ^ wont compile because you cant assign imodel<t> to imodel<?
>> extends list<? extends t>> so we have to cast???
>>
>> -igor
>>
>> On Fri, Mar 13, 2009 at 8:02 AM, James Carman
>> <[email protected]> wrote:
>>> Yes, but that's fine.  The idea is that I want to collect a
>>> List<Apple>, but I want to choose from a List<GrannySmithApple>.  That
>>> should be allowed.
>>>
>>>
>>> On Fri, Mar 13, 2009 at 10:42 AM, Igor Vaynberg <[email protected]> 
>>> wrote:
>>>> so then again you are back to something taking imodel<list<t>> and a
>>>> widened version in the same constructor.
>>>>
>>>> -igor
>>>>
>>>> On Fri, Mar 13, 2009 at 3:54 AM, James Carman
>>>> <[email protected]> wrote:
>>>>> Again, ListMultipleChoice is okay in this instance.  You don't want to
>>>>> "widen" the model.  You want to widen what can go in it (the choices),
>>>>> which I have.
>>>>>
>>>>> On Fri, Mar 13, 2009 at 3:40 AM, Igor Vaynberg <[email protected]> 
>>>>> wrote:
>>>>>> taking ListMultipleChoice as another example, your patch leaves it us
>>>>>>
>>>>>> public class ListMultipleChoice<T> extends AbstractChoice<Collection<T>, 
>>>>>> T>
>>>>>>
>>>>>> when in fact it should be properly declared as
>>>>>>
>>>>>> public class ListMultipleChoice<T> extends AbstractChoice<Collection<?
>>>>>> extends T>, T>
>>>>>>
>>>>>> so that getModelObject() properly returns Collection<? extends T>
>>>>>> instead of the unsafe variant Collection<T>
>>>>>>
>>>>>> which, once again, will break updatemodel()
>>>>>>
>>>>>> in your experience you havent ran into a situation where a component
>>>>>> updates its collection model object. my experience is quiet the
>>>>>> opposite. just trying to make sure we do not paint ourselves into a
>>>>>> corner.
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Fri, Mar 13, 2009 at 12:31 AM, Igor Vaynberg 
>>>>>> <[email protected]> wrote:
>>>>>>> your patch works because it does not properly refactor
>>>>>>> Palette#getModelCollection(). you left it us:
>>>>>>>
>>>>>>> public Collection<T> getModelCollection()
>>>>>>>        {
>>>>>>>                return (Collection<T>)getDefaultModelObject();
>>>>>>>        }
>>>>>>>
>>>>>>> which is incorrect, it should in fact now return Collection<? extends
>>>>>>> T>, which will break Palette#updateModel()
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Thu, Mar 12, 2009 at 11:32 PM, James Carman
>>>>>>> <[email protected]> wrote:
>>>>>>>> FYI,
>>>>>>>>
>>>>>>>> I have created a new JIRA issue for my proposed API changes:
>>>>>>>>
>>>>>>>> https://issues.apache.org/jira/browse/WICKET-2165
>>>>>>>>
>>>>>>>> I've attached a patch.  I've "fixed" all of the places I could find
>>>>>>>> thus far.  If I find anymore, I'll upload a new patch.
>>>>>>>>
>>>>>>>> James
>>>>>>>>
>>>>>>>> On Fri, Mar 13, 2009 at 1:59 AM, James Carman
>>>>>>>> <[email protected]> wrote:
>>>>>>>>> "Feeding" the list to your component isn't the issue (the constructor
>>>>>>>>> will take what you throw at it).  It's using the
>>>>>>>>> getDefaultModelObject() method and trying to modify that list once
>>>>>>>>> you've passed it in that will cause you to have to cast.
>>>>>>>>>
>>>>>>>>> On Fri, Mar 13, 2009 at 1:54 AM, Brill Pappin <[email protected]> wrote:
>>>>>>>>>> I'm really not sure of all the use-cases... all I know is that I 
>>>>>>>>>> spent some
>>>>>>>>>> time trying to get the darn thing to compile using a fairly basic 
>>>>>>>>>> wicket
>>>>>>>>>> pattern.
>>>>>>>>>>
>>>>>>>>>> If such a simple thing as feeding a list of items to a component 
>>>>>>>>>> that draws
>>>>>>>>>> a list using them is going to give me that much trouble (knowing a
>>>>>>>>>> workaround or not), then there is something definitely broken.
>>>>>>>>>>
>>>>>>>>>> - Brill
>>>>>>>>>>
>>>>>>>>>> On 13-Mar-09, at 1:43 AM, James Carman wrote:
>>>>>>>>>>
>>>>>>>>>>> To be clear, the only potential for breakage is where user code 
>>>>>>>>>>> tries
>>>>>>>>>>> to modify the returned "model object" (of type List<? extends T>)
>>>>>>>>>>> without casting it.  However, that's a rare usecase (in my opinion)
>>>>>>>>>>> and again it's easily overcome by a simple cast.
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Mar 12, 2009 at 5:10 PM, Igor Vaynberg 
>>>>>>>>>>> <[email protected]>
>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> before applying an api-breaking patch to an rc release we should 
>>>>>>>>>>>> have
>>>>>>>>>>>> a vote on the dev list.
>>>>>>>>>>>>
>>>>>>>>>>>> -igor
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Mar 12, 2009 at 12:59 PM, Jeremy Thomerson
>>>>>>>>>>>> <[email protected]> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Unless I'm seeing double - this patch has two problems:
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1 - It is the opposite of what was voted on.  The vote was to make
>>>>>>>>>>>>> IModel<List<? extends E>> into IModel<List<E>>.  Your patch makes 
>>>>>>>>>>>>> it
>>>>>>>>>>>>> IModel<? extends List<? extends E>>.
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2 - The patch causes compile errors that were not fixed.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have unassigned myself from the task until those issues are 
>>>>>>>>>>>>> addressed
>>>>>>>>>>>>> or I
>>>>>>>>>>>>> have time to create my own patch.  The best solution would be for
>>>>>>>>>>>>> someone to
>>>>>>>>>>>>> submit a proper patch that fixes the two problems above or 
>>>>>>>>>>>>> explain to me
>>>>>>>>>>>>> what I missed.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks!
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Jeremy Thomerson
>>>>>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Mar 12, 2009 at 2:53 PM, Jeremy Thomerson
>>>>>>>>>>>>> <[email protected]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> I'm reviewing it now.  Assuming that it looks fine, and is line 
>>>>>>>>>>>>>> with
>>>>>>>>>>>>>> what
>>>>>>>>>>>>>> was proposed by the vote thread earlier, I will apply.  The vote
>>>>>>>>>>>>>> passed, so
>>>>>>>>>>>>>> I don't see a reason not to.  I'm not sure how many were binding 
>>>>>>>>>>>>>> /
>>>>>>>>>>>>>> non-binding, but there were eight for, two against.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Jeremy Thomerson
>>>>>>>>>>>>>> http://www.wickettraining.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Thu, Mar 12, 2009 at 9:52 AM, Brill Pappin <[email protected]> 
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> https://issues.apache.org/jira/browse/WICKET-2137
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> - Brill
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>>>> For additional commands, e-mail: [email protected]
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [email protected]
>>>>>> For additional commands, e-mail: [email protected]
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to