参照添加监听

// 项目名称
	BillItem itemname = builder.refPane("hx_blankvoucher_mng.itemname",
		"项目名称", "<nc.ui.hxbusi.ref.KongBaiItemnameModel>");
	((UIRefPane) itemname.getComponent()).getRefModel().reloadData();// 清除缓存

	// 合同编号
	final BillItem contractcode = builder.refPane(
		"hx_blankvoucher_mng.contractcode", "合同编号",
		"<nc.ui.hxbusi.ref.KongBaiContractcodeModel>");
	((UIRefPane) contractcode.getComponent()).getRefModel().reloadData();// 清除缓存

	getQueryManager().setQueryPanelBuilder(builder);
	getQueryManager().setLoaded(true);

	// 添加监听
	((UIRefPane) itemname.getComponent())
		.addValueChangedListener(new ValueChangedListener() {

		    public void valueChanged(ValueChangedEvent event) {
			String itemname = getQueryManager().getBillCardPanel()
				.getHeadItem("hx_blankvoucher_mng.itemname")
				.getValueObject() == null ? ""
				: getQueryManager().getBillCardPanel()
					.getHeadItem(
						"hx_blankvoucher_mng.itemname")
					.getValueObject().toString();
			if (StringUtils.isNotEmpty(itemname)) {
			    ((UIRefPane) contractcode.getComponent())
				    .setWhereString(" hx_blankvoucher_mng.itemname = '"
					    + itemname + "' ");
			}

		    }

		});

 

你可能感兴趣的:(UI)