公共刷新方法
import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.NotifyChange; @GlobalCommand("refreshDeploy") @NotifyChange({ "deploy", "imageContent" }) public void refreshDeploy(@BindingParam("planId") String planId) { if (planId != null && !"".equals(planId)) { BasicDBObject queryall = new BasicDBObject(); queryall.put("planId", planId); queryall.put("webEnable", true); MongoDBBaseExamViewModel mongo = new MongoDBBaseExamViewModel(); BasicDBObject SystemInfo = mongo.findOne(queryall, "SystemInfo"); if (SystemInfo != null) { getDeploy().put("baoMingWenAn", SystemInfo.getString("baoMingWenAn")); getDeploy().put("websiteName", SystemInfo.getString("websiteName")); getDeploy().put("organizer", SystemInfo.getString("organizer")); getDeploy().put("imageString", SystemInfo.getString("imageString")); getDeploy().put("imageType", SystemInfo.getString("imageType")); try { String src = getDeploy().getString("imageString"); if (src != null && !"".equals(src)) { imageContent = new AImage("photo", ConvertUtil.hexStr2Bytes(src)); } } catch (IOException e) { imageContent = null; } } } }
触发刷新方法
import org.zkoss.bind.annotation.AfterCompose; import org.zkoss.bind.BindUtils; @AfterCompose public void afterCompose(@ContextParam(ContextType.VIEW) Component view){ Map map=new HashMap(); map.put("planId", planId); BindUtils.postGlobalCommand(null, null, "refreshDeploy", map); }