java.lang.UnsupportedOperationException java.util.AbstractList.add(Unknown Source) java.util.AbstractList.add(Unknown Source) less than 3.3.2, for a4j:support event=”onclick”
ajaykadiyala May 31, 2010 12:20 PMHi All,
The code I was tested and working fine with richfaces-demo-3.3.2.GA-tomcat6.
The following code is.
Stationx.xml
<?xml version="1.0"?>
<station name="RichRadioStation" type="stationName">
<feed date="yesterday" type="date" >
<song time="09:00" type="time" key="administratorUserProfileNew" > AAAAAAAAAAAA</song>
<song time="10:03" type="time" key="administratorUserProfileView"> BBBBBBBBBBBB</song>
<song time="10:03" type="time" key="administratorUserProfileModify">hhhhhhhhh</song>
</feed>
<feed date="today" type="date" >
<song time="09:00" type="time" key="tadministratorUserProfileNew" > FFFFFFF</song>
<song time="10:03" type="time" key="tadministratorUserProfileView"> dddddddddd</song>
<song time="10:03" type="time" key="tadministratorUserProfileModify">qqqqqqq</song>
</feed>
</station>
Library.java
public class Library {
/**
*
*/
private static final long serialVersionUID = -3530085227471752526L;
//private Map artists = null;
private List menus=null;
private TreeNode treeData;
private Map selectedMenus=null;//A4j : suppoted selections
public void takeMenuAccess()
{
FacesContext context = FacesContext.getCurrentInstance();
String currentMenuItems = (String) context.getExternalContext()
.getRequestParameterMap().get("m");
System.out.println("----------"+currentMenuItems);
String menu=(String)selectedMenus.get(currentMenuItems);
if(menu==null){
menus.add(currentMenuItems);
// Here java.lang.UnsupportedOperationException java.util.AbstractList.add(Unknown Source) java.util.AbstractList.add(Unknown Source) selectedMenus.put(currentMenuItems, currentMenuItems); lessthan 3.3.2 ,
}
else
{
selectedMenus.remove(menu);
}
public void myexpand (){
menus=new ArrayList();
Set s=selectedMenus.entrySet();
Iterator it=s.iterator();
while(it.hasNext()) {
Map.Entry m =(Map.Entry)it.next();
String value=(String)m.getValue();
menus.add(value);
}
;
}
public Library()throws Exception {
// songsList = new ArrayList<Song>();
// songsList.addAll(getLibraryAsList());
tempMenus=new ArrayList();
menus=new ArrayList();
newMode="newMode";
selectedMenus=new HashMap();
FacesContext context = FacesContext.getCurrentInstance();
treeData =XmlTreeDataBuilder.build(new InputSource(getClass().getResourceAsStream("/Stations.xml")));
}
public TreeNode getTreeData() {
return treeData;
}
public void setTreeData(TreeNode treeData) {
this.treeData = treeData;
}
public List getMenus() {
return menus;
}
public void setMenus(List menus) {
this.menus = menus;
}
}
< rich:tree id="treeXML" value="#{library.treeData}" var="vardata" nodeFace="#{vardata.attributes['type']}" switchType="client" nodeSelectListener="#{library.processSelection}" preserveDataInRequest="true" > <rich:treeNode type="stationName" nodeSelectListener="#{library.processSelection}"> <h:outputText value="#{vardata.attributes['name']}" /> </rich:treeNode> <rich:treeNode type="date" nodeSelectListener="#{library.processSelection}"> <h:outputText value="#{vardata.attributes['date']}" /> </rich:treeNode> <rich:treeNode type="time" nodeSelectListener="#{library.processSelection}"> <h:selectManyCheckbox value="#{library.menus}" > <f:selectItem itemValue="#{vardata.attributes['key']}"/> <a4j:support event="onclick" action="#{library.takeMenuAccess}"> // Here is <f:param name="m" value="#{vardata.attributes['key']}"/> </a4j:support> </h:selectManyCheckbox> <h:outputText value="#{vardata.attributes['time']}" /> </rich:treeNode> <a4j:support event="oncollapse" action="#{library.mycollapse}"></a4j:support> </rich:tree> Please see the image to better understand the problem. Please do the needful help.Beacause of version,if so suggested to me. After I putting into the same into my project throwing java.lang.UnsupportedOperationException java.util.AbstractList.add(Unknown Source) java.util.AbstractList.add(Unknown Source)
and also tried in richfaces-demo-3.1.3.GA-tomcat6 as well it’s throwing the same . Please help me.
-
unsupportedExecpton.GIF 73.0 KB