我在 zk 中选择多个复选框时遇到问题。当我为多个数据选择列表框标题复选框时,当encrypt/decrypt
我java.lang.ClassCastException
选择多个没有列表标题复选框的列表单元时, encrypt/decrypt
它工作正常。
selectedFolderInfo
inaftercompose
方法的内化
Set<FolderInfoData> selectedFolderInfo = new HashSet<FolderInfoData>();
这是我的代码:
@Command
@NotifyChange({ "folderInfoList", "selectedFolderInfo" })
public void encryptInfo() {
if (selectedFolderInfo == null) {
showError("Please select an info to Encrypt/Decrypt");
return;
} else if (selectedFolderInfo != null && selectedFolderInfo.isEmpty()) {
showError("Please select an info to Encrypt/Decrypt");
return;
}
List<FolderInfoRecord> folderRecord = new ArrayList<FolderInfoRecord>();
for(FolderInfoData folderInfoData:selectedFolderInfo){
FolderInfoRecord folderInfoRecord=folderInfoData.getFolderInforecord();
folderRecord.add(folderInfoRecord);
}
try {
Services.folderService().encryptDecryptFolderInfoRecords(folderType, folderRecord.toArray(new FolderInfoRecord[0]));
} catch (FolderInfoPermissionDeniedException e) {
e.printStackTrace();
}
列表框:
这是Logcat:
Jan 07, 2014 5:37:38 PM org.zkoss.zk.ui.impl.UiEngineImpl handleError:1359
SEVERE: >>java.lang.ClassCastException: java.lang.String cannot be cast to com.csdcsystems.amanda.jems.web.viewmodel.FolderInfoEditViewModel$FolderInfoData
>> at com.csdcsystems.amanda.jems.web.viewmodel.FolderInfoEditViewModel.encryptInfo(FolderInfoEditViewModel.java:752)
>> at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.zkoss.bind.impl.ParamCall.call(ParamCall.java:111)
>> at org.zkoss.bind.impl.BinderImpl.doExecute(BinderImpl.java:1744)
>> at org.zkoss.bind.impl.BinderImpl.doCommand(BinderImpl.java:1505)
>> at org.zkoss.bind.impl.BinderImpl.access$1500(BinderImpl.java:107)
>> at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent0(BinderImpl.java:1374)
>> at org.zkoss.bind.impl.BinderImpl$CommandEventListener.onEvent(BinderImpl.java:1326)
' 任何人都给我任何建议如何解决这个问题?
谢谢