rich:pickList not working
raovenu Mar 19, 2015 5:21 PMHi,
I am migrating from richfaces 3.3.2 to richfaces 4.5.1.Final and also using myfaces 2.2.1. I have been getting several issues but able to resolve with the help of the community and documentation. Now I am stuck with getting rich:pickList to work properly. I get the values in the left side of the pickList but I cannot get the right side to display the values. I have seen several posts related to this issue and tried to follow what has been suggested. Please some one take a look at my code and let me know where am I going wrong. I have made sure that my model object has equals and hash codes. Here is my code:
<h:panelGrid id="addressBlockPoliciesPanelGrid">
<rich:pickList id="addressBlockPoliciesShuttle"
value="#{addressBlockBean.targetPolicies}"
sourceCaption="Available Policies"
targetCaption="Assigned Policies"
listWidth="165px"
listHeight="165px"
disabled="#{addressBlockBean.disabled || securityBean.privMap['manageAddrBlkFormNamsPolicies']}">
<f:selectItems value="#{addressBlockBean.sourcePolicies}" var="policy" itemValue="#{policy}" itemLabel="#{policy.name}" />
<f:converter converterId="PolicyConverter" />
</rich:pickList>
</h:panelGrid>
Here is the code from my backing bean.
public List<Policy> getSourcePolicies()
{
return this.sourcePolicies;
}
public void setSourcePolicies(List<Policy> sourcePolicies)
{
this.sourcePolicies = sourcePolicies;
}
My private method that populates sourcePolicies:
private void setSourcePolicies(final AddressBlock addressBlock)
{
final List<Policy> sourcePolicies = new ArrayList<Policy>();
final List<Policy> availablePolicies = addressBlockManager.getAddressBlockPolicies();
final List<Policy> selectedPolicies = getSelectedAddressBlockPolicies();
for (final Policy policy : availablePolicies)
{
if (policyIsNotAssigned(selectedPolicies, policy))
{
sourcePolicies.add(policy);
}
}
setSourcePolicies(sourcePolicies);
}
private List<Policy> getSelectedAddressBlockPolicies()
{
final List<Policy> policies = new ArrayList<Policy>();
if ((this.selectedBlock != null) && (this.selectedBlock.getAddressBlockPolicies() != null))
{
final Set<AddressBlockPolicy> abPolicies = this.selectedBlock.getAddressBlockPolicies();
for (final AddressBlockPolicy abPolicy : abPolicies)
{
policies.add(abPolicy.getPolicy());
}
}
return policies;
}
Also I am attaching the model object and converter I am using for your reference. I really appreciate any help you can provide with this issue.
Thanks,
Venu
-
PolicyConverterNew.java 1.3 KB
-
Policy.java 5.3 KB