Re: Binding selected values from a ListView into a Mode

2011-06-10 Thread Nivedan Nadaraj
Hi

Yep I got it going. Prepopulating and the 'the base/fundamental' was a good
start that kinda helped in looking at other parts of the problem. Thanks for
the time

Cheers

On Thu, Jun 9, 2011 at 3:24 PM, Per Newgro  wrote:

> Am 09.06.2011 09:01, schrieb Nivedan Nadaraj:
>
>  Hi All,
>>
>> I have a problem to deal with binding selected values into a model within
>> a
>> ListView. I have tried to outline the approach and class definitions out
>> here. I hope I have been clear. Would appreciate your thoughts on the
>> design
>> and approach i have taken so far. I guess am pretty close to it just one
>> hurdle.
>>
>>
>> public class MainVO{
>> private List  userRoleList;
>> }
>> public class UserModuleRole{
>> private Role role;
>> private Module module;
>> private User user;
>> }
>>
>>
>> *Problem:*
>> 1. I want to list the modules and the roles available for each module in a
>> list view.
>> 2. Select a Role from  each module  for a user
>> 3. Save - Will have the user linked to one or more modules with a role for
>> each.(only one role per module)
>>
>> *Approach*
>>
>> I used a ListView and rendered the list of modules and their respective
>> roles in a drop down. To render this List view these are the steps I took.
>>
>> public class ModuleVO implements Serializable{
>>
>> private Module module;
>> private List  moduleRoles;
>> }
>>
>>
>> 1. I get a Collection/List of ModuleVO via the service. The collection
>> will
>> have a ModuleVO per module with the associated roles as a member.
>> 2. I iterated the list and rendered the Module and render a DropDownChoice
>> 3. End of which I get the following output in the list
>> *
>> Output from List view*:
>>
>> Module   Role
>> 
>> Module-A   Role-1
>>  Role-2
>>
>> Module-B   Role-3
>>  Role-4
>>
>> What I have not done and not clear is:
>> 4. At this time I have not bound a Model to the dropdown and just used new
>> Model() for the Model argument of dropDownChoice.
>>
>> I know that the selected values must eventually be in the MainVO's
>> List  userRoleList property.
>>
>> What is not very clear to me at this point is how to bind it ...so that
>> when
>> the user saves the selected values are captured. I am sure this is
>> possible
>> and should be elegant. Your thoughts and time will be of great value.
>>
>> Many thanks
>> Regards
>>
>>  Instanciate the MainVO with a UserModuleRole for every Module and the
> known user. The role
> has only to be loaded if it's already assigned. That is the base.
> If your listview is on a panel / form - give it the MainVO instance.
> Set the MainVO.userRoleList to the ListView by using a
> PropertyModel>.
> In ListView.populateItem you get every single UserModuleRole. Render the
> UserModuleRole to the
> ListViewItem.
> The DDC for the roles gets a PropertyModel pointing to the UserModuleRole
> of the ListViewItem.
> The selectable Roles have to be provided by a LoadableDetachableModel
> calling your service.
>
> Hth
> Cheers
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Binding selected values from a ListView into a Mode

2011-06-10 Thread Nivedan Nadaraj
Hi Per,
Thanks for taking the time to respond. Much appreciated I will work on it
sounds simple should be a good solution. Will ping back from based on how i
go.
Cheers


On Thu, Jun 9, 2011 at 3:24 PM, Per Newgro  wrote:

> Am 09.06.2011 09:01, schrieb Nivedan Nadaraj:
>
>  Hi All,
>>
>> I have a problem to deal with binding selected values into a model within
>> a
>> ListView. I have tried to outline the approach and class definitions out
>> here. I hope I have been clear. Would appreciate your thoughts on the
>> design
>> and approach i have taken so far. I guess am pretty close to it just one
>> hurdle.
>>
>>
>> public class MainVO{
>> private List  userRoleList;
>> }
>> public class UserModuleRole{
>> private Role role;
>> private Module module;
>> private User user;
>> }
>>
>>
>> *Problem:*
>> 1. I want to list the modules and the roles available for each module in a
>> list view.
>> 2. Select a Role from  each module  for a user
>> 3. Save - Will have the user linked to one or more modules with a role for
>> each.(only one role per module)
>>
>> *Approach*
>>
>> I used a ListView and rendered the list of modules and their respective
>> roles in a drop down. To render this List view these are the steps I took.
>>
>> public class ModuleVO implements Serializable{
>>
>> private Module module;
>> private List  moduleRoles;
>> }
>>
>>
>> 1. I get a Collection/List of ModuleVO via the service. The collection
>> will
>> have a ModuleVO per module with the associated roles as a member.
>> 2. I iterated the list and rendered the Module and render a DropDownChoice
>> 3. End of which I get the following output in the list
>> *
>> Output from List view*:
>>
>> Module   Role
>> 
>> Module-A   Role-1
>>  Role-2
>>
>> Module-B   Role-3
>>  Role-4
>>
>> What I have not done and not clear is:
>> 4. At this time I have not bound a Model to the dropdown and just used new
>> Model() for the Model argument of dropDownChoice.
>>
>> I know that the selected values must eventually be in the MainVO's
>> List  userRoleList property.
>>
>> What is not very clear to me at this point is how to bind it ...so that
>> when
>> the user saves the selected values are captured. I am sure this is
>> possible
>> and should be elegant. Your thoughts and time will be of great value.
>>
>> Many thanks
>> Regards
>>
>>  Instanciate the MainVO with a UserModuleRole for every Module and the
> known user. The role
> has only to be loaded if it's already assigned. That is the base.
> If your listview is on a panel / form - give it the MainVO instance.
> Set the MainVO.userRoleList to the ListView by using a
> PropertyModel>.
> In ListView.populateItem you get every single UserModuleRole. Render the
> UserModuleRole to the
> ListViewItem.
> The DDC for the roles gets a PropertyModel pointing to the UserModuleRole
> of the ListViewItem.
> The selectable Roles have to be provided by a LoadableDetachableModel
> calling your service.
>
> Hth
> Cheers
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Binding selected values from a ListView into a Mode

2011-06-09 Thread Per Newgro

Am 09.06.2011 10:07, schrieb Madan Mohan:

Hi,
 I am usingto hide some rows in a table.

Take for ex.,
Phone:
  
   Fax:
  

Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
Later based on some user action, i want to make faxNumber to *visible*.

How to do this?

regards,
*Madan*
*www.educator.eu*


1) Please don't capture threads. Open another one.
2) You can overwrite onConfigure in every component and set visibility 
by calling Component.setVisible.

So you need to call
spanWithWicketIdfaxNumber.setVisible(true);
if your conditions are met.

Hth
Per

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



Re: Binding selected values from a ListView into a Mode

2011-06-09 Thread Madan Mohan
Hi,
I am using to hide some rows in a table.

Take for ex.,
  Phone: 
 
 Fax: 
 

Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
Later based on some user action, i want to make faxNumber to *visible*.

How to do this?

regards,
*Madan*
*www.educator.eu*


Re: Binding selected values from a ListView into a Mode

2011-06-09 Thread Per Newgro

Am 09.06.2011 09:01, schrieb Nivedan Nadaraj:

Hi All,

I have a problem to deal with binding selected values into a model within a
ListView. I have tried to outline the approach and class definitions out
here. I hope I have been clear. Would appreciate your thoughts on the design
and approach i have taken so far. I guess am pretty close to it just one
hurdle.


public class MainVO{
 private List  userRoleList;
}
public class UserModuleRole{
 private Role role;
 private Module module;
 private User user;
}


*Problem:*
1. I want to list the modules and the roles available for each module in a
list view.
2. Select a Role from  each module  for a user
3. Save - Will have the user linked to one or more modules with a role for
each.(only one role per module)

*Approach*

I used a ListView and rendered the list of modules and their respective
roles in a drop down. To render this List view these are the steps I took.

public class ModuleVO implements Serializable{

 private Module module;
 private List  moduleRoles;
}


1. I get a Collection/List of ModuleVO via the service. The collection will
have a ModuleVO per module with the associated roles as a member.
2. I iterated the list and rendered the Module and render a DropDownChoice
3. End of which I get the following output in the list
*
Output from List view*:

Module   Role

Module-A   Role-1
  Role-2

Module-B   Role-3
  Role-4

What I have not done and not clear is:
4. At this time I have not bound a Model to the dropdown and just used new
Model() for the Model argument of dropDownChoice.

I know that the selected values must eventually be in the MainVO's
List  userRoleList property.

What is not very clear to me at this point is how to bind it ...so that when
the user saves the selected values are captured. I am sure this is possible
and should be elegant. Your thoughts and time will be of great value.

Many thanks
Regards

Instanciate the MainVO with a UserModuleRole for every Module and the 
known user. The role

has only to be loaded if it's already assigned. That is the base.
If your listview is on a panel / form - give it the MainVO instance.
Set the MainVO.userRoleList to the ListView by using a 
PropertyModel>.
In ListView.populateItem you get every single UserModuleRole. Render the 
UserModuleRole to the

ListViewItem.
The DDC for the roles gets a PropertyModel pointing to the 
UserModuleRole of the ListViewItem.
The selectable Roles have to be provided by a LoadableDetachableModel 
calling your service.


Hth
Cheers
Per

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



Binding selected values from a ListView into a Mode

2011-06-09 Thread Nivedan Nadaraj
Hi All,

I have a problem to deal with binding selected values into a model within a
ListView. I have tried to outline the approach and class definitions out
here. I hope I have been clear. Would appreciate your thoughts on the design
and approach i have taken so far. I guess am pretty close to it just one
hurdle.


public class MainVO{
private List userRoleList;
}
public class UserModuleRole{
private Role role;
private Module module;
private User user;
}


*Problem:*
1. I want to list the modules and the roles available for each module in a
list view.
2. Select a Role from  each module  for a user
3. Save - Will have the user linked to one or more modules with a role for
each.(only one role per module)

*Approach*

I used a ListView and rendered the list of modules and their respective
roles in a drop down. To render this List view these are the steps I took.

public class ModuleVO implements Serializable{

private Module module;
private List moduleRoles;
}


1. I get a Collection/List of ModuleVO via the service. The collection will
have a ModuleVO per module with the associated roles as a member.
2. I iterated the list and rendered the Module and render a DropDownChoice
3. End of which I get the following output in the list
*
Output from List view*:

Module   Role

Module-A   Role-1
 Role-2

Module-B   Role-3
 Role-4

What I have not done and not clear is:
4. At this time I have not bound a Model to the dropdown and just used new
Model() for the Model argument of dropDownChoice.

I know that the selected values must eventually be in the MainVO's
List userRoleList property.

What is not very clear to me at this point is how to bind it ...so that when
the user saves the selected values are captured. I am sure this is possible
and should be elegant. Your thoughts and time will be of great value.

Many thanks
Regards