我的用例: 我正在使用基于组件作为模型的视图。在此视图中,我需要一个操作以向列表中添加新行。
在 model.groovy 中声明的组件:
Component('ComposeLoading') {
//fields
date_time 'etd'
//reference
reference 'offerPlan', ref:'OfferPlan'
//lists
list 'loadings', ref:'Loading'
list 'transportOrders', ref:'TransportOrder'
}
在 view.groovy 中声明的视图:
border('ComposeTrain.wizard.first.view', model:'ComposeLoading') {
north {
form {
fields {
propertyView name:'etd'
propertyView name:'offerPlan'
}
}
}
center {
split_horizontal {
left {
table(permId:'ComposeLoading.loadings.table',
model:'ComposeLoading-loadings',
selectionMode:'MULTIPLE_INTERVAL_CUMULATIVE_SELECTION')
}
right {
split_vertical(cascadingModels:true) {
top {
table(permId:'ComposeLoading.transportOrders.table',
model:'ComposeLoading-transportOrders')
{
actionMap () {
actionList('TRANSPORT_ORDER') {
action(ref:'addToMasterFrontAction')
}
}
}
}
bottom {
table(permId:'ComposeLoading.TransportOrders.loadings.table',
model:'TransportOrder-loadings')
}
}
}
}
}
}
我的问题: 当我运行应用程序并单击“添加”按钮时,addToMasterFrontAction 失败并显示:“对象不是声明类的实例”
请在堆栈跟踪下方找到:
ERROR <2015-04-24 08:48:44,014> org.jspresso.framework.application.frontend.controller.AbstractFrontendController : An unexpected error occurred for user demo on session 6b2afee4.
java.lang.RuntimeException: java.lang.IllegalArgumentException: object is not an instance of declaring class
at org.jspresso.framework.util.accessor.bean.BeanCollectionAccessor.addToValue(BeanCollectionAccessor.java:78)
at org.jspresso.framework.application.backend.action.AbstractAddCollectionToMasterAction.execute(AbstractAddCollectionToMasterAction.java:116)
at org.jspresso.framework.application.backend.AbstractBackendController.execute(AbstractBackendController.java:393)
at org.jspresso.framework.application.frontend.controller.AbstractFrontendController.executeBackend(AbstractFrontendController.java:1534)
at org.jspresso.framework.application.frontend.controller.AbstractFrontendController.execute(AbstractFrontendController.java:574)
at org.jspresso.framework.application.action.AbstractAction.execute(AbstractAction.java:114)
at org.jspresso.framework.application.frontend.action.std.AddCollectionToMasterAction.execute(AddCollectionToMasterAction.java:85)
at org.jspresso.framework.application.frontend.controller.AbstractFrontendController.executeFrontend(AbstractFrontendController.java:1547)
at org.jspresso.framework.application.frontend.controller.AbstractFrontendController.execute(AbstractFrontendController.java:576)
at org.jspresso.framework.view.remote.RemoteActionFactory$ActionAdapter.actionPerformed(RemoteActionFactory.java:235)
...