<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.util.*" %>
<%@ page import="com.gx.webpage.framework.util.inoutformat.*" %>
<%@ page import="com.gx.webpage.engine.*" %>
<%@ page import="com.gx.webpage.component.compmodel.app.*" %>
<%
	String uiUuid = DataBean.getStr(request,"uiUuid");
	String compId = DataBean.getStr(request,"compId");
	String sqlCondition = DataBean.getStr(request,"sqlCondition");
	Collection col = null;
	try{
		PageActionEngine pae = new PageActionEngine();
		ReferenceParamModel rpm = new ReferenceParamModel();
		rpm.setSqlCondition(sqlCondition);
		col = (Collection)pae.doActionDirect(uiUuid,compId,"CHANGE",rpm);
	}catch(Exception err){
		//err.printStackTrace();
	}
	
%>
<link rel="StyleSheet" href="./../../../../webpage/common/css/webpagecommon.css" type="text/css" />
<script language="javascript">
	function refModel(){
		var trueValue="";
		var viewValue="";
	}
	function doOk()
  {
      var md = new refModel();
			var trueValue = document.all("selectTrue").value;			
			var viewValue = document.all("selectView").value;
      //md.trueValue=trueValue;
			//md.viewValue=viewValue;
      window.returnValue = trueValue+"|"+viewValue;
      window.close();
  }
	function setValues(a,b,index){
    document.all("selectRadio",(index-1)).checked = true;
		document.all("selectTrue").value = a;
		document.all("selectView").value = b;
	}
	function dbclick2(a,b,index){
		setValues(a,b,index);
    doOk();
	}
	function TrItemOnMouseenter(tr)
	{
	   tr.style.backgroundColor = "#8cb5ce";
	}
  function TrItemOnMouseleave(tr)
	{
     tr.style.backgroundColor = '';
	}
</script>
<html>
	<table cellSpacing=1 cellPadding=0 width="100%" align=center bgColor=#000000 border=0 align=center>
		<%if(col!=null && col.size()>0){%>
		<tr bgColor=#ffffff ><td  bgColor=#ffffff colspan=3 class=title2_class>参照数据列表选择</td></tr>
		<tr bgColor=#ffffff >
				<td bgColor=#ffffff></td>
				<%
					Iterator it = col.iterator();
					Collection row = (Collection)it.next();
					Iterator itRow = row.iterator();
					while(itRow.hasNext()){
						String str = (String)itRow.next();
				%>
				<td bgColor=#ffffff><%=str%></td>
				<%}%>
		</tr>
			<%
       int rowNum = 0;
       while(it.hasNext()){%>
				<tr bgColor=#ffffff onmouseenter="javascript : TrItemOnMouseenter(this);" onmouseleave="javascript : TrItemOnMouseleave(this);">
				<%
					String tdStr = "<td bgColor=#ffffff><input type='radio' id='selectRadio' name='selectRadio'";
					String s1 = "";
					String s2 = "";
					int index = 1;
					rowNum = rowNum +1;
					Collection tempRow = (Collection)it.next();
					Iterator itTemp = tempRow.iterator();
					while(itTemp.hasNext()){
						String str = (String)itTemp.next();
						if(index==1){
							s1=str;
						}else{
							s2 = str;
							tdStr += " onclick=\"setValues('"+s1+"','"+s2+"',"+rowNum+");\"  ondblclick=\"dbclick2('"+s1+"','"+s2+"',"+rowNum+");\"><td onclick=\"setValues('"+s1+"','"+s2+"',"+rowNum+");\"  ondblclick=\"dbclick2('"+s1+"','"+s2+"',"+rowNum+");\">"+s1+"</td><td onclick=\"setValues('"+s1+"','"+s2+"',"+rowNum+");\"  ondblclick=\"dbclick2('"+s1+"','"+s2+"',"+rowNum+");\">"+s2+"</td>";
						}		
						index = index + 1;
				%>
				<%}%>
				<%=tdStr%>
				</tr>
			<%}%>
		<%}%>
		<tr bgColor=#ffffff>
			<td bgColor=#ffffff colspan=3 align=center><input type="button" value="确定" onclick="doOk();"><input type="hidden" name="selectTrue"><input type="hidden" name="selectView">
				  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" onclick="window.close();">
      </td>
		</tr>
	</table>
</html>
