<af:button text="修改" id="b3" useWindow="true" windowEmbedStyle="inlineDocument" windowWidth="450" windowHeight="420" windowModalityType="applicationModal" action="#{xysfpBean.getAction}" returnListener="#{xysfpBean.returnEvent}" actionListener="#{xysfpBean.actionSetParam}"> <af:setPropertyListener from="update" to="#{pageFlowScope.cz}" type="action"/> </af:button> <af:button text="删除" id="b4" action="#{xysfpBean.getAction}" useWindow="true" windowEmbedStyle="inlineDocument" windowModalityType="applicationModal" returnListener="#{xysfpBean.returnEvent}" actionListener="#{xysfpBean.actionSetParam}" > <af:setPropertyListener from="delete" to="#{pageFlowScope.cz}" type="action"/> </af:button>
/** *对选择记录进行可操作性判断 * @param actionEvent */ public void actionSetParam(ActionEvent actionEvent) { if (JSFUtils.resolveExpression("#{pageFlowScope.cz}") == null) { //操作判断 return; } DCIteratorBinding dcIt = ADFUtils.findIterator("JyglJyxysfpView1Iterator"); ViewObject xysfpImpl = dcIt.getViewObject(); Row[] rows = xysfpImpl.getFilteredRows("IsChecked", true); int length = rows.length; String cz = JSFUtils.resolveExpression("#{pageFlowScope.cz}").toString(); if (length == 0) { JSFUtils.addFacesErrorMessage("请选择记录"); return; } else if (cz.equals("update") && length > 1) { JSFUtils.addFacesErrorMessage("修改时每次只能选择一条记录"); return; } else if (cz.equals("delete")) { //删除 this.action = "delete"; return; } else { this.action = "update"; xysfpImpl.setCurrentRow(rows[0]); return; } }