CheckGroup selectedPensCheckGroup = new CheckGroup("selectedPens", 
selectedPensModel);
add(selectedPensCheckGroup);
ListView pensList = new ListView("pens", pensModel)
{
        protected void populateItem(ListItem item)
        {
                item.add(new Check("check", item.getModel()));
                // assuming pen has a nice toString()
                item.add(new Label("pen", item.getModel()));
        };
};
selectedPensCheckGroup.add(pensList);

Now you have one check component for each available pen and all selected pens 
will be contained in selectedPensModel.
For the models there are many possibilities: AbstractReadOnlyModel, 
PropertyModel, ...

Sven

GS-ikiini wrote:

> so this would associate my object with a checkbox? how do i place the select
> objects in a collection from there?
>
> -B
>
>
>
> svenmeier wrote:
>   
>> I'm not sure I fully understand what you're trying to do, but
>> CheckGroup/Check components are a nice solution for managing the selection
>> of multiple objects.
>> No need to introduce a boolean property in your domain objects.
>>
>> Please take a look at FormInput.java from wicket examples:
>>
>> CheckGroup checks = new CheckGroup("numbersCheckGroup");
>> add(checks);
>> ListView checksList = new ListView("numbers", NUMBERS)
>> {
>>      protected void populateItem(ListItem item)
>>      {
>>              item.add(new Check("check", item.getModel()));
>>              item.add(new Label("number", item.getModelObjectAsString()));
>>      };
>> };
>> checks.add(checksList);
>>
>>     
>>> I don't understand that last post can you re phrase please..
>>>
>>> -B 
>>>
>>>
>>>
>>> svenmeier wrote:
>>>       
>>>> Could it be that you slipped our CheckGroup/Check components? Cannot get 
>>>> simpler than that.
>>>>
>>>> Sven
>>>>         
>> -------------------------------------------------------------------------
>> 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-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>>
>>     
>
>   


-------------------------------------------------------------------------
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-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to